




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





All the work is my own. I had no prior knowledge of the exam contents nor will I share the contents with others in CS61C
Instructions (Read Me!)
Problem 0 1 2 3 4 5 6 7 Total Minutes 0 25 30 25 25 25 25 25 180 Points 1 10 14 10 10 10 10 10 75 Score
# O n e bfz $a0 done
*int isNegative(char in) { }
begin: addi $v0, $s1, - 4 #Inst 01 beq $v0, $zero, endif #Inst 02 sw $v1, 4($a0) _#Inst 03
endif: subu $t1, $t2, $t3 #Inst 13
13: 0x014B
void encryptThis(char* cleartext, int* cypher, int* cyphertext_buffer){ if(*cleartext == ‘\0’){ *cyphertext_buffer = 0; }else{ *cyphertext_buffer = *cypher + *cleartext; encryptThis(++cleartext, ++cypher, ++cyphertext_buffer); } }
**Main: ......
jal foo ...... foo: li $v0, - 1 lbu $t0, 0($a0) beq $0, $t0, done addi $sp, $sp, - 8 sw $ra, 4($sp) sw $t0, 0($sp) addi $a0, $a0, 1 jal foo lw $t0, 0($sp) and $v0, $v0, $t lw $ra, 4($sp) addi $sp, $sp, 8 done: jr $ra**
foo( ) { return ; }