papermario/asm/nonmatchings/code_42e0_len_1f60/cosine.s
2020-09-23 23:16:13 -04:00

63 lines
3.0 KiB
ArmAsm

.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel cosine
/* 47D4 800293D4 3C06B60B */ lui $a2, 0xb60b
/* 47D8 800293D8 34C660B7 */ ori $a2, $a2, 0x60b7
/* 47DC 800293DC 00042400 */ sll $a0, $a0, 0x10
/* 47E0 800293E0 00042C03 */ sra $a1, $a0, 0x10
/* 47E4 800293E4 00A60018 */ mult $a1, $a2
/* 47E8 800293E8 000427C3 */ sra $a0, $a0, 0x1f
/* 47EC 800293EC 00003810 */ mfhi $a3
/* 47F0 800293F0 00E51021 */ addu $v0, $a3, $a1
/* 47F4 800293F4 00021203 */ sra $v0, $v0, 8
/* 47F8 800293F8 00441023 */ subu $v0, $v0, $a0
/* 47FC 800293FC 00021840 */ sll $v1, $v0, 1
/* 4800 80029400 00621821 */ addu $v1, $v1, $v0
/* 4804 80029404 00031100 */ sll $v0, $v1, 4
/* 4808 80029408 00431023 */ subu $v0, $v0, $v1
/* 480C 8002940C 000210C0 */ sll $v0, $v0, 3
/* 4810 80029410 00A22823 */ subu $a1, $a1, $v0
/* 4814 80029414 00051400 */ sll $v0, $a1, 0x10
/* 4818 80029418 04410002 */ bgez $v0, .L80029424
/* 481C 8002941C 00A0182D */ daddu $v1, $a1, $zero
/* 4820 80029420 24A30168 */ addiu $v1, $a1, 0x168
.L80029424:
/* 4824 80029424 00031C00 */ sll $v1, $v1, 0x10
/* 4828 80029428 00032C03 */ sra $a1, $v1, 0x10
/* 482C 8002942C 00A60018 */ mult $a1, $a2
/* 4830 80029430 00031FC3 */ sra $v1, $v1, 0x1f
/* 4834 80029434 00003810 */ mfhi $a3
/* 4838 80029438 00E51021 */ addu $v0, $a3, $a1
/* 483C 8002943C 000211C3 */ sra $v0, $v0, 7
/* 4840 80029440 00431023 */ subu $v0, $v0, $v1
/* 4844 80029444 00021840 */ sll $v1, $v0, 1
/* 4848 80029448 00621821 */ addu $v1, $v1, $v0
/* 484C 8002944C 00031100 */ sll $v0, $v1, 4
/* 4850 80029450 00431023 */ subu $v0, $v0, $v1
/* 4854 80029454 00021080 */ sll $v0, $v0, 2
/* 4858 80029458 00A21823 */ subu $v1, $a1, $v0
/* 485C 8002945C 00031400 */ sll $v0, $v1, 0x10
/* 4860 80029460 00021403 */ sra $v0, $v0, 0x10
/* 4864 80029464 2842005B */ slti $v0, $v0, 0x5b
/* 4868 80029468 14400003 */ bnez $v0, .L80029478
/* 486C 8002946C 0060202D */ daddu $a0, $v1, $zero
/* 4870 80029470 240200B4 */ addiu $v0, $zero, 0xb4
/* 4874 80029474 00432023 */ subu $a0, $v0, $v1
.L80029478:
/* 4878 80029478 28A200B4 */ slti $v0, $a1, 0xb4
/* 487C 8002947C 10400006 */ beqz $v0, .L80029498
/* 4880 80029480 00041400 */ sll $v0, $a0, 0x10
/* 4884 80029484 00021383 */ sra $v0, $v0, 0xe
/* 4888 80029488 3C018007 */ lui $at, 0x8007
/* 488C 8002948C 00220821 */ addu $at, $at, $v0
/* 4890 80029490 03E00008 */ jr $ra
/* 4894 80029494 C4204274 */ lwc1 $f0, 0x4274($at)
.L80029498:
/* 4898 80029498 00021383 */ sra $v0, $v0, 0xe
/* 489C 8002949C 3C018007 */ lui $at, 0x8007
/* 48A0 800294A0 00220821 */ addu $at, $at, $v0
/* 48A4 800294A4 C4204274 */ lwc1 $f0, 0x4274($at)
/* 48A8 800294A8 03E00008 */ jr $ra
/* 48AC 800294AC 46000007 */ neg.s $f0, $f0