Código C al convertidor de ensamblaje MIPS en línea
print("salam")
Silly Skunk
print("salam")
for (i=1; i<=N; i++) {
a[i] = c[i]*16; }
int j = 5;
int i = 0;
int k = 5;
while (i < 10)
{
if((i == j) || ((i + j) < k))
k += 2;
else
k += 1;
}
toUnsignedString:
# $a0 : nbre entier non signe
# $a1: adresse du chaine de caractères
# $a2: base valide
sw $a0,0($sp)
sw $a1,-4($sp)
sw $ra,-8($sp)
sw $v0,-12($sp)
addi $sp,$sp,-16
toUnsignedStringBoucle1:
div $a0,$a2
mflo $a0
addi $a1,$a1,1
bne $a0,$0,toUnsignedStringBoucle1
sb $0,0($a1)
lw $a0,16($sp)
toUnsignedStringBoucle2:
addi $a1,$a1,-1
div $a0,$a2
mfhi $a0
jal forDigit
sb $v0,0($a1)
mflo $a0
bne $a0,$0,toUnsignedStringBoucle2
addi $sp,$sp,16
lw $a0,0($sp)
lw $a1,-4($sp)
lw $ra,-8($sp)
lw $v0,-12($sp)
jr $ra
#include<stdio.h>
int main()
{
printf("Hello");
return 0;
}
while(S[i]!=k)
{
i++;
temp = temp+p+6;
if(i==j)
break;
}
a=a+b;
int i=0, j=0, k=2;
while(i==j){
i++; j++;
if(i>>2==k)
j=0;
}
#include<stdio.h>
#define MAX 10
int main(){
int a[MAX];
int i;
for(i=0;i<MAX;i++);
a[i]=i;
}
addi $3, $0, 15
start: addi $3, $3, -1
add $2, $2, $2
bne $0, $3, start
count:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("Olá Mundo!\n");
return 0;
}