//
// _ctrlfp from 0x180133858 to 0x1801338d4 (124 bytes)
//
// 11 xrefs:
// > ldexp @ 0x18012750a
// > ldexp @ 0x180127553
// > _except2 @ 0x18013312b
// > _umatherr @ 0x1801337fb
// > _umatherr @ 0x18013381d
// > _call_matherr @ 0x180133947
// > _handle_error @ 0x180133a67
// > _handle_error @ 0x180133b26
// > _handle_errorf @ 0x180133b8f
// > _handle_errorf @ 0x180133c5a
// > ??> @ 0x18020317c
//
// 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
//
__int64 __fastcall ctrlfp(int a1, int a2)
{
unsigned int fpsr; // esi
__int64 v5; // rcx
fpsr = get_fpsr();
v5 = a2 & a1 | fpsr & (~(_WORD)a2 | 0xFFFF807F);
if ( byte_1801B1864 && (((unsigned __int8)(a2 & a1) | fpsr & ((unsigned __int8)~(_BYTE)a2 | 0x7F)) & 0x40) != 0 )
set_fpsr(v5);
else
set_fpsr((unsigned int)v5 & 0xFFFFFFBF);
return fpsr;
}