papermario/asm/nonmatchings/code_42e0_len_1f60/cosine.s
2020-08-12 22:37:16 -04:00

66 lines
2.9 KiB
ArmAsm

.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel cosine
/* 0047D4 800293D4 3C06B60B */ lui $a2, 0xb60b
/* 0047D8 800293D8 34C660B7 */ ori $a2, $a2, 0x60b7
/* 0047DC 800293DC 00042400 */ sll $a0, $a0, 0x10
/* 0047E0 800293E0 00042C03 */ sra $a1, $a0, 0x10
/* 0047E4 800293E4 00A60018 */ mult $a1, $a2
/* 0047E8 800293E8 000427C3 */ sra $a0, $a0, 0x1f
/* 0047EC 800293EC 00003810 */ mfhi $a3
/* 0047F0 800293F0 00E51021 */ addu $v0, $a3, $a1
/* 0047F4 800293F4 00021203 */ sra $v0, $v0, 8
/* 0047F8 800293F8 00441023 */ subu $v0, $v0, $a0
/* 0047FC 800293FC 00021840 */ sll $v1, $v0, 1
/* 004800 80029400 00621821 */ addu $v1, $v1, $v0
/* 004804 80029404 00031100 */ sll $v0, $v1, 4
/* 004808 80029408 00431023 */ subu $v0, $v0, $v1
/* 00480C 8002940C 000210C0 */ sll $v0, $v0, 3
/* 004810 80029410 00A22823 */ subu $a1, $a1, $v0
/* 004814 80029414 00051400 */ sll $v0, $a1, 0x10
/* 004818 80029418 04410002 */ bgez $v0, .L80029424
/* 00481C 8002941C 00A0182D */ daddu $v1, $a1, $zero
/* 004820 80029420 24A30168 */ addiu $v1, $a1, 0x168
.L80029424:
/* 004824 80029424 00031C00 */ sll $v1, $v1, 0x10
/* 004828 80029428 00032C03 */ sra $a1, $v1, 0x10
/* 00482C 8002942C 00A60018 */ mult $a1, $a2
/* 004830 80029430 00031FC3 */ sra $v1, $v1, 0x1f
/* 004834 80029434 00003810 */ mfhi $a3
/* 004838 80029438 00E51021 */ addu $v0, $a3, $a1
/* 00483C 8002943C 000211C3 */ sra $v0, $v0, 7
/* 004840 80029440 00431023 */ subu $v0, $v0, $v1
/* 004844 80029444 00021840 */ sll $v1, $v0, 1
/* 004848 80029448 00621821 */ addu $v1, $v1, $v0
/* 00484C 8002944C 00031100 */ sll $v0, $v1, 4
/* 004850 80029450 00431023 */ subu $v0, $v0, $v1
/* 004854 80029454 00021080 */ sll $v0, $v0, 2
/* 004858 80029458 00A21823 */ subu $v1, $a1, $v0
/* 00485C 8002945C 00031400 */ sll $v0, $v1, 0x10
/* 004860 80029460 00021403 */ sra $v0, $v0, 0x10
/* 004864 80029464 2842005B */ slti $v0, $v0, 0x5b
/* 004868 80029468 14400003 */ bnez $v0, .L80029478
/* 00486C 8002946C 0060202D */ daddu $a0, $v1, $zero
/* 004870 80029470 240200B4 */ addiu $v0, $zero, 0xb4
/* 004874 80029474 00432023 */ subu $a0, $v0, $v1
.L80029478:
/* 004878 80029478 28A200B4 */ slti $v0, $a1, 0xb4
/* 00487C 8002947C 10400006 */ beqz $v0, .L80029498
/* 004880 80029480 00041400 */ sll $v0, $a0, 0x10
/* 004884 80029484 00021383 */ sra $v0, $v0, 0xe
/* 004888 80029488 3C018007 */ lui $at, 0x8007
/* 00488C 8002948C 00220821 */ addu $at, $at, $v0
/* 004890 80029490 03E00008 */ jr $ra
/* 004894 80029494 C4204274 */ lwc1 $f0, 0x4274($at)
.L80029498:
/* 004898 80029498 00021383 */ sra $v0, $v0, 0xe
/* 00489C 8002949C 3C018007 */ lui $at, 0x8007
/* 0048A0 800294A0 00220821 */ addu $at, $at, $v0
/* 0048A4 800294A4 C4204274 */ lwc1 $f0, 0x4274($at)
/* 0048A8 800294A8 03E00008 */ jr $ra
/* 0048AC 800294AC 46000007 */ neg.s $f0, $f0