6.9k views
0 votes
Write a C translation of the NASM program below, sticking to the assembly code as much as possible. Use single-letter variable names for function parameters (e.g., int foo(int x, int y)) and for local variables within function (e.g., int z) instead of using x86 register names (in fact registers should never appear in your translation). It is expected that your C code is much shorter than the assembly code.

1 Answer

3 votes

Answer:

See explaination

Step-by-step explanation:

mov ebp, esp

and esp, 0FFFFFFF0H

sub esp, 16

mov dword [esp], ?_001

call puts

mov eax, 0

leave

ret

End

The C translation is always expected to be shorter than the assembly language code.

User David Dean
by
4.8k points