Question
Modify the code in fact.s so that it displays the 10th Fibonacci number.ou must do this in x86 and not C. 1 .file fact.c 2
Modify the code in fact.s so that it displays the 10th Fibonacci number.ou must do this in x86 and not C.
1 .file "fact.c" 2 .text 3 .section .rodata 4 .LC0: 5 .string "10! is %d " 6 .text 7 .globl main 8 .type main, @function 9 main: 10 .LFB0: 11 .cfi_startproc 12 pushq %rbp 13 .cfi_def_cfa_offset 16 14 .cfi_offset 6, -16 15 movq %rsp, %rbp 16 .cfi_def_cfa_register 6 17 subq $16, %rsp 18 movl $10, -4(%rbp) 19 movl $1, -8(%rbp) 20 .L2: 21 movl -8(%rbp), %eax 22 imull -4(%rbp), %eax 23 movl %eax, -8(%rbp) 24 subl $1, -4(%rbp) 25 cmpl $1, -4(%rbp) 26 jg .L2 27 movl -8(%rbp), %eax 28 movl %eax, %esi 29 leaq .LC0(%rip), %rdi 30 movl $0, %eax 31 call printf@PLT 32 movl $0, %eax 33 leave 34 .cfi_def_cfa 7, 8 35 ret 36 .cfi_endproc 37 .LFE0: 38 .size main, .-main 39 .ident "GCC: (Debian 8.3.0-6) 8.3.0" 40 .section .note.GNU-stack,"",@progbits ~
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started