Question: Consider the following assembly code of the C function long absdiff (long x, long y ). Get the equivalent C code for function considering %
Consider the following assembly code of the C function long absdiff (long x, long y ). Get the equivalent C code for function considering % rdi has x and % rsi has y. Verify your answer on the gcc compiler and include screenshot. absdiff: movq \%rdi, 24(%rbp) movq % rsi, 32(%rbp) movl \$0,-4(\%rbp) movq 24(%rbp),%rax cmpq 32(%rbp),%rax jle .L2 movq 24(% rbp), % rax movl \%eax, \%edx movq 32(%rbp),%rax subl \%eax, \%edx movl \%edx, \%eax movl \%eax, 4(%rbp) jmp .L3 .L 2 : movq 32(%rbp),% rax movl \%eax, \%edx movq 24(%rbp),%rax subl \%eax, \%edx movl \%edx, \%eax movl \%eax, 4(%rbp) .L3: movl 4(%rbp),% eax cltq ret
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
