.globl a
.data
.align 2
.type a, @object
.size a, 4
a:
.word 1234
.globl b
.align 2
.type b, @object
.size b, 4
b:
.word 5678
.comm sum,4,4
.rdata
.align 2
$LC0:
.ascii "%d\000"
.text
.align 2
.globl main
.ent main
.type main, @function
main:
.frame $fp,32,$31 # vars= 0, regs= 2/0, args= 16, gp= 8
.mask 0xc0000000,-4
.fmask 0x00000000,0
.set noreorder
.cpload $25
.set nomacro
addiu $sp,$sp,-32
sw $31,28($sp)
sw $fp,24($sp)
move $fp,$sp
.cprestore 16
movz $31,$31,$0
lw $2,%got(a)($28)
nop
lw $3,0($2)
lw $2,%got(b)($28)
nop
lw $2,0($2)
nop
addu $3,$3,$2
lw $2,%got(sum)($28)
nop
sw $3,0($2)
lw $2,%got(sum)($28)
nop
lw $2,0($2)
nop
move $5,$2
lw $2,%got($LC0)($28)
nop
addiu $4,$2,%lo($LC0)
lw $2,%call16(printf)($28)
nop
move $25,$2
.reloc 1f,R_MIPS_JALR,printf
1: jalr $25
nop
lw $28,16($fp)
move $2,$0
move $sp,$fp
lw $31,28($sp)
lw $fp,24($sp)
addiu $sp,$sp,32
j $31
nop
2. Write a MIPS program that translates the following C code int a 1234; b 5678 int sum void main () atb sum = cout <...
10) What is the output when the following code fragment is executed? void exam(int i) {cout « i; } void main() { int n; for (n = 3; n <= 4; n++) exam(n); } A) 1234 B) 234 C) 34 D) 4
Translate the following C code to MIPS assembly code. Question 1) int counter = 0; void change_global(int value) { counter = counter + value; } void main() { change_global(5); change_global(10); }
How do i convert the following C program into MIPS assembly? int main(void) { int var1[4] ={4, 7, 12, 5}; int var2[4]= {15, 3, 6, 14}; int result[4]={0}; for (int i=0 ; i< 4; i++) result[i] = var1[i] - var2[i]; }
Consider the following C program: int sub(int *sum) { *sum =*sum +*sum; return 10; } void main() { int num= 3; num = sub(&num)+ num; } What is the value of num after the assignment statement in main, assuming operands are evaluated left to right. operands are evaluated right to left.
Write the missing statements for the following program. #include <iostream> using namespace std; int main(void) { int Num1; cout << "Enter 2 numbers: "; cin >> Num2; if (Num1 < Num2) cout << "Smallest number is " << Num1; else cout << "Smallest number is " << Num2; return 0; }
Convert the below C code to basic MIPS. Please leave comments for explanation #include <stdio.h> int main(void) { printf("Insert two numbers\n"); int a,b; scanf("%d",&a); scanf("%d",&b); a=a<<2; b=b<<2; printf("%d&%d\n",a,b); return 0; }
In mips code please
Implement the following C code in MAL and develop a small main program that tests your implementation on an integer array. You must use nested procedures in your implementation. int getArrAvg (int Arr) int sum0 for (int i = 0; i < 10; i += 1) sum-addfn (sum, Arr[i]) return sum/10; int addfn (int a, int b) return ab;
(10pts). Consider the following: void fun1(void); void fun2(void); void fun3(void); void main() { Int a,b,c; … } void fun1(void){ Int b,c,d; … } void fun2(void){ Int c,d,e; … } void fun3(void){ Int d,e,f; … } Given the following calling sequences and assuming that dynamic scoping is used. What variables are visible during execution of the last function called? Include with each visible variable the name of the function in which it was...
I need MIPS code for this program Translate the following C++ program to MIPS assembly program (Please explain each instruction of your code by a comment and submit a .asm file) // Example program #include <iostream> #include <string> using namespace std; int main() { const int ADULT_CHOICE= 1, CHILD_CHOICE= 2, SENIOR_CHOICE= 3, QUIT_CHOICE= 4, ADULT = 250, CHILD = 200, SENIOR = 350; int choice, months; int charges = 0; do { cout <<"\n\t\tHealth Club Membership Menu\n\n" <<"1. Standard Adult...
Convert the below C code to basic MIPS. Leave comments for explanation please #include <stdio.h> int main(void) { printf("Insert two numbers\n"); int a,b,c; scanf("%d",&a); scanf("%d",&b); c=a|b; printf("%d|%d=%d\n",a,b,c); return 0; }