//
// sub_10045C914 from 0x10045c914 to 0x10045cb9c (648 bytes)
//
// 3 xrefs:
// > sub_1004433EC @ 0x1004438d8
// > sub_1004433EC @ 0x100443944
// > sub_10045BF90 @ 0x10045c11c
//
// 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 sub_10045C914(__int64 a1, unsigned int *a2)
{
float v4; // s8
float *v5; // x0
float v6; // s0
_QWORD *v7; // x0
bool v8; // cc
__int64 v9; // x21
__int64 v10; // x8
__int64 result; // x0
unsigned __int8 v12; // [xsp+Bh] [xbp-35h] BYREF
unsigned int v13; // [xsp+Ch] [xbp-34h] BYREF
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 144LL))(a1, *a2);
v4 = *(float *)(a1 + 556);
if ( (~LODWORD(v4) & 0x7F800000) != 0 )
{
v5 = *(float **)(a1 + 472);
if ( v5 )
{
if ( *(_QWORD *)(a1 + 32) )
{
v6 = v5[26];
if ( v6 <= v4 )
v6 = *(float *)(a1 + 556);
if ( v6 > v5[25] )
v6 = v5[25];
*(float *)(a1 + 556) = v6;
if ( !(*(unsigned int (__fastcall **)(float *))(*(_QWORD *)v5 + 112LL))(v5)
&& *(_QWORD *)(a1 + 496)
&& (v4 < 0.0 && *(float *)(a1 + 556) > 0.0 || v4 > 0.0 && *(float *)(a1 + 556) < 0.0) )
{
sub_10045DC60(a1, 1);
}
}
}
}
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)a1 + 72LL))(a1, *(float *)(a1 + 52));
v7 = *(_QWORD **)(a1 + 472);
if ( v7 )
{
if ( !*(_QWORD *)(a1 + 32)
|| (v7[5] ? (v8 = a2[3] > a2[2]) : (v8 = 0),
!v8 || ((*(void (__fastcall **)(_QWORD *))(*v7 + 144LL))(v7), (v7 = *(_QWORD **)(a1 + 472)) != nullptr)) )
{
if ( !*(_QWORD *)(a1 + 32)
|| (int)a2[6] < -1
|| ((*(void (__fastcall **)(_QWORD *))(*v7 + 152LL))(v7), (v7 = *(_QWORD **)(a1 + 472)) != nullptr) )
{
if ( *(_QWORD *)(a1 + 32) )
{
v9 = a2[1];
v10 = v7[5];
if ( !v10 )
goto LABEL_25;
if ( (*(unsigned int (__fastcall **)(_QWORD, unsigned int *, __int64))(*(_QWORD *)v10 + 152LL))(
v7[5],
&v13,
2)
|| v13 <= (unsigned int)v9 )
{
goto LABEL_28;
}
v7 = *(_QWORD **)(a1 + 472);
if ( !v7[5] )
{
LABEL_25:
if ( !v7[6] )
goto LABEL_28;
}
if ( !(*(unsigned int (__fastcall **)(_QWORD *, __int64))(*v7 + 128LL))(v7, v9 << 32) )
sub_10045DC60(a1, 1);
}
}
}
}
LABEL_28:
(*(void (__fastcall **)(__int64, _QWORD, float))(*(_QWORD *)a1 + 32LL))(a1, 0, *(float *)(a1 + 48));
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 120LL))(a1, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 120LL))(a1, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 120LL))(a1, 2);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 120LL))(a1, 3);
if ( !*(_QWORD *)(a1 + 368)
|| ((*(void (__fastcall **)(__int64, unsigned __int8 *))(*(_QWORD *)a1 + 496LL))(a1, &v12),
result = sub_1005085F4(a1, *(_QWORD *)(a1 + 80), 0, 1, v12, 0),
!(_DWORD)result) )
{
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)a2 + 2) + 208LL))(*((_QWORD *)a2 + 2));
result = 0;
*(_DWORD *)(*((_QWORD *)a2 + 2) + 60LL) &= ~0x8000u;
}
return result;
}