Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Simulate the code given below on MARS4_5 for MIPS and paste output screenshots Code .LC0: .ascii Fibonacci Numbers by Leonardo 012000 .LC1: .ascii What

Please Simulate the code given below on MARS4_5 for MIPS and paste output screenshots Code

.LC0: .ascii "Fibonacci Numbers by Leonardo \012\000" .LC1: .ascii "What is your name? \000" .LC2: .ascii "Hi, \000" .LC3: .ascii "How many fibonacci Numbers should I display? \012\000" .LC4: .ascii "Enter an integer in the range [1..47]: \000" .LC5: .ascii "That number was out of range, try again\012\000" .LC6: .ascii "\011\000" main: daddiu $sp,$sp,-96 sd $31,88($sp) sd $fp,80($sp) sd $28,72($sp) sd $16,64($sp) move $fp,$sp lui $28,%hi(%neg(%gp_rel(main))) daddu $28,$28,$25 daddiu $28,$28,%lo(%neg(%gp_rel(main))) sw $0,0($fp) li $2,1 # 0x1 sw $2,4($fp) sw $0,12($fp) sw $0,16($fp) daddiu $2,$fp,32 move $4,$2 ld $2,%call16(ZNSt7_cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1Ev)($28) move $25,$2 nop

ld $2,%got_page(.LC0)($28) daddiu $5,$2,%got_ofst(.LC0) ld $4,%got_disp(_ZSt4cout)($28) ld $2,%call16(_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc)($28) move $25,$2 nop

ld $2,%got_page(.LC1)($28) daddiu $5,$2,%got_ofst(.LC1) ld $4,%got_disp(_ZSt4cout)($28) ld $2,%call16(_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc)($28) move $25,$2 nop

daddiu $2,$fp,32 move $5,$2 ld $4,%got_disp(_ZSt3cin)($28) ld $2,%call16(ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7_cxx1112basic_stringIS4_S5_T1_EE)($28) move $25,$2 nop

ld $2,%got_page(.LC2)($28) daddiu $5,$2,%got_ofst(.LC2) ld $4,%got_disp(_ZSt4cout)($28) ld $2,%call16(_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc)($28) move $25,$2 nop

move $3,$2 daddiu $2,$fp,32 move $5,$2 move $4,$3 ld $2,%call16(ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7_cxx1112basic_stringIS4_S5_T1_EE)($28) move $25,$2 nop

ld $5,%got_disp(ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6)($28) move $4,$2 ld $2,%call16(_ZNSolsEPFRSoS_E)($28) move $25,$2 nop

.L2: ld $2,%got_page(.LC3)($28) daddiu $5,$2,%got_ofst(.LC3) ld $4,%got_disp(_ZSt4cout)($28) ld $2,%call16(_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc)($28) move $25,$2 nop

ld $2,%got_page(.LC4)($28) daddiu $5,$2,%got_ofst(.LC4) ld $4,%got_disp(_ZSt4cout)($28) ld $2,%call16(_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc)($28) move $25,$2 nop

daddiu $2,$fp,28 move $5,$2 ld $4,%got_disp(_ZSt3cin)($28) ld $2,%call16(_ZNSirsERi)($28) move $25,$2 nop

lw $2,28($fp) slt $2,$2,48 beq $2,$0,.L3 nop

lw $2,28($fp) blez $2,.L3 nop

lw $2,28($fp) sw $2,20($fp) lw $2,0($fp) move $5,$2 ld $4,%got_disp(_ZSt4cout)($28) ld $2,%call16(_ZNSolsEi)($28) move $25,$2 nop

move $3,$2 ld $2,%got_page(.LC6)($28) daddiu $5,$2,%got_ofst(.LC6) move $4,$3 ld $2,%call16(_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc)($28) move $25,$2 nop

b .L12 nop

.L3: ld $2,%got_page(.LC5)($28) daddiu $5,$2,%got_ofst(.LC5) ld $4,%got_disp(_ZSt4cout)($28) ld $2,%call16(_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc)($28) move $25,$2 nop

b .L2 nop

.L12: move $3,$2 lw $2,4($fp) move $5,$2 move $4,$3 ld $2,%call16(_ZNSolsEi)($28) move $25,$2 nop

move $3,$2 ld $2,%got_page(.LC6)($28) daddiu $5,$2,%got_ofst(.LC6) move $4,$3 ld $2,%call16(_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc)($28) move $25,$2 nop

li $2,2 # 0x2 sw $2,8($fp) .L8: lw $3,8($fp) lw $2,20($fp) slt $2,$3,$2 beq $2,$0,.L5 nop

lw $3,0($fp) lw $2,4($fp) addu $2,$3,$2 sw $2,24($fp) lw $2,16($fp) addiu $2,$2,1 sw $2,16($fp) lw $2,24($fp) move $5,$2 ld $4,%got_disp(_ZSt4cout)($28) ld $2,%call16(_ZNSolsEi)($28) move $25,$2 nop

move $3,$2 ld $2,%got_page(.LC6)($28) daddiu $5,$2,%got_ofst(.LC6) move $4,$3 ld $2,%call16(_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc)($28) move $25,$2 nop

lw $2,12($fp) bne $2,$0,.L6 nop

lw $4,16($fp) move $3,$4 move $2,$3 dsll $2,$2,2 daddu $2,$2,$3 dsll $5,$2,4 daddu $2,$2,$5 dsll $5,$2,8 daddu $2,$2,$5 dsll $5,$2,16 daddu $2,$2,$5 daddu $2,$2,$3 dsrl $2,$2,32 sll $3,$2,0 sra $2,$4,31 subu $3,$3,$2 move $2,$3 sll $2,$2,1 addu $2,$2,$3 subu $2,$4,$2 bne $2,$0,.L6 nop

ld $5,%got_disp(ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6)($28) ld $4,%got_disp(_ZSt4cout)($28) ld $2,%call16(_ZNSolsEPFRSoS_E)($28) move $25,$2 nop

li $2,1 # 0x1 sw $2,12($fp) sw $0,16($fp) b .L7 nop

.L6: lw $4,16($fp) move $5,$4 move $3,$5 dsll $2,$3,1 move $3,$2 dsll $2,$3,2 dsubu $2,$2,$3 dsll $3,$2,4 daddu $2,$2,$3 dsll $3,$2,8 daddu $2,$2,$3 dsll $3,$2,16 daddu $2,$2,$3 daddu $2,$2,$5 dsrl $2,$2,32 sll $2,$2,0 sra $3,$2,1 sra $2,$4,31 subu $3,$3,$2 move $2,$3 sll $2,$2,2 addu $2,$2,$3 subu $2,$4,$2 bne $2,$0,.L7 nop

ld $5,%got_disp(ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6)($28) ld $4,%got_disp(_ZSt4cout)($28) ld $2,%call16(_ZNSolsEPFRSoS_E)($28) move $25,$2 nop

sw $0,16($fp) .L7: lw $2,4($fp) sw $2,0($fp) lw $2,24($fp) sw $2,4($fp) lw $2,8($fp) addiu $2,$2,1 sw $2,8($fp) b .L8 nop

.L5: move $16,$0 daddiu $2,$fp,32 move $4,$2 ld $2,%call16(ZNSt7_cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev)($28) move $25,$2 nop

move $2,$16 b .L13 nop

move $16,$4 daddiu $2,$fp,32 move $4,$2 ld $2,%call16(ZNSt7_cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev)($28) move $25,$2 nop

move $2,$16 move $4,$2 ld $2,%call16(_Unwind_Resume)($28) move $25,$2 nop

.L13: move $sp,$fp ld $31,88($sp) ld $fp,80($sp) ld $28,72($sp) ld $16,64($sp) daddiu $sp,$sp,96 j $31 nop

__static_initialization_and_destruction_0(int, int): daddiu $sp,$sp,-48 sd $31,40($sp) sd $fp,32($sp) sd $28,24($sp) move $fp,$sp lui $28,%hi(%neg(%gp_rel(__static_initialization_and_destruction_0(int, int)))) daddu $28,$28,$25 daddiu $28,$28,%lo(%neg(%gp_rel(__static_initialization_and_destruction_0(int, int)))) move $3,$4 move $2,$5 sll $3,$3,0 sw $3,0($fp) sll $2,$2,0 sw $2,4($fp) lw $3,0($fp) li $2,1 # 0x1 bne $3,$2,.L16 nop

lw $3,4($fp) li $2,65535 # 0xffff bne $3,$2,.L16 nop

ld $2,%got_page(ZStL8_ioinit)($28) daddiu $4,$2,%got_ofst(ZStL8_ioinit) ld $2,%call16(_ZNSt8ios_base4InitC1Ev)($28) move $25,$2 nop

ld $6,%got_disp(__dso_handle)($28) ld $2,%got_page(ZStL8_ioinit)($28) daddiu $5,$2,%got_ofst(ZStL8_ioinit) ld $4,%got_disp(_ZNSt8ios_base4InitD1Ev)($28) ld $2,%call16(__cxa_atexit)($28) move $25,$2 nop

.L16: nop move $sp,$fp ld $31,40($sp) ld $fp,32($sp) ld $28,24($sp) daddiu $sp,$sp,48 j $31 nop

GLOBAL_sub_I_main: daddiu $sp,$sp,-32 sd $31,24($sp) sd $fp,16($sp) sd $28,8($sp) move $fp,$sp lui $28,%hi(%neg(%gp_rel(GLOBAL_sub_I_main))) daddu $28,$28,$25 daddiu $28,$28,%lo(%neg(%gp_rel(GLOBAL_sub_I_main))) li $5,65535 # 0xffff li $4,1 # 0x1 ld $2,%got_page(__static_initialization_and_destruction_0(int, int))($28) daddiu $2,$2,%got_ofst(__static_initialization_and_destruction_0(int, int)) move $25,$2 nop

move $sp,$fp ld $31,24($sp) ld $fp,16($sp) ld $28,8($sp) daddiu $sp,$sp,32 j $31 nop

DW.ref.__gxx_personality_v0:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions