I am having trouble understanding how this code knows when to stop looping. I am supposed to figure out what values are put into %edi. But I can't figure out how many times it loops.
0x40106e movl $0x2b,0xffffffdc(%ebp)
0x401075 movl $0x31,0xffffffe4(%ebp)
0x40107c movl $0x74,0xffffffec(%ebp)
0x401083 movl $0x19,0xffffffe8(%ebp)
0x40108a movl $0x7,0xffffffd8(%ebp)
0x401091 movl $0x14,0xffffffe0(%ebp)
0x401098 mov $0xdead,%edi
0x40109d mov $0x2,%ecx
0x4010a2 mov %ecx,%esi
0x4010a4 mov $0x3,%ecx
0x4010a9 mov $0x2,%ebx
0x4010ae sub %esi,%ebx
0x4010b0 imul $0xc,%ebx,%ebx
0x4010b3 mov $0x3,%edx
0x4010b8 sub %ecx,%edx
0x4010ba lea 0xffffffd8(%ebp),%eax
0x4010bd lea (%ebx,%edx,4),%ebx
0x4010c0 add %ebx,%eax
0x4010c2 mov (%eax),%edi
0x4010c4 loop 0x4010a9
0x4010c6 mov %esi,%ecx
0x4010c8 loop 0x4010a2
0x4010ca mov $0xbeef,%edi
Edit: I now understand the looping logic. However I am having a hard time following all the values getting moved around. I am stuck here lea 0xffffffd8(%ebp),%eax
How do I know what %ebp is?