prime/asm/Runtime/s_atan.s

152 lines
7.1 KiB
ArmAsm

.include "macros.inc"
.section .rodata
.global lbl_803D89D0
lbl_803D89D0:
.incbin "baserom.dol", 0x3D59D0, 0x98
.section .text, "ax"
.global atan
atan:
/* 803941C8 00391128 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 803941CC 0039112C 3C 60 80 3E */ lis r3, lbl_803D89D0@ha
/* 803941D0 00391130 3C 00 44 10 */ lis r0, 0x4410
/* 803941D4 00391134 D8 21 00 08 */ stfd f1, 8(r1)
/* 803941D8 00391138 38 83 89 D0 */ addi r4, r3, lbl_803D89D0@l
/* 803941DC 0039113C 80 C1 00 08 */ lwz r6, 8(r1)
/* 803941E0 00391140 54 C5 00 7E */ clrlwi r5, r6, 1
/* 803941E4 00391144 7C 05 00 00 */ cmpw r5, r0
/* 803941E8 00391148 41 80 00 60 */ blt lbl_80394248
/* 803941EC 0039114C 3C 00 7F F0 */ lis r0, 0x7ff0
/* 803941F0 00391150 7C 05 00 00 */ cmpw r5, r0
/* 803941F4 00391154 41 81 00 1C */ bgt lbl_80394210
/* 803941F8 00391158 3C 05 80 10 */ addis r0, r5, 0x8010
/* 803941FC 0039115C 28 00 00 00 */ cmplwi r0, 0
/* 80394200 00391160 40 82 00 1C */ bne lbl_8039421C
/* 80394204 00391164 80 01 00 0C */ lwz r0, 0xc(r1)
/* 80394208 00391168 2C 00 00 00 */ cmpwi r0, 0
/* 8039420C 0039116C 41 82 00 10 */ beq lbl_8039421C
lbl_80394210:
/* 80394210 00391170 C8 01 00 08 */ lfd f0, 8(r1)
/* 80394214 00391174 FC 20 00 2A */ fadd f1, f0, f0
/* 80394218 00391178 48 00 01 A8 */ b lbl_803943C0
lbl_8039421C:
/* 8039421C 0039117C 2C 06 00 00 */ cmpwi r6, 0
/* 80394220 00391180 40 81 00 14 */ ble lbl_80394234
/* 80394224 00391184 C8 24 00 18 */ lfd f1, 0x18(r4)
/* 80394228 00391188 C8 04 00 38 */ lfd f0, 0x38(r4)
/* 8039422C 0039118C FC 21 00 2A */ fadd f1, f1, f0
/* 80394230 00391190 48 00 01 90 */ b lbl_803943C0
lbl_80394234:
/* 80394234 00391194 C8 24 00 18 */ lfd f1, 0x18(r4)
/* 80394238 00391198 C8 04 00 38 */ lfd f0, 0x38(r4)
/* 8039423C 0039119C FC 20 08 50 */ fneg f1, f1
/* 80394240 003911A0 FC 21 00 28 */ fsub f1, f1, f0
/* 80394244 003911A4 48 00 01 7C */ b lbl_803943C0
lbl_80394248:
/* 80394248 003911A8 3C 00 3F DC */ lis r0, 0x3fdc
/* 8039424C 003911AC 7C 05 00 00 */ cmpw r5, r0
/* 80394250 003911B0 40 80 00 30 */ bge lbl_80394280
/* 80394254 003911B4 3C 00 3E 20 */ lis r0, 0x3e20
/* 80394258 003911B8 7C 05 00 00 */ cmpw r5, r0
/* 8039425C 003911BC 40 80 00 1C */ bge lbl_80394278
/* 80394260 003911C0 C8 42 D4 70 */ lfd f2, lbl_805AF190@sda21(r2)
/* 80394264 003911C4 C8 02 D4 78 */ lfd f0, lbl_805AF198@sda21(r2)
/* 80394268 003911C8 FC 42 08 2A */ fadd f2, f2, f1
/* 8039426C 003911CC FC 02 00 40 */ fcmpo cr0, f2, f0
/* 80394270 003911D0 40 81 00 08 */ ble lbl_80394278
/* 80394274 003911D4 48 00 01 4C */ b lbl_803943C0
lbl_80394278:
/* 80394278 003911D8 38 00 FF FF */ li r0, -1
/* 8039427C 003911DC 48 00 00 A0 */ b lbl_8039431C
lbl_80394280:
/* 80394280 003911E0 FC 60 0A 10 */ fabs f3, f1
/* 80394284 003911E4 3C 00 3F F3 */ lis r0, 0x3ff3
/* 80394288 003911E8 7C 05 00 00 */ cmpw r5, r0
/* 8039428C 003911EC D8 61 00 08 */ stfd f3, 8(r1)
/* 80394290 003911F0 40 80 00 4C */ bge lbl_803942DC
/* 80394294 003911F4 3C 00 3F E6 */ lis r0, 0x3fe6
/* 80394298 003911F8 7C 05 00 00 */ cmpw r5, r0
/* 8039429C 003911FC 40 80 00 24 */ bge lbl_803942C0
/* 803942A0 00391200 C8 42 D4 80 */ lfd f2, lbl_805AF1A0@sda21(r2)
/* 803942A4 00391204 38 00 00 00 */ li r0, 0
/* 803942A8 00391208 C8 22 D4 78 */ lfd f1, lbl_805AF198@sda21(r2)
/* 803942AC 0039120C FC 02 18 2A */ fadd f0, f2, f3
/* 803942B0 00391210 FC 22 08 F8 */ fmsub f1, f2, f3, f1
/* 803942B4 00391214 FC 01 00 24 */ fdiv f0, f1, f0
/* 803942B8 00391218 D8 01 00 08 */ stfd f0, 8(r1)
/* 803942BC 0039121C 48 00 00 60 */ b lbl_8039431C
lbl_803942C0:
/* 803942C0 00391220 C8 02 D4 78 */ lfd f0, lbl_805AF198@sda21(r2)
/* 803942C4 00391224 38 00 00 01 */ li r0, 1
/* 803942C8 00391228 FC 23 00 28 */ fsub f1, f3, f0
/* 803942CC 0039122C FC 00 18 2A */ fadd f0, f0, f3
/* 803942D0 00391230 FC 01 00 24 */ fdiv f0, f1, f0
/* 803942D4 00391234 D8 01 00 08 */ stfd f0, 8(r1)
/* 803942D8 00391238 48 00 00 44 */ b lbl_8039431C
lbl_803942DC:
/* 803942DC 0039123C 3C 60 40 04 */ lis r3, 0x40038000@ha
/* 803942E0 00391240 38 03 80 00 */ addi r0, r3, 0x40038000@l
/* 803942E4 00391244 7C 05 00 00 */ cmpw r5, r0
/* 803942E8 00391248 40 80 00 24 */ bge lbl_8039430C
/* 803942EC 0039124C C8 42 D4 88 */ lfd f2, lbl_805AF1A8@sda21(r2)
/* 803942F0 00391250 38 00 00 02 */ li r0, 2
/* 803942F4 00391254 C8 02 D4 78 */ lfd f0, lbl_805AF198@sda21(r2)
/* 803942F8 00391258 FC 23 10 28 */ fsub f1, f3, f2
/* 803942FC 0039125C FC 02 00 FA */ fmadd f0, f2, f3, f0
/* 80394300 00391260 FC 01 00 24 */ fdiv f0, f1, f0
/* 80394304 00391264 D8 01 00 08 */ stfd f0, 8(r1)
/* 80394308 00391268 48 00 00 14 */ b lbl_8039431C
lbl_8039430C:
/* 8039430C 0039126C C8 02 D4 90 */ lfd f0, lbl_805AF1B0@sda21(r2)
/* 80394310 00391270 38 00 00 03 */ li r0, 3
/* 80394314 00391274 FC 00 18 24 */ fdiv f0, f0, f3
/* 80394318 00391278 D8 01 00 08 */ stfd f0, 8(r1)
lbl_8039431C:
/* 8039431C 0039127C C9 21 00 08 */ lfd f9, 8(r1)
/* 80394320 00391280 2C 00 00 00 */ cmpwi r0, 0
/* 80394324 00391284 C8 84 00 90 */ lfd f4, 0x90(r4)
/* 80394328 00391288 FD 69 02 72 */ fmul f11, f9, f9
/* 8039432C 0039128C C8 24 00 80 */ lfd f1, 0x80(r4)
/* 80394330 00391290 C8 E4 00 70 */ lfd f7, 0x70(r4)
/* 80394334 00391294 C8 64 00 88 */ lfd f3, 0x88(r4)
/* 80394338 00391298 C8 04 00 78 */ lfd f0, 0x78(r4)
/* 8039433C 0039129C FD 4B 02 F2 */ fmul f10, f11, f11
/* 80394340 003912A0 C8 C4 00 60 */ lfd f6, 0x60(r4)
/* 80394344 003912A4 C8 44 00 68 */ lfd f2, 0x68(r4)
/* 80394348 003912A8 C8 A4 00 50 */ lfd f5, 0x50(r4)
/* 8039434C 003912AC FD 0A 09 3A */ fmadd f8, f10, f4, f1
/* 80394350 003912B0 C8 24 00 58 */ lfd f1, 0x58(r4)
/* 80394354 003912B4 C8 84 00 40 */ lfd f4, 0x40(r4)
/* 80394358 003912B8 FC 6A 00 FA */ fmadd f3, f10, f3, f0
/* 8039435C 003912BC C8 04 00 48 */ lfd f0, 0x48(r4)
/* 80394360 003912C0 FC EA 3A 3A */ fmadd f7, f10, f8, f7
/* 80394364 003912C4 FC 4A 10 FA */ fmadd f2, f10, f3, f2
/* 80394368 003912C8 FC 6A 31 FA */ fmadd f3, f10, f7, f6
/* 8039436C 003912CC FC 2A 08 BA */ fmadd f1, f10, f2, f1
/* 80394370 003912D0 FC 4A 28 FA */ fmadd f2, f10, f3, f5
/* 80394374 003912D4 FC 0A 00 7A */ fmadd f0, f10, f1, f0
/* 80394378 003912D8 FC 2A 20 BA */ fmadd f1, f10, f2, f4
/* 8039437C 003912DC FC 4A 00 32 */ fmul f2, f10, f0
/* 80394380 003912E0 FC 0B 00 72 */ fmul f0, f11, f1
/* 80394384 003912E4 40 80 00 10 */ bge lbl_80394394
/* 80394388 003912E8 FC 00 10 2A */ fadd f0, f0, f2
/* 8039438C 003912EC FC 29 48 3C */ fnmsub f1, f9, f0, f9
/* 80394390 003912F0 48 00 00 30 */ b lbl_803943C0
lbl_80394394:
/* 80394394 003912F4 54 00 18 38 */ slwi r0, r0, 3
/* 80394398 003912F8 FC 20 10 2A */ fadd f1, f0, f2
/* 8039439C 003912FC 7C 64 02 14 */ add r3, r4, r0
/* 803943A0 00391300 2C 06 00 00 */ cmpwi r6, 0
/* 803943A4 00391304 C8 03 00 20 */ lfd f0, 0x20(r3)
/* 803943A8 00391308 C8 43 00 00 */ lfd f2, 0(r3)
/* 803943AC 0039130C FC 09 00 78 */ fmsub f0, f9, f1, f0
/* 803943B0 00391310 FC 00 48 28 */ fsub f0, f0, f9
/* 803943B4 00391314 FC 22 00 28 */ fsub f1, f2, f0
/* 803943B8 00391318 40 80 00 08 */ bge lbl_803943C0
/* 803943BC 0039131C FC 20 08 50 */ fneg f1, f1
lbl_803943C0:
/* 803943C0 00391320 38 21 00 10 */ addi r1, r1, 0x10
/* 803943C4 00391324 4E 80 00 20 */ blr