Question: Hi I need to convert the following into C code. The following is the gdb output for ex2: 0x400773 mov $0x0, %eax 0x400778 mov $0x0,

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

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

0x400778is the gdb output for ex2: 0x400773 mov $0x0, %eax 0x400778 mov mov $0x0, %edx

0x40077d$0x0, %edx 0x40077d jmp 0x40078d 0x40077f cmp $0x61, %cl 0x400782 sete %cl jmp 0x40078d 0x400785 movzbl %cl, %ecx 0x400788 dd %ecx, %eax 0x40078a add $0x1, %edx

0x40077f0x40078d movslq %edx, %rcx 0x400790 movzbl (%rdi, %rcx, 1), %ecx 0x400794 test cmp $0x61, %cl

0x400782%cl, %cl 0x400796 jne 0x40077f 0x400798 repz retq The code should be sete %cl

0x400785converted into the function void ex2 () {} where void should be movzbl %cl, %ecx

0x400788replaced by int or other comparable data type and parameters should be dd %ecx, %eaxinferred from the assembly

0x40078aimage text in transcribed add $0x1, %edx

0x40078dimage text in transcribed movslq %edx, %rcx

0x400790image text in transcribed movzbl (%rdi, %rcx, 1), %ecx

0x400794image text in transcribed test %cl, %cl

0x400796image text in transcribed jne 0x40077f image text in transcribed

0x400798image text in transcribed repz retq

The code should be converted into the function

void ex2 () {}

where void should be replaced by int or other comparable data type and parameters should be inferred from the assembly

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!