Question: start: push ebp mov ebp,esp sub esp,0x10 mov eax,DWORD PTR [esp] add eax,0x2e48 mov DWORD PTR [ebp-0x8],0x30 mov DWORD PTR [ebp-0x4],0x0 jmp loc_2 loc_1: mov
start:
push ebp
mov ebp,esp
sub esp,0x10
mov eax,DWORD PTR [esp]
add eax,0x2e48
mov DWORD PTR [ebp-0x8],0x30
mov DWORD PTR [ebp-0x4],0x0
jmp loc_2
loc_1:
mov edx,DWORD PTR [ebp-0x4]
mov eax,DWORD PTR [ebp+0x8]
add eax,edx
movzx eax,BYTE PTR [eax]
movsx eax,al
xor DWORD PTR [ebp-0x8],eax
add DWORD PTR [ebp-0x4],0x1
loc_2:
mov eax,DWORD PTR [ebp-0x4]
cmp eax,DWORD PTR [ebp+0xc]
jl loc_1
loc_3:
mov eax,DWORD PTR [ebp-0x8]
leave
ret
3.1) In a few sentences, explain what this function does.
3.2) Write a function in C that is equivalent to the assembly above.
int func3(char* arg_0, int arg_4) {
// Your code goes here
}
3.3) Let arg_0 be a pointer to the string "x64 is better than x86" and let arg_4 be 22.
What does the function return?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
