sm64

A Super Mario 64 decompilation
Log | Files | Refs | README | LICENSE

test2.c (992B)


      1 const char buf1[1] = {1};
      2 float func1(void) {
      3     "func1";
      4     return 0.1f;
      5 }
      6 const char buf2[1] = {2};
      7 void func2(void) {
      8     *(volatile float*)0 = -3.5792360305786133f;
      9     *(volatile float*)0 = -3.5792362689971924f;
     10     // "func2";
     11     // return 0.2f;
     12 }
     13 const char buf3[1] = {3};
     14 int func3(int x) {
     15     switch(x) {
     16     case 0:
     17         return 1;
     18     case 1:
     19         return 2;
     20     case 2:
     21         return 3;
     22     case 3:
     23         return 4;
     24     case 4:
     25         return 5;
     26     case 5:
     27         return 4;
     28     case 6:
     29         return 4;
     30     case 7:
     31         return 4;
     32     default:
     33         return 3;
     34     }
     35 }
     36 
     37 #if 1
     38 GLOBAL_ASM(
     39 .rdata
     40 .word 0x66756e63 # func
     41 .word 0x34000000 # 4\0\0\0
     42 .word jumptarget + 4
     43 
     44 .late_rodata
     45 glabel rv
     46 .word 0x3e4ccccd # 0.2f
     47 .word jumptarget + 8
     48 
     49 .text
     50 glabel func4
     51 lui     $at, %hi(rv)
     52 glabel jumptarget
     53 jr      $ra
     54 lwc1    $f0, %lo(rv)($at)
     55 jr      $ra
     56 nop
     57 jr      $ra
     58 nop
     59 jr      $ra
     60 nop
     61 jr      $ra
     62 nop
     63 )
     64 #else
     65 float func4(void) {
     66     "func4";
     67     return 0.2f;
     68 }
     69 #endif