Write a MIPS code to arrange the given set of integers in descending order. You may either assume that the set of integers are provided as initialization of array elements (or) you may ask the user to input the set of integers. You must have the output as
The given integers arranged in descending order is :
xx
yy
z
file 1 ""
.section .mdebug.abi32
.previous
.nan legacy
.module fp=32
.module nooddspreg
.abicalls
.rdata
.align 2
$LC0:
.ascii "\012\012 sort elements of array in descending order :\000"
.align 2
$LC1:
.ascii "----------------------------------------------\000"
.align 2
$LC2:
.ascii "Input the size of array : \000"
.align 2
$LC3:
.ascii "%d\000"
.align 2
$LC4:
.ascii "Input %d elements in the array :\012\000"
.align 2
$LC5:
.ascii "element - %d : \000"
.align 2
$LC6:
.ascii "\012Elements of array is sorted in descending order:\000"
.align 2
$LC7:
.ascii "%d\012\000"
.align 2
$LC8:
.ascii "\012\000"
.text
.align 2
.globl main
.set nomips16
.set nomicromips
.ent main
.type main, @function
main:
.frame $fp,448,$31 # vars= 416, regs= 2/0, args= 16, gp= 8
.mask 0xc0000000,-4
.fmask 0x00000000,0
.set noreorder
.cpload $25
.set nomacro
addiu $sp,$sp,-448
sw $31,444($sp)
sw $fp,440($sp)
move $fp,$sp
.cprestore 16
movz $31,$31,$0
lw $2,%got($LC0)($28)
nop
addiu $4,$2,%lo($LC0)
lw $2,%call16(puts)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,puts
1: jalr $25
nop
lw $28,16($fp)
nop
lw $2,%got($LC1)($28)
nop
addiu $4,$2,%lo($LC1)
lw $2,%call16(puts)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,puts
1: jalr $25
nop
lw $28,16($fp)
nop
lw $2,%got($LC2)($28)
nop
addiu $4,$2,%lo($LC2)
lw $2,%call16(printf)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,printf
1: jalr $25
nop
lw $28,16($fp)
addiu $2,$fp,436
move $5,$2
lw $2,%got($LC3)($28)
nop
addiu $4,$2,%lo($LC3)
lw $2,%call16(__isoc99_scanf)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,__isoc99_scanf
1: jalr $25
nop
lw $28,16($fp)
lw $2,436($fp)
nop
move $5,$2
lw $2,%got($LC4)($28)
nop
addiu $4,$2,%lo($LC4)
lw $2,%call16(printf)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,printf
1: jalr $25
nop
lw $28,16($fp)
sw $0,24($fp)
b $L2
nop
$L3:
lw $5,24($fp)
lw $2,%got($LC5)($28)
nop
addiu $4,$2,%lo($LC5)
lw $2,%call16(printf)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,printf
1: jalr $25
nop
lw $28,16($fp)
addiu $3,$fp,36
lw $2,24($fp)
nop
sll $2,$2,2
addu $2,$3,$2
move $5,$2
lw $2,%got($LC3)($28)
nop
addiu $4,$2,%lo($LC3)
lw $2,%call16(__isoc99_scanf)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,__isoc99_scanf
1: jalr $25
nop
lw $28,16($fp)
lw $2,24($fp)
nop
addiu $2,$2,1
sw $2,24($fp)
$L2:
lw $2,436($fp)
lw $3,24($fp)
nop
slt $2,$3,$2
bne $2,$0,$L3
nop
sw $0,24($fp)
b $L4
nop
$L8:
lw $2,24($fp)
nop
addiu $2,$2,1
sw $2,28($fp)
b $L5
nop
$L7:
lw $2,24($fp)
nop
sll $2,$2,2
addiu $3,$fp,24
addu $2,$3,$2
lw $3,12($2)
lw $2,28($fp)
nop
sll $2,$2,2
addiu $4,$fp,24
addu $2,$4,$2
lw $2,12($2)
nop
slt $2,$3,$2
beq $2,$0,$L6
nop
lw $2,24($fp)
nop
sll $2,$2,2
addiu $3,$fp,24
addu $2,$3,$2
lw $2,12($2)
nop
sw $2,32($fp)
lw $2,28($fp)
nop
sll $2,$2,2
addiu $3,$fp,24
addu $2,$3,$2
lw $3,12($2)
lw $2,24($fp)
nop
sll $2,$2,2
addiu $4,$fp,24
addu $2,$4,$2
sw $3,12($2)
lw $2,28($fp)
nop
sll $2,$2,2
addiu $3,$fp,24
addu $2,$3,$2
lw $3,32($fp)
nop
sw $3,12($2)
$L6:
lw $2,28($fp)
nop
addiu $2,$2,1
sw $2,28($fp)
$L5:
lw $2,436($fp)
lw $3,28($fp)
nop
slt $2,$3,$2
bne $2,$0,$L7
nop
lw $2,24($fp)
nop
addiu $2,$2,1
sw $2,24($fp)
$L4:
lw $2,436($fp)
lw $3,24($fp)
nop
slt $2,$3,$2
bne $2,$0,$L8
nop
lw $2,%got($LC6)($28)
nop
addiu $4,$2,%lo($LC6)
lw $2,%call16(puts)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,puts
1: jalr $25
nop
lw $28,16($fp)
sw $0,24($fp)
b $L9
nop
$L10:
lw $2,24($fp)
nop
sll $2,$2,2
addiu $3,$fp,24
addu $2,$3,$2
lw $2,12($2)
nop
move $5,$2
lw $2,%got($LC7)($28)
nop
addiu $4,$2,%lo($LC7)
lw $2,%call16(printf)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,printf
1: jalr $25
nop
lw $28,16($fp)
lw $2,24($fp)
nop
addiu $2,$2,1
sw $2,24($fp)
$L9:
lw $2,436($fp)
lw $3,24($fp)
nop
slt $2,$3,$2
bne $2,$0,$L10
nop
lw $2,%got($LC8)($28)
nop
addiu $4,$2,%lo($LC8)
lw $2,%call16(puts)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,puts
1: jalr $25
nop
lw $28,16($fp)
nop
move $sp,$fp
lw $31,444($sp)
lw $fp,440($sp)
addiu $sp,$sp,448
j $31
nop
.set macro
.set reorder
.end main
.size main, .-main
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609"
Note: No Errors but some warings are occurs due to if using another "GCC". here code is exactly correct.
Write a MIPS code to arrange the given set of integers in descending order. You may...
Write a MIPS code to arrange the given set of integers in descending order. You may either assume that the set of integers are provided as initialization of array elements (or) you may ask the user to input the set of integers. You must have the output as The given integers arranged in descending order is xx yy z It would be helpful to post the code and corresponding output. Thanks!
Write a program in MIPS assembly language that implements the DESCENDING bubble sort algorithm to sort a variable-sized array of signed 32-bit integers (words)that are read from the console. Be reminded that in a descending sort, the integers are sorted from the largest to the smallest. A “special value” 99999 will beused to signify the end of the input sequence. This value is not to be considered part of the input data set. However, any value greater than 99999 that...
Write a program in MIPS assembly language that implements the DESCENDING insertion sort algorithm to sort a variable-sized array of signed 32-bit integers (words)that are read from the console. Be reminded that in a descending sort, the integers are sorted from the largest to the smallest. A “special value” 99999 will beused to signify the end of the input sequence. This value is not to be considered part of the input data set. However, any value greater than 99999 that...
Write a program in MIPS assembly language that implements the DESCENDING insertion sort algorithm to sort a variable-sized array of signed 32-bit integers (words)that are read from the console. Be reminded that in a descending sort, the integers are sorted from the largest to the smallest. A “special value” 99999 will beused to signify the end of the input sequence. This value is not to be considered part of the input data set. However, any value greater than 99999 that...
C programing Write a program to sort numbers in either descending or ascending order. The program should ask the user to enter positive integer numbers one at a time(hiting the enter key after each one) The last number entered by the user should be -1, to indicate no further numbers will be entered. Store the numbers in an array, and then ask the user how to sort the numbers (either descending or ascending). Call a function void sortnumbers ( int...
I need help with this MIPS program. Write a program that makes an array of integers called array in the .data section. It should print the number of zeroes in that array. You should also have a variable called array_size in the .data section which is set to the number of elements in your array. Let's say you name your program count_zeroes.s. To submit your program, you must upload it to hills and run the following command (assuming you are...
Introduction: In this lab, you will write a MIPS program to read in (up to) 50 integer values from the user, store them in an array, print out the amay, one number per line, reverse the elements in the array and finally print out the elements in the just-reversed) array. Feel free to do this lab and all assembly programming labs) in Windows. You must use MARS Getting started: l. In MARS, create a new assembly file with the name...
Write MIPS code, please. Following: Write a program to be used by the Wisconsin DNR to track the number of Deer Hunting Licenses issued in a county and the state. It will display a menu with 5 choices numbered 1-5. They are (1) update the count, (2) display the number of licenses already issued to a county whose number is input, (3) display the county number and the number of licenses already issued to a range of counties whose starting...
Write a JAVA program to sort a given array of integers (1 Dimensional) in ascending order (from smallest to largest). You can either get the array as input or hardcode it inside your program.