Question: Hi I need to convert the following into C code. The following is the gdb output for ex3: 0x40079a mov $0x0, %eax 0x40079f jmp 0x4007bc

Hi I need to convert the following into C code. The following is the gdb output for ex3:

0x40079aHi I need to convert the following into C code. The following mov $0x0, %eax

0x40079fis the gdb output for ex3: 0x40079a mov $0x0, %eax 0x40079f jmp jmp 0x4007bc 0x4007bc 0x4007a1 movslq %eax, %rcx 0x4007a4 lea (%rdi, %rcx, 1), %r8 0x4007a8

0x4007a1movzbl (%r8), %r9d0x10(%rsp) 0x4007ac add %rsi, %rcx, 0x18(%rsp) 0x4007af movzbl (%rcx), %r10d movslq %eax, %rcx

0x4007a40x4007b3 mov %r10b, (%r8) 0x4007b6 mov %r9b, (%rcx) 0x4007b9 add $0x1, %eax lea (%rdi, %rcx, 1), %r8

0x4007a80x4007bc cmp %edx, %eax 0x4007be jl 0x4007a1 0x4007c0 repz retq The code movzbl (%r8), %r9d0x10(%rsp)

0x4007acshould be converted into the function void ex3 () {} where void add %rsi, %rcx, 0x18(%rsp)

0x4007afshould be replaced by int or other comparable data type and parameters movzbl (%rcx), %r10d

0x4007b3should be inferred from the assembly, Please only answer if you know mov %r10b, (%r8)

0x4007b6assembly, do not copy and paste the code I gave. mov %r9b, (%rcx)

0x4007b9image text in transcribed add $0x1, %eax

0x4007bcimage text in transcribed cmp %edx, %eax

0x4007beimage text in transcribed jl 0x4007a1 image text in transcribed

0x4007c0image text in transcribed repz retq

The code should be converted into the function

void ex3 () {}

where void should be replaced by int or other comparable data type and parameters should be inferred from the assembly, Please only answer if you know assembly, do not copy and paste the code I gave.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!