Problem 1: Consider the following assembly code: .LCO .string "ans %d\n" main: .LFBO: pushq %rbp movq %rsp, %rbp subq $16, %rsp movabsq $83162457113523645, %rax movq %rax, -8(%rbp) movl $0, -12(%rbp)...


Problem 1: Consider the following assembly code:<br>.LCO .string
int main() { long int val= int result= for(;val>. val=. result += printf("ans %d\n",result); } "/>
Extracted text: Problem 1: Consider the following assembly code: .LCO .string "ans %d\n" main: .LFBO: pushq %rbp movq %rsp, %rbp subq $16, %rsp movabsq $83162457113523645, %rax movq %rax, -8(%rbp) movl $0, -12(%rbp) jmp .L2 .L3: movq -8(%rbp), %rbx movl %ebx, %ecx andl $1, %ecx movl -12(%rbp), %ebx addl %ecx, %ebx movl %ebx, -12(%rbp) sarq -8(%rbp) .L2: cmpq $0, -8(%rbp) jg .L3 movl -12(%rbp), %ebx movl %ebx, %esi movl $.LCO, %edi movl $0, %ebx call printf leave ret This code came from the following skeleton C file, and optimized with 00, so gcc -00 -S was the exact command to compile the file. Complete the below given C code using the above information. Step 1 might be to ignore the skeleton file and create a C file from the assembly code, and then rewrite the code to fit the skeleton file. #include int main() { long int val= int result= for(;val>. val=. result += printf("ans %d\n",result); }

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here