### RAW ASSEMBLY INSTRUCTIONS:

glabel evt_get_variable_index
/* EC758 802C7DA8 3C02EFE8 */  lui       $v0, (0xEFE82080 >> 16)
/* EC75C 802C7DAC 34422080 */  ori       $v0, $v0, (0xEFE82080 & 0xFFFF)
/* EC760 802C7DB0 0045102A */  slt       $v0, $v0, $a1
/* EC764 802C7DB4 14400003 */  bnez      $v0, .L802C7DC4
/* EC768 802C7DB8 3C02F119 */   lui      $v0, (0xF1194D80 >> 16)
.L802C7DBC:
/* EC76C 802C7DBC 03E00008 */  jr        $ra
/* EC770 802C7DC0 00A0102D */   daddu    $v0, $a1, $zero
.L802C7DC4:
/* EC774 802C7DC4 34424D80 */  ori       $v0, $v0, (0xF1194D80 & 0xFFFF)
/* EC778 802C7DC8 0045102A */  slt       $v0, $v0, $a1
/* EC77C 802C7DCC 1040FFFB */  beqz      $v0, .L802C7DBC
/* EC780 802C7DD0 3C02F2E3 */   lui      $v0, (0xF2E31100 >> 16)
/* EC784 802C7DD4 34421100 */  ori       $v0, $v0, (0xF2E31100 & 0xFFFF)
/* EC788 802C7DD8 0045102A */  slt       $v0, $v0, $a1
/* EC78C 802C7DDC 1040FFF7 */  beqz      $v0, .L802C7DBC
/* EC790 802C7DE0 3C02F414 */   lui      $v0, (0xF4143E00 >> 16)
/* EC794 802C7DE4 34423E00 */  ori       $v0, $v0, (0xF4143E00 & 0xFFFF)
/* EC798 802C7DE8 0045102A */  slt       $v0, $v0, $a1
/* EC79C 802C7DEC 54400005 */  bnel      $v0, $zero, .L802C7E04
/* EC7A0 802C7DF0 3C02F545 */   lui      $v0, (0xF5456B00 >> 16)
/* EC7A4 802C7DF4 3C020C84 */  lui       $v0, (0xC845880 >> 16)
/* EC7A8 802C7DF8 34425880 */  ori       $v0, $v0, (0xC845880 & 0xFFFF)
/* EC7AC 802C7DFC 03E00008 */  jr        $ra
/* EC7B0 802C7E00 00A21021 */   addu     $v0, $a1, $v0
.L802C7E04:
/* EC7B4 802C7E04 34426B00 */  ori       $v0, $v0, (0xF5456B00 & 0xFFFF)
/* EC7B8 802C7E08 0045102A */  slt       $v0, $v0, $a1
/* EC7BC 802C7E0C 54400005 */  bnel      $v0, $zero, .L802C7E24
/* EC7C0 802C7E10 3C02F676 */   lui      $v0, (0xF6769800 >> 16)
/* EC7C4 802C7E14 3C020B53 */  lui       $v0, (0xB532B80 >> 16)
/* EC7C8 802C7E18 34422B80 */  ori       $v0, $v0, (0xB532B80 & 0xFFFF)
/* EC7CC 802C7E1C 03E00008 */  jr        $ra
/* EC7D0 802C7E20 00A21021 */   addu     $v0, $a1, $v0
.L802C7E24:
/* EC7D4 802C7E24 34429800 */  ori       $v0, $v0, (0xF6769800 & 0xFFFF)
/* EC7D8 802C7E28 0045102A */  slt       $v0, $v0, $a1
/* EC7DC 802C7E2C 54400005 */  bnel      $v0, $zero, .L802C7E44
/* EC7E0 802C7E30 3C02F7A7 */   lui      $v0, (0xF7A7C500 >> 16)
/* EC7E4 802C7E34 3C020A21 */  lui       $v0, (0xA21FE80 >> 16)
/* EC7E8 802C7E38 3442FE80 */  ori       $v0, $v0, (0xA21FE80 & 0xFFFF)
/* EC7EC 802C7E3C 03E00008 */  jr        $ra
/* EC7F0 802C7E40 00A21021 */   addu     $v0, $a1, $v0
.L802C7E44:
/* EC7F4 802C7E44 3442C500 */  ori       $v0, $v0, (0xF7A7C500 & 0xFFFF)
/* EC7F8 802C7E48 0045102A */  slt       $v0, $v0, $a1
/* EC7FC 802C7E4C 54400005 */  bnel      $v0, $zero, .L802C7E64
/* EC800 802C7E50 3C02F8D8 */   lui      $v0, (0xF8D8F200 >> 16)
/* EC804 802C7E54 3C0208F0 */  lui       $v0, (0x8F0D180 >> 16)
/* EC808 802C7E58 3442D180 */  ori       $v0, $v0, (0x8F0D180 & 0xFFFF)
/* EC80C 802C7E5C 03E00008 */  jr        $ra
/* EC810 802C7E60 00A21021 */   addu     $v0, $a1, $v0
.L802C7E64:
/* EC814 802C7E64 3442F200 */  ori       $v0, $v0, (0xF8D8F200 & 0xFFFF)
/* EC818 802C7E68 0045102A */  slt       $v0, $v0, $a1
/* EC81C 802C7E6C 54400005 */  bnel      $v0, $zero, .L802C7E84
/* EC820 802C7E70 3C02FA0A */   lui      $v0, (0xFA0A1F00 >> 16)
/* EC824 802C7E74 3C0207BF */  lui       $v0, (0x7BFA480 >> 16)
/* EC828 802C7E78 3442A480 */  ori       $v0, $v0, (0x7BFA480 & 0xFFFF)
/* EC82C 802C7E7C 03E00008 */  jr        $ra
/* EC830 802C7E80 00A21021 */   addu     $v0, $a1, $v0
.L802C7E84:
/* EC834 802C7E84 34421F00 */  ori       $v0, $v0, (0xFA0A1F00 & 0xFFFF)
/* EC838 802C7E88 0045102A */  slt       $v0, $v0, $a1
/* EC83C 802C7E8C 54400005 */  bnel      $v0, $zero, .L802C7EA4
/* EC840 802C7E90 3C02FB3B */   lui      $v0, (0xFB3B4C00 >> 16)
/* EC844 802C7E94 3C02068E */  lui       $v0, (0x68E7780 >> 16)
/* EC848 802C7E98 34427780 */  ori       $v0, $v0, (0x68E7780 & 0xFFFF)
/* EC84C 802C7E9C 03E00008 */  jr        $ra
/* EC850 802C7EA0 00A21021 */   addu     $v0, $a1, $v0
.L802C7EA4:
/* EC854 802C7EA4 34424C00 */  ori       $v0, $v0, (0xFB3B4C00 & 0xFFFF)
/* EC858 802C7EA8 0045102A */  slt       $v0, $v0, $a1
/* EC85C 802C7EAC 54400005 */  bnel      $v0, $zero, .L802C7EC4
/* EC860 802C7EB0 3C02FC6C */   lui      $v0, (0xFC6C7900 >> 16)
/* EC864 802C7EB4 3C02055D */  lui       $v0, (0x55D4A80 >> 16)
/* EC868 802C7EB8 34424A80 */  ori       $v0, $v0, (0x55D4A80 & 0xFFFF)
/* EC86C 802C7EBC 03E00008 */  jr        $ra
/* EC870 802C7EC0 00A21021 */   addu     $v0, $a1, $v0
.L802C7EC4:
/* EC874 802C7EC4 34427900 */  ori       $v0, $v0, (0xFC6C7900 & 0xFFFF)
/* EC878 802C7EC8 0045102A */  slt       $v0, $v0, $a1
/* EC87C 802C7ECC 54400005 */  bnel      $v0, $zero, .L802C7EE4
/* EC880 802C7ED0 3C02FD9D */   lui      $v0, (0xFD9DA600 >> 16)
/* EC884 802C7ED4 3C02042C */  lui       $v0, (0x42C1D80 >> 16)
/* EC888 802C7ED8 34421D80 */  ori       $v0, $v0, (0x42C1D80 & 0xFFFF)
/* EC88C 802C7EDC 03E00008 */  jr        $ra
/* EC890 802C7EE0 00A21021 */   addu     $v0, $a1, $v0
.L802C7EE4:
/* EC894 802C7EE4 3442A600 */  ori       $v0, $v0, (0xFD9DA600 & 0xFFFF)
/* EC898 802C7EE8 0045102A */  slt       $v0, $v0, $a1
/* EC89C 802C7EEC 54400005 */  bnel      $v0, $zero, .L802C7F04
/* EC8A0 802C7EF0 3C02FECE */   lui      $v0, (0xFECED300 >> 16)
/* EC8A4 802C7EF4 3C0202FA */  lui       $v0, (0x2FAF080 >> 16)
/* EC8A8 802C7EF8 3442F080 */  ori       $v0, $v0, (0x2FAF080 & 0xFFFF)
/* EC8AC 802C7EFC 03E00008 */  jr        $ra
/* EC8B0 802C7F00 00A21021 */   addu     $v0, $a1, $v0
.L802C7F04:
/* EC8B4 802C7F04 3442D300 */  ori       $v0, $v0, (0xFECED300 & 0xFFFF)
/* EC8B8 802C7F08 0045102A */  slt       $v0, $v0, $a1
/* EC8BC 802C7F0C 1440FFAB */  bnez      $v0, .L802C7DBC
/* EC8C0 802C7F10 3C0201C9 */   lui      $v0, (0x1C9C380 >> 16)
/* EC8C4 802C7F14 3442C380 */  ori       $v0, $v0, (0x1C9C380 & 0xFFFF)
/* EC8C8 802C7F18 03E00008 */  jr        $ra
/* EC8CC 802C7F1C 00A21021 */   addu     $v0, $a1, $v0

### DECOMPILED C INSTRUCTIONS:

s32 evt_get_variable_index(Evt* script, s32 var) {
    if (EVT_LIMIT >= var) {
        return var;
    }
    if (EVT_IGNORE_ARG >= var) {
        return var;
    }
    if (EVT_FIXED_CUTOFF >= var) {
        return var;
    }
    if (EVT_ARRAY_FLAG_CUTOFF >= var) {
        return EVT_INDEX_OF_ARRAY_FLAG(var);
    }
    if (EVT_ARRAY_VAR_CUTOFF >= var) {
        return EVT_INDEX_OF_ARRAY_VAR(var);
    }
    if (EVT_GAME_BYTE_CUTOFF >= var) {
        return EVT_INDEX_OF_GAME_BYTE(var);
    }
    if (EVT_AREA_BYTE_CUTOFF >= var) {
        return EVT_INDEX_OF_AREA_BYTE(var);
    }
    if (EVT_GAME_FLAG_CUTOFF >= var) {
        return EVT_INDEX_OF_GAME_FLAG(var);
    }
    if (EVT_AREA_FLAG_CUTOFF >= var) {
        return EVT_INDEX_OF_AREA_FLAG(var);
    }
    if (EVT_MAP_FLAG_CUTOFF >= var) {
        return EVT_INDEX_OF_MAP_FLAG(var);
    }
    if (EVT_LOCAL_FLAG_CUTOFF >= var) {
        return EVT_INDEX_OF_LOCAL_FLAG(var);
    }
    if (EVT_MAP_VAR_CUTOFF >= var) {
        return EVT_INDEX_OF_MAP_VAR(var);
    }
    if (EVT_LOCAL_VAR_CUTOFF >= var) {
        return EVT_INDEX_OF_LOCAL_VAR(var);
    }
    return var;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel evt_get_variable_index_alt
/* EC8D0 802C7F20 3C02EFE8 */  lui       $v0, (0xEFE82080 >> 16)
/* EC8D4 802C7F24 34422080 */  ori       $v0, $v0, (0xEFE82080 & 0xFFFF)
/* EC8D8 802C7F28 0044102A */  slt       $v0, $v0, $a0
/* EC8DC 802C7F2C 14400003 */  bnez      $v0, .L802C7F3C
/* EC8E0 802C7F30 3C02F119 */   lui      $v0, (0xF1194D80 >> 16)
.L802C7F34:
/* EC8E4 802C7F34 03E00008 */  jr        $ra
/* EC8E8 802C7F38 0080102D */   daddu    $v0, $a0, $zero
.L802C7F3C:
/* EC8EC 802C7F3C 34424D80 */  ori       $v0, $v0, (0xF1194D80 & 0xFFFF)
/* EC8F0 802C7F40 0044102A */  slt       $v0, $v0, $a0
/* EC8F4 802C7F44 1040FFFB */  beqz      $v0, .L802C7F34
/* EC8F8 802C7F48 3C02F2E3 */   lui      $v0, (0xF2E31100 >> 16)
/* EC8FC 802C7F4C 34421100 */  ori       $v0, $v0, (0xF2E31100 & 0xFFFF)
/* EC900 802C7F50 0044102A */  slt       $v0, $v0, $a0
/* EC904 802C7F54 1040FFF7 */  beqz      $v0, .L802C7F34
/* EC908 802C7F58 3C02F414 */   lui      $v0, (0xF4143E00 >> 16)
/* EC90C 802C7F5C 34423E00 */  ori       $v0, $v0, (0xF4143E00 & 0xFFFF)
/* EC910 802C7F60 0044102A */  slt       $v0, $v0, $a0
/* EC914 802C7F64 54400005 */  bnel      $v0, $zero, .L802C7F7C
/* EC918 802C7F68 3C02F545 */   lui      $v0, (0xF5456B00 >> 16)
/* EC91C 802C7F6C 3C020C84 */  lui       $v0, (0xC845880 >> 16)
/* EC920 802C7F70 34425880 */  ori       $v0, $v0, (0xC845880 & 0xFFFF)
/* EC924 802C7F74 03E00008 */  jr        $ra
/* EC928 802C7F78 00821021 */   addu     $v0, $a0, $v0
.L802C7F7C:
/* EC92C 802C7F7C 34426B00 */  ori       $v0, $v0, (0xF5456B00 & 0xFFFF)
/* EC930 802C7F80 0044102A */  slt       $v0, $v0, $a0
/* EC934 802C7F84 54400005 */  bnel      $v0, $zero, .L802C7F9C
/* EC938 802C7F88 3C02F676 */   lui      $v0, (0xF6769800 >> 16)
/* EC93C 802C7F8C 3C020B53 */  lui       $v0, (0xB532B80 >> 16)
/* EC940 802C7F90 34422B80 */  ori       $v0, $v0, (0xB532B80 & 0xFFFF)
/* EC944 802C7F94 03E00008 */  jr        $ra
/* EC948 802C7F98 00821021 */   addu     $v0, $a0, $v0
.L802C7F9C:
/* EC94C 802C7F9C 34429800 */  ori       $v0, $v0, (0xF6769800 & 0xFFFF)
/* EC950 802C7FA0 0044102A */  slt       $v0, $v0, $a0
/* EC954 802C7FA4 54400005 */  bnel      $v0, $zero, .L802C7FBC
/* EC958 802C7FA8 3C02F7A7 */   lui      $v0, (0xF7A7C500 >> 16)
/* EC95C 802C7FAC 3C020A21 */  lui       $v0, (0xA21FE80 >> 16)
/* EC960 802C7FB0 3442FE80 */  ori       $v0, $v0, (0xA21FE80 & 0xFFFF)
/* EC964 802C7FB4 03E00008 */  jr        $ra
/* EC968 802C7FB8 00821021 */   addu     $v0, $a0, $v0
.L802C7FBC:
/* EC96C 802C7FBC 3442C500 */  ori       $v0, $v0, (0xF7A7C500 & 0xFFFF)
/* EC970 802C7FC0 0044102A */  slt       $v0, $v0, $a0
/* EC974 802C7FC4 54400005 */  bnel      $v0, $zero, .L802C7FDC
/* EC978 802C7FC8 3C02F8D8 */   lui      $v0, (0xF8D8F200 >> 16)
/* EC97C 802C7FCC 3C0208F0 */  lui       $v0, (0x8F0D180 >> 16)
/* EC980 802C7FD0 3442D180 */  ori       $v0, $v0, (0x8F0D180 & 0xFFFF)
/* EC984 802C7FD4 03E00008 */  jr        $ra
/* EC988 802C7FD8 00821021 */   addu     $v0, $a0, $v0
.L802C7FDC:
/* EC98C 802C7FDC 3442F200 */  ori       $v0, $v0, (0xF8D8F200 & 0xFFFF)
/* EC990 802C7FE0 0044102A */  slt       $v0, $v0, $a0
/* EC994 802C7FE4 54400005 */  bnel      $v0, $zero, .L802C7FFC
/* EC998 802C7FE8 3C02FA0A */   lui      $v0, (0xFA0A1F00 >> 16)
/* EC99C 802C7FEC 3C0207BF */  lui       $v0, (0x7BFA480 >> 16)
/* EC9A0 802C7FF0 3442A480 */  ori       $v0, $v0, (0x7BFA480 & 0xFFFF)
/* EC9A4 802C7FF4 03E00008 */  jr        $ra
/* EC9A8 802C7FF8 00821021 */   addu     $v0, $a0, $v0
.L802C7FFC:
/* EC9AC 802C7FFC 34421F00 */  ori       $v0, $v0, (0xFA0A1F00 & 0xFFFF)
/* EC9B0 802C8000 0044102A */  slt       $v0, $v0, $a0
/* EC9B4 802C8004 54400005 */  bnel      $v0, $zero, .L802C801C
/* EC9B8 802C8008 3C02FB3B */   lui      $v0, (0xFB3B4C00 >> 16)
/* EC9BC 802C800C 3C02068E */  lui       $v0, (0x68E7780 >> 16)
/* EC9C0 802C8010 34427780 */  ori       $v0, $v0, (0x68E7780 & 0xFFFF)
/* EC9C4 802C8014 03E00008 */  jr        $ra
/* EC9C8 802C8018 00821021 */   addu     $v0, $a0, $v0
.L802C801C:
/* EC9CC 802C801C 34424C00 */  ori       $v0, $v0, (0xFB3B4C00 & 0xFFFF)
/* EC9D0 802C8020 0044102A */  slt       $v0, $v0, $a0
/* EC9D4 802C8024 54400005 */  bnel      $v0, $zero, .L802C803C
/* EC9D8 802C8028 3C02FC6C */   lui      $v0, (0xFC6C7900 >> 16)
/* EC9DC 802C802C 3C02055D */  lui       $v0, (0x55D4A80 >> 16)
/* EC9E0 802C8030 34424A80 */  ori       $v0, $v0, (0x55D4A80 & 0xFFFF)
/* EC9E4 802C8034 03E00008 */  jr        $ra
/* EC9E8 802C8038 00821021 */   addu     $v0, $a0, $v0
.L802C803C:
/* EC9EC 802C803C 34427900 */  ori       $v0, $v0, (0xFC6C7900 & 0xFFFF)
/* EC9F0 802C8040 0044102A */  slt       $v0, $v0, $a0
/* EC9F4 802C8044 54400005 */  bnel      $v0, $zero, .L802C805C
/* EC9F8 802C8048 3C02FD9D */   lui      $v0, (0xFD9DA600 >> 16)
/* EC9FC 802C804C 3C02042C */  lui       $v0, (0x42C1D80 >> 16)
/* ECA00 802C8050 34421D80 */  ori       $v0, $v0, (0x42C1D80 & 0xFFFF)
/* ECA04 802C8054 03E00008 */  jr        $ra
/* ECA08 802C8058 00821021 */   addu     $v0, $a0, $v0
.L802C805C:
/* ECA0C 802C805C 3442A600 */  ori       $v0, $v0, (0xFD9DA600 & 0xFFFF)
/* ECA10 802C8060 0044102A */  slt       $v0, $v0, $a0
/* ECA14 802C8064 54400005 */  bnel      $v0, $zero, .L802C807C
/* ECA18 802C8068 3C02FECE */   lui      $v0, (0xFECED300 >> 16)
/* ECA1C 802C806C 3C0202FA */  lui       $v0, (0x2FAF080 >> 16)
/* ECA20 802C8070 3442F080 */  ori       $v0, $v0, (0x2FAF080 & 0xFFFF)
/* ECA24 802C8074 03E00008 */  jr        $ra
/* ECA28 802C8078 00821021 */   addu     $v0, $a0, $v0
.L802C807C:
/* ECA2C 802C807C 3442D300 */  ori       $v0, $v0, (0xFECED300 & 0xFFFF)
/* ECA30 802C8080 0044102A */  slt       $v0, $v0, $a0
/* ECA34 802C8084 1440FFAB */  bnez      $v0, .L802C7F34
/* ECA38 802C8088 3C0201C9 */   lui      $v0, (0x1C9C380 >> 16)
/* ECA3C 802C808C 3442C380 */  ori       $v0, $v0, (0x1C9C380 & 0xFFFF)
/* ECA40 802C8090 03E00008 */  jr        $ra
/* ECA44 802C8094 00821021 */   addu     $v0, $a0, $v0

### DECOMPILED C INSTRUCTIONS:

s32 evt_get_variable_index_alt(s32 var) {
    if (EVT_LIMIT >= var) {
        return var;
    }
    if (EVT_IGNORE_ARG >= var) {
        return var;
    }
    if (EVT_FIXED_CUTOFF >= var) {
        return var;
    }
    if (EVT_ARRAY_FLAG_CUTOFF >= var) {
        return EVT_INDEX_OF_ARRAY_FLAG(var);
    }
    if (EVT_ARRAY_VAR_CUTOFF >= var) {
        return EVT_INDEX_OF_ARRAY_VAR(var);
    }
    if (EVT_GAME_BYTE_CUTOFF >= var) {
        return EVT_INDEX_OF_GAME_BYTE(var);
    }
    if (EVT_AREA_BYTE_CUTOFF >= var) {
        return EVT_INDEX_OF_AREA_BYTE(var);
    }
    if (EVT_GAME_FLAG_CUTOFF >= var) {
        return EVT_INDEX_OF_GAME_FLAG(var);
    }
    if (EVT_AREA_FLAG_CUTOFF >= var) {
        return EVT_INDEX_OF_AREA_FLAG(var);
    }
    if (EVT_MAP_FLAG_CUTOFF >= var) {
        return EVT_INDEX_OF_MAP_FLAG(var);
    }
    if (EVT_LOCAL_FLAG_CUTOFF >= var) {
        return EVT_INDEX_OF_LOCAL_FLAG(var);
    }
    if (EVT_MAP_VAR_CUTOFF >= var) {
        return EVT_INDEX_OF_MAP_VAR(var);
    }
    if (EVT_LOCAL_VAR_CUTOFF >= var) {
        return EVT_INDEX_OF_LOCAL_VAR(var);
    }
    return var;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel status_bar_draw_number
/* 81154 800E7CA4 27BDFFC0 */  addiu     $sp, $sp, -0x40
/* 81158 800E7CA8 AFB1001C */  sw        $s1, 0x1C($sp)
/* 8115C 800E7CAC 00A0882D */  daddu     $s1, $a1, $zero
/* 81160 800E7CB0 3C05800F */  lui       $a1, %hi(TimesHudScript)
/* 81164 800E7CB4 8CA57FA8 */  lw        $a1, %lo(TimesHudScript)($a1)
/* 81168 800E7CB8 AFB40028 */  sw        $s4, 0x28($sp)
/* 8116C 800E7CBC 0080A02D */  daddu     $s4, $a0, $zero
/* 81170 800E7CC0 AFB00018 */  sw        $s0, 0x18($sp)
/* 81174 800E7CC4 00C0802D */  daddu     $s0, $a2, $zero
/* 81178 800E7CC8 AFB30024 */  sw        $s3, 0x24($sp)
/* 8117C 800E7CCC 00E0982D */  daddu     $s3, $a3, $zero
/* 81180 800E7CD0 AFB5002C */  sw        $s5, 0x2C($sp)
/* 81184 800E7CD4 8FB50050 */  lw        $s5, 0x50($sp)
/* 81188 800E7CD8 AFB20020 */  sw        $s2, 0x20($sp)
/* 8118C 800E7CDC 0000902D */  daddu     $s2, $zero, $zero
/* 81190 800E7CE0 AFBF003C */  sw        $ra, 0x3C($sp)
/* 81194 800E7CE4 AFBE0038 */  sw        $fp, 0x38($sp)
/* 81198 800E7CE8 AFB70034 */  sw        $s7, 0x34($sp)
/* 8119C 800E7CEC 0C0511FF */  jal       hud_element_set_script
/* 811A0 800E7CF0 AFB60030 */   sw       $s6, 0x30($sp)
/* 811A4 800E7CF4 26310008 */  addiu     $s1, $s1, 0x8
/* 811A8 800E7CF8 0280202D */  daddu     $a0, $s4, $zero
/* 811AC 800E7CFC 0220282D */  daddu     $a1, $s1, $zero
/* 811B0 800E7D00 26060007 */  addiu     $a2, $s0, 0x7
/* 811B4 800E7D04 0C051261 */  jal       hud_element_set_render_pos
/* 811B8 800E7D08 261E0008 */   addiu    $fp, $s0, 0x8
/* 811BC 800E7D0C 0280202D */  daddu     $a0, $s4, $zero
/* 811C0 800E7D10 0C05128B */  jal       hud_element_clear_flags
/* 811C4 800E7D14 24050002 */   addiu    $a1, $zero, 0x2
/* 811C8 800E7D18 0C0511F1 */  jal       hud_element_draw_next
/* 811CC 800E7D1C 0280202D */   daddu    $a0, $s4, $zero
/* 811D0 800E7D20 5AA00016 */  blezl     $s5, .L800E7D7C
/* 811D4 800E7D24 2631000D */   addiu    $s1, $s1, 0xD
/* 811D8 800E7D28 3C066666 */  lui       $a2, (0x66666667 >> 16)
/* 811DC 800E7D2C 34C66667 */  ori       $a2, $a2, (0x66666667 & 0xFFFF)
/* 811E0 800E7D30 27A50010 */  addiu     $a1, $sp, 0x10
.L800E7D34:
/* 811E4 800E7D34 02660018 */  mult      $s3, $a2
/* 811E8 800E7D38 02B22023 */  subu      $a0, $s5, $s2
/* 811EC 800E7D3C 26520001 */  addiu     $s2, $s2, 0x1
/* 811F0 800E7D40 001317C3 */  sra       $v0, $s3, 31
/* 811F4 800E7D44 00852021 */  addu      $a0, $a0, $a1
/* 811F8 800E7D48 00004010 */  mfhi      $t0
/* 811FC 800E7D4C 00081883 */  sra       $v1, $t0, 2
/* 81200 800E7D50 00621023 */  subu      $v0, $v1, $v0
/* 81204 800E7D54 0040182D */  daddu     $v1, $v0, $zero
/* 81208 800E7D58 00031080 */  sll       $v0, $v1, 2
/* 8120C 800E7D5C 00431021 */  addu      $v0, $v0, $v1
/* 81210 800E7D60 00021040 */  sll       $v0, $v0, 1
/* 81214 800E7D64 02621023 */  subu      $v0, $s3, $v0
/* 81218 800E7D68 A082FFFF */  sb        $v0, -0x1($a0)
/* 8121C 800E7D6C 0255102A */  slt       $v0, $s2, $s5
/* 81220 800E7D70 1440FFF0 */  bnez      $v0, .L800E7D34
/* 81224 800E7D74 0060982D */   daddu    $s3, $v1, $zero
/* 81228 800E7D78 2631000D */  addiu     $s1, $s1, 0xD
.L800E7D7C:
/* 8122C 800E7D7C 0000982D */  daddu     $s3, $zero, $zero
/* 81230 800E7D80 1AA00020 */  blez      $s5, .L800E7E04
/* 81234 800E7D84 0260902D */   daddu    $s2, $s3, $zero
/* 81238 800E7D88 27B60010 */  addiu     $s6, $sp, 0x10
/* 8123C 800E7D8C 26B0FFFF */  addiu     $s0, $s5, -0x1
/* 81240 800E7D90 3C17800F */  lui       $s7, %hi(DigitHudScripts)
/* 81244 800E7D94 26F77F80 */  addiu     $s7, $s7, %lo(DigitHudScripts)
.L800E7D98:
/* 81248 800E7D98 02D21021 */  addu      $v0, $s6, $s2
/* 8124C 800E7D9C 80420000 */  lb        $v0, 0x0($v0)
/* 81250 800E7DA0 54400006 */  bnel      $v0, $zero, .L800E7DBC
/* 81254 800E7DA4 24130001 */   addiu    $s3, $zero, 0x1
/* 81258 800E7DA8 56600004 */  bnel      $s3, $zero, .L800E7DBC
/* 8125C 800E7DAC 24130001 */   addiu    $s3, $zero, 0x1
/* 81260 800E7DB0 56500011 */  bnel      $s2, $s0, .L800E7DF8
/* 81264 800E7DB4 26520001 */   addiu    $s2, $s2, 0x1
/* 81268 800E7DB8 24130001 */  addiu     $s3, $zero, 0x1
.L800E7DBC:
/* 8126C 800E7DBC 00021080 */  sll       $v0, $v0, 2
/* 81270 800E7DC0 00571021 */  addu      $v0, $v0, $s7
/* 81274 800E7DC4 8C450000 */  lw        $a1, 0x0($v0)
/* 81278 800E7DC8 0C0511FF */  jal       hud_element_set_script
/* 8127C 800E7DCC 0280202D */   daddu    $a0, $s4, $zero
/* 81280 800E7DD0 0280202D */  daddu     $a0, $s4, $zero
/* 81284 800E7DD4 0220282D */  daddu     $a1, $s1, $zero
/* 81288 800E7DD8 0C051261 */  jal       hud_element_set_render_pos
/* 8128C 800E7DDC 03C0302D */   daddu    $a2, $fp, $zero
/* 81290 800E7DE0 0280202D */  daddu     $a0, $s4, $zero
/* 81294 800E7DE4 0C05128B */  jal       hud_element_clear_flags
/* 81298 800E7DE8 24050002 */   addiu    $a1, $zero, 0x2
/* 8129C 800E7DEC 0C0511F1 */  jal       hud_element_draw_next
/* 812A0 800E7DF0 0280202D */   daddu    $a0, $s4, $zero
/* 812A4 800E7DF4 26520001 */  addiu     $s2, $s2, 0x1
.L800E7DF8:
/* 812A8 800E7DF8 0255102A */  slt       $v0, $s2, $s5
/* 812AC 800E7DFC 1440FFE6 */  bnez      $v0, .L800E7D98
/* 812B0 800E7E00 26310008 */   addiu    $s1, $s1, 0x8
.L800E7E04:
/* 812B4 800E7E04 8FBF003C */  lw        $ra, 0x3C($sp)
/* 812B8 800E7E08 8FBE0038 */  lw        $fp, 0x38($sp)
/* 812BC 800E7E0C 8FB70034 */  lw        $s7, 0x34($sp)
/* 812C0 800E7E10 8FB60030 */  lw        $s6, 0x30($sp)
/* 812C4 800E7E14 8FB5002C */  lw        $s5, 0x2C($sp)
/* 812C8 800E7E18 8FB40028 */  lw        $s4, 0x28($sp)
/* 812CC 800E7E1C 8FB30024 */  lw        $s3, 0x24($sp)
/* 812D0 800E7E20 8FB20020 */  lw        $s2, 0x20($sp)
/* 812D4 800E7E24 8FB1001C */  lw        $s1, 0x1C($sp)
/* 812D8 800E7E28 8FB00018 */  lw        $s0, 0x18($sp)
/* 812DC 800E7E2C 03E00008 */  jr        $ra
/* 812E0 800E7E30 27BD0040 */   addiu    $sp, $sp, 0x40

### DECOMPILED C INSTRUCTIONS:

void status_bar_draw_number(s32 iconID, s32 x, s32 y, s32 value, s32 numDigits) {
    s8 digits[4];
    s32 i;
    s32 x2, y2;
    s32 keepDrawing;
    s32 digit;

    hud_element_set_script(iconID, TimesHudScript);
    x2 = x + 8;
    y2 = y + 8;
    hud_element_set_render_pos(iconID, x2, y2 - 1);
    hud_element_clear_flags(iconID, HUD_ELEMENT_FLAG_DISABLED);
    hud_element_draw_next(iconID);

    // Write each digit of the input number into the digits array
    for (i = 0; i < numDigits; i++) {
        digit = value % 10;
        digits[(numDigits - i) - 1] = digit;
        value /= 10;
    }

    x2 += 13;
    keepDrawing = FALSE;

    for (i = 0; i < numDigits; i++, x2 += 8) {
        digit = digits[i];

        // Once we have encountered our first non-zero digit, we need to keep drawing the remaining digits
        if (digit != 0 || keepDrawing || (i == numDigits - 1)) {
            keepDrawing = TRUE;
            hud_element_set_script(iconID, DigitHudScripts[digit]);
            hud_element_set_render_pos(iconID, x2, y2);
            hud_element_clear_flags(iconID, HUD_ELEMENT_FLAG_DISABLED);
            hud_element_draw_next(iconID);
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel contRmbRetrace
/* 3AF10 8005FB10 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 3AF14 8005FB14 AFB10014 */  sw        $s1, 0x14($sp)
/* 3AF18 8005FB18 0000882D */  daddu     $s1, $zero, $zero
/* 3AF1C 8005FB1C AFB40020 */  sw        $s4, 0x20($sp)
/* 3AF20 8005FB20 24140002 */  addiu     $s4, $zero, 0x2
/* 3AF24 8005FB24 AFB50024 */  sw        $s5, 0x24($sp)
/* 3AF28 8005FB28 24150001 */  addiu     $s5, $zero, 0x1
/* 3AF2C 8005FB2C AFB3001C */  sw        $s3, 0x1C($sp)
/* 3AF30 8005FB30 0220982D */  daddu     $s3, $s1, $zero
/* 3AF34 8005FB34 AFB20018 */  sw        $s2, 0x18($sp)
/* 3AF38 8005FB38 0220902D */  daddu     $s2, $s1, $zero
/* 3AF3C 8005FB3C AFBF0028 */  sw        $ra, 0x28($sp)
/* 3AF40 8005FB40 AFB00010 */  sw        $s0, 0x10($sp)
.L8005FB44:
/* 3AF44 8005FB44 3C02800B */  lui       $v0, %hi(nuContRmbCtl)
/* 3AF48 8005FB48 24421D40 */  addiu     $v0, $v0, %lo(nuContRmbCtl)
/* 3AF4C 8005FB4C 02428021 */  addu      $s0, $s2, $v0
/* 3AF50 8005FB50 92030007 */  lbu       $v1, 0x7($s0)
/* 3AF54 8005FB54 10740015 */  beq       $v1, $s4, .L8005FBAC
/* 3AF58 8005FB58 28620003 */   slti     $v0, $v1, 0x3
/* 3AF5C 8005FB5C 50400007 */  beql      $v0, $zero, .L8005FB7C
/* 3AF60 8005FB60 28620083 */   slti     $v0, $v1, 0x83
/* 3AF64 8005FB64 5060003B */  beql      $v1, $zero, .L8005FC54
/* 3AF68 8005FB68 26730068 */   addiu    $s3, $s3, 0x68
/* 3AF6C 8005FB6C 10750009 */  beq       $v1, $s5, .L8005FB94
/* 3AF70 8005FB70 0200202D */   daddu    $a0, $s0, $zero
/* 3AF74 8005FB74 08017F15 */  j         .L8005FC54
/* 3AF78 8005FB78 26730068 */   addiu    $s3, $s3, 0x68
.L8005FB7C:
/* 3AF7C 8005FB7C 10400034 */  beqz      $v0, .L8005FC50
/* 3AF80 8005FB80 28620081 */   slti     $v0, $v1, 0x81
/* 3AF84 8005FB84 54400033 */  bnel      $v0, $zero, .L8005FC54
/* 3AF88 8005FB88 26730068 */   addiu    $s3, $s3, 0x68
/* 3AF8C 8005FB8C 08017F0E */  j         .L8005FC38
/* 3AF90 8005FB90 00000000 */   nop
.L8005FB94:
/* 3AF94 8005FB94 0C017E48 */  jal       contRmbControl
/* 3AF98 8005FB98 0220282D */   daddu    $a1, $s1, $zero
/* 3AF9C 8005FB9C 5440002C */  bnel      $v0, $zero, .L8005FC50
/* 3AFA0 8005FBA0 A2000007 */   sb       $zero, 0x7($s0)
/* 3AFA4 8005FBA4 08017F15 */  j         .L8005FC54
/* 3AFA8 8005FBA8 26730068 */   addiu    $s3, $s3, 0x68
.L8005FBAC:
/* 3AFAC 8005FBAC 92020008 */  lbu       $v0, 0x8($s0)
/* 3AFB0 8005FBB0 14400019 */  bnez      $v0, .L8005FC18
/* 3AFB4 8005FBB4 0200202D */   daddu    $a0, $s0, $zero
/* 3AFB8 8005FBB8 96030004 */  lhu       $v1, 0x4($s0)
/* 3AFBC 8005FBBC 3C028009 */  lui       $v0, %hi(nuContRmbSearchTime)
/* 3AFC0 8005FBC0 8C423CE0 */  lw        $v0, %lo(nuContRmbSearchTime)($v0)
/* 3AFC4 8005FBC4 14400002 */  bnez      $v0, .L8005FBD0
/* 3AFC8 8005FBC8 0062001B */   divu     $zero, $v1, $v0
/* 3AFCC 8005FBCC 0007000D */  break     7
.L8005FBD0:
/* 3AFD0 8005FBD0 00001010 */  mfhi      $v0
/* 3AFD4 8005FBD4 1440000C */  bnez      $v0, .L8005FC08
/* 3AFD8 8005FBD8 00000000 */   nop
/* 3AFDC 8005FBDC 3C04800E */  lui       $a0, %hi(nuSiMesgQ)
/* 3AFE0 8005FBE0 2484AC78 */  addiu     $a0, $a0, %lo(nuSiMesgQ)
/* 3AFE4 8005FBE4 3C05800E */  lui       $a1, %hi(nuContPfs)
/* 3AFE8 8005FBE8 24A5AAD8 */  addiu     $a1, $a1, %lo(nuContPfs)
/* 3AFEC 8005FBEC 02652821 */  addu      $a1, $s3, $a1
/* 3AFF0 8005FBF0 0C019FD1 */  jal       osMotorInit
/* 3AFF4 8005FBF4 0220302D */   daddu    $a2, $s1, $zero
/* 3AFF8 8005FBF8 14400003 */  bnez      $v0, .L8005FC08
/* 3AFFC 8005FBFC 00000000 */   nop
/* 3B000 8005FC00 A2150008 */  sb        $s5, 0x8($s0)
/* 3B004 8005FC04 A2140009 */  sb        $s4, 0x9($s0)
.L8005FC08:
/* 3B008 8005FC08 96020004 */  lhu       $v0, 0x4($s0)
/* 3B00C 8005FC0C 24420001 */  addiu     $v0, $v0, 0x1
/* 3B010 8005FC10 08017F14 */  j         .L8005FC50
/* 3B014 8005FC14 A6020004 */   sh       $v0, 0x4($s0)
.L8005FC18:
/* 3B018 8005FC18 0C017E48 */  jal       contRmbControl
/* 3B01C 8005FC1C 0220282D */   daddu    $a1, $s1, $zero
/* 3B020 8005FC20 5040000C */  beql      $v0, $zero, .L8005FC54
/* 3B024 8005FC24 26730068 */   addiu    $s3, $s3, 0x68
/* 3B028 8005FC28 A6110004 */  sh        $s1, 0x4($s0)
/* 3B02C 8005FC2C A2000008 */  sb        $zero, 0x8($s0)
/* 3B030 8005FC30 08017F14 */  j         .L8005FC50
/* 3B034 8005FC34 A2000009 */   sb       $zero, 0x9($s0)
.L8005FC38:
/* 3B038 8005FC38 92020009 */  lbu       $v0, 0x9($s0)
/* 3B03C 8005FC3C 54540005 */  bnel      $v0, $s4, .L8005FC54
/* 3B040 8005FC40 26730068 */   addiu    $s3, $s3, 0x68
/* 3B044 8005FC44 0200202D */  daddu     $a0, $s0, $zero
/* 3B048 8005FC48 0C017E48 */  jal       contRmbControl
/* 3B04C 8005FC4C 0220282D */   daddu    $a1, $s1, $zero
.L8005FC50:
/* 3B050 8005FC50 26730068 */  addiu     $s3, $s3, 0x68
.L8005FC54:
/* 3B054 8005FC54 26310001 */  addiu     $s1, $s1, 0x1
/* 3B058 8005FC58 2E220004 */  sltiu     $v0, $s1, 0x4
/* 3B05C 8005FC5C 1440FFB9 */  bnez      $v0, .L8005FB44
/* 3B060 8005FC60 2652000A */   addiu    $s2, $s2, 0xA
/* 3B064 8005FC64 8FBF0028 */  lw        $ra, 0x28($sp)
/* 3B068 8005FC68 8FB50024 */  lw        $s5, 0x24($sp)
/* 3B06C 8005FC6C 8FB40020 */  lw        $s4, 0x20($sp)
/* 3B070 8005FC70 8FB3001C */  lw        $s3, 0x1C($sp)
/* 3B074 8005FC74 8FB20018 */  lw        $s2, 0x18($sp)
/* 3B078 8005FC78 8FB10014 */  lw        $s1, 0x14($sp)
/* 3B07C 8005FC7C 8FB00010 */  lw        $s0, 0x10($sp)
/* 3B080 8005FC80 0000102D */  daddu     $v0, $zero, $zero
/* 3B084 8005FC84 03E00008 */  jr        $ra
/* 3B088 8005FC88 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

s32 contRmbRetrace(NUSiCommonMesg* mesg) {
    u32 i;
    NUContRmbCtl* cont;

    for (i = 0; i < NU_CONT_MAXCONTROLLERS; i++) {
        cont = &nuContRmbCtl[i];
        switch (cont->mode) {
            case NU_CONT_RMB_MODE_DISABLE:
                break;
            case NU_CONT_RMB_MODE_ENABLE:
                if (contRmbControl(cont, i)) {
                    cont->mode = NU_CONT_RMB_MODE_DISABLE;
                }
                break;
            case NU_CONT_RMB_MODE_AUTORUN:
                if (cont->autorun == NU_CONT_RMB_AUTO_SEARCH) {
                    if ((cont->counter % nuContRmbSearchTime) == 0) {
                        if (osMotorInit(&nuSiMesgQ, &nuContPfs[i], i) == 0) {
                            cont->autorun = NU_CONT_RMB_AUTO_FIND;
                            cont->type = NU_CONT_PAK_TYPE_RUMBLE;
                        }
                    }
                    cont->counter++;
                } else {
                    if (contRmbControl(cont, i)) {
                        cont->counter = i;
                        cont->autorun = NU_CONT_RMB_AUTO_SEARCH;
                        cont->type = NU_CONT_PAK_TYPE_NONE;
                    }
                }
                break;
            case (NU_CONT_RMB_MODE_ENABLE | NU_CONT_RMB_MODE_PAUSE):
            case (NU_CONT_RMB_MODE_AUTORUN | NU_CONT_RMB_MODE_PAUSE):
                if (cont->type == NU_CONT_PAK_TYPE_RUMBLE) {
                    contRmbControl(cont, i);
                }
        }
    }

    return 0;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel chapter_change_main
/* 3EB80C E010E32C 27BDFFA8 */  addiu     $sp, $sp, -0x58
/* 3EB810 E010E330 F7B40040 */  sdc1      $f20, 0x40($sp)
/* 3EB814 E010E334 4485A000 */  mtc1      $a1, $f20
/* 3EB818 E010E338 F7B60048 */  sdc1      $f22, 0x48($sp)
/* 3EB81C E010E33C 4486B000 */  mtc1      $a2, $f22
/* 3EB820 E010E340 AFB20030 */  sw        $s2, 0x30($sp)
/* 3EB824 E010E344 0080902D */  daddu     $s2, $a0, $zero
/* 3EB828 E010E348 F7B80050 */  sdc1      $f24, 0x50($sp)
/* 3EB82C E010E34C 4487C000 */  mtc1      $a3, $f24
/* 3EB830 E010E350 27A40010 */  addiu     $a0, $sp, 0x10
/* 3EB834 E010E354 AFB30034 */  sw        $s3, 0x34($sp)
/* 3EB838 E010E358 8FB3006C */  lw        $s3, 0x6C($sp)
/* 3EB83C E010E35C 3C02E011 */  lui       $v0, %hi(chapter_change_init)
/* 3EB840 E010E360 2442E4A0 */  addiu     $v0, $v0, %lo(chapter_change_init)
/* 3EB844 E010E364 AFA20018 */  sw        $v0, 0x18($sp)
/* 3EB848 E010E368 3C02E011 */  lui       $v0, %hi(chapter_change_update)
/* 3EB84C E010E36C 2442E4A8 */  addiu     $v0, $v0, %lo(chapter_change_update)
/* 3EB850 E010E370 AFA2001C */  sw        $v0, 0x1C($sp)
/* 3EB854 E010E374 3C02E011 */  lui       $v0, %hi(chapter_change_render)
/* 3EB858 E010E378 2442E510 */  addiu     $v0, $v0, %lo(chapter_change_render)
/* 3EB85C E010E37C AFA20020 */  sw        $v0, 0x20($sp)
/* 3EB860 E010E380 24020079 */  addiu     $v0, $zero, 0x79
/* 3EB864 E010E384 AFBF0038 */  sw        $ra, 0x38($sp)
/* 3EB868 E010E388 AFB1002C */  sw        $s1, 0x2C($sp)
/* 3EB86C E010E38C AFB00028 */  sw        $s0, 0x28($sp)
/* 3EB870 E010E390 AFA00010 */  sw        $zero, 0x10($sp)
/* 3EB874 E010E394 AFA00024 */  sw        $zero, 0x24($sp)
/* 3EB878 E010E398 0C080124 */  jal       shim_create_effect_instance
/* 3EB87C E010E39C AFA20014 */   sw       $v0, 0x14($sp)
/* 3EB880 E010E3A0 24040058 */  addiu     $a0, $zero, 0x58
/* 3EB884 E010E3A4 24030001 */  addiu     $v1, $zero, 0x1
/* 3EB888 E010E3A8 0040882D */  daddu     $s1, $v0, $zero
/* 3EB88C E010E3AC 0C08012C */  jal       shim_general_heap_malloc
/* 3EB890 E010E3B0 AE230008 */   sw       $v1, 0x8($s1)
/* 3EB894 E010E3B4 0040802D */  daddu     $s0, $v0, $zero
/* 3EB898 E010E3B8 16000003 */  bnez      $s0, .LE010E3C8
/* 3EB89C E010E3BC AE22000C */   sw       $v0, 0xC($s1)
.LE010E3C0:
/* 3EB8A0 E010E3C0 080438F0 */  j         .LE010E3C0
/* 3EB8A4 E010E3C4 00000000 */   nop
.LE010E3C8:
/* 3EB8A8 E010E3C8 AE120000 */  sw        $s2, 0x0($s0)
/* 3EB8AC E010E3CC 1E600004 */  bgtz      $s3, .LE010E3E0
/* 3EB8B0 E010E3D0 AE00001C */   sw       $zero, 0x1C($s0)
/* 3EB8B4 E010E3D4 240203E8 */  addiu     $v0, $zero, 0x3E8
/* 3EB8B8 E010E3D8 080438F9 */  j         .LE010E3E4
/* 3EB8BC E010E3DC AE020018 */   sw       $v0, 0x18($s0)
.LE010E3E0:
/* 3EB8C0 E010E3E0 AE130018 */  sw        $s3, 0x18($s0)
.LE010E3E4:
/* 3EB8C4 E010E3E4 E6140010 */  swc1      $f20, 0x10($s0)
/* 3EB8C8 E010E3E8 E6140004 */  swc1      $f20, 0x4($s0)
/* 3EB8CC E010E3EC E6160014 */  swc1      $f22, 0x14($s0)
/* 3EB8D0 E010E3F0 E6160008 */  swc1      $f22, 0x8($s0)
/* 3EB8D4 E010E3F4 E618000C */  swc1      $f24, 0xC($s0)
/* 3EB8D8 E010E3F8 C7A00068 */  lwc1      $f0, 0x68($sp)
/* 3EB8DC E010E3FC 240300FF */  addiu     $v1, $zero, 0xFF
/* 3EB8E0 E010E400 AE030020 */  sw        $v1, 0x20($s0)
/* 3EB8E4 E010E404 AE030024 */  sw        $v1, 0x24($s0)
/* 3EB8E8 E010E408 AE030028 */  sw        $v1, 0x28($s0)
/* 3EB8EC E010E40C AE03002C */  sw        $v1, 0x2C($s0)
/* 3EB8F0 E010E410 AE000030 */  sw        $zero, 0x30($s0)
/* 3EB8F4 E010E414 AE000034 */  sw        $zero, 0x34($s0)
/* 3EB8F8 E010E418 AE000038 */  sw        $zero, 0x38($s0)
/* 3EB8FC E010E41C 12400005 */  beqz      $s2, .LE010E434
/* 3EB900 E010E420 E6000050 */   swc1     $f0, 0x50($s0)
/* 3EB904 E010E424 2642FFF6 */  addiu     $v0, $s2, -0xA
/* 3EB908 E010E428 2C420009 */  sltiu     $v0, $v0, 0x9
/* 3EB90C E010E42C 50400002 */  beql      $v0, $zero, .LE010E438
/* 3EB910 E010E430 AE03003C */   sw       $v1, 0x3C($s0)
.LE010E434:
/* 3EB914 E010E434 AE00003C */  sw        $zero, 0x3C($s0)
.LE010E438:
/* 3EB918 E010E438 00121080 */  sll       $v0, $s2, 2
/* 3EB91C E010E43C 3C01E011 */  lui       $at, (0xE0110000 >> 16)
/* 3EB920 E010E440 00220821 */  addu      $at, $at, $v0
/* 3EB924 E010E444 8C22E750 */  lw        $v0, -0x18B0($at)
/* 3EB928 E010E448 0440000A */  bltz      $v0, .LE010E474
/* 3EB92C E010E44C AE020054 */   sw       $v0, 0x54($s0)
/* 3EB930 E010E450 0040202D */  daddu     $a0, $v0, $zero
/* 3EB934 E010E454 240200A0 */  addiu     $v0, $zero, 0xA0
/* 3EB938 E010E458 0000282D */  daddu     $a1, $zero, $zero
/* 3EB93C E010E45C AE020040 */  sw        $v0, 0x40($s0)
/* 3EB940 E010E460 0C080198 */  jal       shim_get_msg_width
/* 3EB944 E010E464 AE020044 */   sw       $v0, 0x44($s0)
/* 3EB948 E010E468 AE020048 */  sw        $v0, 0x48($s0)
/* 3EB94C E010E46C 24020018 */  addiu     $v0, $zero, 0x18
/* 3EB950 E010E470 AE02004C */  sw        $v0, 0x4C($s0)
.LE010E474:
/* 3EB954 E010E474 0220102D */  daddu     $v0, $s1, $zero
/* 3EB958 E010E478 8FBF0038 */  lw        $ra, 0x38($sp)
/* 3EB95C E010E47C 8FB30034 */  lw        $s3, 0x34($sp)
/* 3EB960 E010E480 8FB20030 */  lw        $s2, 0x30($sp)
/* 3EB964 E010E484 8FB1002C */  lw        $s1, 0x2C($sp)
/* 3EB968 E010E488 8FB00028 */  lw        $s0, 0x28($sp)
/* 3EB96C E010E48C D7B80050 */  ldc1      $f24, 0x50($sp)
/* 3EB970 E010E490 D7B60048 */  ldc1      $f22, 0x48($sp)
/* 3EB974 E010E494 D7B40040 */  ldc1      $f20, 0x40($sp)
/* 3EB978 E010E498 03E00008 */  jr        $ra
/* 3EB97C E010E49C 27BD0058 */   addiu    $sp, $sp, 0x58

### DECOMPILED C INSTRUCTIONS:

EffectInstance* chapter_change_main(s32 arg0, f32 posX, f32 posY, f32 arg3, f32 arg4, s32 duration) {
    EffectBlueprint bp;
    ChapterChangeFXData* data;
    EffectInstance* effect;
    s32 numParts = 1;

    bp.init = chapter_change_init;
    bp.update = chapter_change_update;
    bp.renderWorld = chapter_change_render;
    bp.unk_00 = 0;
    bp.renderUI = NULL;
    bp.effectID = EFFECT_CHAPTER_CHANGE;

    effect = shim_create_effect_instance(&bp);
    effect->numParts = numParts;
    data = effect->data.chapterChange = shim_general_heap_malloc(numParts * sizeof(*data));
    ASSERT(effect->data.chapterChange != NULL);

    data->unk_00 = arg0;
    data->lifetime = 0;
    if (duration <= 0) {
        data->timeLeft = 1000;
    } else {
        data->timeLeft = duration;
    }
    data->chapterPos.x = data->endOfPos.x = posX;
    data->chapterPos.y = data->endOfPos.y = posY;
    data->unk_0C = arg3;
    data->unk_50 = arg4;
    data->unk_20 = 255;
    data->unk_24 = 255;
    data->unk_28 = 255;
    data->unk_2C = 255;
    data->unk_30 = 0;
    data->unk_34 = 0;
    data->unk_38 = 0;
    if (arg0 == 0 || (arg0 >= 10 && arg0 <= 18)) {
        data->unk_3C = 0;
    } else {
        data->unk_3C = 255;
    }
    data->unk_54 = D_E010E750[arg0];
    if (data->unk_54 >= 0) {
        data->unk_40 = 160;
        data->unk_44 = 160;
        data->unk_48 = shim_get_msg_width(data->unk_54, 0);
        data->unk_4C = 24;
    }

    return effect;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel AddPartDispOffset
/* 19A668 8026BD88 27BDFFC0 */  addiu     $sp, $sp, -0x40
/* 19A66C 8026BD8C AFB20018 */  sw        $s2, 0x18($sp)
/* 19A670 8026BD90 0080902D */  daddu     $s2, $a0, $zero
/* 19A674 8026BD94 AFBF0020 */  sw        $ra, 0x20($sp)
/* 19A678 8026BD98 AFB3001C */  sw        $s3, 0x1C($sp)
/* 19A67C 8026BD9C AFB10014 */  sw        $s1, 0x14($sp)
/* 19A680 8026BDA0 AFB00010 */  sw        $s0, 0x10($sp)
/* 19A684 8026BDA4 F7B80038 */  sdc1      $f24, 0x38($sp)
/* 19A688 8026BDA8 F7B60030 */  sdc1      $f22, 0x30($sp)
/* 19A68C 8026BDAC F7B40028 */  sdc1      $f20, 0x28($sp)
/* 19A690 8026BDB0 8E51000C */  lw        $s1, 0xC($s2)
/* 19A694 8026BDB4 8E250000 */  lw        $a1, 0x0($s1)
/* 19A698 8026BDB8 0C0B1EAF */  jal       evt_get_variable
/* 19A69C 8026BDBC 26310004 */   addiu    $s1, $s1, 0x4
/* 19A6A0 8026BDC0 0040982D */  daddu     $s3, $v0, $zero
/* 19A6A4 8026BDC4 2402FF81 */  addiu     $v0, $zero, -0x7F
/* 19A6A8 8026BDC8 16620002 */  bne       $s3, $v0, .L8026BDD4
/* 19A6AC 8026BDCC 00000000 */   nop
/* 19A6B0 8026BDD0 8E530148 */  lw        $s3, 0x148($s2)
.L8026BDD4:
/* 19A6B4 8026BDD4 8E250000 */  lw        $a1, 0x0($s1)
/* 19A6B8 8026BDD8 26310004 */  addiu     $s1, $s1, 0x4
/* 19A6BC 8026BDDC 0C0B1EAF */  jal       evt_get_variable
/* 19A6C0 8026BDE0 0240202D */   daddu    $a0, $s2, $zero
/* 19A6C4 8026BDE4 8E250000 */  lw        $a1, 0x0($s1)
/* 19A6C8 8026BDE8 26310004 */  addiu     $s1, $s1, 0x4
/* 19A6CC 8026BDEC 0240202D */  daddu     $a0, $s2, $zero
/* 19A6D0 8026BDF0 0C0B210B */  jal       evt_get_float_variable
/* 19A6D4 8026BDF4 0040802D */   daddu    $s0, $v0, $zero
/* 19A6D8 8026BDF8 8E250000 */  lw        $a1, 0x0($s1)
/* 19A6DC 8026BDFC 26310004 */  addiu     $s1, $s1, 0x4
/* 19A6E0 8026BE00 0240202D */  daddu     $a0, $s2, $zero
/* 19A6E4 8026BE04 0C0B210B */  jal       evt_get_float_variable
/* 19A6E8 8026BE08 46000506 */   mov.s    $f20, $f0
/* 19A6EC 8026BE0C 0240202D */  daddu     $a0, $s2, $zero
/* 19A6F0 8026BE10 8E250000 */  lw        $a1, 0x0($s1)
/* 19A6F4 8026BE14 0C0B210B */  jal       evt_get_float_variable
/* 19A6F8 8026BE18 46000586 */   mov.s    $f22, $f0
/* 19A6FC 8026BE1C 0260202D */  daddu     $a0, $s3, $zero
/* 19A700 8026BE20 0C09A75B */  jal       get_actor
/* 19A704 8026BE24 46000606 */   mov.s    $f24, $f0
/* 19A708 8026BE28 0040202D */  daddu     $a0, $v0, $zero
/* 19A70C 8026BE2C 0C099117 */  jal       get_actor_part
pause_spirits_bg_pal:
/* 19A710 8026BE30 0200282D */   daddu    $a1, $s0, $zero
/* 19A714 8026BE34 0040202D */  daddu     $a0, $v0, $zero
/* 19A718 8026BE38 8C820000 */  lw        $v0, 0x0($a0)
/* 19A71C 8026BE3C 3C030010 */  lui       $v1, (0x100000 >> 16)
/* 19A720 8026BE40 00431024 */  and       $v0, $v0, $v1
/* 19A724 8026BE44 1440001B */  bnez      $v0, .L8026BEB4
/* 19A728 8026BE48 00000000 */   nop
/* 19A72C 8026BE4C 84820014 */  lh        $v0, 0x14($a0)
/* 19A730 8026BE50 44820000 */  mtc1      $v0, $f0
/* 19A734 8026BE54 00000000 */  nop
/* 19A738 8026BE58 46800020 */  cvt.s.w   $f0, $f0
/* 19A73C 8026BE5C 46140000 */  add.s     $f0, $f0, $f20
/* 19A740 8026BE60 84820016 */  lh        $v0, 0x16($a0)
/* 19A744 8026BE64 44821000 */  mtc1      $v0, $f2
/* 19A748 8026BE68 00000000 */  nop
/* 19A74C 8026BE6C 468010A0 */  cvt.s.w   $f2, $f2
/* 19A750 8026BE70 46161080 */  add.s     $f2, $f2, $f22
/* 19A754 8026BE74 84820018 */  lh        $v0, 0x18($a0)
/* 19A758 8026BE78 4600010D */  trunc.w.s $f4, $f0
/* 19A75C 8026BE7C 44032000 */  mfc1      $v1, $f4
/* 19A760 8026BE80 44820000 */  mtc1      $v0, $f0
/* 19A764 8026BE84 00000000 */  nop
/* 19A768 8026BE88 46800020 */  cvt.s.w   $f0, $f0
/* 19A76C 8026BE8C 46180000 */  add.s     $f0, $f0, $f24
/* 19A770 8026BE90 A4830014 */  sh        $v1, 0x14($a0)
/* 19A774 8026BE94 4600110D */  trunc.w.s $f4, $f2
/* 19A778 8026BE98 44022000 */  mfc1      $v0, $f4
/* 19A77C 8026BE9C 00000000 */  nop
/* 19A780 8026BEA0 A4820016 */  sh        $v0, 0x16($a0)
/* 19A784 8026BEA4 4600010D */  trunc.w.s $f4, $f0
/* 19A788 8026BEA8 44022000 */  mfc1      $v0, $f4
/* 19A78C 8026BEAC 0809AFC7 */  j         .L8026BF1C
/* 19A790 8026BEB0 A4820018 */   sh       $v0, 0x18($a0)
.L8026BEB4:
/* 19A794 8026BEB4 8482001A */  lh        $v0, 0x1A($a0)
/* 19A798 8026BEB8 44820000 */  mtc1      $v0, $f0
/* 19A79C 8026BEBC 00000000 */  nop
/* 19A7A0 8026BEC0 46800020 */  cvt.s.w   $f0, $f0
/* 19A7A4 8026BEC4 46140000 */  add.s     $f0, $f0, $f20
/* 19A7A8 8026BEC8 8482001C */  lh        $v0, 0x1C($a0)
/* 19A7AC 8026BECC 44821000 */  mtc1      $v0, $f2
/* 19A7B0 8026BED0 00000000 */  nop
/* 19A7B4 8026BED4 468010A0 */  cvt.s.w   $f2, $f2
/* 19A7B8 8026BED8 46161080 */  add.s     $f2, $f2, $f22
/* 19A7BC 8026BEDC 8482001E */  lh        $v0, 0x1E($a0)
/* 19A7C0 8026BEE0 4600010D */  trunc.w.s $f4, $f0
/* 19A7C4 8026BEE4 44032000 */  mfc1      $v1, $f4
/* 19A7C8 8026BEE8 44820000 */  mtc1      $v0, $f0
/* 19A7CC 8026BEEC 00000000 */  nop
/* 19A7D0 8026BEF0 46800020 */  cvt.s.w   $f0, $f0
/* 19A7D4 8026BEF4 46180000 */  add.s     $f0, $f0, $f24
/* 19A7D8 8026BEF8 A483001A */  sh        $v1, 0x1A($a0)
/* 19A7DC 8026BEFC 4600110D */  trunc.w.s $f4, $f2
/* 19A7E0 8026BF00 44022000 */  mfc1      $v0, $f4
/* 19A7E4 8026BF04 00000000 */  nop
/* 19A7E8 8026BF08 A482001C */  sh        $v0, 0x1C($a0)
/* 19A7EC 8026BF0C 4600010D */  trunc.w.s $f4, $f0
/* 19A7F0 8026BF10 44022000 */  mfc1      $v0, $f4
/* 19A7F4 8026BF14 00000000 */  nop
/* 19A7F8 8026BF18 A482001E */  sh        $v0, 0x1E($a0)
.L8026BF1C:
/* 19A7FC 8026BF1C 8FBF0020 */  lw        $ra, 0x20($sp)
/* 19A800 8026BF20 8FB3001C */  lw        $s3, 0x1C($sp)
/* 19A804 8026BF24 8FB20018 */  lw        $s2, 0x18($sp)
/* 19A808 8026BF28 8FB10014 */  lw        $s1, 0x14($sp)
/* 19A80C 8026BF2C 8FB00010 */  lw        $s0, 0x10($sp)
/* 19A810 8026BF30 D7B80038 */  ldc1      $f24, 0x38($sp)
/* 19A814 8026BF34 D7B60030 */  ldc1      $f22, 0x30($sp)
/* 19A818 8026BF38 D7B40028 */  ldc1      $f20, 0x28($sp)
/* 19A81C 8026BF3C 24020002 */  addiu     $v0, $zero, 0x2
/* 19A820 8026BF40 03E00008 */  jr        $ra
/* 19A824 8026BF44 27BD0040 */   addiu    $sp, $sp, 0x40

### DECOMPILED C INSTRUCTIONS:

ApiStatus AddPartDispOffset(Evt* script, s32 isInitialCall) {
    Bytecode* args = script->ptrReadPos;
    s32 actorID = evt_get_variable(script, *args++);
    ActorPart* actorPart;
    s32 partID;
    f32 x, y, z;

    if (actorID == ACTOR_SELF) {
        actorID = script->owner1.actorID;
    }

    partID = evt_get_variable(script, *args++);

    x = evt_get_float_variable(script, *args++);
    y = evt_get_float_variable(script, *args++);
    z = evt_get_float_variable(script, *args++);
    actorPart = get_actor_part(get_actor(actorID), partID);

    if (!(actorPart->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION)) {
        actorPart->partOffset.x += x;
        actorPart->partOffset.y += y;
        actorPart->partOffset.z += z;
    } else {
        actorPart->visualOffset.x += x;
        actorPart->visualOffset.y += y;
        actorPart->visualOffset.z += z;
    }

    return ApiStatus_DONE2;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_802BB0A0_E2D9D0
/* E2D9D0 802BB0A0 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* E2D9D4 802BB0A4 AFB10014 */  sw        $s1, 0x14($sp)
/* E2D9D8 802BB0A8 0080882D */  daddu     $s1, $a0, $zero
/* E2D9DC 802BB0AC AFBF001C */  sw        $ra, 0x1C($sp)
/* E2D9E0 802BB0B0 AFB20018 */  sw        $s2, 0x18($sp)
.L802BB0B4:
/* E2D9E4 802BB0B4 AFB00010 */  sw        $s0, 0x10($sp)
/* E2D9E8 802BB0B8 0C0AEC00 */  jal       func_802BB000_E2D930
.L802BB0BC:
/* E2D9EC 802BB0BC 8E300040 */   lw       $s0, 0x40($s1)
/* E2D9F0 802BB0C0 82030002 */  lb        $v1, 0x2($s0)
/* E2D9F4 802BB0C4 3C128011 */  lui       $s2, %hi(gPlayerStatus)
/* E2D9F8 802BB0C8 2652EFC8 */  addiu     $s2, $s2, %lo(gPlayerStatus)
/* E2D9FC 802BB0CC 10600005 */  beqz      $v1, .L802BB0E4
/* E2DA00 802BB0D0 24020001 */   addiu    $v0, $zero, 0x1
/* E2DA04 802BB0D4 1062000A */  beq       $v1, $v0, .L802BB100
/* E2DA08 802BB0D8 00000000 */   nop
/* E2DA0C 802BB0DC 080AEC67 */  j         .L802BB19C
/* E2DA10 802BB0E0 00000000 */   nop
.L802BB0E4:
/* E2DA14 802BB0E4 24020001 */  addiu     $v0, $zero, 0x1
/* E2DA18 802BB0E8 AE000018 */  sw        $zero, 0x18($s0)
/* E2DA1C 802BB0EC A6000000 */  sh        $zero, 0x0($s0)
/* E2DA20 802BB0F0 A2020002 */  sb        $v0, 0x2($s0)
.L802BB0F4:
/* E2DA24 802BB0F4 AE000004 */  sw        $zero, 0x4($s0)
/* E2DA28 802BB0F8 080AEC67 */  j         .L802BB19C
/* E2DA2C 802BB0FC AE00000C */   sw       $zero, 0xC($s0)
.L802BB100:
/* E2DA30 802BB100 92220006 */  lbu       $v0, 0x6($s1)
/* E2DA34 802BB104 30420001 */  andi      $v0, $v0, 0x1
glabel func_802BB108_E2FA58
/* E2DA38 802BB108 14400017 */  bnez      $v0, .L802BB168
/* E2DA3C 802BB10C 00000000 */   nop
/* E2DA40 802BB110 C6000014 */  lwc1      $f0, 0x14($s0)
/* E2DA44 802BB114 3C01802C */  lui       $at, %hi(D_802BCDC0_E2F6F0)
/* E2DA48 802BB118 D422CDC0 */  ldc1      $f2, %lo(D_802BCDC0_E2F6F0)($at)
/* E2DA4C 802BB11C 46000021 */  cvt.d.s   $f0, $f0
/* E2DA50 802BB120 46220000 */  add.d     $f0, $f0, $f2
/* E2DA54 802BB124 3C014000 */  lui       $at, (0x40000000 >> 16)
/* E2DA58 802BB128 44812800 */  mtc1      $at, $f5
/* E2DA5C 802BB12C 44802000 */  mtc1      $zero, $f4
/* E2DA60 802BB130 46200020 */  cvt.s.d   $f0, $f0
/* E2DA64 802BB134 460000A1 */  cvt.d.s   $f2, $f0
/* E2DA68 802BB138 4622203C */  c.lt.d    $f4, $f2
/* E2DA6C 802BB13C 00000000 */  nop
.L802BB140:
/* E2DA70 802BB140 45000016 */  bc1f      .L802BB19C
/* E2DA74 802BB144 E6000014 */   swc1     $f0, 0x14($s0)
/* E2DA78 802BB148 45000014 */  bc1f      .L802BB19C
/* E2DA7C 802BB14C 00000000 */   nop
/* E2DA80 802BB150 3C01802C */  lui       $at, %hi(D_802BCDC8_E2F6F8)
/* E2DA84 802BB154 D420CDC8 */  ldc1      $f0, %lo(D_802BCDC8_E2F6F8)($at)
/* E2DA88 802BB158 46201001 */  sub.d     $f0, $f2, $f0
/* E2DA8C 802BB15C 46200020 */  cvt.s.d   $f0, $f0
/* E2DA90 802BB160 080AEC67 */  j         .L802BB19C
/* E2DA94 802BB164 E6000014 */   swc1     $f0, 0x14($s0)
.L802BB168:
/* E2DA98 802BB168 C6000014 */  lwc1      $f0, 0x14($s0)
/* E2DA9C 802BB16C 3C01802C */  lui       $at, %hi(D_802BCDD0_E2F700)
/* E2DAA0 802BB170 D422CDD0 */  ldc1      $f2, %lo(D_802BCDD0_E2F700)($at)
/* E2DAA4 802BB174 46000021 */  cvt.d.s   $f0, $f0
/* E2DAA8 802BB178 46220000 */  add.d     $f0, $f0, $f2
/* E2DAAC 802BB17C 3C014160 */  lui       $at, (0x41600000 >> 16)
/* E2DAB0 802BB180 44811000 */  mtc1      $at, $f2
/* E2DAB4 802BB184 46200020 */  cvt.s.d   $f0, $f0
/* E2DAB8 802BB188 4600103C */  c.lt.s    $f2, $f0
/* E2DABC 802BB18C 00000000 */  nop
/* E2DAC0 802BB190 45000002 */  bc1f      .L802BB19C
/* E2DAC4 802BB194 E6000014 */   swc1     $f0, 0x14($s0)
/* E2DAC8 802BB198 E6020014 */  swc1      $f2, 0x14($s0)
.L802BB19C:
/* E2DACC 802BB19C C6000008 */  lwc1      $f0, 0x8($s0)
/* E2DAD0 802BB1A0 C60C0014 */  lwc1      $f12, 0x14($s0)
/* E2DAD4 802BB1A4 0C00A6C9 */  jal       clamp_angle
/* E2DAD8 802BB1A8 460C0300 */   add.s    $f12, $f0, $f12
/* E2DADC 802BB1AC E6000008 */  swc1      $f0, 0x8($s0)
/* E2DAE0 802BB1B0 92220006 */  lbu       $v0, 0x6($s1)
/* E2DAE4 802BB1B4 30420001 */  andi      $v0, $v0, 0x1
/* E2DAE8 802BB1B8 14400015 */  bnez      $v0, .L802BB210
/* E2DAEC 802BB1BC 3C030001 */   lui      $v1, (0x10000 >> 16)
/* E2DAF0 802BB1C0 8E420004 */  lw        $v0, 0x4($s2)
.L802BB1C4:
/* E2DAF4 802BB1C4 00431024 */  and       $v0, $v0, $v1
/* E2DAF8 802BB1C8 10400011 */  beqz      $v0, .L802BB210
/* E2DAFC 802BB1CC 00000000 */   nop
/* E2DB00 802BB1D0 C62C0048 */  lwc1      $f12, 0x48($s1)
/* E2DB04 802BB1D4 C62E0050 */  lwc1      $f14, 0x50($s1)
/* E2DB08 802BB1D8 8E460028 */  lw        $a2, 0x28($s2)
/* E2DB0C 802BB1DC 0C00A7B5 */  jal       dist2D
/* E2DB10 802BB1E0 8E470030 */   lw       $a3, 0x30($s2)
/* E2DB14 802BB1E4 46000021 */  cvt.d.s   $f0, $f0
glabel func_802BB1E8_E2B918
/* E2DB18 802BB1E8 3C01404E */  lui       $at, (0x404E0000 >> 16)
/* E2DB1C 802BB1EC 44811800 */  mtc1      $at, $f3
/* E2DB20 802BB1F0 44801000 */  mtc1      $zero, $f2
/* E2DB24 802BB1F4 46200005 */  abs.d     $f0, $f0
/* E2DB28 802BB1F8 4622003C */  c.lt.d    $f0, $f2
/* E2DB2C 802BB1FC 00000000 */  nop
/* E2DB30 802BB200 45000003 */  bc1f      .L802BB210
/* E2DB34 802BB204 00000000 */   nop
/* E2DB38 802BB208 0C043F5A */  jal       exec_entity_commandlist
/* E2DB3C 802BB20C 0220202D */   daddu    $a0, $s1, $zero
.L802BB210:
/* E2DB40 802BB210 8FBF001C */  lw        $ra, 0x1C($sp)
/* E2DB44 802BB214 8FB20018 */  lw        $s2, 0x18($sp)
/* E2DB48 802BB218 8FB10014 */  lw        $s1, 0x14($sp)
/* E2DB4C 802BB21C 8FB00010 */  lw        $s0, 0x10($sp)
/* E2DB50 802BB220 03E00008 */  jr        $ra
glabel .L802BB224
/* E2DB54 802BB224 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

void func_802BB0A0_E2D9D0(Entity* entity) {
    SpinningFlowerData* data = entity->dataBuf.spinningFlower;
    PlayerStatus* playerStatus = &gPlayerStatus;

    func_802BB000_E2D930(entity);
    switch (data->state) {
        case 0:
            data->unk_18 = 0;
            data->unk_00 = 0;
            data->state = 1;
            data->rotation.x = 0.0f;
            data->rotation.z = 0.0f;
            break;
        case 1:
            if (!(entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR)) {
                data->spinSpeed += 0.02;
                if (data->spinSpeed > 2.0) {
                    if (data->spinSpeed > 2.0) {
                        data->spinSpeed -= 0.4;
                    }
                }
            } else {
                data->spinSpeed += 0.8;
                if (data->spinSpeed > 14.0f) {
                    data->spinSpeed = 14.0f;
                }
            }
            break;
    }

    data->rotation.y = clamp_angle(data->rotation.y + data->spinSpeed);

    if (!(entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) &&
        (playerStatus->animFlags & PA_FLAG_SPINNING) &&
        fabs(dist2D(entity->position.x, entity->position.z, playerStatus->position.x, playerStatus->position.z)) < 60.0)
        {
        exec_entity_commandlist(entity);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel render_shadows
/* A67CC 801100CC 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* A67D0 801100D0 AFB10014 */  sw        $s1, 0x14($sp)
/* A67D4 801100D4 0000882D */  daddu     $s1, $zero, $zero
/* A67D8 801100D8 AFB3001C */  sw        $s3, 0x1C($sp)
/* A67DC 801100DC 3C131000 */  lui       $s3, (0x10000000 >> 16)
/* A67E0 801100E0 AFB20018 */  sw        $s2, 0x18($sp)
/* A67E4 801100E4 3C122000 */  lui       $s2, (0x20000000 >> 16)
/* A67E8 801100E8 AFBF0020 */  sw        $ra, 0x20($sp)
/* A67EC 801100EC AFB00010 */  sw        $s0, 0x10($sp)
.L801100F0:
/* A67F0 801100F0 0C044181 */  jal       get_shadow_by_index
/* A67F4 801100F4 0220202D */   daddu    $a0, $s1, $zero
/* A67F8 801100F8 0040802D */  daddu     $s0, $v0, $zero
/* A67FC 801100FC 52000041 */  beql      $s0, $zero, .L80110204
/* A6800 80110100 26310001 */   addiu    $s1, $s1, 0x1
/* A6804 80110104 8E030000 */  lw        $v1, 0x0($s0)
/* A6808 80110108 30620001 */  andi      $v0, $v1, 0x1
/* A680C 8011010C 1040000E */  beqz      $v0, .L80110148
/* A6810 80110110 00731024 */   and      $v0, $v1, $s3
/* A6814 80110114 5040003B */  beql      $v0, $zero, .L80110204
/* A6818 80110118 26310001 */   addiu    $s1, $s1, 0x1
/* A681C 8011011C 92020005 */  lbu       $v0, 0x5($s0)
/* A6820 80110120 2442FFEC */  addiu     $v0, $v0, -0x14
/* A6824 80110124 A2020005 */  sb        $v0, 0x5($s0)
/* A6828 80110128 304200FF */  andi      $v0, $v0, 0xFF
/* A682C 8011012C 2C420015 */  sltiu     $v0, $v0, 0x15
/* A6830 80110130 50400034 */  beql      $v0, $zero, .L80110204
/* A6834 80110134 26310001 */   addiu    $s1, $s1, 0x1
/* A6838 80110138 0060102D */  daddu     $v0, $v1, $zero
/* A683C 8011013C 00521025 */  or        $v0, $v0, $s2
/* A6840 80110140 08044080 */  j         .L80110200
/* A6844 80110144 AE020000 */   sw       $v0, 0x0($s0)
.L80110148:
/* A6848 80110148 30620008 */  andi      $v0, $v1, 0x8
/* A684C 8011014C 1040000F */  beqz      $v0, .L8011018C
/* A6850 80110150 00731024 */   and      $v0, $v1, $s3
/* A6854 80110154 8E07000C */  lw        $a3, 0xC($s0)
/* A6858 80110158 14E00006 */  bnez      $a3, .L80110174
/* A685C 8011015C 00000000 */   nop
/* A6860 80110160 86040008 */  lh        $a0, 0x8($s0)
/* A6864 80110164 0C047CC1 */  jal       render_animated_model
/* A6868 80110168 26050038 */   addiu    $a1, $s0, 0x38
/* A686C 8011016C 08044081 */  j         .L80110204
/* A6870 80110170 26310001 */   addiu    $s1, $s1, 0x1
.L80110174:
/* A6874 80110174 86040008 */  lh        $a0, 0x8($s0)
/* A6878 80110178 8606000A */  lh        $a2, 0xA($s0)
/* A687C 8011017C 0C047CFA */  jal       render_animated_model_with_vertices
/* A6880 80110180 26050038 */   addiu    $a1, $s0, 0x38
/* A6884 80110184 08044081 */  j         .L80110204
/* A6888 80110188 26310001 */   addiu    $s1, $s1, 0x1
.L8011018C:
/* A688C 8011018C 1040000B */  beqz      $v0, .L801101BC
/* A6890 80110190 00000000 */   nop
/* A6894 80110194 92020005 */  lbu       $v0, 0x5($s0)
/* A6898 80110198 2442FFEC */  addiu     $v0, $v0, -0x14
/* A689C 8011019C A2020005 */  sb        $v0, 0x5($s0)
/* A68A0 801101A0 304200FF */  andi      $v0, $v0, 0xFF
/* A68A4 801101A4 2C420015 */  sltiu     $v0, $v0, 0x15
/* A68A8 801101A8 10400004 */  beqz      $v0, .L801101BC
/* A68AC 801101AC 00000000 */   nop
/* A68B0 801101B0 8E020000 */  lw        $v0, 0x0($s0)
/* A68B4 801101B4 00521025 */  or        $v0, $v0, $s2
/* A68B8 801101B8 AE020000 */  sw        $v0, 0x0($s0)
.L801101BC:
/* A68BC 801101BC 86040008 */  lh        $a0, 0x8($s0)
/* A68C0 801101C0 92050005 */  lbu       $a1, 0x5($s0)
/* A68C4 801101C4 3C068011 */  lui       $a2, %hi(entity_model_set_shadow_color)
/* A68C8 801101C8 0C048BD9 */  jal       bind_entity_model_setupGfx
/* A68CC 801101CC 24C6FE68 */   addiu    $a2, $a2, %lo(entity_model_set_shadow_color)
/* A68D0 801101D0 8E07000C */  lw        $a3, 0xC($s0)
/* A68D4 801101D4 14E00006 */  bnez      $a3, .L801101F0
/* A68D8 801101D8 00000000 */   nop
/* A68DC 801101DC 86040008 */  lh        $a0, 0x8($s0)
/* A68E0 801101E0 0C04873A */  jal       draw_entity_model_A
/* A68E4 801101E4 26050038 */   addiu    $a1, $s0, 0x38
/* A68E8 801101E8 08044081 */  j         .L80110204
/* A68EC 801101EC 26310001 */   addiu    $s1, $s1, 0x1
.L801101F0:
/* A68F0 801101F0 86040008 */  lh        $a0, 0x8($s0)
/* A68F4 801101F4 8606000A */  lh        $a2, 0xA($s0)
/* A68F8 801101F8 0C0487AE */  jal       draw_entity_model_B
/* A68FC 801101FC 26050038 */   addiu    $a1, $s0, 0x38
.L80110200:
/* A6900 80110200 26310001 */  addiu     $s1, $s1, 0x1
.L80110204:
/* A6904 80110204 2A22003C */  slti      $v0, $s1, 0x3C
/* A6908 80110208 1440FFB9 */  bnez      $v0, .L801100F0
/* A690C 8011020C 00000000 */   nop
/* A6910 80110210 8FBF0020 */  lw        $ra, 0x20($sp)
/* A6914 80110214 8FB3001C */  lw        $s3, 0x1C($sp)
/* A6918 80110218 8FB20018 */  lw        $s2, 0x18($sp)
/* A691C 8011021C 8FB10014 */  lw        $s1, 0x14($sp)
/* A6920 80110220 8FB00010 */  lw        $s0, 0x10($sp)
/* A6924 80110224 03E00008 */  jr        $ra
/* A6928 80110228 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void render_shadows(void) {
    s32 i;

    for (i = 0; i < MAX_SHADOWS; i++) {
        Shadow* shadow = get_shadow_by_index(i);

        if (shadow != NULL) {
            if (shadow->flags & ENTITY_FLAG_HIDDEN) {
                if (shadow->flags & ENTITY_FLAG_FADING_AWAY) {
                    shadow->alpha -= 20;
                    if (shadow->alpha <= 20) {
                        shadow->flags |= ENTITY_FLAG_PENDING_INSTANCE_DELETE;
                    }
                }
            } else if (shadow->flags & ENTITY_FLAG_HAS_ANIMATED_MODEL) {
                if (shadow->vertexArray == NULL) {
                    render_animated_model(shadow->entityModelID, &shadow->transformMatrix);
                } else {
                    render_animated_model_with_vertices(shadow->entityModelID,
                                  &shadow->transformMatrix,
                                  shadow->vertexSegment,
                                  shadow->vertexArray);
                }
            } else {
                if (shadow->flags & ENTITY_FLAG_FADING_AWAY) {
                    shadow->alpha -= 20;
                    if (shadow->alpha <= 20) {
                        shadow->flags |=  ENTITY_FLAG_PENDING_INSTANCE_DELETE;
                    }
                }

                bind_entity_model_setupGfx(shadow->entityModelID, (void*)(u32)shadow->alpha, entity_model_set_shadow_color);

                if (shadow->vertexArray == NULL) {
                    draw_entity_model_A(shadow->entityModelID, &shadow->transformMatrix);
                } else {
                    draw_entity_model_B(shadow->entityModelID,
                                           &shadow->transformMatrix,
                                           shadow->vertexSegment,
                                           shadow->vertexArray);
                }
            }
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel snowfall_update
/* 38CB2C E008A53C 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 38CB30 E008A540 0080282D */  daddu     $a1, $a0, $zero
/* 38CB34 E008A544 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 38CB38 E008A548 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 38CB3C E008A54C 3C04800B */  lui       $a0, %hi(gCameras)
/* 38CB40 E008A550 24841D80 */  addiu     $a0, $a0, %lo(gCameras)
/* 38CB44 E008A554 AFBF002C */  sw        $ra, 0x2C($sp)
/* 38CB48 E008A558 AFB60028 */  sw        $s6, 0x28($sp)
/* 38CB4C E008A55C AFB50024 */  sw        $s5, 0x24($sp)
/* 38CB50 E008A560 AFB40020 */  sw        $s4, 0x20($sp)
/* 38CB54 E008A564 AFB3001C */  sw        $s3, 0x1C($sp)
/* 38CB58 E008A568 AFB20018 */  sw        $s2, 0x18($sp)
/* 38CB5C E008A56C AFB10014 */  sw        $s1, 0x14($sp)
/* 38CB60 E008A570 AFB00010 */  sw        $s0, 0x10($sp)
/* 38CB64 E008A574 8CB1000C */  lw        $s1, 0xC($a1)
/* 38CB68 E008A578 00031080 */  sll       $v0, $v1, 2
/* 38CB6C E008A57C 00431021 */  addu      $v0, $v0, $v1
/* 38CB70 E008A580 00021080 */  sll       $v0, $v0, 2
/* 38CB74 E008A584 00431023 */  subu      $v0, $v0, $v1
/* 38CB78 E008A588 000218C0 */  sll       $v1, $v0, 3
/* 38CB7C E008A58C 00431021 */  addu      $v0, $v0, $v1
/* 38CB80 E008A590 000210C0 */  sll       $v0, $v0, 3
/* 38CB84 E008A594 8E230020 */  lw        $v1, 0x20($s1)
/* 38CB88 E008A598 00442021 */  addu      $a0, $v0, $a0
/* 38CB8C E008A59C 28620064 */  slti      $v0, $v1, 0x64
/* 38CB90 E008A5A0 10400002 */  beqz      $v0, .LE008A5AC
/* 38CB94 E008A5A4 2462FFFF */   addiu    $v0, $v1, -0x1
/* 38CB98 E008A5A8 AE220020 */  sw        $v0, 0x20($s1)
.LE008A5AC:
/* 38CB9C E008A5AC 8E220020 */  lw        $v0, 0x20($s1)
/* 38CBA0 E008A5B0 04410005 */  bgez      $v0, .LE008A5C8
/* 38CBA4 E008A5B4 00000000 */   nop
/* 38CBA8 E008A5B8 0C080128 */  jal       shim_remove_effect
/* 38CBAC E008A5BC 00A0202D */   daddu    $a0, $a1, $zero
/* 38CBB0 E008A5C0 080229AF */  j         .LE008A6BC
/* 38CBB4 E008A5C4 00000000 */   nop
.LE008A5C8:
/* 38CBB8 E008A5C8 8E220024 */  lw        $v0, 0x24($s1)
/* 38CBBC E008A5CC 8E330020 */  lw        $s3, 0x20($s1)
/* 38CBC0 E008A5D0 8E35002C */  lw        $s5, 0x2C($s1)
/* 38CBC4 E008A5D4 24420001 */  addiu     $v0, $v0, 0x1
/* 38CBC8 E008A5D8 AE220024 */  sw        $v0, 0x24($s1)
/* 38CBCC E008A5DC 2A62000A */  slti      $v0, $s3, 0xA
/* 38CBD0 E008A5E0 10400005 */  beqz      $v0, .LE008A5F8
/* 38CBD4 E008A5E4 00131040 */   sll      $v0, $s3, 1
/* 38CBD8 E008A5E8 00531021 */  addu      $v0, $v0, $s3
/* 38CBDC E008A5EC 000210C0 */  sll       $v0, $v0, 3
/* 38CBE0 E008A5F0 00531021 */  addu      $v0, $v0, $s3
/* 38CBE4 E008A5F4 AE220028 */  sw        $v0, 0x28($s1)
.LE008A5F8:
/* 38CBE8 E008A5F8 C4800078 */  lwc1      $f0, 0x78($a0)
/* 38CBEC E008A5FC 3C01E009 */  lui       $at, (0xE0090000 >> 16)
/* 38CBF0 E008A600 D422AA78 */  ldc1      $f2, -0x5588($at)
/* 38CBF4 E008A604 4600020D */  trunc.w.s $f8, $f0
/* 38CBF8 E008A608 44144000 */  mfc1      $s4, $f8
/* 38CBFC E008A60C 00000000 */  nop
/* 38CC00 E008A610 44940000 */  mtc1      $s4, $f0
/* 38CC04 E008A614 00000000 */  nop
/* 38CC08 E008A618 46800021 */  cvt.d.w   $f0, $f0
/* 38CC0C E008A61C 46220002 */  mul.d     $f0, $f0, $f2
/* 38CC10 E008A620 00000000 */  nop
/* 38CC14 E008A624 3C013FF0 */  lui       $at, (0x3FF00000 >> 16)
/* 38CC18 E008A628 44811800 */  mtc1      $at, $f3
/* 38CC1C E008A62C 44801000 */  mtc1      $zero, $f2
/* 38CC20 E008A630 00000000 */  nop
/* 38CC24 E008A634 46220000 */  add.d     $f0, $f0, $f2
/* 38CC28 E008A638 26310034 */  addiu     $s1, $s1, 0x34
/* 38CC2C E008A63C 4620020D */  trunc.w.d $f8, $f0
/* 38CC30 E008A640 44164000 */  mfc1      $s6, $f8
/* 38CC34 E008A644 1AA0001D */  blez      $s5, .LE008A6BC
/* 38CC38 E008A648 0000902D */   daddu    $s2, $zero, $zero
/* 38CC3C E008A64C 26300010 */  addiu     $s0, $s1, 0x10
.LE008A650:
/* 38CC40 E008A650 8E020020 */  lw        $v0, 0x20($s0)
/* 38CC44 E008A654 18400003 */  blez      $v0, .LE008A664
/* 38CC48 E008A658 2442FFFF */   addiu    $v0, $v0, -0x1
/* 38CC4C E008A65C 1C400012 */  bgtz      $v0, .LE008A6A8
/* 38CC50 E008A660 AE020020 */   sw       $v0, 0x20($s0)
.LE008A664:
/* 38CC54 E008A664 0220202D */  daddu     $a0, $s1, $zero
/* 38CC58 E008A668 0280282D */  daddu     $a1, $s4, $zero
/* 38CC5C E008A66C 02C0302D */  daddu     $a2, $s6, $zero
/* 38CC60 E008A670 C606FFF8 */  lwc1      $f6, -0x8($s0)
/* 38CC64 E008A674 C6000004 */  lwc1      $f0, 0x4($s0)
/* 38CC68 E008A678 C604FFFC */  lwc1      $f4, -0x4($s0)
/* 38CC6C E008A67C 46003180 */  add.s     $f6, $f6, $f0
/* 38CC70 E008A680 C6000008 */  lwc1      $f0, 0x8($s0)
/* 38CC74 E008A684 C602000C */  lwc1      $f2, 0xC($s0)
/* 38CC78 E008A688 46002100 */  add.s     $f4, $f4, $f0
/* 38CC7C E008A68C C6000000 */  lwc1      $f0, 0x0($s0)
/* 38CC80 E008A690 0260382D */  daddu     $a3, $s3, $zero
/* 38CC84 E008A694 46020000 */  add.s     $f0, $f0, $f2
/* 38CC88 E008A698 E606FFF8 */  swc1      $f6, -0x8($s0)
/* 38CC8C E008A69C E604FFFC */  swc1      $f4, -0x4($s0)
/* 38CC90 E008A6A0 0C0228A4 */  jal       func_E008A290
/* 38CC94 E008A6A4 E6000000 */   swc1     $f0, 0x0($s0)
.LE008A6A8:
/* 38CC98 E008A6A8 26520001 */  addiu     $s2, $s2, 0x1
/* 38CC9C E008A6AC 26100034 */  addiu     $s0, $s0, 0x34
/* 38CCA0 E008A6B0 0255102A */  slt       $v0, $s2, $s5
/* 38CCA4 E008A6B4 1440FFE6 */  bnez      $v0, .LE008A650
/* 38CCA8 E008A6B8 26310034 */   addiu    $s1, $s1, 0x34
.LE008A6BC:
/* 38CCAC E008A6BC 8FBF002C */  lw        $ra, 0x2C($sp)
/* 38CCB0 E008A6C0 8FB60028 */  lw        $s6, 0x28($sp)
/* 38CCB4 E008A6C4 8FB50024 */  lw        $s5, 0x24($sp)
/* 38CCB8 E008A6C8 8FB40020 */  lw        $s4, 0x20($sp)
/* 38CCBC E008A6CC 8FB3001C */  lw        $s3, 0x1C($sp)
/* 38CCC0 E008A6D0 8FB20018 */  lw        $s2, 0x18($sp)
/* 38CCC4 E008A6D4 8FB10014 */  lw        $s1, 0x14($sp)
/* 38CCC8 E008A6D8 8FB00010 */  lw        $s0, 0x10($sp)
/* 38CCCC E008A6DC 03E00008 */  jr        $ra
/* 38CCD0 E008A6E0 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void snowfall_update(EffectInstance* effect) {
    Camera* camera = &gCameras[gCurrentCameraID];
    SnowfallFXData* data = effect->data.snowfall;
    s32 timeLeft;
    s32 boomLength;
    s32 temp_s5;
    s32 temp_s6;
    s32 i;

    if (data->timeLeft < 100) {
        data->timeLeft--;
    }
    if (data->timeLeft < 0) {
        shim_remove_effect(effect);
        return;
    }

    data->lifeTime++;
    timeLeft = data->timeLeft;
    temp_s5 = data->unk_2C;
    if (timeLeft < 10) {
        data->unk_28 = timeLeft * 25;
    }
    boomLength = camera->currentBoomLength;
    temp_s6 = (boomLength * 0.3) + 1.0;

    data++;
    for (i = 0; i < temp_s5; i++, data++) {
        if (data->unk_30 <= 0 || --data->unk_30 <= 0) {
            data->unk_08 += data->unk_14;
            data->unk_0C += data->unk_18;
            data->unk_10 += data->unk_1C;
            func_E008A290(data, boomLength, temp_s6, timeLeft);
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel fio_fetch_saved_file_info
/* 6554 8002B154 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 6558 8002B158 AFB20018 */  sw        $s2, 0x18($sp)
/* 655C 8002B15C 3C12800A */  lui       $s2, %hi(D_8009A6B0)
/* 6560 8002B160 2652A6B0 */  addiu     $s2, $s2, %lo(D_8009A6B0)
/* 6564 8002B164 AFB40020 */  sw        $s4, 0x20($sp)
/* 6568 8002B168 0240A02D */  daddu     $s4, $s2, $zero
/* 656C 8002B16C AFB00010 */  sw        $s0, 0x10($sp)
/* 6570 8002B170 0000802D */  daddu     $s0, $zero, $zero
/* 6574 8002B174 2404FFFF */  addiu     $a0, $zero, -0x1
/* 6578 8002B178 3C03800A */  lui       $v1, %hi(logicalSaveInfo)
/* 657C 8002B17C 2463BA30 */  addiu     $v1, $v1, %lo(logicalSaveInfo)
/* 6580 8002B180 AFBF0024 */  sw        $ra, 0x24($sp)
/* 6584 8002B184 AFB3001C */  sw        $s3, 0x1C($sp)
/* 6588 8002B188 AFB10014 */  sw        $s1, 0x14($sp)
.L8002B18C:
/* 658C 8002B18C AC640000 */  sw        $a0, 0x0($v1)
/* 6590 8002B190 AC640004 */  sw        $a0, 0x4($v1)
/* 6594 8002B194 26100001 */  addiu     $s0, $s0, 0x1
/* 6598 8002B198 2A020004 */  slti      $v0, $s0, 0x4
/* 659C 8002B19C 1440FFFB */  bnez      $v0, .L8002B18C
/* 65A0 8002B1A0 24630008 */   addiu    $v1, $v1, 0x8
/* 65A4 8002B1A4 0000802D */  daddu     $s0, $zero, $zero
/* 65A8 8002B1A8 3C13800A */  lui       $s3, %hi(logicalSaveInfo)
/* 65AC 8002B1AC 2673BA30 */  addiu     $s3, $s3, %lo(logicalSaveInfo)
/* 65B0 8002B1B0 3C11800A */  lui       $s1, %hi(physicalSaveInfo)
/* 65B4 8002B1B4 2631BA50 */  addiu     $s1, $s1, %lo(physicalSaveInfo)
.L8002B1B8:
/* 65B8 8002B1B8 0200202D */  daddu     $a0, $s0, $zero
/* 65BC 8002B1BC 0280282D */  daddu     $a1, $s4, $zero
/* 65C0 8002B1C0 0C00AE1A */  jal       fio_read_flash
glabel func_8002B1C4
/* 65C4 8002B1C4 24061380 */   addiu    $a2, $zero, 0x1380
/* 65C8 8002B1C8 0C00AC3E */  jal       fio_validate_file_checksum
/* 65CC 8002B1CC 0280202D */   daddu    $a0, $s4, $zero
/* 65D0 8002B1D0 50400014 */  beql      $v0, $zero, .L8002B224
/* 65D4 8002B1D4 26100001 */   addiu    $s0, $s0, 0x1
/* 65D8 8002B1D8 8E420038 */  lw        $v0, 0x38($s2)
/* 65DC 8002B1DC AE220000 */  sw        $v0, 0x0($s1)
/* 65E0 8002B1E0 8E42003C */  lw        $v0, 0x3C($s2)
/* 65E4 8002B1E4 AE220004 */  sw        $v0, 0x4($s1)
/* 65E8 8002B1E8 8E420038 */  lw        $v0, 0x38($s2)
/* 65EC 8002B1EC 8E43003C */  lw        $v1, 0x3C($s2)
/* 65F0 8002B1F0 000210C0 */  sll       $v0, $v0, 3
/* 65F4 8002B1F4 00532021 */  addu      $a0, $v0, $s3
/* 65F8 8002B1F8 8C820004 */  lw        $v0, 0x4($a0)
/* 65FC 8002B1FC 0043102A */  slt       $v0, $v0, $v1
/* 6600 8002B200 50400008 */  beql      $v0, $zero, .L8002B224
/* 6604 8002B204 26100001 */   addiu    $s0, $s0, 0x1
/* 6608 8002B208 AC900000 */  sw        $s0, 0x0($a0)
/* 660C 8002B20C 8E420038 */  lw        $v0, 0x38($s2)
/* 6610 8002B210 8E43003C */  lw        $v1, 0x3C($s2)
/* 6614 8002B214 000210C0 */  sll       $v0, $v0, 3
/* 6618 8002B218 00531021 */  addu      $v0, $v0, $s3
glabel func_8002B21C
/* 661C 8002B21C AC430004 */  sw        $v1, 0x4($v0)
/* 6620 8002B220 26100001 */  addiu     $s0, $s0, 0x1
.L8002B224:
/* 6624 8002B224 2A020006 */  slti      $v0, $s0, 0x6
/* 6628 8002B228 1440FFE3 */  bnez      $v0, .L8002B1B8
/* 662C 8002B22C 26310008 */   addiu    $s1, $s1, 0x8
/* 6630 8002B230 3C067FFF */  lui       $a2, (0x7FFFFFFF >> 16)
/* 6634 8002B234 34C6FFFF */  ori       $a2, $a2, (0x7FFFFFFF & 0xFFFF)
/* 6638 8002B238 0000202D */  daddu     $a0, $zero, $zero
/* 663C 8002B23C 3C09800A */  lui       $t1, %hi(logicalSaveInfo)
/* 6640 8002B240 2529BA30 */  addiu     $t1, $t1, %lo(logicalSaveInfo)
/* 6644 8002B244 24080004 */  addiu     $t0, $zero, 0x4
/* 6648 8002B248 3C07800A */  lui       $a3, %hi(nextAvailableSavePage)
/* 664C 8002B24C 24E7BA80 */  addiu     $a3, $a3, %lo(nextAvailableSavePage)
/* 6650 8002B250 3C05800A */  lui       $a1, %hi(physicalSaveInfo)
/* 6654 8002B254 24A5BA50 */  addiu     $a1, $a1, %lo(physicalSaveInfo)
.L8002B258:
/* 6658 8002B258 0000802D */  daddu     $s0, $zero, $zero
/* 665C 8002B25C 0120182D */  daddu     $v1, $t1, $zero
.L8002B260:
/* 6660 8002B260 8C620000 */  lw        $v0, 0x0($v1)
/* 6664 8002B264 10820005 */  beq       $a0, $v0, .L8002B27C
/* 6668 8002B268 00000000 */   nop
/* 666C 8002B26C 26100001 */  addiu     $s0, $s0, 0x1
/* 6670 8002B270 2A020004 */  slti      $v0, $s0, 0x4
/* 6674 8002B274 1440FFFA */  bnez      $v0, .L8002B260
/* 6678 8002B278 24630008 */   addiu    $v1, $v1, 0x8
.L8002B27C:
/* 667C 8002B27C 56080008 */  bnel      $s0, $t0, .L8002B2A0
/* 6680 8002B280 24840001 */   addiu    $a0, $a0, 0x1
/* 6684 8002B284 8CA30004 */  lw        $v1, 0x4($a1)
/* 6688 8002B288 0066102A */  slt       $v0, $v1, $a2
glabel func_8002B28C
/* 668C 8002B28C 50400004 */  beql      $v0, $zero, .L8002B2A0
/* 6690 8002B290 24840001 */   addiu    $a0, $a0, 0x1
/* 6694 8002B294 0060302D */  daddu     $a2, $v1, $zero
/* 6698 8002B298 ACE40000 */  sw        $a0, 0x0($a3)
/* 669C 8002B29C 24840001 */  addiu     $a0, $a0, 0x1
.L8002B2A0:
/* 66A0 8002B2A0 28820006 */  slti      $v0, $a0, 0x6
/* 66A4 8002B2A4 1440FFEC */  bnez      $v0, .L8002B258
/* 66A8 8002B2A8 24A50008 */   addiu    $a1, $a1, 0x8
/* 66AC 8002B2AC 8FBF0024 */  lw        $ra, 0x24($sp)
/* 66B0 8002B2B0 8FB40020 */  lw        $s4, 0x20($sp)
/* 66B4 8002B2B4 8FB3001C */  lw        $s3, 0x1C($sp)
/* 66B8 8002B2B8 8FB20018 */  lw        $s2, 0x18($sp)
/* 66BC 8002B2BC 8FB10014 */  lw        $s1, 0x14($sp)
/* 66C0 8002B2C0 8FB00010 */  lw        $s0, 0x10($sp)
/* 66C4 8002B2C4 24020001 */  addiu     $v0, $zero, 0x1
/* 66C8 8002B2C8 03E00008 */  jr        $ra
/* 66CC 8002B2CC 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

s32 fio_fetch_saved_file_info(void) {
    SaveData* buffer = &D_8009A6B0; // temps required to match
    SaveData* buffer2 = buffer;
    s32 i, j, savePage;

    for (i = 0; i < ARRAY_COUNT(logicalSaveInfo); i++) {
        logicalSaveInfo[i][0] = -1;
        logicalSaveInfo[i][1] = -1;
    }

    for (i = 0; i < ARRAY_COUNT(physicalSaveInfo); i++) {
        fio_read_flash(i, buffer, sizeof(SaveData));
        if (fio_validate_file_checksum(buffer)) {
            physicalSaveInfo[i][0] = buffer2->saveSlot;
            physicalSaveInfo[i][1] = buffer2->saveCount;
            if (logicalSaveInfo[buffer2->saveSlot][1] < buffer2->saveCount) {
                logicalSaveInfo[buffer2->saveSlot][0] = i;
                logicalSaveInfo[buffer2->saveSlot][1] = buffer2->saveCount;
            }
        }
    }

    savePage = 0x7FFFFFFF;
    for (j = 0; j < ARRAY_COUNT(physicalSaveInfo); j++) {
        for (i = 0; i < ARRAY_COUNT(logicalSaveInfo); i++) {
            if (j == logicalSaveInfo[i][0]) {
                break;
            }
        }

        if (i == ARRAY_COUNT(logicalSaveInfo)) {
            if (physicalSaveInfo[j][1] < savePage) {
                savePage = physicalSaveInfo[j][1];
                nextAvailableSavePage = j;
            }
        }
    }
    return TRUE;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80117D00
/* AE400 80117D00 27BDFF20 */  addiu     $sp, $sp, -0xE0
/* AE404 80117D04 AFBF00DC */  sw        $ra, 0xDC($sp)
/* AE408 80117D08 AFB600D8 */  sw        $s6, 0xD8($sp)
/* AE40C 80117D0C AFB500D4 */  sw        $s5, 0xD4($sp)
/* AE410 80117D10 AFB400D0 */  sw        $s4, 0xD0($sp)
/* AE414 80117D14 AFB300CC */  sw        $s3, 0xCC($sp)
/* AE418 80117D18 AFB200C8 */  sw        $s2, 0xC8($sp)
/* AE41C 80117D1C AFB100C4 */  sw        $s1, 0xC4($sp)
/* AE420 80117D20 AFB000C0 */  sw        $s0, 0xC0($sp)
/* AE424 80117D24 8C930008 */  lw        $s3, 0x8($a0)
/* AE428 80117D28 8E630000 */  lw        $v1, 0x0($s3)
/* AE42C 80117D2C 24020002 */  addiu     $v0, $zero, 0x2
/* AE430 80117D30 10620044 */  beq       $v1, $v0, .L80117E44
/* AE434 80117D34 0080802D */   daddu    $s0, $a0, $zero
/* AE438 80117D38 8E620010 */  lw        $v0, 0x10($s3)
/* AE43C 80117D3C 10400043 */  beqz      $v0, .L80117E4C
/* AE440 80117D40 00000000 */   nop
/* AE444 80117D44 8C52000C */  lw        $s2, 0xC($v0)
/* AE448 80117D48 12400040 */  beqz      $s2, .L80117E4C
/* AE44C 80117D4C 00000000 */   nop
/* AE450 80117D50 1A40003E */  blez      $s2, .L80117E4C
/* AE454 80117D54 0000882D */   daddu    $s1, $zero, $zero
/* AE458 80117D58 249500B0 */  addiu     $s5, $a0, 0xB0
/* AE45C 80117D5C 24160002 */  addiu     $s6, $zero, 0x2
/* AE460 80117D60 3C148015 */  lui       $s4, %hi(mdl_treeIterPos)
/* AE464 80117D64 26943224 */  addiu     $s4, $s4, %lo(mdl_treeIterPos)
/* AE468 80117D68 27A30010 */  addiu     $v1, $sp, 0x10
.L80117D6C:
/* AE46C 80117D6C 0200102D */  daddu     $v0, $s0, $zero
.L80117D70:
/* AE470 80117D70 8C460000 */  lw        $a2, 0x0($v0)
/* AE474 80117D74 8C470004 */  lw        $a3, 0x4($v0)
/* AE478 80117D78 8C480008 */  lw        $t0, 0x8($v0)
/* AE47C 80117D7C 8C49000C */  lw        $t1, 0xC($v0)
/* AE480 80117D80 AC660000 */  sw        $a2, 0x0($v1)
/* AE484 80117D84 AC670004 */  sw        $a3, 0x4($v1)
/* AE488 80117D88 AC680008 */  sw        $t0, 0x8($v1)
/* AE48C 80117D8C AC69000C */  sw        $t1, 0xC($v1)
/* AE490 80117D90 24420010 */  addiu     $v0, $v0, 0x10
/* AE494 80117D94 1455FFF6 */  bne       $v0, $s5, .L80117D70
/* AE498 80117D98 24630010 */   addiu    $v1, $v1, 0x10
/* AE49C 80117D9C 96020000 */  lhu       $v0, 0x0($s0)
/* AE4A0 80117DA0 A7A20010 */  sh        $v0, 0x10($sp)
/* AE4A4 80117DA4 8E020010 */  lw        $v0, 0x10($s0)
/* AE4A8 80117DA8 AFA20020 */  sw        $v0, 0x20($sp)
/* AE4AC 80117DAC 8E620010 */  lw        $v0, 0x10($s3)
/* AE4B0 80117DB0 8C430010 */  lw        $v1, 0x10($v0)
/* AE4B4 80117DB4 00111080 */  sll       $v0, $s1, 2
/* AE4B8 80117DB8 00431021 */  addu      $v0, $v0, $v1
/* AE4BC 80117DBC 8C440000 */  lw        $a0, 0x0($v0)
/* AE4C0 80117DC0 AFA40018 */  sw        $a0, 0x18($sp)
/* AE4C4 80117DC4 920200A4 */  lbu       $v0, 0xA4($s0)
/* AE4C8 80117DC8 A3A200B4 */  sb        $v0, 0xB4($sp)
/* AE4CC 80117DCC 920200A5 */  lbu       $v0, 0xA5($s0)
/* AE4D0 80117DD0 A3A200B5 */  sb        $v0, 0xB5($sp)
/* AE4D4 80117DD4 8C820000 */  lw        $v0, 0x0($a0)
/* AE4D8 80117DD8 14560003 */  bne       $v0, $s6, .L80117DE8
/* AE4DC 80117DDC 0000102D */   daddu    $v0, $zero, $zero
/* AE4E0 80117DE0 0C0456C3 */  jal       get_model_property
/* AE4E4 80117DE4 2405005C */   addiu    $a1, $zero, 0x5C
.L80117DE8:
/* AE4E8 80117DE8 50400003 */  beql      $v0, $zero, .L80117DF8
/* AE4EC 80117DEC A3A000B6 */   sb       $zero, 0xB6($sp)
/* AE4F0 80117DF0 9042000B */  lbu       $v0, 0xB($v0)
/* AE4F4 80117DF4 A3A200B6 */  sb        $v0, 0xB6($sp)
.L80117DF8:
/* AE4F8 80117DF8 8E820000 */  lw        $v0, 0x0($s4)
/* AE4FC 80117DFC 3C03800A */  lui       $v1, %hi(mdl_currentModelTreeNodeInfo)
/* AE500 80117E00 8C63A5F4 */  lw        $v1, %lo(mdl_currentModelTreeNodeInfo)($v1)
/* AE504 80117E04 00021080 */  sll       $v0, $v0, 2
/* AE508 80117E08 00431021 */  addu      $v0, $v0, $v1
/* AE50C 80117E0C 90420002 */  lbu       $v0, 0x2($v0)
/* AE510 80117E10 27A40010 */  addiu     $a0, $sp, 0x10
/* AE514 80117E14 A3A000B9 */  sb        $zero, 0xB9($sp)
/* AE518 80117E18 0C045F40 */  jal       func_80117D00
/* AE51C 80117E1C A3A200B8 */   sb       $v0, 0xB8($sp)
/* AE520 80117E20 8E820000 */  lw        $v0, 0x0($s4)
/* AE524 80117E24 26310001 */  addiu     $s1, $s1, 0x1
/* AE528 80117E28 24420001 */  addiu     $v0, $v0, 0x1
/* AE52C 80117E2C AE820000 */  sw        $v0, 0x0($s4)
/* AE530 80117E30 0232102A */  slt       $v0, $s1, $s2
/* AE534 80117E34 1440FFCD */  bnez      $v0, .L80117D6C
/* AE538 80117E38 27A30010 */   addiu    $v1, $sp, 0x10
/* AE53C 80117E3C 08045F93 */  j         .L80117E4C
/* AE540 80117E40 00000000 */   nop
.L80117E44:
/* AE544 80117E44 0C044C24 */  jal       appendGfx_model
/* AE548 80117E48 0200202D */   daddu    $a0, $s0, $zero
.L80117E4C:
/* AE54C 80117E4C 8FBF00DC */  lw        $ra, 0xDC($sp)
/* AE550 80117E50 8FB600D8 */  lw        $s6, 0xD8($sp)
/* AE554 80117E54 8FB500D4 */  lw        $s5, 0xD4($sp)
/* AE558 80117E58 8FB400D0 */  lw        $s4, 0xD0($sp)
/* AE55C 80117E5C 8FB300CC */  lw        $s3, 0xCC($sp)
/* AE560 80117E60 8FB200C8 */  lw        $s2, 0xC8($sp)
/* AE564 80117E64 8FB100C4 */  lw        $s1, 0xC4($sp)
/* AE568 80117E68 8FB000C0 */  lw        $s0, 0xC0($sp)
/* AE56C 80117E6C 03E00008 */  jr        $ra
/* AE570 80117E70 27BD00E0 */   addiu    $sp, $sp, 0xE0

### DECOMPILED C INSTRUCTIONS:

void func_80117D00(Model* model) {
    Model* mdl = model; // temps needed to match
    ModelNode* modelNode = mdl->modelNode;

    if (model->modelNode->type != SHAPE_TYPE_MODEL) {
        if (modelNode->groupData != NULL) {
            s32 numChildren = modelNode->groupData->numChildren;

            if (numChildren != 0) {
                s32 i;

                for (i = 0; i < numChildren; i++, mdl_treeIterPos++) {
                    Model newModel = *mdl;
                    ModelNodeProperty* prop;

                    newModel.flags = mdl->flags;
                    newModel.currentSpecialMatrix = mdl->currentSpecialMatrix;
                    newModel.modelNode = modelNode->groupData->childList[i];
                    newModel.texPannerID = mdl->texPannerID;
                    newModel.customGfxIndex = mdl->customGfxIndex;

                    if (newModel.modelNode->type == SHAPE_TYPE_MODEL) {
                        prop = get_model_property(newModel.modelNode, MODEL_PROP_KEY_RENDER_MODE);
                    } else {
                        prop = NULL;
                    }

                    if (prop != NULL) {
                        newModel.renderMode = prop->data.s;
                    } else {
                        newModel.renderMode = 0;
                    }

                    newModel.textureID = (*mdl_currentModelTreeNodeInfo)[mdl_treeIterPos].textureID;
                    newModel.textureVariation = 0;
                    func_80117D00(&newModel);
                }
            }
        }
    } else {
        appendGfx_model(mdl);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel shape_spell_main
/* 339250 E0024000 27BDFFB0 */  addiu     $sp, $sp, -0x50
/* 339254 E0024004 F7B40038 */  sdc1      $f20, 0x38($sp)
/* 339258 E0024008 4485A000 */  mtc1      $a1, $f20
/* 33925C E002400C F7B60040 */  sdc1      $f22, 0x40($sp)
/* 339260 E0024010 4486B000 */  mtc1      $a2, $f22
/* 339264 E0024014 AFB1002C */  sw        $s1, 0x2C($sp)
/* 339268 E0024018 0080882D */  daddu     $s1, $a0, $zero
/* 33926C E002401C F7B80048 */  sdc1      $f24, 0x48($sp)
/* 339270 E0024020 4487C000 */  mtc1      $a3, $f24
/* 339274 E0024024 27A40010 */  addiu     $a0, $sp, 0x10
/* 339278 E0024028 AFB20030 */  sw        $s2, 0x30($sp)
/* 33927C E002402C 8FB2006C */  lw        $s2, 0x6C($sp)
/* 339280 E0024030 3C02E002 */  lui       $v0, %hi(shape_spell_init)
/* 339284 E0024034 24424180 */  addiu     $v0, $v0, %lo(shape_spell_init)
/* 339288 E0024038 AFA20018 */  sw        $v0, 0x18($sp)
/* 33928C E002403C 3C02E002 */  lui       $v0, %hi(shape_spell_update)
/* 339290 E0024040 24424188 */  addiu     $v0, $v0, %lo(shape_spell_update)
/* 339294 E0024044 AFA2001C */  sw        $v0, 0x1C($sp)
/* 339298 E0024048 3C02E002 */  lui       $v0, %hi(shape_spell_render)
/* 33929C E002404C 244242E0 */  addiu     $v0, $v0, %lo(shape_spell_render)
/* 3392A0 E0024050 AFA20020 */  sw        $v0, 0x20($sp)
/* 3392A4 E0024054 24020012 */  addiu     $v0, $zero, 0x12
/* 3392A8 E0024058 AFBF0034 */  sw        $ra, 0x34($sp)
/* 3392AC E002405C AFB00028 */  sw        $s0, 0x28($sp)
/* 3392B0 E0024060 AFA00010 */  sw        $zero, 0x10($sp)
/* 3392B4 E0024064 AFA00024 */  sw        $zero, 0x24($sp)
/* 3392B8 E0024068 0C080124 */  jal       shim_create_effect_instance
/* 3392BC E002406C AFA20014 */   sw       $v0, 0x14($sp)
/* 3392C0 E0024070 24040038 */  addiu     $a0, $zero, 0x38
/* 3392C4 E0024074 24030001 */  addiu     $v1, $zero, 0x1
/* 3392C8 E0024078 0040802D */  daddu     $s0, $v0, $zero
/* 3392CC E002407C 0C08012C */  jal       shim_general_heap_malloc
/* 3392D0 E0024080 AE030008 */   sw       $v1, 0x8($s0)
/* 3392D4 E0024084 0040182D */  daddu     $v1, $v0, $zero
/* 3392D8 E0024088 14600003 */  bnez      $v1, .LE0024098
/* 3392DC E002408C AE02000C */   sw       $v0, 0xC($s0)
.LE0024090:
/* 3392E0 E0024090 08009024 */  j         .LE0024090
/* 3392E4 E0024094 00000000 */   nop
.LE0024098:
/* 3392E8 E0024098 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 3392EC E002409C 44810000 */  mtc1      $at, $f0
/* 3392F0 E00240A0 240200FF */  addiu     $v0, $zero, 0xFF
/* 3392F4 E00240A4 AC60002C */  sw        $zero, 0x2C($v1)
/* 3392F8 E00240A8 AC710000 */  sw        $s1, 0x0($v1)
/* 3392FC E00240AC AC620034 */  sw        $v0, 0x34($v1)
/* 339300 E00240B0 E4740004 */  swc1      $f20, 0x4($v1)
/* 339304 E00240B4 E4760008 */  swc1      $f22, 0x8($v1)
/* 339308 E00240B8 E478000C */  swc1      $f24, 0xC($v1)
/* 33930C E00240BC 16200019 */  bnez      $s1, .LE0024124
/* 339310 E00240C0 E4600028 */   swc1     $f0, 0x28($v1)
/* 339314 E00240C4 C7A60060 */  lwc1      $f6, 0x60($sp)
/* 339318 E00240C8 46143181 */  sub.s     $f6, $f6, $f20
/* 33931C E00240CC 44921000 */  mtc1      $s2, $f2
/* 339320 E00240D0 00000000 */  nop
/* 339324 E00240D4 468010A0 */  cvt.s.w   $f2, $f2
/* 339328 E00240D8 46020083 */  div.s     $f2, $f0, $f2
/* 33932C E00240DC 46023182 */  mul.s     $f6, $f6, $f2
/* 339330 E00240E0 00000000 */  nop
/* 339334 E00240E4 C7A40064 */  lwc1      $f4, 0x64($sp)
/* 339338 E00240E8 46162101 */  sub.s     $f4, $f4, $f22
/* 33933C E00240EC 46022102 */  mul.s     $f4, $f4, $f2
/* 339340 E00240F0 00000000 */  nop
/* 339344 E00240F4 C7A00068 */  lwc1      $f0, 0x68($sp)
/* 339348 E00240F8 46180001 */  sub.s     $f0, $f0, $f24
/* 33934C E00240FC AC600010 */  sw        $zero, 0x10($v1)
/* 339350 E0024100 AC600014 */  sw        $zero, 0x14($v1)
/* 339354 E0024104 46020002 */  mul.s     $f0, $f0, $f2
/* 339358 E0024108 00000000 */  nop
/* 33935C E002410C AC600018 */  sw        $zero, 0x18($v1)
/* 339360 E0024110 AC720030 */  sw        $s2, 0x30($v1)
/* 339364 E0024114 E466001C */  swc1      $f6, 0x1C($v1)
/* 339368 E0024118 E4640020 */  swc1      $f4, 0x20($v1)
/* 33936C E002411C 08009056 */  j         .LE0024158
/* 339370 E0024120 E4600024 */   swc1     $f0, 0x24($v1)
.LE0024124:
/* 339374 E0024124 3C0141E8 */  lui       $at, (0x41E80000 >> 16)
/* 339378 E0024128 44810000 */  mtc1      $at, $f0
/* 33937C E002412C 3C0140C6 */  lui       $at, (0x40C66666 >> 16)
/* 339380 E0024130 34216666 */  ori       $at, $at, (0x40C66666 & 0xFFFF)
/* 339384 E0024134 44811000 */  mtc1      $at, $f2
/* 339388 E0024138 24020018 */  addiu     $v0, $zero, 0x18
/* 33938C E002413C AC600014 */  sw        $zero, 0x14($v1)
/* 339390 E0024140 AC600018 */  sw        $zero, 0x18($v1)
/* 339394 E0024144 AC600020 */  sw        $zero, 0x20($v1)
/* 339398 E0024148 AC600024 */  sw        $zero, 0x24($v1)
/* 33939C E002414C AC620030 */  sw        $v0, 0x30($v1)
/* 3393A0 E0024150 E4600010 */  swc1      $f0, 0x10($v1)
/* 3393A4 E0024154 E462001C */  swc1      $f2, 0x1C($v1)
.LE0024158:
/* 3393A8 E0024158 0200102D */  daddu     $v0, $s0, $zero
/* 3393AC E002415C 8FBF0034 */  lw        $ra, 0x34($sp)
/* 3393B0 E0024160 8FB20030 */  lw        $s2, 0x30($sp)
/* 3393B4 E0024164 8FB1002C */  lw        $s1, 0x2C($sp)
/* 3393B8 E0024168 8FB00028 */  lw        $s0, 0x28($sp)
/* 3393BC E002416C D7B80048 */  ldc1      $f24, 0x48($sp)
/* 3393C0 E0024170 D7B60040 */  ldc1      $f22, 0x40($sp)
/* 3393C4 E0024174 D7B40038 */  ldc1      $f20, 0x38($sp)
/* 3393C8 E0024178 03E00008 */  jr        $ra
/* 3393CC E002417C 27BD0050 */   addiu    $sp, $sp, 0x50

### DECOMPILED C INSTRUCTIONS:

EffectInstance* shape_spell_main(s32 isChild, f32 x, f32 y, f32 z, f32 arg4, f32 arg5, f32 arg6, s32 arg7) {
    EffectBlueprint bp;
    EffectBlueprint* bpPtr = &bp;
    EffectInstance* effect;
    ShapeSpellFXData* part;
    s32 numParts = 1;

    bp.init = shape_spell_init;
    bp.update = shape_spell_update;
    bp.renderWorld = shape_spell_render;
    bp.unk_00 = 0;
    bp.renderUI = NULL;
    bp.effectID = EFFECT_SHAPE_SPELL;

    effect = shim_create_effect_instance(bpPtr);
    effect->numParts = numParts;
    part = effect->data.shapeSpell = shim_general_heap_malloc(numParts * sizeof(*part));

    ASSERT(effect->data.shapeSpell != NULL);

    part->unk_2C = 0;
    part->isChild = isChild;
    part->unk_34 = 255;
    part->pos.x = x;
    part->pos.y = y;
    part->pos.z = z;
    part->unk_28 = 1.0f;
    if (!isChild) {
        part->unk_10 = 0;
        part->unk_14 = 0.0f;
        part->unk_18 = 0.0f;
        part->timeLeft = arg7;
        part->unk_1C = (arg4 - x) * (1.0f / arg7);
        part->unk_20 = (arg5 - y) * (1.0f / arg7);
        part->unk_24 = (arg6 - z) * (1.0f / arg7);
    } else {
        part->unk_10 = 29.f;
        part->unk_14 = 0.0f;
        part->unk_18 = 0.0f;
        part->unk_1C = 6.2f;
        part->unk_20 = 0.0f;
        part->unk_24 = 0.0f;
        part->timeLeft = 24;
    }

    return effect;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_E00D8630
/* 3D6DF0 E00D8630 27BDFFA8 */  addiu     $sp, $sp, -0x58
/* 3D6DF4 E00D8634 3C07DB06 */  lui       $a3, (0xDB060024 >> 16)
/* 3D6DF8 E00D8638 3C06800A */  lui       $a2, %hi(gMainGfxPos)
/* 3D6DFC E00D863C 24C6A66C */  addiu     $a2, $a2, %lo(gMainGfxPos)
/* 3D6E00 E00D8640 34E70024 */  ori       $a3, $a3, (0xDB060024 & 0xFFFF)
/* 3D6E04 E00D8644 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 3D6E08 E00D8648 AFBF0050 */  sw        $ra, 0x50($sp)
/* 3D6E0C E00D864C 8CC50000 */  lw        $a1, 0x0($a2)
/* 3D6E10 E00D8650 8C88000C */  lw        $t0, 0xC($a0)
/* 3D6E14 E00D8654 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 3D6E18 E00D8658 44810000 */  mtc1      $at, $f0
/* 3D6E1C E00D865C 00A0182D */  daddu     $v1, $a1, $zero
/* 3D6E20 E00D8660 24A50008 */  addiu     $a1, $a1, 0x8
/* 3D6E24 E00D8664 AC620000 */  sw        $v0, 0x0($v1)
/* 3D6E28 E00D8668 AC600004 */  sw        $zero, 0x4($v1)
/* 3D6E2C E00D866C ACA70000 */  sw        $a3, 0x0($a1)
/* 3D6E30 E00D8670 8C820010 */  lw        $v0, 0x10($a0)
/* 3D6E34 E00D8674 24040001 */  addiu     $a0, $zero, 0x1
/* 3D6E38 E00D8678 ACC50000 */  sw        $a1, 0x0($a2)
/* 3D6E3C E00D867C 8C42001C */  lw        $v0, 0x1C($v0)
/* 3D6E40 E00D8680 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 3D6E44 E00D8684 00431021 */  addu      $v0, $v0, $v1
/* 3D6E48 E00D8688 ACA20004 */  sw        $v0, 0x4($a1)
/* 3D6E4C E00D868C C502001C */  lwc1      $f2, 0x1C($t0)
/* 3D6E50 E00D8690 24A50008 */  addiu     $a1, $a1, 0x8
/* 3D6E54 E00D8694 46001032 */  c.eq.s    $f2, $f0
/* 3D6E58 E00D8698 00000000 */  nop
/* 3D6E5C E00D869C 45000012 */  bc1f      .LE00D86E8
/* 3D6E60 E00D86A0 ACC50000 */   sw       $a1, 0x0($a2)
/* 3D6E64 E00D86A4 C5000020 */  lwc1      $f0, 0x20($t0)
/* 3D6E68 E00D86A8 44801000 */  mtc1      $zero, $f2
/* 3D6E6C E00D86AC 00000000 */  nop
/* 3D6E70 E00D86B0 46020032 */  c.eq.s    $f0, $f2
/* 3D6E74 E00D86B4 00000000 */  nop
/* 3D6E78 E00D86B8 4500000B */  bc1f      .LE00D86E8
/* 3D6E7C E00D86BC 00000000 */   nop
/* 3D6E80 E00D86C0 C5000024 */  lwc1      $f0, 0x24($t0)
/* 3D6E84 E00D86C4 46020032 */  c.eq.s    $f0, $f2
/* 3D6E88 E00D86C8 00000000 */  nop
/* 3D6E8C E00D86CC 45000006 */  bc1f      .LE00D86E8
/* 3D6E90 E00D86D0 00000000 */   nop
/* 3D6E94 E00D86D4 C5000028 */  lwc1      $f0, 0x28($t0)
/* 3D6E98 E00D86D8 46020032 */  c.eq.s    $f0, $f2
/* 3D6E9C E00D86DC 00000000 */  nop
/* 3D6EA0 E00D86E0 45030001 */  bc1tl     .LE00D86E8
/* 3D6EA4 E00D86E4 0000202D */   daddu    $a0, $zero, $zero
.LE00D86E8:
/* 3D6EA8 E00D86E8 C5040004 */  lwc1      $f4, 0x4($t0)
/* 3D6EAC E00D86EC C508002C */  lwc1      $f8, 0x2C($t0)
/* 3D6EB0 E00D86F0 C5020008 */  lwc1      $f2, 0x8($t0)
/* 3D6EB4 E00D86F4 C50A0030 */  lwc1      $f10, 0x30($t0)
/* 3D6EB8 E00D86F8 C500000C */  lwc1      $f0, 0xC($t0)
/* 3D6EBC E00D86FC 24020096 */  addiu     $v0, $zero, 0x96
/* 3D6EC0 E00D8700 AFA20014 */  sw        $v0, 0x14($sp)
/* 3D6EC4 E00D8704 2402006B */  addiu     $v0, $zero, 0x6B
/* 3D6EC8 E00D8708 AFA20018 */  sw        $v0, 0x18($sp)
/* 3D6ECC E00D870C 240200FF */  addiu     $v0, $zero, 0xFF
/* 3D6ED0 E00D8710 AFA2001C */  sw        $v0, 0x1C($sp)
/* 3D6ED4 E00D8714 AFA00020 */  sw        $zero, 0x20($sp)
/* 3D6ED8 E00D8718 4600030D */  trunc.w.s $f12, $f0
/* 3D6EDC E00D871C E7AC0010 */  swc1      $f12, 0x10($sp)
/* 3D6EE0 E00D8720 C500001C */  lwc1      $f0, 0x1C($t0)
/* 3D6EE4 E00D8724 E7A00024 */  swc1      $f0, 0x24($sp)
/* 3D6EE8 E00D8728 C500001C */  lwc1      $f0, 0x1C($t0)
/* 3D6EEC E00D872C 3C02E00E */  lui       $v0, %hi(func_E00D8334)
/* 3D6EF0 E00D8730 24428334 */  addiu     $v0, $v0, %lo(func_E00D8334)
/* 3D6EF4 E00D8734 E7A00028 */  swc1      $f0, 0x28($sp)
/* 3D6EF8 E00D8738 C5000020 */  lwc1      $f0, 0x20($t0)
/* 3D6EFC E00D873C 3C05E00E */  lui       $a1, %hi(D_E00D87E0)
/* 3D6F00 E00D8740 24A587E0 */  addiu     $a1, $a1, %lo(D_E00D87E0)
/* 3D6F04 E00D8744 E7A0002C */  swc1      $f0, 0x2C($sp)
/* 3D6F08 E00D8748 C5000024 */  lwc1      $f0, 0x24($t0)
/* 3D6F0C E00D874C 46082100 */  add.s     $f4, $f4, $f8
/* 3D6F10 E00D8750 E7A00030 */  swc1      $f0, 0x30($sp)
/* 3D6F14 E00D8754 C5060028 */  lwc1      $f6, 0x28($t0)
/* 3D6F18 E00D8758 3C014296 */  lui       $at, (0x42960000 >> 16)
/* 3D6F1C E00D875C 44810000 */  mtc1      $at, $f0
/* 3D6F20 E00D8760 460A1080 */  add.s     $f2, $f2, $f10
/* 3D6F24 E00D8764 AFA20038 */  sw        $v0, 0x38($sp)
/* 3D6F28 E00D8768 24020140 */  addiu     $v0, $zero, 0x140
/* 3D6F2C E00D876C AFA20044 */  sw        $v0, 0x44($sp)
/* 3D6F30 E00D8770 46002101 */  sub.s     $f4, $f4, $f0
/* 3D6F34 E00D8774 3C014254 */  lui       $at, (0x42540000 >> 16)
/* 3D6F38 E00D8778 44810000 */  mtc1      $at, $f0
/* 3D6F3C E00D877C 240200F0 */  addiu     $v0, $zero, 0xF0
/* 3D6F40 E00D8780 AFA8003C */  sw        $t0, 0x3C($sp)
/* 3D6F44 E00D8784 AFA00040 */  sw        $zero, 0x40($sp)
/* 3D6F48 E00D8788 AFA20048 */  sw        $v0, 0x48($sp)
/* 3D6F4C E00D878C AFA0004C */  sw        $zero, 0x4C($sp)
/* 3D6F50 E00D8790 46001081 */  sub.s     $f2, $f2, $f0
/* 3D6F54 E00D8794 4600230D */  trunc.w.s $f12, $f4
/* 3D6F58 E00D8798 44066000 */  mfc1      $a2, $f12
/* 3D6F5C E00D879C 4600130D */  trunc.w.s $f12, $f2
/* 3D6F60 E00D87A0 44076000 */  mfc1      $a3, $f12
/* 3D6F64 E00D87A4 0C080190 */  jal       shim_draw_box
/* 3D6F68 E00D87A8 E7A60034 */   swc1     $f6, 0x34($sp)
/* 3D6F6C E00D87AC 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 3D6F70 E00D87B0 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 3D6F74 E00D87B4 8C620000 */  lw        $v0, 0x0($v1)
/* 3D6F78 E00D87B8 0040202D */  daddu     $a0, $v0, $zero
/* 3D6F7C E00D87BC 24420008 */  addiu     $v0, $v0, 0x8
/* 3D6F80 E00D87C0 AC620000 */  sw        $v0, 0x0($v1)
/* 3D6F84 E00D87C4 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 3D6F88 E00D87C8 AC820000 */  sw        $v0, 0x0($a0)
/* 3D6F8C E00D87CC AC800004 */  sw        $zero, 0x4($a0)
/* 3D6F90 E00D87D0 8FBF0050 */  lw        $ra, 0x50($sp)
/* 3D6F94 E00D87D4 03E00008 */  jr        $ra
/* 3D6F98 E00D87D8 27BD0058 */   addiu    $sp, $sp, 0x58
/* 3D6F9C E00D87DC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void func_E00D8630(EffectInstance* effect) {
    TattleWindowFXData* data = effect->data.tattleWindow;
    s32 flags;

    gDPPipeSync(gMainGfxPos++);
    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));

    if (data->scale == 1.0f && data->rot.x == 0.0f && data->rot.y == 0.0f && data->rot.z == 0.0f) {
        flags = 0;
    } else {
        flags = 1;
    }

    shim_draw_box(
        flags, &D_E00D87E0,
        (data->pos.x + data->offset.x) - 75.0f,
        (data->pos.y + data->offset.y) - 53.0f,
        data->pos.z,
        150, 107,
        255, 0,
        data->scale, data->scale,
        data->rot.x, data->rot.y, data->rot.z,
        (void (*)(void*)) func_E00D8334, data, NULL, SCREEN_WIDTH, SCREEN_HEIGHT, NULL);
    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel stars_spread_update
/* 3604BC E005A1FC 27BDFFE8 */  addiu     $sp, $sp, -0x18
/* 3604C0 E005A200 AFBF0010 */  sw        $ra, 0x10($sp)
/* 3604C4 E005A204 8C85000C */  lw        $a1, 0xC($a0)
/* 3604C8 E005A208 8CA20028 */  lw        $v0, 0x28($a1)
/* 3604CC E005A20C 8CA30024 */  lw        $v1, 0x24($a1)
/* 3604D0 E005A210 24420001 */  addiu     $v0, $v0, 0x1
/* 3604D4 E005A214 2463FFFF */  addiu     $v1, $v1, -0x1
/* 3604D8 E005A218 ACA20028 */  sw        $v0, 0x28($a1)
/* 3604DC E005A21C 04610005 */  bgez      $v1, .LE005A234
/* 3604E0 E005A220 ACA30024 */   sw       $v1, 0x24($a1)
/* 3604E4 E005A224 0C080128 */  jal       shim_remove_effect
/* 3604E8 E005A228 00000000 */   nop
/* 3604EC E005A22C 080168E9 */  j         .LE005A3A4
/* 3604F0 E005A230 00000000 */   nop
.LE005A234:
/* 3604F4 E005A234 8CA7002C */  lw        $a3, 0x2C($a1)
/* 3604F8 E005A238 8C820008 */  lw        $v0, 0x8($a0)
/* 3604FC E005A23C 24060001 */  addiu     $a2, $zero, 0x1
/* 360500 E005A240 00C2102A */  slt       $v0, $a2, $v0
/* 360504 E005A244 10400057 */  beqz      $v0, .LE005A3A4
/* 360508 E005A248 24A50034 */   addiu    $a1, $a1, 0x34
/* 36050C E005A24C 28690006 */  slti      $t1, $v1, 0x6
/* 360510 E005A250 28680005 */  slti      $t0, $v1, 0x5
/* 360514 E005A254 00C31004 */  sllv      $v0, $v1, $a2
/* 360518 E005A258 0047382A */  slt       $a3, $v0, $a3
/* 36051C E005A25C 24A3001C */  addiu     $v1, $a1, 0x1C
/* 360520 E005A260 3C01E006 */  lui       $at, (0xE0060000 >> 16)
/* 360524 E005A264 D428A750 */  ldc1      $f8, -0x58B0($at)
/* 360528 E005A268 3C01E006 */  lui       $at, (0xE0060000 >> 16)
/* 36052C E005A26C D42AA758 */  ldc1      $f10, -0x58A8($at)
/* 360530 E005A270 3C01E006 */  lui       $at, (0xE0060000 >> 16)
/* 360534 E005A274 D42CA760 */  ldc1      $f12, -0x58A0($at)
.LE005A278:
/* 360538 E005A278 15200013 */  bnez      $t1, .LE005A2C8
/* 36053C E005A27C 00000000 */   nop
/* 360540 E005A280 C464FFF4 */  lwc1      $f4, -0xC($v1)
/* 360544 E005A284 46002121 */  cvt.d.s   $f4, $f4
/* 360548 E005A288 46282102 */  mul.d     $f4, $f4, $f8
/* 36054C E005A28C 00000000 */  nop
/* 360550 E005A290 C462FFF8 */  lwc1      $f2, -0x8($v1)
/* 360554 E005A294 460010A1 */  cvt.d.s   $f2, $f2
/* 360558 E005A298 46281082 */  mul.d     $f2, $f2, $f8
/* 36055C E005A29C 00000000 */  nop
/* 360560 E005A2A0 C460FFFC */  lwc1      $f0, -0x4($v1)
/* 360564 E005A2A4 46000021 */  cvt.d.s   $f0, $f0
/* 360568 E005A2A8 46280002 */  mul.d     $f0, $f0, $f8
/* 36056C E005A2AC 00000000 */  nop
/* 360570 E005A2B0 46202120 */  cvt.s.d   $f4, $f4
/* 360574 E005A2B4 462010A0 */  cvt.s.d   $f2, $f2
/* 360578 E005A2B8 46200020 */  cvt.s.d   $f0, $f0
/* 36057C E005A2BC E464FFF4 */  swc1      $f4, -0xC($v1)
/* 360580 E005A2C0 E462FFF8 */  swc1      $f2, -0x8($v1)
/* 360584 E005A2C4 E460FFFC */  swc1      $f0, -0x4($v1)
.LE005A2C8:
/* 360588 E005A2C8 11000019 */  beqz      $t0, .LE005A330
/* 36058C E005A2CC 00000000 */   nop
/* 360590 E005A2D0 C4660004 */  lwc1      $f6, 0x4($v1)
/* 360594 E005A2D4 460031A1 */  cvt.d.s   $f6, $f6
/* 360598 E005A2D8 46283182 */  mul.d     $f6, $f6, $f8
/* 36059C E005A2DC 00000000 */  nop
/* 3605A0 E005A2E0 C464FFF4 */  lwc1      $f4, -0xC($v1)
/* 3605A4 E005A2E4 46002121 */  cvt.d.s   $f4, $f4
/* 3605A8 E005A2E8 462A2102 */  mul.d     $f4, $f4, $f10
/* 3605AC E005A2EC 00000000 */  nop
/* 3605B0 E005A2F0 C462FFF8 */  lwc1      $f2, -0x8($v1)
/* 3605B4 E005A2F4 460010A1 */  cvt.d.s   $f2, $f2
/* 3605B8 E005A2F8 462A1082 */  mul.d     $f2, $f2, $f10
/* 3605BC E005A2FC 00000000 */  nop
/* 3605C0 E005A300 C460FFFC */  lwc1      $f0, -0x4($v1)
/* 3605C4 E005A304 46000021 */  cvt.d.s   $f0, $f0
/* 3605C8 E005A308 462A0002 */  mul.d     $f0, $f0, $f10
/* 3605CC E005A30C 00000000 */  nop
/* 3605D0 E005A310 462031A0 */  cvt.s.d   $f6, $f6
/* 3605D4 E005A314 46202120 */  cvt.s.d   $f4, $f4
/* 3605D8 E005A318 462010A0 */  cvt.s.d   $f2, $f2
/* 3605DC E005A31C 46200020 */  cvt.s.d   $f0, $f0
/* 3605E0 E005A320 E4660004 */  swc1      $f6, 0x4($v1)
/* 3605E4 E005A324 E464FFF4 */  swc1      $f4, -0xC($v1)
/* 3605E8 E005A328 E462FFF8 */  swc1      $f2, -0x8($v1)
/* 3605EC E005A32C E460FFFC */  swc1      $f0, -0x4($v1)
.LE005A330:
/* 3605F0 E005A330 10E0000A */  beqz      $a3, .LE005A35C
/* 3605F4 E005A334 00000000 */   nop
/* 3605F8 E005A338 C4600014 */  lwc1      $f0, 0x14($v1)
/* 3605FC E005A33C 46000087 */  neg.s     $f2, $f0
/* 360600 E005A340 460010A1 */  cvt.d.s   $f2, $f2
/* 360604 E005A344 462C1082 */  mul.d     $f2, $f2, $f12
/* 360608 E005A348 00000000 */  nop
/* 36060C E005A34C 46000021 */  cvt.d.s   $f0, $f0
/* 360610 E005A350 46220000 */  add.d     $f0, $f0, $f2
/* 360614 E005A354 46200020 */  cvt.s.d   $f0, $f0
/* 360618 E005A358 E4600014 */  swc1      $f0, 0x14($v1)
.LE005A35C:
/* 36061C E005A35C C466FFE8 */  lwc1      $f6, -0x18($v1)
/* 360620 E005A360 C460FFF4 */  lwc1      $f0, -0xC($v1)
/* 360624 E005A364 C462FFEC */  lwc1      $f2, -0x14($v1)
/* 360628 E005A368 46003180 */  add.s     $f6, $f6, $f0
/* 36062C E005A36C C460FFF8 */  lwc1      $f0, -0x8($v1)
/* 360630 E005A370 C4640004 */  lwc1      $f4, 0x4($v1)
/* 360634 E005A374 46001080 */  add.s     $f2, $f2, $f0
/* 360638 E005A378 C4600000 */  lwc1      $f0, 0x0($v1)
/* 36063C E005A37C 24C60001 */  addiu     $a2, $a2, 0x1
/* 360640 E005A380 AC60FFF0 */  sw        $zero, -0x10($v1)
/* 360644 E005A384 46040000 */  add.s     $f0, $f0, $f4
/* 360648 E005A388 E466FFE8 */  swc1      $f6, -0x18($v1)
/* 36064C E005A38C E462FFEC */  swc1      $f2, -0x14($v1)
/* 360650 E005A390 E4600000 */  swc1      $f0, 0x0($v1)
/* 360654 E005A394 8C820008 */  lw        $v0, 0x8($a0)
/* 360658 E005A398 00C2102A */  slt       $v0, $a2, $v0
/* 36065C E005A39C 1440FFB6 */  bnez      $v0, .LE005A278
/* 360660 E005A3A0 24630034 */   addiu    $v1, $v1, 0x34
.LE005A3A4:
/* 360664 E005A3A4 8FBF0010 */  lw        $ra, 0x10($sp)
/* 360668 E005A3A8 03E00008 */  jr        $ra
/* 36066C E005A3AC 27BD0018 */   addiu    $sp, $sp, 0x18

### DECOMPILED C INSTRUCTIONS:

void stars_spread_update(EffectInstance* effect) {
    StarsSpreadFXData* part = effect->data.starsSpread;
    s32 unk_24;
    s32 unk_2C;
    s32 i;

    part->unk_28++;
    part->unk_24--;

    if (part->unk_24 < 0) {
        shim_remove_effect(effect);
        return;
    }

    unk_24 = part->unk_24;
    unk_2C = part->unk_2C;

    part++;
    for (i = 1; i < effect->numParts; i++, part++) {
        if (unk_24 >= 6) {
            part->unk_10 *= 0.8;
            part->unk_14 *= 0.8;
            part->unk_18 *= 0.8;
        }

        if (unk_24 < 5) {
            part->unk_20 *= 0.8;
            part->unk_10 *= 0.7;
            part->unk_14 *= 0.7;
            part->unk_18 *= 0.7;
        }

        if (unk_24 * 2 < unk_2C) {
            part->unk_30 += -part->unk_30 * 0.2;
        }

        part->unk_04 += part->unk_10;
        part->unk_08 += part->unk_14;
        part->unk_0C = 0;
        part->unk_1C += part->unk_20;
    }
}