papermario/asm/nonmatchings/os/code_46c70_len_e00/_Ldtob.s
2020-08-12 22:37:16 -04:00

325 lines
14 KiB
ArmAsm

.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel _Ldtob
/* 046FD0 8006BBD0 27BDFF80 */ addiu $sp, $sp, -0x80
/* 046FD4 8006BBD4 AFB30054 */ sw $s3, 0x54($sp)
/* 046FD8 8006BBD8 00809821 */ addu $s3, $a0, $zero
/* 046FDC 8006BBDC AFB1004C */ sw $s1, 0x4c($sp)
/* 046FE0 8006BBE0 27B10018 */ addiu $s1, $sp, 0x18
/* 046FE4 8006BBE4 AFBF0060 */ sw $ra, 0x60($sp)
/* 046FE8 8006BBE8 AFB5005C */ sw $s5, 0x5c($sp)
/* 046FEC 8006BBEC AFB40058 */ sw $s4, 0x58($sp)
/* 046FF0 8006BBF0 AFB20050 */ sw $s2, 0x50($sp)
/* 046FF4 8006BBF4 AFB00048 */ sw $s0, 0x48($sp)
/* 046FF8 8006BBF8 F7B80078 */ sdc1 $f24, 0x78($sp)
/* 046FFC 8006BBFC F7B60070 */ sdc1 $f22, 0x70($sp)
/* 047000 8006BC00 F7B40068 */ sdc1 $f20, 0x68($sp)
/* 047004 8006BC04 8E630024 */ lw $v1, 0x24($s3)
/* 047008 8006BC08 D6740000 */ ldc1 $f20, ($s3)
/* 04700C 8006BC0C 04610003 */ bgez $v1, .L8006BC1C
/* 047010 8006BC10 00A0A821 */ addu $s5, $a1, $zero
/* 047014 8006BC14 0801AF12 */ j .L8006BC48
/* 047018 8006BC18 24020006 */ addiu $v0, $zero, 6
.L8006BC1C:
/* 04701C 8006BC1C 1460000C */ bnez $v1, .L8006BC50
/* 047020 8006BC20 27A40038 */ addiu $a0, $sp, 0x38
/* 047024 8006BC24 00051600 */ sll $v0, $a1, 0x18
/* 047028 8006BC28 00021603 */ sra $v0, $v0, 0x18
/* 04702C 8006BC2C 38430067 */ xori $v1, $v0, 0x67
/* 047030 8006BC30 2C630001 */ sltiu $v1, $v1, 1
/* 047034 8006BC34 38420047 */ xori $v0, $v0, 0x47
/* 047038 8006BC38 2C420001 */ sltiu $v0, $v0, 1
/* 04703C 8006BC3C 00621825 */ or $v1, $v1, $v0
/* 047040 8006BC40 10600003 */ beqz $v1, .L8006BC50
/* 047044 8006BC44 24020001 */ addiu $v0, $zero, 1
.L8006BC48:
/* 047048 8006BC48 AE620024 */ sw $v0, 0x24($s3)
/* 04704C 8006BC4C 27A40038 */ addiu $a0, $sp, 0x38
.L8006BC50:
/* 047050 8006BC50 0C01B007 */ jal _Ldunscale
/* 047054 8006BC54 02602821 */ addu $a1, $s3, $zero
/* 047058 8006BC58 00021400 */ sll $v0, $v0, 0x10
/* 04705C 8006BC5C 00021C03 */ sra $v1, $v0, 0x10
/* 047060 8006BC60 18600010 */ blez $v1, .L8006BCA4
/* 047064 8006BC64 24020002 */ addiu $v0, $zero, 2
/* 047068 8006BC68 3C06800A */ lui $a2, 0x800a
/* 04706C 8006BC6C 24C69E1C */ addiu $a2, $a2, -0x61e4
/* 047070 8006BC70 8E670008 */ lw $a3, 8($s3)
/* 047074 8006BC74 14620003 */ bne $v1, $v0, .L8006BC84
/* 047078 8006BC78 24020003 */ addiu $v0, $zero, 3
/* 04707C 8006BC7C 3C06800A */ lui $a2, 0x800a
/* 047080 8006BC80 24C69E18 */ addiu $a2, $a2, -0x61e8
.L8006BC84:
/* 047084 8006BC84 AE620014 */ sw $v0, 0x14($s3)
/* 047088 8006BC88 80C20000 */ lb $v0, ($a2)
/* 04708C 8006BC8C 80C30001 */ lb $v1, 1($a2)
/* 047090 8006BC90 80C40002 */ lb $a0, 2($a2)
/* 047094 8006BC94 A0E20000 */ sb $v0, ($a3)
/* 047098 8006BC98 A0E30001 */ sb $v1, 1($a3)
/* 04709C 8006BC9C 0801AFFB */ j .L8006BFEC
/* 0470A0 8006BCA0 A0E40002 */ sb $a0, 2($a3)
.L8006BCA4:
/* 0470A4 8006BCA4 14600003 */ bnez $v1, .L8006BCB4
/* 0470A8 8006BCA8 00003821 */ addu $a3, $zero, $zero
/* 0470AC 8006BCAC 0801AFF2 */ j .L8006BFC8
/* 0470B0 8006BCB0 A7A00038 */ sh $zero, 0x38($sp)
.L8006BCB4:
/* 0470B4 8006BCB4 44800000 */ mtc1 $zero, $f0
/* 0470B8 8006BCB8 44800800 */ mtc1 $zero, $f1
/* 0470BC 8006BCBC 00000000 */ nop
/* 0470C0 8006BCC0 4620A03C */ c.lt.d $f20, $f0
/* 0470C4 8006BCC4 00000000 */ nop
/* 0470C8 8006BCC8 00000000 */ nop
/* 0470CC 8006BCCC 45030001 */ bc1tl .L8006BCD4
/* 0470D0 8006BCD0 4620A507 */ neg.d $f20, $f20
.L8006BCD4:
/* 0470D4 8006BCD4 87A30038 */ lh $v1, 0x38($sp)
/* 0470D8 8006BCD8 24027597 */ addiu $v0, $zero, 0x7597
/* 0470DC 8006BCDC 00620018 */ mult $v1, $v0
/* 0470E0 8006BCE0 00001812 */ mflo $v1
/* 0470E4 8006BCE4 3C0214F8 */ lui $v0, 0x14f8
/* 0470E8 8006BCE8 3442B589 */ ori $v0, $v0, 0xb589
/* 0470EC 8006BCEC 00620018 */ mult $v1, $v0
/* 0470F0 8006BCF0 00031FC3 */ sra $v1, $v1, 0x1f
/* 0470F4 8006BCF4 00004010 */ mfhi $t0
/* 0470F8 8006BCF8 00081343 */ sra $v0, $t0, 0xd
/* 0470FC 8006BCFC 00431023 */ subu $v0, $v0, $v1
/* 047100 8006BD00 2443FFFC */ addiu $v1, $v0, -4
/* 047104 8006BD04 00031400 */ sll $v0, $v1, 0x10
/* 047108 8006BD08 00021403 */ sra $v0, $v0, 0x10
/* 04710C 8006BD0C 04410013 */ bgez $v0, .L8006BD5C
/* 047110 8006BD10 A7A30038 */ sh $v1, 0x38($sp)
/* 047114 8006BD14 00021023 */ negu $v0, $v0
/* 047118 8006BD18 24420003 */ addiu $v0, $v0, 3
/* 04711C 8006BD1C 2403FFFC */ addiu $v1, $zero, -4
/* 047120 8006BD20 00431824 */ and $v1, $v0, $v1
/* 047124 8006BD24 00031023 */ negu $v0, $v1
/* 047128 8006BD28 1860001F */ blez $v1, .L8006BDA8
/* 04712C 8006BD2C A7A20038 */ sh $v0, 0x38($sp)
/* 047130 8006BD30 3C04800A */ lui $a0, 0x800a
/* 047134 8006BD34 24849DD0 */ addiu $a0, $a0, -0x6230
.L8006BD38:
/* 047138 8006BD38 30620001 */ andi $v0, $v1, 1
/* 04713C 8006BD3C 10400003 */ beqz $v0, .L8006BD4C
/* 047140 8006BD40 00031843 */ sra $v1, $v1, 1
/* 047144 8006BD44 D4800000 */ ldc1 $f0, ($a0)
/* 047148 8006BD48 4620A502 */ mul.d $f20, $f20, $f0
.L8006BD4C:
/* 04714C 8006BD4C 1C60FFFA */ bgtz $v1, .L8006BD38
/* 047150 8006BD50 24840008 */ addiu $a0, $a0, 8
/* 047154 8006BD54 0801AF6A */ j .L8006BDA8
/* 047158 8006BD58 00000000 */ nop
.L8006BD5C:
/* 04715C 8006BD5C 18400012 */ blez $v0, .L8006BDA8
/* 047160 8006BD60 2402FFFC */ addiu $v0, $zero, -4
/* 047164 8006BD64 3C01800A */ lui $at, 0x800a
/* 047168 8006BD68 D4229E20 */ ldc1 $f2, -0x61e0($at)
/* 04716C 8006BD6C 00621024 */ and $v0, $v1, $v0
/* 047170 8006BD70 00021C00 */ sll $v1, $v0, 0x10
/* 047174 8006BD74 00031C03 */ sra $v1, $v1, 0x10
/* 047178 8006BD78 1860000A */ blez $v1, .L8006BDA4
/* 04717C 8006BD7C A7A20038 */ sh $v0, 0x38($sp)
/* 047180 8006BD80 3C04800A */ lui $a0, 0x800a
/* 047184 8006BD84 24849DD0 */ addiu $a0, $a0, -0x6230
.L8006BD88:
/* 047188 8006BD88 30620001 */ andi $v0, $v1, 1
/* 04718C 8006BD8C 10400003 */ beqz $v0, .L8006BD9C
/* 047190 8006BD90 00031843 */ sra $v1, $v1, 1
/* 047194 8006BD94 D4800000 */ ldc1 $f0, ($a0)
/* 047198 8006BD98 46201082 */ mul.d $f2, $f2, $f0
.L8006BD9C:
/* 04719C 8006BD9C 1C60FFFA */ bgtz $v1, .L8006BD88
/* 0471A0 8006BDA0 24840008 */ addiu $a0, $a0, 8
.L8006BDA4:
/* 0471A4 8006BDA4 4622A503 */ div.d $f20, $f20, $f2
.L8006BDA8:
/* 0471A8 8006BDA8 8E640024 */ lw $a0, 0x24($s3)
/* 0471AC 8006BDAC 00151600 */ sll $v0, $s5, 0x18
/* 0471B0 8006BDB0 00021603 */ sra $v0, $v0, 0x18
/* 0471B4 8006BDB4 24030066 */ addiu $v1, $zero, 0x66
/* 0471B8 8006BDB8 14430004 */ bne $v0, $v1, .L8006BDCC
/* 0471BC 8006BDBC 24920006 */ addiu $s2, $a0, 6
/* 0471C0 8006BDC0 87A30038 */ lh $v1, 0x38($sp)
/* 0471C4 8006BDC4 2482000A */ addiu $v0, $a0, 0xa
/* 0471C8 8006BDC8 00439021 */ addu $s2, $v0, $v1
.L8006BDCC:
/* 0471CC 8006BDCC 2A420014 */ slti $v0, $s2, 0x14
/* 0471D0 8006BDD0 50400001 */ beql $v0, $zero, .L8006BDD8
/* 0471D4 8006BDD4 24120013 */ addiu $s2, $zero, 0x13
.L8006BDD8:
/* 0471D8 8006BDD8 24020030 */ addiu $v0, $zero, 0x30
/* 0471DC 8006BDDC A2220000 */ sb $v0, ($s1)
/* 0471E0 8006BDE0 26310001 */ addiu $s1, $s1, 1
/* 0471E4 8006BDE4 4480C000 */ mtc1 $zero, $f24
/* 0471E8 8006BDE8 4480C800 */ mtc1 $zero, $f25
/* 0471EC 8006BDEC 3C01800A */ lui $at, 0x800a
/* 0471F0 8006BDF0 D4369E28 */ ldc1 $f22, -0x61d8($at)
/* 0471F4 8006BDF4 24140030 */ addiu $s4, $zero, 0x30
.L8006BDF8:
/* 0471F8 8006BDF8 4634C03C */ c.lt.d $f24, $f20
/* 0471FC 8006BDFC 24030001 */ addiu $v1, $zero, 1
/* 047200 8006BE00 00000000 */ nop
/* 047204 8006BE04 45010002 */ bc1t .L8006BE10
/* 047208 8006BE08 0012102A */ slt $v0, $zero, $s2
/* 04720C 8006BE0C 00001821 */ addu $v1, $zero, $zero
.L8006BE10:
/* 047210 8006BE10 00431024 */ and $v0, $v0, $v1
/* 047214 8006BE14 10400021 */ beqz $v0, .L8006BE9C
/* 047218 8006BE18 2652FFF8 */ addiu $s2, $s2, -8
/* 04721C 8006BE1C 4620A00D */ trunc.w.d $f0, $f20
/* 047220 8006BE20 44050000 */ mfc1 $a1, $f0
/* 047224 8006BE24 00000000 */ nop
/* 047228 8006BE28 1A400006 */ blez $s2, .L8006BE44
/* 04722C 8006BE2C 26310008 */ addiu $s1, $s1, 8
/* 047230 8006BE30 44850000 */ mtc1 $a1, $f0
/* 047234 8006BE34 00000000 */ nop
/* 047238 8006BE38 46800021 */ cvt.d.w $f0, $f0
/* 04723C 8006BE3C 4620A001 */ sub.d $f0, $f20, $f0
/* 047240 8006BE40 46360502 */ mul.d $f20, $f0, $f22
.L8006BE44:
/* 047244 8006BE44 18A00010 */ blez $a1, .L8006BE88
/* 047248 8006BE48 24100008 */ addiu $s0, $zero, 8
/* 04724C 8006BE4C 2610FFFF */ addiu $s0, $s0, -1
.L8006BE50:
/* 047250 8006BE50 0600000D */ bltz $s0, .L8006BE88
/* 047254 8006BE54 27A40040 */ addiu $a0, $sp, 0x40
/* 047258 8006BE58 0C01B588 */ jal ldiv
/* 04725C 8006BE5C 2406000A */ addiu $a2, $zero, 0xa
/* 047260 8006BE60 8FA20044 */ lw $v0, 0x44($sp)
/* 047264 8006BE64 2631FFFF */ addiu $s1, $s1, -1
/* 047268 8006BE68 24420030 */ addiu $v0, $v0, 0x30
/* 04726C 8006BE6C A2220000 */ sb $v0, ($s1)
/* 047270 8006BE70 8FA50040 */ lw $a1, 0x40($sp)
/* 047274 8006BE74 1CA0FFF6 */ bgtz $a1, .L8006BE50
/* 047278 8006BE78 2610FFFF */ addiu $s0, $s0, -1
/* 04727C 8006BE7C 0801AFA3 */ j .L8006BE8C
/* 047280 8006BE80 00000000 */ nop
.L8006BE84:
/* 047284 8006BE84 A2340000 */ sb $s4, ($s1)
.L8006BE88:
/* 047288 8006BE88 2610FFFF */ addiu $s0, $s0, -1
.L8006BE8C:
/* 04728C 8006BE8C 0603FFFD */ bgezl $s0, .L8006BE84
/* 047290 8006BE90 2631FFFF */ addiu $s1, $s1, -1
/* 047294 8006BE94 0801AF7E */ j .L8006BDF8
/* 047298 8006BE98 26310008 */ addiu $s1, $s1, 8
.L8006BE9C:
/* 04729C 8006BE9C 2623FFFF */ addiu $v1, $s1, -1
/* 0472A0 8006BEA0 27A20018 */ addiu $v0, $sp, 0x18
/* 0472A4 8006BEA4 00629023 */ subu $s2, $v1, $v0
/* 0472A8 8006BEA8 97A20038 */ lhu $v0, 0x38($sp)
/* 0472AC 8006BEAC 83A30019 */ lb $v1, 0x19($sp)
/* 0472B0 8006BEB0 24420007 */ addiu $v0, $v0, 7
/* 0472B4 8006BEB4 A7A20038 */ sh $v0, 0x38($sp)
/* 0472B8 8006BEB8 24020030 */ addiu $v0, $zero, 0x30
/* 0472BC 8006BEBC 14620009 */ bne $v1, $v0, .L8006BEE4
/* 0472C0 8006BEC0 27B10019 */ addiu $s1, $sp, 0x19
/* 0472C4 8006BEC4 24030030 */ addiu $v1, $zero, 0x30
.L8006BEC8:
/* 0472C8 8006BEC8 97A20038 */ lhu $v0, 0x38($sp)
/* 0472CC 8006BECC 26310001 */ addiu $s1, $s1, 1
/* 0472D0 8006BED0 2442FFFF */ addiu $v0, $v0, -1
/* 0472D4 8006BED4 A7A20038 */ sh $v0, 0x38($sp)
/* 0472D8 8006BED8 82220000 */ lb $v0, ($s1)
/* 0472DC 8006BEDC 1043FFFA */ beq $v0, $v1, .L8006BEC8
/* 0472E0 8006BEE0 2652FFFF */ addiu $s2, $s2, -1
.L8006BEE4:
/* 0472E4 8006BEE4 8E650024 */ lw $a1, 0x24($s3)
/* 0472E8 8006BEE8 00151600 */ sll $v0, $s5, 0x18
/* 0472EC 8006BEEC 00022603 */ sra $a0, $v0, 0x18
/* 0472F0 8006BEF0 24020066 */ addiu $v0, $zero, 0x66
/* 0472F4 8006BEF4 14820005 */ bne $a0, $v0, .L8006BF0C
/* 0472F8 8006BEF8 38830065 */ xori $v1, $a0, 0x65
/* 0472FC 8006BEFC 87A30038 */ lh $v1, 0x38($sp)
/* 047300 8006BF00 24A20001 */ addiu $v0, $a1, 1
/* 047304 8006BF04 0801AFC8 */ j .L8006BF20
/* 047308 8006BF08 00433821 */ addu $a3, $v0, $v1
.L8006BF0C:
/* 04730C 8006BF0C 2C630001 */ sltiu $v1, $v1, 1
/* 047310 8006BF10 38820045 */ xori $v0, $a0, 0x45
/* 047314 8006BF14 2C420001 */ sltiu $v0, $v0, 1
/* 047318 8006BF18 00621825 */ or $v1, $v1, $v0
/* 04731C 8006BF1C 00A33821 */ addu $a3, $a1, $v1
.L8006BF20:
/* 047320 8006BF20 00071400 */ sll $v0, $a3, 0x10
/* 047324 8006BF24 00021403 */ sra $v0, $v0, 0x10
/* 047328 8006BF28 0242102A */ slt $v0, $s2, $v0
/* 04732C 8006BF2C 54400001 */ bnel $v0, $zero, .L8006BF34
/* 047330 8006BF30 02403821 */ addu $a3, $s2, $zero
.L8006BF34:
/* 047334 8006BF34 00071400 */ sll $v0, $a3, 0x10
/* 047338 8006BF38 00022403 */ sra $a0, $v0, 0x10
/* 04733C 8006BF3C 18800022 */ blez $a0, .L8006BFC8
/* 047340 8006BF40 0092102A */ slt $v0, $a0, $s2
/* 047344 8006BF44 10400008 */ beqz $v0, .L8006BF68
/* 047348 8006BF48 24030030 */ addiu $v1, $zero, 0x30
/* 04734C 8006BF4C 02241021 */ addu $v0, $s1, $a0
/* 047350 8006BF50 80420000 */ lb $v0, ($v0)
/* 047354 8006BF54 28420035 */ slti $v0, $v0, 0x35
/* 047358 8006BF58 38420001 */ xori $v0, $v0, 1
/* 04735C 8006BF5C 00021023 */ negu $v0, $v0
/* 047360 8006BF60 30420039 */ andi $v0, $v0, 0x39
/* 047364 8006BF64 34430030 */ ori $v1, $v0, 0x30
.L8006BF68:
/* 047368 8006BF68 2485FFFF */ addiu $a1, $a0, -1
/* 04736C 8006BF6C 02252021 */ addu $a0, $s1, $a1
/* 047370 8006BF70 80820000 */ lb $v0, ($a0)
/* 047374 8006BF74 54430008 */ bnel $v0, $v1, .L8006BF98
/* 047378 8006BF78 24020039 */ addiu $v0, $zero, 0x39
/* 04737C 8006BF7C 00403021 */ addu $a2, $v0, $zero
.L8006BF80:
/* 047380 8006BF80 2484FFFF */ addiu $a0, $a0, -1
/* 047384 8006BF84 80820000 */ lb $v0, ($a0)
/* 047388 8006BF88 24E7FFFF */ addiu $a3, $a3, -1
/* 04738C 8006BF8C 1046FFFC */ beq $v0, $a2, .L8006BF80
/* 047390 8006BF90 24A5FFFF */ addiu $a1, $a1, -1
/* 047394 8006BF94 24020039 */ addiu $v0, $zero, 0x39
.L8006BF98:
/* 047398 8006BF98 14620004 */ bne $v1, $v0, .L8006BFAC
/* 04739C 8006BF9C 02251821 */ addu $v1, $s1, $a1
/* 0473A0 8006BFA0 90620000 */ lbu $v0, ($v1)
/* 0473A4 8006BFA4 24420001 */ addiu $v0, $v0, 1
/* 0473A8 8006BFA8 A0620000 */ sb $v0, ($v1)
.L8006BFAC:
/* 0473AC 8006BFAC 04A10007 */ bgez $a1, .L8006BFCC
/* 0473B0 8006BFB0 02602021 */ addu $a0, $s3, $zero
/* 0473B4 8006BFB4 97A20038 */ lhu $v0, 0x38($sp)
/* 0473B8 8006BFB8 2631FFFF */ addiu $s1, $s1, -1
/* 0473BC 8006BFBC 24E70001 */ addiu $a3, $a3, 1
/* 0473C0 8006BFC0 24420001 */ addiu $v0, $v0, 1
/* 0473C4 8006BFC4 A7A20038 */ sh $v0, 0x38($sp)
.L8006BFC8:
/* 0473C8 8006BFC8 02602021 */ addu $a0, $s3, $zero
.L8006BFCC:
/* 0473CC 8006BFCC 00152E00 */ sll $a1, $s5, 0x18
/* 0473D0 8006BFD0 87A20038 */ lh $v0, 0x38($sp)
/* 0473D4 8006BFD4 00052E03 */ sra $a1, $a1, 0x18
/* 0473D8 8006BFD8 02203021 */ addu $a2, $s1, $zero
/* 0473DC 8006BFDC 00073C00 */ sll $a3, $a3, 0x10
/* 0473E0 8006BFE0 00073C03 */ sra $a3, $a3, 0x10
/* 0473E4 8006BFE4 0C01B02D */ jal _Genld
/* 0473E8 8006BFE8 AFA20010 */ sw $v0, 0x10($sp)
.L8006BFEC:
/* 0473EC 8006BFEC 8FBF0060 */ lw $ra, 0x60($sp)
/* 0473F0 8006BFF0 8FB5005C */ lw $s5, 0x5c($sp)
/* 0473F4 8006BFF4 8FB40058 */ lw $s4, 0x58($sp)
/* 0473F8 8006BFF8 8FB30054 */ lw $s3, 0x54($sp)
/* 0473FC 8006BFFC 8FB20050 */ lw $s2, 0x50($sp)
/* 047400 8006C000 8FB1004C */ lw $s1, 0x4c($sp)
/* 047404 8006C004 8FB00048 */ lw $s0, 0x48($sp)
/* 047408 8006C008 D7B80078 */ ldc1 $f24, 0x78($sp)
/* 04740C 8006C00C D7B60070 */ ldc1 $f22, 0x70($sp)
/* 047410 8006C010 D7B40068 */ ldc1 $f20, 0x68($sp)
/* 047414 8006C014 03E00008 */ jr $ra
/* 047418 8006C018 27BD0080 */ addiu $sp, $sp, 0x80