-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoMips.test.ts.snap
1219 lines (1181 loc) · 69.9 KB
/
toMips.test.ts.snap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`toMips 1`] = `
".globl _start
.data
global_globalPointer: .word 0
global_failCount: .word 0
global_totalCount: .word 0
global_testNumber: .word 0
global_var: .word 0
str_0: .asciiz \\"left_\\"
str_1: .asciiz \\"\\\\n\\"
str_2: .asciiz \\"right_\\"
str_3: .asciiz \\"Calling a function using pointer:\\\\n\\"
str_4: .asciiz \\"Function as an actual:\\\\n\\"
str_5: .asciiz \\"Calling a function returned from another function:\\\\n\\"
str_6: .asciiz \\"Test #\\"
str_7: .asciiz \\": \\"
str_8: .asciiz \\"Pass\\\\n\\"
str_9: .asciiz \\"Fail\\\\n\\"
str_10: .asciiz \\"FAIL\\\\n\\"
str_11: .asciiz \\"Expected: \\"
str_12: .asciiz \\"\\\\nReceived:\\"
str_13: .asciiz \\"\\\\n\\\\n\\"
str_14: .asciiz \\"Passed \\"
str_15: .asciiz \\" of \\"
str_16: .asciiz \\" tests\\\\n\\\\n\\\\n\\"
str_17: .asciiz \\"Section #\\"
str_18: .asciiz \\":\\\\n\\"
.text
_start: jal global_main
li $v0, 10 # Exit syscall
syscall
_get_pc: move $v0, $ra # A helper function for getting current PC
jr $ra
global_break: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
lbl_0: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_left: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
lw $t0, 0($fp) # Getting argument \\"a\\"
sw $t0, -12($fp)
la $a0, str_0 # BEGIN Output # String Literal: \\"left_\\"
addi $v0, $zero, 4
syscall # END Output
lw $a0, -12($fp) # BEGIN Output
addi $v0, $zero, 1
syscall # END Output
la $a0, str_1 # BEGIN Output # String Literal: \\"\\\\n\\"
addi $v0, $zero, 4
syscall # END Output
lbl_1: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_right: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
lw $t0, 0($fp) # Getting argument \\"a\\"
sw $t0, -12($fp)
la $a0, str_2 # BEGIN Output # String Literal: \\"right_\\"
addi $v0, $zero, 4
syscall # END Output
lw $a0, -12($fp) # BEGIN Output
addi $v0, $zero, 1
syscall # END Output
la $a0, str_1 # BEGIN Output # String Literal: \\"\\\\n\\"
addi $v0, $zero, 4
syscall # END Output
lbl_2: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_twice: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
lw $t0, 4($fp) # Getting argument \\"f\\"
sw $t0, -12($fp)
lw $t0, 0($fp) # Getting argument \\"a\\"
sw $t0, -16($fp)
lw $t1, -16($fp) # Setting argument 1
sw $t1, -20($fp)
addi $sp, $sp, -20 # BEGIN Calling f
jal _get_pc # Calling function by pointer
move $ra, $v0
addi $ra, $ra, 16 # Offset the return position
lw $v0, -12($fp)
jr $v0
addi $sp, $sp, 20 # END Calling f
lw $t2, -16($fp) # Setting argument 1
sw $t2, -24($fp)
addi $sp, $sp, -24 # BEGIN Calling f
jal _get_pc # Calling function by pointer
move $ra, $v0
addi $ra, $ra, 16 # Offset the return position
lw $v0, -12($fp)
jr $v0
addi $sp, $sp, 24 # END Calling f
lw $v0, -12($fp) # BEGIN Return
lbl_3: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_testFunctionPointers: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
sw $zero, -12($fp) # Initializing localPointer
sw $zero, -16($fp) # Initializing a
addi $v0, $zero, 41 # BEGIN Mayhem
move $a0, $zero
syscall
sw $a0, -20($fp) # END Mayhem
lw $t1, -20($fp)
sw $t1, -16($fp) # BEGIN Assigning a # END Assigning a
sw $zero, -24($fp) # Initializing b
addi $v0, $zero, 41 # BEGIN Mayhem
move $a0, $zero
syscall
sw $a0, -28($fp) # END Mayhem
lw $t2, -28($fp)
sw $t2, -24($fp) # BEGIN Assigning b # END Assigning b
lw $t4, -16($fp) # BEGIN if # BEGIN If Condition # Operation: GT64
lw $t5, -24($fp)
slt $t3, $t5, $t4
sw $t3, -32($fp)
lw $t0, -32($fp)
beq $zero, $t0, lbl_5 # END If Condition
la $t6, global_left # BEGIN True Branch
sw $t6, global_globalPointer # BEGIN Assigning globalPointer # END Assigning globalPointer
la $t7, global_right
sw $t7, -12($fp) # BEGIN Assigning localPointer # END True Branch # END Assigning localPointer
j lbl_6
lbl_5: la $t8, global_right # BEGIN False Branch
sw $t8, global_globalPointer # BEGIN Assigning globalPointer # END Assigning globalPointer
la $t9, global_left
sw $t9, -12($fp) # BEGIN Assigning localPointer # END if # END False Branch # END Assigning localPointer
lbl_6: addi $sp, $sp, -32 # BEGIN Calling break
jal global_break
addi $sp, $sp, 32 # END Calling break
la $a0, str_3 # BEGIN Output # String Literal: \\"Calling a function using pointer:\\\\n\\"
addi $v0, $zero, 4
syscall # END Output
lw $t1, -24($fp) # Setting argument 1
sw $t1, -36($fp)
addi $sp, $sp, -36 # BEGIN Calling localPointer
jal _get_pc # Calling function by pointer
move $ra, $v0
addi $ra, $ra, 16 # Offset the return position
lw $v0, -12($fp)
jr $v0
addi $sp, $sp, 36 # END Calling localPointer
sw $zero, -40($fp) # Initializing result
la $a0, str_4 # BEGIN Output # String Literal: \\"Function as an actual:\\\\n\\"
addi $v0, $zero, 4
syscall # END Output
lw $t2, global_globalPointer # Setting argument 1
sw $t2, -44($fp)
lw $t2, -16($fp) # Setting argument 2
sw $t2, -48($fp)
addi $sp, $sp, -48 # BEGIN Calling twice
jal global_twice
addi $sp, $sp, 48 # END Calling twice
sw $v0, -52($fp)
lw $t3, -52($fp)
sw $t3, -40($fp) # BEGIN Assigning result # END Assigning result
la $a0, str_5 # BEGIN Output # String Literal: \\"Calling a function returned from another function:\\\\n\\"
addi $v0, $zero, 4
syscall # END Output
lw $t4, -16($fp) # Setting argument 1
sw $t4, -56($fp)
addi $sp, $sp, -56 # BEGIN Calling result
jal _get_pc # Calling function by pointer
move $ra, $v0
addi $ra, $ra, 16 # Offset the return position
lw $v0, -40($fp)
jr $v0
addi $sp, $sp, 56 # END Calling result
lbl_4: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_assertBool: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
lw $t0, 0($fp) # Getting argument \\"result\\"
sw $t0, -12($fp)
li $t2, 1 # BEGIN PostInc # Int Literal: 1
sw $t2, -16($fp)
lw $t1, global_totalCount
add $t1, $t1, $t2
sw $t1, global_totalCount # END PostInc
la $a0, str_6 # BEGIN Output # String Literal: \\"Test #\\"
addi $v0, $zero, 4
syscall # END Output
lw $a0, global_totalCount # BEGIN Output
addi $v0, $zero, 1
syscall # END Output
la $a0, str_7 # BEGIN Output # String Literal: \\": \\"
addi $v0, $zero, 4
syscall # END Output
lw $t5, -12($fp) # BEGIN if # BEGIN If Condition
beq $zero, $t5, lbl_8 # END If Condition
la $a0, str_8 # BEGIN True Branch # BEGIN Output # String Literal: \\"Pass\\\\n\\"
addi $v0, $zero, 4
syscall # END True Branch # END Output
j lbl_9
lbl_8: la $a0, str_9 # BEGIN False Branch # BEGIN Output # String Literal: \\"Fail\\\\n\\"
addi $v0, $zero, 4
syscall # END Output
li $t4, 1 # BEGIN PostInc # Int Literal: 1
sw $t4, -20($fp)
lw $t3, global_failCount
add $t3, $t3, $t4
sw $t3, global_failCount # END if # END False Branch # END PostInc
lbl_9: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_not: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
lw $t0, 0($fp) # Getting argument \\"a\\"
sw $t0, -12($fp)
lw $t3, -12($fp) # BEGIN Return # Operation: NOT64
sltiu $t1, $t3, 1
andi $t1, $t1, 0x00ff
sw $t1, -16($fp)
lw $v0, -16($fp)
lbl_10: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_assert: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
lw $t0, 4($fp) # Getting argument \\"result\\"
sw $t0, -12($fp)
lw $t0, 0($fp) # Getting argument \\"expected\\"
sw $t0, -16($fp)
li $t2, 1 # BEGIN PostInc # Int Literal: 1
sw $t2, -20($fp)
lw $t1, global_totalCount
add $t1, $t1, $t2
sw $t1, global_totalCount # END PostInc
la $a0, str_6 # BEGIN Output # String Literal: \\"Test #\\"
addi $v0, $zero, 4
syscall # END Output
lw $a0, global_totalCount # BEGIN Output
addi $v0, $zero, 1
syscall # END Output
la $a0, str_7 # BEGIN Output # String Literal: \\": \\"
addi $v0, $zero, 4
syscall # END Output
lw $t4, -12($fp) # BEGIN if # BEGIN If Condition # Operation: EQ64
lw $t5, -16($fp)
xor $t3, $t4, $t5
sltiu $t3, $t3, 1
sw $t3, -24($fp)
lw $t8, -24($fp)
beq $zero, $t8, lbl_12 # END If Condition
la $a0, str_8 # BEGIN True Branch # BEGIN Output # String Literal: \\"Pass\\\\n\\"
addi $v0, $zero, 4
syscall # END True Branch # END Output
j lbl_13
lbl_12: la $a0, str_10 # BEGIN False Branch # BEGIN Output # String Literal: \\"FAIL\\\\n\\"
addi $v0, $zero, 4
syscall # END Output
la $a0, str_11 # BEGIN Output # String Literal: \\"Expected: \\"
addi $v0, $zero, 4
syscall # END Output
lw $a0, -16($fp) # BEGIN Output
addi $v0, $zero, 1
syscall # END Output
la $a0, str_12 # BEGIN Output # String Literal: \\"\\\\nReceived:\\"
addi $v0, $zero, 4
syscall # END Output
lw $a0, -12($fp) # BEGIN Output
addi $v0, $zero, 1
syscall # END Output
la $a0, str_13 # BEGIN Output # String Literal: \\"\\\\n\\\\n\\"
addi $v0, $zero, 4
syscall # END Output
li $t7, 1 # BEGIN PostInc # Int Literal: 1
sw $t7, -28($fp)
lw $t6, global_failCount
add $t6, $t6, $t7
sw $t6, global_failCount # END if # END False Branch # END PostInc
lbl_13: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_printSummary: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
la $a0, str_14 # BEGIN Output # String Literal: \\"Passed \\"
addi $v0, $zero, 4
syscall # END Output
lw $t2, global_totalCount # BEGIN Output # Operation: SUB64
lw $t3, global_failCount
sub $t1, $t2, $t3
sw $t1, -12($fp)
lw $a0, -12($fp)
addi $v0, $zero, 1
syscall # END Output
la $a0, str_15 # BEGIN Output # String Literal: \\" of \\"
addi $v0, $zero, 4
syscall # END Output
lw $a0, global_totalCount # BEGIN Output
addi $v0, $zero, 1
syscall # END Output
la $a0, str_16 # BEGIN Output # String Literal: \\" tests\\\\n\\\\n\\\\n\\"
addi $v0, $zero, 4
syscall # END Output
lbl_14: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_printTestHeader: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
li $t2, 1 # BEGIN PostInc # Int Literal: 1
sw $t2, -12($fp)
lw $t1, global_testNumber
add $t1, $t1, $t2
sw $t1, global_testNumber # END PostInc
la $a0, str_17 # BEGIN Output # String Literal: \\"Section #\\"
addi $v0, $zero, 4
syscall # END Output
lw $a0, global_testNumber # BEGIN Output
addi $v0, $zero, 1
syscall # END Output
la $a0, str_18 # BEGIN Output # String Literal: \\":\\\\n\\"
addi $v0, $zero, 4
syscall # END Output
lbl_15: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_testLoops: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
sw $zero, -12($fp) # BEGIN for loop # Initializing i
lbl_17: li $t1, 10 # BEGIN if # BEGIN If Condition # Operation: LT64 # Int Literal: 10
sw $t1, -16($fp)
lw $t3, -12($fp)
lw $t4, -16($fp)
slt $t2, $t3, $t4
sw $t2, -20($fp)
lw $t7, -20($fp)
beq $zero, $t7, lbl_18 # END If Condition
lw $a0, -12($fp) # BEGIN True Branch # BEGIN Output
addi $v0, $zero, 1
syscall # END Output
la $a0, str_1 # BEGIN Output # String Literal: \\"\\\\n\\"
addi $v0, $zero, 4
syscall # END Output
li $t6, 1 # BEGIN PostInc # Int Literal: 1
sw $t6, -24($fp)
lw $t5, -12($fp)
add $t5, $t5, $t6
sw $t5, -12($fp) # END PostInc
j lbl_17 # END for loop # END if # END True Branch
lbl_18: sw $zero, -28($fp) # Initializing b
li $t8, 10 # Int Literal: 10
sw $t8, -32($fp)
lw $t9, -32($fp)
sw $t9, -28($fp) # BEGIN Assigning b # END Assigning b
lbl_19: li $t0, 0 # BEGIN for loop # BEGIN if # BEGIN If Condition # Operation: GT64 # Int Literal: 0
sw $t0, -36($fp)
lw $t2, -28($fp)
lw $t3, -36($fp)
slt $t1, $t3, $t2
sw $t1, -40($fp)
lw $t6, -40($fp)
beq $zero, $t6, lbl_20 # END If Condition
lw $a0, -28($fp) # BEGIN True Branch # BEGIN Output
addi $v0, $zero, 1
syscall # END Output
la $a0, str_1 # BEGIN Output # String Literal: \\"\\\\n\\"
addi $v0, $zero, 4
syscall # END Output
li $t5, 1 # BEGIN PostDec # Int Literal: 1
sw $t5, -44($fp)
lw $t4, -28($fp)
sub $t4, $t4, $t5
sw $t4, -28($fp) # END PostDec
j lbl_19 # END for loop # END if # END True Branch
lbl_20: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_testOperators: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
li $t1, 1 # Operation: AND64 # Int Literal: 1
sw $t1, -12($fp)
li $t2, 1 # Int Literal: 1
sw $t2, -16($fp)
lw $t4, -12($fp)
lw $t5, -16($fp)
and $t3, $t4, $t5
sw $t3, -20($fp)
lw $t6, -20($fp) # Setting argument 1
sw $t6, -24($fp)
addi $sp, $sp, -24 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 24 # END Calling assertBool
li $t7, 1 # Operation: OR64 # Int Literal: 1
sw $t7, -28($fp)
li $t8, 1 # Int Literal: 1
sw $t8, -32($fp)
lw $t0, -28($fp)
lw $t1, -32($fp)
or $t9, $t0, $t1
sw $t9, -36($fp)
lw $t2, -36($fp) # Setting argument 1
sw $t2, -40($fp)
addi $sp, $sp, -40 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 40 # END Calling assertBool
li $t3, 1 # Operation: AND64 # Int Literal: 1
sw $t3, -44($fp)
li $t4, 0 # Int Literal: 0
sw $t4, -48($fp)
lw $t6, -44($fp)
lw $t7, -48($fp)
and $t5, $t6, $t7
sw $t5, -52($fp)
lw $t8, -52($fp) # Setting argument 1
sw $t8, -56($fp)
addi $sp, $sp, -56 # BEGIN Calling not
jal global_not
addi $sp, $sp, 56 # END Calling not
sw $v0, -60($fp)
lw $t9, -60($fp) # Setting argument 1
sw $t9, -64($fp)
addi $sp, $sp, -64 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 64 # END Calling assertBool
li $t0, 1 # Operation: OR64 # Int Literal: 1
sw $t0, -68($fp)
li $t1, 0 # Int Literal: 0
sw $t1, -72($fp)
lw $t3, -68($fp)
lw $t4, -72($fp)
or $t2, $t3, $t4
sw $t2, -76($fp)
lw $t5, -76($fp) # Setting argument 1
sw $t5, -80($fp)
addi $sp, $sp, -80 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 80 # END Calling assertBool
li $t6, 0 # Operation: AND64 # Int Literal: 0
sw $t6, -84($fp)
li $t7, 1 # Int Literal: 1
sw $t7, -88($fp)
lw $t9, -84($fp)
lw $t0, -88($fp)
and $t8, $t9, $t0
sw $t8, -92($fp)
lw $t1, -92($fp) # Setting argument 1
sw $t1, -96($fp)
addi $sp, $sp, -96 # BEGIN Calling not
jal global_not
addi $sp, $sp, 96 # END Calling not
sw $v0, -100($fp)
lw $t2, -100($fp) # Setting argument 1
sw $t2, -104($fp)
addi $sp, $sp, -104 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 104 # END Calling assertBool
li $t3, 0 # Operation: OR64 # Int Literal: 0
sw $t3, -108($fp)
li $t4, 1 # Int Literal: 1
sw $t4, -112($fp)
lw $t6, -108($fp)
lw $t7, -112($fp)
or $t5, $t6, $t7
sw $t5, -116($fp)
lw $t8, -116($fp) # Setting argument 1
sw $t8, -120($fp)
addi $sp, $sp, -120 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 120 # END Calling assertBool
li $t9, 0 # Operation: AND64 # Int Literal: 0
sw $t9, -124($fp)
li $t0, 0 # Int Literal: 0
sw $t0, -128($fp)
lw $t2, -124($fp)
lw $t3, -128($fp)
and $t1, $t2, $t3
sw $t1, -132($fp)
lw $t4, -132($fp) # Setting argument 1
sw $t4, -136($fp)
addi $sp, $sp, -136 # BEGIN Calling not
jal global_not
addi $sp, $sp, 136 # END Calling not
sw $v0, -140($fp)
lw $t5, -140($fp) # Setting argument 1
sw $t5, -144($fp)
addi $sp, $sp, -144 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 144 # END Calling assertBool
li $t6, 0 # Operation: OR64 # Int Literal: 0
sw $t6, -148($fp)
li $t7, 0 # Int Literal: 0
sw $t7, -152($fp)
lw $t9, -148($fp)
lw $t0, -152($fp)
or $t8, $t9, $t0
sw $t8, -156($fp)
lw $t1, -156($fp) # Setting argument 1
sw $t1, -160($fp)
addi $sp, $sp, -160 # BEGIN Calling not
jal global_not
addi $sp, $sp, 160 # END Calling not
sw $v0, -164($fp)
lw $t2, -164($fp) # Setting argument 1
sw $t2, -168($fp)
addi $sp, $sp, -168 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 168 # END Calling assertBool
li $t3, 3 # Operation: GT64 # Int Literal: 3
sw $t3, -172($fp)
li $t4, 2 # Int Literal: 2
sw $t4, -176($fp)
lw $t6, -172($fp)
lw $t7, -176($fp)
slt $t5, $t7, $t6
sw $t5, -180($fp)
lw $t8, -180($fp) # Setting argument 1
sw $t8, -184($fp)
addi $sp, $sp, -184 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 184 # END Calling assertBool
li $t9, 2 # Operation: GT64 # Int Literal: 2
sw $t9, -188($fp)
li $t0, 2 # Int Literal: 2
sw $t0, -192($fp)
lw $t2, -188($fp)
lw $t3, -192($fp)
slt $t1, $t3, $t2
sw $t1, -196($fp)
lw $t4, -196($fp) # Setting argument 1
sw $t4, -200($fp)
addi $sp, $sp, -200 # BEGIN Calling not
jal global_not
addi $sp, $sp, 200 # END Calling not
sw $v0, -204($fp)
lw $t5, -204($fp) # Setting argument 1
sw $t5, -208($fp)
addi $sp, $sp, -208 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 208 # END Calling assertBool
li $t6, 2 # Operation: GT64 # Int Literal: 2
sw $t6, -212($fp)
li $t7, 3 # Int Literal: 3
sw $t7, -216($fp)
lw $t9, -212($fp)
lw $t0, -216($fp)
slt $t8, $t0, $t9
sw $t8, -220($fp)
lw $t1, -220($fp) # Setting argument 1
sw $t1, -224($fp)
addi $sp, $sp, -224 # BEGIN Calling not
jal global_not
addi $sp, $sp, 224 # END Calling not
sw $v0, -228($fp)
lw $t2, -228($fp) # Setting argument 1
sw $t2, -232($fp)
addi $sp, $sp, -232 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 232 # END Calling assertBool
li $t3, 3 # Operation: LT64 # Int Literal: 3
sw $t3, -236($fp)
li $t4, 2 # Int Literal: 2
sw $t4, -240($fp)
lw $t6, -236($fp)
lw $t7, -240($fp)
slt $t5, $t6, $t7
sw $t5, -244($fp)
lw $t8, -244($fp) # Setting argument 1
sw $t8, -248($fp)
addi $sp, $sp, -248 # BEGIN Calling not
jal global_not
addi $sp, $sp, 248 # END Calling not
sw $v0, -252($fp)
lw $t9, -252($fp) # Setting argument 1
sw $t9, -256($fp)
addi $sp, $sp, -256 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 256 # END Calling assertBool
li $t0, 2 # Operation: LT64 # Int Literal: 2
sw $t0, -260($fp)
li $t1, 2 # Int Literal: 2
sw $t1, -264($fp)
lw $t3, -260($fp)
lw $t4, -264($fp)
slt $t2, $t3, $t4
sw $t2, -268($fp)
lw $t5, -268($fp) # Setting argument 1
sw $t5, -272($fp)
addi $sp, $sp, -272 # BEGIN Calling not
jal global_not
addi $sp, $sp, 272 # END Calling not
sw $v0, -276($fp)
lw $t6, -276($fp) # Setting argument 1
sw $t6, -280($fp)
addi $sp, $sp, -280 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 280 # END Calling assertBool
li $t7, 2 # Operation: LT64 # Int Literal: 2
sw $t7, -284($fp)
li $t8, 3 # Int Literal: 3
sw $t8, -288($fp)
lw $t0, -284($fp)
lw $t1, -288($fp)
slt $t9, $t0, $t1
sw $t9, -292($fp)
lw $t2, -292($fp) # Setting argument 1
sw $t2, -296($fp)
addi $sp, $sp, -296 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 296 # END Calling assertBool
li $t3, 3 # Operation: GTE64 # Int Literal: 3
sw $t3, -300($fp)
li $t4, 2 # Int Literal: 2
sw $t4, -304($fp)
lw $t6, -300($fp)
lw $t7, -304($fp)
slt $t5, $t6, $t7
xori $t5, $t5, 1
sw $t5, -308($fp)
lw $t8, -308($fp) # Setting argument 1
sw $t8, -312($fp)
addi $sp, $sp, -312 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 312 # END Calling assertBool
li $t9, 2 # Operation: GTE64 # Int Literal: 2
sw $t9, -316($fp)
li $t0, 2 # Int Literal: 2
sw $t0, -320($fp)
lw $t2, -316($fp)
lw $t3, -320($fp)
slt $t1, $t2, $t3
xori $t1, $t1, 1
sw $t1, -324($fp)
lw $t4, -324($fp) # Setting argument 1
sw $t4, -328($fp)
addi $sp, $sp, -328 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 328 # END Calling assertBool
li $t5, 2 # Operation: GTE64 # Int Literal: 2
sw $t5, -332($fp)
li $t6, 3 # Int Literal: 3
sw $t6, -336($fp)
lw $t8, -332($fp)
lw $t9, -336($fp)
slt $t7, $t8, $t9
xori $t7, $t7, 1
sw $t7, -340($fp)
lw $t0, -340($fp) # Setting argument 1
sw $t0, -344($fp)
addi $sp, $sp, -344 # BEGIN Calling not
jal global_not
addi $sp, $sp, 344 # END Calling not
sw $v0, -348($fp)
lw $t1, -348($fp) # Setting argument 1
sw $t1, -352($fp)
addi $sp, $sp, -352 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 352 # END Calling assertBool
li $t2, 3 # Operation: LTE64 # Int Literal: 3
sw $t2, -356($fp)
li $t3, 2 # Int Literal: 2
sw $t3, -360($fp)
lw $t5, -356($fp)
lw $t6, -360($fp)
slt $t4, $t6, $t5
xori $t4, $t4, 1
sw $t4, -364($fp)
lw $t7, -364($fp) # Setting argument 1
sw $t7, -368($fp)
addi $sp, $sp, -368 # BEGIN Calling not
jal global_not
addi $sp, $sp, 368 # END Calling not
sw $v0, -372($fp)
lw $t8, -372($fp) # Setting argument 1
sw $t8, -376($fp)
addi $sp, $sp, -376 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 376 # END Calling assertBool
li $t9, 2 # Operation: LTE64 # Int Literal: 2
sw $t9, -380($fp)
li $t0, 2 # Int Literal: 2
sw $t0, -384($fp)
lw $t2, -380($fp)
lw $t3, -384($fp)
slt $t1, $t3, $t2
xori $t1, $t1, 1
sw $t1, -388($fp)
lw $t4, -388($fp) # Setting argument 1
sw $t4, -392($fp)
addi $sp, $sp, -392 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 392 # END Calling assertBool
li $t5, 2 # Operation: LTE64 # Int Literal: 2
sw $t5, -396($fp)
li $t6, 3 # Int Literal: 3
sw $t6, -400($fp)
lw $t8, -396($fp)
lw $t9, -400($fp)
slt $t7, $t9, $t8
xori $t7, $t7, 1
sw $t7, -404($fp)
lw $t0, -404($fp) # Setting argument 1
sw $t0, -408($fp)
addi $sp, $sp, -408 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 408 # END Calling assertBool
li $t1, 3 # Operation: EQ64 # Int Literal: 3
sw $t1, -412($fp)
li $t2, 2 # Int Literal: 2
sw $t2, -416($fp)
lw $t4, -412($fp)
lw $t5, -416($fp)
xor $t3, $t4, $t5
sltiu $t3, $t3, 1
sw $t3, -420($fp)
lw $t6, -420($fp) # Setting argument 1
sw $t6, -424($fp)
addi $sp, $sp, -424 # BEGIN Calling not
jal global_not
addi $sp, $sp, 424 # END Calling not
sw $v0, -428($fp)
lw $t7, -428($fp) # Setting argument 1
sw $t7, -432($fp)
addi $sp, $sp, -432 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 432 # END Calling assertBool
li $t8, 2 # Operation: EQ64 # Int Literal: 2
sw $t8, -436($fp)
li $t9, 2 # Int Literal: 2
sw $t9, -440($fp)
lw $t1, -436($fp)
lw $t2, -440($fp)
xor $t0, $t1, $t2
sltiu $t0, $t0, 1
sw $t0, -444($fp)
lw $t3, -444($fp) # Setting argument 1
sw $t3, -448($fp)
addi $sp, $sp, -448 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 448 # END Calling assertBool
li $t4, 3 # Operation: NEQ64 # Int Literal: 3
sw $t4, -452($fp)
li $t5, 2 # Int Literal: 2
sw $t5, -456($fp)
lw $t7, -452($fp)
lw $t8, -456($fp)
xor $t6, $t7, $t8
slt $t6, $zero, $t6
sw $t6, -460($fp)
lw $t9, -460($fp) # Setting argument 1
sw $t9, -464($fp)
addi $sp, $sp, -464 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 464 # END Calling assertBool
li $t0, 2 # Operation: NEQ64 # Int Literal: 2
sw $t0, -468($fp)
li $t1, 2 # Int Literal: 2
sw $t1, -472($fp)
lw $t3, -468($fp)
lw $t4, -472($fp)
xor $t2, $t3, $t4
slt $t2, $zero, $t2
sw $t2, -476($fp)
lw $t5, -476($fp) # Setting argument 1
sw $t5, -480($fp)
addi $sp, $sp, -480 # BEGIN Calling not
jal global_not
addi $sp, $sp, 480 # END Calling not
sw $v0, -484($fp)
lw $t6, -484($fp) # Setting argument 1
sw $t6, -488($fp)
addi $sp, $sp, -488 # BEGIN Calling assertBool
jal global_assertBool
addi $sp, $sp, 488 # END Calling assertBool
li $t7, 2 # Operation: ADD64 # Int Literal: 2
sw $t7, -492($fp)
li $t8, 3 # Int Literal: 3
sw $t8, -496($fp)
lw $t0, -492($fp)
lw $t1, -496($fp)
add $t9, $t0, $t1
sw $t9, -500($fp)
lw $t3, -500($fp) # Setting argument 1
sw $t3, -508($fp)
li $t2, 5 # Int Literal: 5
sw $t2, -504($fp)
lw $t3, -504($fp) # Setting argument 2
sw $t3, -512($fp)
addi $sp, $sp, -512 # BEGIN Calling assert
jal global_assert
addi $sp, $sp, 512 # END Calling assert
li $t4, 2 # Operation: SUB64 # Int Literal: 2
sw $t4, -516($fp)
li $t5, 3 # Int Literal: 3
sw $t5, -520($fp)
lw $t7, -516($fp)
lw $t8, -520($fp)
sub $t6, $t7, $t8
sw $t6, -524($fp)
lw $t3, -524($fp) # Setting argument 1
sw $t3, -536($fp)
li $t9, 1 # Operation: NEG64 # Int Literal: 1
sw $t9, -528($fp)
lw $t2, -528($fp)
sub $t0, $zero, $t2
sw $t0, -532($fp)
lw $t3, -532($fp) # Setting argument 2
sw $t3, -540($fp)
addi $sp, $sp, -540 # BEGIN Calling assert
jal global_assert
addi $sp, $sp, 540 # END Calling assert
li $t4, 2 # Operation: MULT64 # Int Literal: 2
sw $t4, -544($fp)
li $t5, 3 # Int Literal: 3
sw $t5, -548($fp)
lw $t7, -544($fp)
lw $t8, -548($fp)
mult $t7, $t8
mflo $t6
sw $t6, -552($fp)
lw $t0, -552($fp) # Setting argument 1
sw $t0, -560($fp)
li $t9, 6 # Int Literal: 6
sw $t9, -556($fp)
lw $t0, -556($fp) # Setting argument 2
sw $t0, -564($fp)
addi $sp, $sp, -564 # BEGIN Calling assert
jal global_assert
addi $sp, $sp, 564 # END Calling assert
li $t1, 9 # Operation: DIV64 # Int Literal: 9
sw $t1, -568($fp)
li $t2, 4 # Int Literal: 4
sw $t2, -572($fp)
lw $t4, -568($fp)
lw $t5, -572($fp)
div $t4, $t5
mflo $t3
sw $t3, -576($fp)
lw $t7, -576($fp) # Setting argument 1
sw $t7, -584($fp)
li $t6, 2 # Int Literal: 2
sw $t6, -580($fp)
lw $t7, -580($fp) # Setting argument 2
sw $t7, -588($fp)
addi $sp, $sp, -588 # BEGIN Calling assert
jal global_assert
addi $sp, $sp, 588 # END Calling assert
lbl_21: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_testShadowingHelper: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
li $t1, 4 # Int Literal: 4
sw $t1, -12($fp)
lw $t2, -12($fp)
sw $t2, global_var # BEGIN Assigning var # END Assigning var
sw $zero, -16($fp) # Initializing var
li $t3, 2 # Int Literal: 2
sw $t3, -20($fp)
lw $t4, -20($fp)
sw $t4, -16($fp) # BEGIN Assigning var # END Assigning var
lw $v0, -16($fp) # BEGIN Return
lbl_22: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_testShadowing: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
sw $zero, -12($fp) # Initializing returnValue
addi $sp, $sp, -12 # BEGIN Calling testShadowingHelper
jal global_testShadowingHelper
addi $sp, $sp, 12 # END Calling testShadowingHelper
sw $v0, -16($fp)
lw $t1, -16($fp)
sw $t1, -12($fp) # BEGIN Assigning returnValue # END Assigning returnValue
lw $t3, global_var # Setting argument 1
sw $t3, -24($fp)
li $t2, 4 # Int Literal: 4
sw $t2, -20($fp)
lw $t3, -20($fp) # Setting argument 2
sw $t3, -28($fp)
addi $sp, $sp, -28 # BEGIN Calling assert
jal global_assert
addi $sp, $sp, 28 # END Calling assert
lw $t5, -12($fp) # Setting argument 1
sw $t5, -36($fp)
li $t4, 2 # Int Literal: 2
sw $t4, -32($fp)
lw $t5, -32($fp) # Setting argument 2
sw $t5, -40($fp)
addi $sp, $sp, -40 # BEGIN Calling assert
jal global_assert
addi $sp, $sp, 40 # END Calling assert
lbl_23: lw $ra, -8($fp) # END Function body # Restore return address
lw $fp, -4($fp) # Restore frame pointer
jr $ra # Return to caller
global_testLongExpression: sw $fp, -4($sp) # Save frame pointer
move $fp, $sp # Set new frame pointer
sw $ra, -8($fp) # Save return address # BEGIN Function body
lw $t0, 0($fp) # Getting argument \\"isFirstCall\\"
sw $t0, -12($fp)
sw $zero, -16($fp) # Initializing a
li $t1, 1 # Int Literal: 1
sw $t1, -20($fp)
lw $t2, -20($fp)
sw $t2, -16($fp) # BEGIN Assigning a # END Assigning a
sw $zero, -24($fp) # Initializing b
li $t3, 2 # Int Literal: 2
sw $t3, -28($fp)
lw $t4, -28($fp)
sw $t4, -24($fp) # BEGIN Assigning b # END Assigning b
sw $zero, -32($fp) # Initializing c
li $t5, 3 # Int Literal: 3
sw $t5, -36($fp)
lw $t6, -36($fp)
sw $t6, -32($fp) # BEGIN Assigning c # END Assigning c
sw $zero, -40($fp) # Initializing d
li $t7, 4 # Int Literal: 4
sw $t7, -44($fp)
lw $t8, -44($fp)
sw $t8, -40($fp) # BEGIN Assigning d # END Assigning d
sw $zero, -48($fp) # Initializing e
li $t9, 5 # Int Literal: 5
sw $t9, -52($fp)
lw $t0, -52($fp)
sw $t0, -48($fp) # BEGIN Assigning e # END Assigning e
sw $zero, -56($fp) # Initializing f
li $t1, 6 # Int Literal: 6
sw $t1, -60($fp)
lw $t2, -60($fp)
sw $t2, -56($fp) # BEGIN Assigning f # END Assigning f
sw $zero, -64($fp) # Initializing g
li $t3, 7 # Int Literal: 7
sw $t3, -68($fp)
lw $t4, -68($fp)
sw $t4, -64($fp) # BEGIN Assigning g # END Assigning g
lw $t9, -12($fp) # BEGIN if # BEGIN If Condition
beq $zero, $t9, lbl_25 # END If Condition
lw $t6, -16($fp) # BEGIN True Branch # Operation: SUB64 # Operation: MULT64 # Operation: ADD64
lw $t7, -24($fp)
add $t5, $t6, $t7
sw $t5, -72($fp)
lw $t9, -40($fp) # Operation: DIV64
lw $t0, -32($fp)
div $t9, $t0
mflo $t8
sw $t8, -76($fp)
lw $t2, -72($fp)
lw $t3, -76($fp)
mult $t2, $t3
mflo $t1
sw $t1, -80($fp)
li $t4, 0 # Operation: DIV64 # Int Literal: 0
sw $t4, -84($fp)
lw $t5, -84($fp) # Setting argument 1
sw $t5, -88($fp)
addi $sp, $sp, -88 # BEGIN Calling testLongExpression
jal global_testLongExpression
addi $sp, $sp, 88 # END Calling testLongExpression
sw $v0, -92($fp)
lw $t7, -92($fp)