Question: (Translate from Assembly to C) Rewrite the strcpy_pascal_string function in C. Write the function's prototype and all code contained within. Don't forget about arguments and

(Translate from Assembly to C) Rewrite the strcpy_pascal_string function in C. Write the function's prototype and all code contained within. Don't forget about arguments and local variable definitions:

push rbp mov rbp,rsp sub rsp,0x30 mov QWORD PTR [rbp-0x28],rdi mov QWORD PTR [rbp-0x30],rsi mov rax,QWORD PTR [rbp-0x30] movzx eax,BYTE PTR [rax] movsx rax,al mov QWORD PTR [rbp-0x18],rax mov rax,QWORD PTR [rbp-0x18] mov QWORD PTR [rbp-0x8],rax mov rax,QWORD PTR [rbp-0x18] mov rdi,rax call 4004a0 mov rdx,rax mov rax,QWORD PTR [rbp-0x28] mov QWORD PTR [rax],rdx mov rax,QWORD PTR [rbp-0x28] mov rax,QWORD PTR [rax] mov QWORD PTR [rbp-0x10],rax cmp QWORD PTR [rbp-0x10],0x0 jne 40060c mov eax,0x0 jmp 400645 add QWORD PTR [rbp-0x30],0x1 jmp 400630 mov rax,QWORD PTR [rbp-0x10] lea rdx,[rax+0x1] mov QWORD PTR [rbp-0x10],rdx mov rdx,QWORD PTR [rbp-0x30] lea rcx,[rdx+0x1] mov QWORD PTR [rbp-0x30],rcx movzx edx,BYTE PTR [rdx] mov BYTE PTR [rax],dl mov rax,QWORD PTR [rbp-0x8] lea rdx,[rax-0x1] mov QWORD PTR [rbp-0x8],rdx test rax,rax jne 400613 mov rax,QWORD PTR [rbp-0x18] leave ret

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!