Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

OVra sing what if using chg? Pile of Fibonacci Numbers (Chapter 5, Pr 10, Modifi

ID: 3869799 • Letter: O

Question

OVra sing what if using chg? Pile of Fibonacci Numbers (Chapter 5, Pr 10, Modified) hing Programming Exercise 5 n Chapter 4 as a starting point wie a program that gnerales the frst 47 valuers in the F bonacci seren stores them n an ay of fou can work in ths way Creale a procedure generate, tbonaco to calculate the ist 47 values, ave umber generated You aso have to check he saved Fbonacci number erary function 10sbasm that provides the stub procedures for your progranming Your output tie is a binary fie with ts suce 584) bytes The blowing are requred On the t sde s he conale 0000000 0100000001000000 "60000003000000 S00000008000000 OD00000035000000 00000030 83 00 00 00 79 03 00 6 02 00 00 08 03 00 00 ooo000s0 00000070 07 00 28 82 00 DD SA 14 89 65 30 21 C2 2A 0 29 45 00 00 PI 6F0 00 20 B5 0 0 11 25 01 00 33 DA 01 00 42 FY 02 00 73 D9 0 2 C1 35 00 87 04 57 00 es ce sc 0 0 1 3 98 70 1 29 70 54 02 A2 O 5 3 C 78 15 06

Explanation / Answer

Answer :

push rbp

mov rbp, rsp

push rbx

sub rsp, 24

mov DWORD PTR [rbp-20], edi

cmp DWORD PTR [rbp-20], 0

je .L2

cmp DWORD PTR [rbp-20], 1

jne .L3

.L2:

mov eax, 1

jmp .L4

.L3:

mov eax, DWORD PTR [rbp-20]

sub eax, 1

mov edi, eax

call fib(int)

mov ebx, eax

mov eax, DWORD PTR [rbp-20]

sub eax, 2

mov edi, eax

call fib(int)

add eax, ebx

.L4:

add rsp, 24

pop rbx

pop rbp

ret

main:

push rbp

mov rbp, rsp

sub rsp, 16

mov DWORD PTR [rbp-4], 0

.L7:

cmp DWORD PTR [rbp-4], 46

jg .L6

mov eax, DWORD PTR [rbp-4]

mov edi, eax

call fib(int)

add DWORD PTR [rbp-4], 1

jmp .L7

.L6:

mov eax, 0

leave

ret