In: Computer Science
if (M <= N + 3 && (C == ‘N’ || C == ‘n’))
C = ‘0’;
else
C = ‘1’;
Assume that M and N are 32-bit signed integer variables, and C is an 8-bit ASCII character variable. All variables are stored in memory, and all general-purpose registers are available for use.
main:
push rbp
mov rbp, rsp
mov eax, DWORD PTR [rbp-4]
add eax, 3
cmp DWORD PTR [rbp-8], eax
jg .L2
cmp BYTE PTR [rbp-9], 78
je .L3
cmp BYTE PTR [rbp-9], 110
jne .L2
.L3:
mov BYTE PTR [rbp-9], 48
jmp .L4
.L2:
mov BYTE PTR [rbp-9], 49
.L4:
mov eax, 0
pop rbp
ret