In: Computer Science
6.) Write the assembly code for the following piece of code. Note: r,g,y,z correlate with the w4, w8, w11, and w15. if (g * y > 25) || (y == z / 8) && (y * 4 < z - g)) y = r / 32; else g = 8 * (r - z);
##Intel asm Syntax Compiler:x86-64 gcc 10.2
## if (g * y > 25) || (y == z / 8) && (y * 4 < z - g))
mov eax, DWORD PTR [rbp-4]
imul eax, DWORD PTR [rbp-8]
mov eax, DWORD PTR [rbp-12]
lea edx, [rax+7]
test eax, eax
cmovs eax, edx
sar eax, 3
cmp DWORD PTR [rbp-8], eax
jne .L3
mov eax, DWORD PTR [rbp-8]
lea edx, [0+rax*4]
mov eax, DWORD PTR [rbp-12]
sub eax, DWORD PTR [rbp-4]
cmp edx, eax
jge .L3
## y = r / 32;
mov eax, DWORD PTR [rbp-16]
lea edx, [rax+31]
test eax, eax
cmovs eax, edx
sar eax, 5
mov DWORD PTR [rbp-8], eax
jmp .L4
## g = 8 * (r - z);
mov eax, DWORD PTR [rbp-16]
sub eax, DWORD PTR [rbp-12]
sal eax, 3
mov DWORD PTR [rbp-4], eax