Write the following statement in C, in Assembly language unsigned char i, j, k; j = 10; do {k
= k + I; j = j + 1;} while(j! = 18);//... rest of code ...
Solution
//assembly code is as follows
//please include int main() uncion in your asssembly code
main:
push rbp
mov rbp, rsp
mov BYTE PTR [rbp-1], 10
.L3:
movzx eax, BYTE PTR [rbp-3]
add BYTE PTR [rbp-2], al
add BYTE PTR [rbp-1], 1
cmp BYTE PTR [rbp-1], 18
je .L2
jmp .L3
.L2:
mov eax, 0
pop rbp
ret

Write the following statement in C, in Assembly language unsigned ch.pdf

  • 1.
    Write the followingstatement in C, in Assembly language unsigned char i, j, k; j = 10; do {k = k + I; j = j + 1;} while(j! = 18);//... rest of code ... Solution //assembly code is as follows //please include int main() uncion in your asssembly code main: push rbp mov rbp, rsp mov BYTE PTR [rbp-1], 10 .L3: movzx eax, BYTE PTR [rbp-3] add BYTE PTR [rbp-2], al add BYTE PTR [rbp-1], 1 cmp BYTE PTR [rbp-1], 18 je .L2 jmp .L3 .L2: mov eax, 0 pop rbp ret