---
# System prepended metadata

title: annotated crash_screen_draw_square

---

# annotated crash_screen_draw_square

```as
glabel crash_screen_draw_square
/* 004D44 80004144 27BDFFD0 */  addiu $sp, $sp, -0x30  ; 0x30 of stack
/* 004D48 80004148 AFB40028 */  sw    $s4, 0x28($sp)  ; store s4 to sp at offset 0x28
/* 004D4C 8000414C AFB30024 */  sw    $s3, 0x24($sp) ; store s3 to sp at offset 0x24
/* 004D50 80004150 AFB20020 */  sw    $s2, 0x20($sp) ; store s2 to sp at offset 0x20
/* 004D54 80004154 AFB00018 */  sw    $s0, 0x18($sp) ; store s0 to sp at offset 0x18
/* 004D58 80004158 00809825 */  move  $s3, $a0 ; move s3 to first argument
/* 004D5C 8000415C AFBF002C */  sw    $ra, 0x2c($sp) ; store return address to sp offset 0x2c
/* 004D60 80004160 AFB1001C */  sw    $s1, 0x1c($sp) ; store s1 to sp offset 0x1c
/* 004D64 80004164 2410002E */  li    $s0, 46 ; load 46 to s0
/* 004D68 80004168 24120028 */  li    $s2, 40 ; load 40 to s2
/* 004D6C 8000416C 2414002C */  li    $s4, 44 ; load 44 to s4

; load temps t5-t1
/* 004D70 80004170 240D0006 */  li    $t5, 6
/* 004D74 80004174 240C0006 */  li    $t4, 6
/* 004D78 80004178 240B0006 */  li    $t3, 6
/* 004D7C 8000417C 240A0006 */  li    $t2, 6
/* 004D80 80004180 24090006 */  li    $t1, 6

/* 004D84 80004184 3407FFFF */  li    $a3, 65535 ; load u16 size limit to a3
/* 004D88 80004188 3406F801 */  li    $a2, 63489 ; load.. that to a2

; comparisons
.L8000418C:
/* 004D8C 8000418C 0250082A */  slt   $at, $s2, $s0 ; set assembler value $at to 1 if $s2 (40?) is less than $s0 (46?)
/* 004D90 80004190 10200032 */  beqz  $at, .L8000425C ; if assembler value is equal to 0, jump to the end of the function
/* 004D94 80004194 02408825 */   move  $s1, $s2 ; move s1 to s2 (40?)
/* 004D98 80004198 0250082A */  slt   $at, $s2, $s0 ; set assembler value $at to 1 if $s2, which is $s1 (40?) is less than $s0 (46?)
.L8000419C:
/* 004D9C 8000419C 1020002C */  beqz  $at, .L80004250 ; if assembler value is equal to 0, jump to L80004250
/* 004DA0 800041A0 02401825 */   move  $v1, $s2 ; move result v1 to s2 (40?)
/* 004DA4 800041A4 00117080 */  sll   $t6, $s1, 2 ; shift t6 to s1, which is s2 (40?) by 2/decimals
/* 004DA8 800041A8 01D17021 */  addu  $t6, $t6, $s1 ; add s1 (40?) to t6
/* 004DAC 800041AC 02122023 */  subu  $a0, $s0, $s2 ; sub value of s0 (46) - s2 (40) to a0 = 6
/* 004DB0 800041B0 30880003 */  andi  $t0, $a0, 3
/* 004DB4 800041B4 000E79C0 */  sll   $t7, $t6, 7
/* 004DB8 800041B8 1100000C */  beqz  $t0, .L800041EC
/* 004DBC 800041BC 026FF821 */   addu  $ra, $s3, $t7
/* 004DC0 800041C0 0003C040 */  sll   $t8, $v1, 1
/* 004DC4 800041C4 03F81021 */  addu  $v0, $ra, $t8
/* 004DC8 800041C8 01122821 */  addu  $a1, $t0, $s2
.L800041CC:
/* 004DCC 800041CC 15240003 */  bne   $t1, $a0, .L800041DC
/* 004DD0 800041D0 24630001 */   addiu $v1, $v1, 1
/* 004DD4 800041D4 10000002 */  b     .L800041E0
/* 004DD8 800041D8 A4460000 */   sh    $a2, ($v0)
.L800041DC:
/* 004DDC 800041DC A4470000 */  sh    $a3, ($v0)
.L800041E0:
/* 004DE0 800041E0 14A3FFFA */  bne   $a1, $v1, .L800041CC
/* 004DE4 800041E4 24420002 */   addiu $v0, $v0, 2
/* 004DE8 800041E8 10700019 */  beq   $v1, $s0, .L80004250
.L800041EC:
/* 004DEC 800041EC 00032840 */   sll   $a1, $v1, 1
/* 004DF0 800041F0 03E51021 */  addu  $v0, $ra, $a1
/* 004DF4 800041F4 00104040 */  sll   $t0, $s0, 1
.L800041F8:
/* 004DF8 800041F8 15440003 */  bne   $t2, $a0, .L80004208
/* 004DFC 800041FC 24A50008 */   addiu $a1, $a1, 8
/* 004E00 80004200 10000002 */  b     .L8000420C
/* 004E04 80004204 A4460000 */   sh    $a2, ($v0)
.L80004208:
/* 004E08 80004208 A4470000 */  sh    $a3, ($v0)
.L8000420C:
/* 004E0C 8000420C 55640004 */  bnel  $t3, $a0, .L80004220
/* 004E10 80004210 A4470002 */   sh    $a3, 2($v0)
/* 004E14 80004214 10000002 */  b     .L80004220
/* 004E18 80004218 A4460002 */   sh    $a2, 2($v0)
/* 004E1C 8000421C A4470002 */  sh    $a3, 2($v0)
.L80004220:
/* 004E20 80004220 55840004 */  bnel  $t4, $a0, .L80004234
/* 004E24 80004224 A4470004 */   sh    $a3, 4($v0)
/* 004E28 80004228 10000002 */  b     .L80004234
/* 004E2C 8000422C A4460004 */   sh    $a2, 4($v0)
/* 004E30 80004230 A4470004 */  sh    $a3, 4($v0)
.L80004234:
/* 004E34 80004234 55A40004 */  bnel  $t5, $a0, .L80004248
/* 004E38 80004238 A4470006 */   sh    $a3, 6($v0)
/* 004E3C 8000423C 10000002 */  b     .L80004248
/* 004E40 80004240 A4460006 */   sh    $a2, 6($v0)
/* 004E44 80004244 A4470006 */  sh    $a3, 6($v0)
.L80004248:
/* 004E48 80004248 14A8FFEB */  bne   $a1, $t0, .L800041F8
/* 004E4C 8000424C 24420008 */   addiu $v0, $v0, 8
.L80004250:
/* 004E50 80004250 26310001 */  addiu $s1, $s1, 1
/* 004E54 80004254 5630FFD1 */  bnel  $s1, $s0, .L8000419C
/* 004E58 80004258 0250082A */   slt   $at, $s2, $s0
.L8000425C:  ; end
/* 004E5C 8000425C 2610FFFF */  addiu $s0, $s0, -1
/* 004E60 80004260 1690FFCA */  bne   $s4, $s0, .L8000418C
/* 004E64 80004264 26520001 */   addiu $s2, $s2, 1
/* 004E68 80004268 0C033624 */  jal   osWritebackDCacheAll
/* 004E6C 8000426C 00000000 */   nop   
/* 004E70 80004270 0C033684 */  jal   osViSwapBuffer
/* 004E74 80004274 02602025 */   move  $a0, $s3
/* 004E78 80004278 8FBF002C */  lw    $ra, 0x2c($sp)
/* 004E7C 8000427C 8FB00018 */  lw    $s0, 0x18($sp)
/* 004E80 80004280 8FB1001C */  lw    $s1, 0x1c($sp)
/* 004E84 80004284 8FB20020 */  lw    $s2, 0x20($sp)
/* 004E88 80004288 8FB30024 */  lw    $s3, 0x24($sp)
/* 004E8C 8000428C 8FB40028 */  lw    $s4, 0x28($sp)
/* 004E90 80004290 03E00008 */  jr    $ra
/* 004E94 80004294 27BD0030 */   addiu $sp, $sp, 0x30
``