; ; cosf from 0x18012af90 to 0x18012b48f (1279 bytes) ; ; 20 xrefs: ; > sub_180028BE0 @ 0x180028d64 ; > sub_180032180 @ 0x1800323be ; > sub_180032180 @ 0x1800323f9 ; > sub_180032180 @ 0x18003245e ; > sub_180032180 @ 0x18003247e ; > sub_180032180 @ 0x18003249d ; > sub_180032180 @ 0x1800324e3 ; > sub_180032180 @ 0x18003254b ; > sub_180032180 @ 0x18003258b ; > sub_180032180 @ 0x18003264f ; > sub_180053BD0 @ 0x180053c0b ; > sub_180069DE0 @ 0x180069e1b ; > sub_18006B8A0 @ 0x18006b8db ; > sub_18006E7E0 @ 0x18006e82d ; > sub_180077F30 @ 0x180077f6b ; > sub_1800894D0 @ 0x180089524 ; > sub_1800899C0 @ 0x180089a1b ; > sub_1800F8FF0 @ 0x1800f905e ; > sub_1800F8FF0 @ 0x1800f9080 ; > @ 0x180202b10 ; ; This function is hookable on this platform! ; ; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA ; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings ; sub rsp, 68h ; +0x0, 0x18012af90 cmp cs:dword_1801F4D54, 0 ; +0x4, 0x18012af94 jnz Lcosf_fma3 ; +0xb, 0x18012af9b xorpd xmm2, xmm2 ; +0x11, 0x18012afa1 movd edx, xmm0 ; +0x15, 0x18012afa5 mov eax, 7F800000h ; +0x19, 0x18012afa9 mov r10d, eax ; +0x1e, 0x18012afae and r10d, edx ; +0x21, 0x18012afb1 cmp r10d, eax ; +0x24, 0x18012afb4 jz Lcosf_sse2_naninf ; +0x27, 0x18012afb7 cvtss2sd xmm0, xmm0 ; +0x2d, 0x18012afbd movq rdx, xmm0 ; +0x31, 0x18012afc1 mov r10, rdx ; +0x36, 0x18012afc6 btr r10, 3Fh ; '?' ; +0x39, 0x18012afc9 mov r8d, 1 ; +0x3e, 0x18012afce movapd xmm1, xmm0 ; +0x44, 0x18012afd4 mov rax, 3FE921FB54442D18h ; +0x48, 0x18012afd8 cmp r10, rax ; +0x52, 0x18012afe2 jg short Lcosf_sse2_absx_gt_piby4 ; +0x55, 0x18012afe5 movapd xmm2, xmm0 ; +0x57, 0x18012afe7 mulsd xmm2, xmm2 ; +0x5b, 0x18012afeb xor eax, eax ; +0x5f, 0x18012afef mov rdx, r10 ; +0x61, 0x18012aff1 movsd xmm5, cs:qword_180171A50 ; +0x64, 0x18012aff4 jmp Lcosf_sse2_calc_sincosf_piby4 ; +0x6c, 0x18012affc align 10h ; +0x71, 0x18012b001 movq xmm0, r10 ; +0x80, 0x18012b010 cmp r10, cs:qword_180171AD0 ; +0x85, 0x18012b015 jnb Lcosf_sse2_reduce_precise ; +0x8c, 0x18012b01c movapd xmm2, xmm0 ; +0x92, 0x18012b022 movsd xmm3, qword ptr cs:xmmword_180171A60 ; +0x96, 0x18012b026 movapd xmm4, xmm0 ; +0x9e, 0x18012b02e movsd xmm5, cs:qword_180171A50 ; +0xa2, 0x18012b032 mulsd xmm2, xmm3 ; +0xaa, 0x18012b03a mov r9, r10 ; +0xae, 0x18012b03e shr r9, 34h ; +0xb1, 0x18012b041 addsd xmm2, xmm5 ; +0xb5, 0x18012b045 movsd xmm3, cs:qword_180171A90 ; +0xb9, 0x18012b049 cvttpd2dq xmm0, xmm2 ; +0xc1, 0x18012b051 movsd xmm1, cs:qword_180171AA0 ; +0xc5, 0x18012b055 cvtdq2pd xmm2, xmm0 ; +0xcd, 0x18012b05d mulsd xmm3, xmm2 ; +0xd1, 0x18012b061 subsd xmm4, xmm3 ; +0xd5, 0x18012b065 mulsd xmm1, xmm2 ; +0xd9, 0x18012b069 movd eax, xmm0 ; +0xdd, 0x18012b06d movapd xmm0, xmm4 ; +0xe1, 0x18012b071 subsd xmm0, xmm1 ; +0xe5, 0x18012b075 movsd xmm3, cs:qword_180171AB0 ; +0xe9, 0x18012b079 movq rcx, xmm0 ; +0xf1, 0x18012b081 movsd xmm5, cs:qword_180171AC0 ; +0xf6, 0x18012b086 shl rcx, 1 ; +0xfe, 0x18012b08e shr rcx, 35h ; +0x101, 0x18012b091 sub r9, rcx ; +0x105, 0x18012b095 cmp r9, 0Fh ; +0x108, 0x18012b098 jle short Lcosf_sse2_expdiff_le_15 ; +0x10c, 0x18012b09c movapd xmm1, xmm4 ; +0x10e, 0x18012b09e mulsd xmm3, xmm2 ; +0x112, 0x18012b0a2 mulsd xmm5, xmm2 ; +0x116, 0x18012b0a6 subsd xmm4, xmm3 ; +0x11a, 0x18012b0aa subsd xmm1, xmm4 ; +0x11e, 0x18012b0ae subsd xmm1, xmm3 ; +0x122, 0x18012b0b2 subsd xmm5, xmm1 ; +0x126, 0x18012b0b6 movapd xmm0, xmm4 ; +0x12a, 0x18012b0ba movapd xmm1, xmm5 ; +0x12e, 0x18012b0be subsd xmm0, xmm5 ; +0x132, 0x18012b0c2 cmp rcx, 3F2h ; +0x136, 0x18012b0c6 jge Lcosf_sse2_calc_sincosf_piby4 ; +0x13d, 0x18012b0cd cmp rcx, 3DEh ; +0x143, 0x18012b0d3 jle short Lcosf_sse2_r_very_small ; +0x14a, 0x18012b0da movapd xmm2, xmm0 ; +0x14c, 0x18012b0dc mulsd xmm2, xmm0 ; +0x150, 0x18012b0e0 and r8d, eax ; +0x154, 0x18012b0e4 jz short Lcosf_sse2_r_small_calc_sin ; +0x157, 0x18012b0e7 movsd xmm3, cs:qword_180171A70 ; +0x159, 0x18012b0e9 mulsd xmm3, xmm0 ; +0x161, 0x18012b0f1 mulsd xmm3, xmm2 ; +0x165, 0x18012b0f5 subsd xmm0, xmm3 ; +0x169, 0x18012b0f9 jmp Lcosf_sse2_adjust_region ; +0x16d, 0x18012b0fd align 10h ; +0x172, 0x18012b102 movsd xmm0, qword ptr cs:xmmword_180171A40 ; +0x180, 0x18012b110 mulsd xmm2, cs:qword_180171A50 ; +0x188, 0x18012b118 subsd xmm0, xmm2 ; +0x190, 0x18012b120 jmp Lcosf_sse2_adjust_region ; +0x194, 0x18012b124 align 10h ; +0x199, 0x18012b129 and r8d, eax ; +0x1a0, 0x18012b130 jnz Lcosf_sse2_adjust_region ; +0x1a3, 0x18012b133 movsd xmm0, qword ptr cs:xmmword_180171A40 ; +0x1a9, 0x18012b139 jmp Lcosf_sse2_adjust_region ; +0x1b1, 0x18012b141 align 10h ; +0x1b6, 0x18012b146 mov [rsp+68h+var_48], rdx ; +0x1c0, 0x18012b150 mov [rsp+68h+var_38], r10 ; +0x1c5, 0x18012b155 call __remainder_piby2d2f_forAsm ; +0x1ca, 0x18012b15a mov rdx, [rsp+68h+var_48] ; +0x1cf, 0x18012b15f mov r10, [rsp+68h+var_38] ; +0x1d4, 0x18012b164 mov r8d, 1 ; +0x1d9, 0x18012b169 movapd xmm1, xmm0 ; +0x1df, 0x18012b16f movsd xmm5, cs:qword_180171A50 ; +0x1e3, 0x18012b173 jmp short Lcosf_sse2_calc_sincosf_piby4 ; +0x1eb, 0x18012b17b align 20h ; +0x1ed, 0x18012b17d movapd xmm2, xmm0 ; +0x1f0, 0x18012b180 mulsd xmm2, xmm0 ; +0x1f4, 0x18012b184 and r8d, eax ; +0x1f8, 0x18012b188 jz short Lcosf_sse2_do_cosf_calc ; +0x1fb, 0x18012b18b movsd xmm1, cs:qword_180175688 ; +0x1fd, 0x18012b18d mulsd xmm1, xmm2 ; +0x205, 0x18012b195 movsd xmm4, xmm2 ; +0x209, 0x18012b199 mulsd xmm4, xmm2 ; +0x20d, 0x18012b19d movsd xmm5, cs:qword_180175678 ; +0x211, 0x18012b1a1 mulsd xmm5, xmm2 ; +0x219, 0x18012b1a9 movsd xmm3, xmm0 ; +0x21d, 0x18012b1ad mulsd xmm3, xmm2 ; +0x221, 0x18012b1b1 addsd xmm1, cs:qword_180175680 ; +0x225, 0x18012b1b5 mulsd xmm1, xmm4 ; +0x22d, 0x18012b1bd addsd xmm5, cs:qword_180175670 ; +0x231, 0x18012b1c1 addsd xmm1, xmm5 ; +0x239, 0x18012b1c9 mulsd xmm1, xmm3 ; +0x23d, 0x18012b1cd addsd xmm0, xmm1 ; +0x241, 0x18012b1d1 jmp short Lcosf_sse2_adjust_region ; +0x245, 0x18012b1d5 align 20h ; +0x247, 0x18012b1d7 movsd xmm1, cs:qword_180175660 ; +0x250, 0x18012b1e0 movsd xmm4, xmm2 ; +0x258, 0x18012b1e8 mulsd xmm1, xmm2 ; +0x25c, 0x18012b1ec movsd xmm3, cs:qword_180175650 ; +0x260, 0x18012b1f0 mulsd xmm4, xmm2 ; +0x268, 0x18012b1f8 movsd xmm0, cs:qword_180175640 ; +0x26c, 0x18012b1fc mulsd xmm3, xmm2 ; +0x274, 0x18012b204 mulsd xmm0, xmm2 ; +0x278, 0x18012b208 addsd xmm1, cs:qword_180175658 ; +0x27c, 0x18012b20c mulsd xmm1, xmm4 ; +0x284, 0x18012b214 addsd xmm3, cs:qword_180175648 ; +0x288, 0x18012b218 addsd xmm1, xmm3 ; +0x290, 0x18012b220 mulsd xmm1, xmm4 ; +0x294, 0x18012b224 addsd xmm0, qword ptr cs:xmmword_180171A40 ; +0x298, 0x18012b228 addsd xmm0, xmm1 ; +0x2a0, 0x18012b230 add eax, 1 ; +0x2a4, 0x18012b234 and eax, 2 ; +0x2a7, 0x18012b237 jz short Lcosf_sse2_cleanup ; +0x2aa, 0x18012b23a xorpd xmm2, xmm2 ; +0x2ac, 0x18012b23c subsd xmm2, xmm0 ; +0x2b0, 0x18012b240 movapd xmm0, xmm2 ; +0x2b4, 0x18012b244 nop dword ptr [rax+rax+00000000h] ; +0x2b8, 0x18012b248 cvtsd2ss xmm0, xmm0 ; +0x2c0, 0x18012b250 add rsp, 68h ; +0x2c4, 0x18012b254 retn ; +0x2c8, 0x18012b258 call _cosf_special ; +0x2c9, 0x18012b259 add rsp, 68h ; +0x2ce, 0x18012b25e retn ; +0x2d2, 0x18012b262 align 10h ; +0x2d3, 0x18012b263 vmovd eax, xmm0 ; +0x2e0, 0x18012b270 mov r8d, cs:dword_180171B50 ; +0x2e4, 0x18012b274 and eax, r8d ; +0x2eb, 0x18012b27b cmp eax, r8d ; +0x2ee, 0x18012b27e jz Lcosf_fma3_naninf ; +0x2f1, 0x18012b281 vcvtss2sd xmm5, xmm0, xmm0 ; +0x2f7, 0x18012b287 vmovq r9, xmm5 ; +0x2fb, 0x18012b28b btr r9, 3Fh ; '?' ; +0x300, 0x18012b290 cmp r9, cs:qword_180171A80 ; +0x305, 0x18012b295 jg Lcosf_fma3_range_reduce ; +0x30c, 0x18012b29c cmp r9, cs:qword_180171B20 ; +0x312, 0x18012b2a2 jge short Lcosf_fma3_compute_cosf_piby_4 ; +0x319, 0x18012b2a9 cmp r9, cs:qword_180171B30 ; +0x31b, 0x18012b2ab jge short Lcosf_fma3_compute_1_xx_5 ; +0x322, 0x18012b2b2 vaddss xmm1, xmm0, cs:dword_180171B40 ; +0x324, 0x18012b2b4 vmovd xmm0, cs:dword_180171B48 ; +0x32c, 0x18012b2bc add rsp, 68h ; +0x334, 0x18012b2c4 retn ; +0x338, 0x18012b2c8 align 10h ; +0x339, 0x18012b2c9 vmulsd xmm0, xmm5, cs:qword_180171A50 ; +0x340, 0x18012b2d0 vfnmadd213sd xmm0, xmm5, qword ptr cs:xmmword_180171A40 ; +0x348, 0x18012b2d8 vcvtsd2ss xmm0, xmm0, xmm0 ; +0x351, 0x18012b2e1 add rsp, 68h ; +0x355, 0x18012b2e5 retn ; +0x359, 0x18012b2e9 align 10h ; +0x35a, 0x18012b2ea movsd xmm0, xmm5 ; +0x360, 0x18012b2f0 vmovapd xmm2, cs:xmmword_180171A40 ; +0x364, 0x18012b2f4 vmulsd xmm3, xmm0, xmm0 ; +0x36c, 0x18012b2fc vmulsd xmm1, xmm3, cs:qword_180171A50 ; +0x370, 0x18012b300 vsubsd xmm2, xmm2, xmm1 ; +0x378, 0x18012b308 vmovsd xmm1, cs:qword_180175658 ; +0x37c, 0x18012b30c vfmadd231sd xmm1, xmm3, cs:qword_180175660 ; +0x384, 0x18012b314 vfmadd213sd xmm1, xmm3, cs:qword_180175650 ; +0x38d, 0x18012b31d vfmadd213sd xmm1, xmm3, cs:qword_180175648 ; +0x396, 0x18012b326 vmulsd xmm3, xmm3, xmm3 ; +0x39f, 0x18012b32f vmovdqa xmm0, xmm2 ; +0x3a3, 0x18012b333 vfmadd231sd xmm0, xmm1, xmm3 ; +0x3a7, 0x18012b337 vcvtsd2ss xmm0, xmm0, xmm0 ; +0x3ac, 0x18012b33c add rsp, 68h ; +0x3b0, 0x18012b340 retn ; +0x3b4, 0x18012b344 align 10h ; +0x3b5, 0x18012b345 vmovq xmm0, r9 ; +0x3c0, 0x18012b350 cmp r9, cs:qword_180171AE0 ; +0x3c5, 0x18012b355 jge short Lcosf_reduce_precise ; +0x3cc, 0x18012b35c vandpd xmm1, xmm0, cs:xmmword_180171AF0 ; +0x3ce, 0x18012b35e vmovapd xmm2, cs:xmmword_180171A60 ; +0x3d6, 0x18012b366 vfmadd213sd xmm2, xmm1, cs:qword_180171A50 ; +0x3de, 0x18012b36e vcvttpd2dq xmm2, xmm2 ; +0x3e7, 0x18012b377 vpmovsxdq xmm1, xmm2 ; +0x3eb, 0x18012b37b vandpd xmm4, xmm1, cs:xmmword_180171B00 ; +0x3f0, 0x18012b380 vshufps xmm1, xmm1, xmm1, 8 ; +0x3f8, 0x18012b388 vcvtdq2pd xmm1, xmm1 ; +0x3fd, 0x18012b38d vmovdqa xmm2, xmm0 ; +0x401, 0x18012b391 vfnmadd231sd xmm2, xmm1, cs:qword_180171A90 ; +0x405, 0x18012b395 vmulsd xmm3, xmm1, cs:qword_180171AA0 ; +0x40e, 0x18012b39e vsubsd xmm0, xmm2, xmm3 ; +0x416, 0x18012b3a6 vsubsd xmm2, xmm2, xmm0 ; +0x41a, 0x18012b3aa vsubsd xmm1, xmm2, xmm3 ; +0x41e, 0x18012b3ae vmovq rax, xmm4 ; +0x422, 0x18012b3b2 jmp short Lcosf_exit_s ; +0x427, 0x18012b3b7 align 20h ; +0x429, 0x18012b3b9 vmovq xmm0, r9 ; +0x430, 0x18012b3c0 cmp r9, cs:qword_180171AE0 ; +0x435, 0x18012b3c5 jge short Lcos_remainder_piby2 ; +0x43c, 0x18012b3cc call __remainder_piby2_fma3_bdl ; +0x43e, 0x18012b3ce jmp short Lcosf_exit_s ; +0x443, 0x18012b3d3 align 20h ; +0x445, 0x18012b3d5 call __remainder_piby2_fma3 ; +0x450, 0x18012b3e0 bt rax, 0 ; +0x455, 0x18012b3e5 jnb short Lcosf_piby4_compute ; +0x45a, 0x18012b3ea vmovsd xmm1, cs:qword_180175680 ; +0x45c, 0x18012b3ec vmulsd xmm3, xmm0, xmm0 ; +0x464, 0x18012b3f4 vfmadd231sd xmm1, xmm3, cs:qword_180175688 ; +0x468, 0x18012b3f8 vfmadd213sd xmm1, xmm3, cs:qword_180175678 ; +0x471, 0x18012b401 vfmadd213sd xmm1, xmm3, cs:qword_180175670 ; +0x47a, 0x18012b40a vmulsd xmm3, xmm0, xmm3 ; +0x483, 0x18012b413 vfmadd231sd xmm0, xmm1, xmm3 ; +0x487, 0x18012b417 jmp short Lcosf_fma3_adjust_sign ; +0x48c, 0x18012b41c align 20h ; +0x48e, 0x18012b41e vmovapd xmm2, cs:xmmword_180171A40 ; +0x490, 0x18012b420 vmulsd xmm3, xmm0, xmm0 ; +0x498, 0x18012b428 vmulsd xmm1, xmm3, cs:qword_180171A50 ; +0x49c, 0x18012b42c vsubsd xmm2, xmm2, xmm1 ; +0x4a4, 0x18012b434 vmovsd xmm1, cs:qword_180175658 ; +0x4a8, 0x18012b438 vfmadd231sd xmm1, xmm3, cs:qword_180175660 ; +0x4b0, 0x18012b440 vfmadd213sd xmm1, xmm3, cs:qword_180175650 ; +0x4b9, 0x18012b449 vfmadd213sd xmm1, xmm3, cs:qword_180175648 ; +0x4c2, 0x18012b452 vmulsd xmm3, xmm3, xmm3 ; +0x4cb, 0x18012b45b vmovdqa xmm0, xmm2 ; +0x4cf, 0x18012b45f vfmadd231sd xmm0, xmm1, xmm3 ; +0x4d3, 0x18012b463 add rax, 1 ; +0x4d8, 0x18012b468 shr rax, 1 ; +0x4dc, 0x18012b46c shl rax, 3Fh ; +0x4df, 0x18012b46f vmovq xmm3, rax ; +0x4e3, 0x18012b473 vxorpd xmm0, xmm0, xmm3 ; +0x4e8, 0x18012b478 vcvtsd2ss xmm0, xmm0, xmm0 ; +0x4ec, 0x18012b47c add rsp, 68h ; +0x4f0, 0x18012b480 retn ; +0x4f4, 0x18012b484 call _cosf_special ; +0x4f5, 0x18012b485 add rsp, 68h ; +0x4fa, 0x18012b48a retn ; +0x4fe, 0x18012b48e