Following is the c++ code;
int func1(int i) {return i*7;}
int func2(int i) {return i*11;}
int test(int i){
int j;
if(i>0) {
j = func1(i);
}else {
j = func2(i);
}
return j*13;
}
The instructions for above code (Ignoring func1 and func2 instructions) in debug mode comes out to be
test(int):
push rbp
mov rbp, rsp
sub rsp, 24
mov DWORD PTR [rbp-20], edi
cmp DWORD PTR [rbp-20], 0
jle .L6
mov eax, DWORD PTR [rbp-20]
mov edi, eax
call func1(int)
mov DWORD PTR [rbp-4], eax
jmp .L7
.L6:
mov eax, DWORD PTR [rbp-20]
mov edi, eax
call func2(int)
mov DWORD PTR [rbp-4], eax
.L7:
mov edx, DWORD PTR [rbp-4]
mov eax, edx
add eax, eax
add eax, edx
sal eax, 2
add eax, edx
leave
ret
Please help me in understanding on what happens post jump to .L6 instruction; Will it Go directly to .L7 or will it execute the instructions after .L6 and then go to .L7; If it later then seems like its executing both the loop conditions.