//
// sub_1800B76D0 from 0x1800b76d0 to 0x1800b7b77 (1191 bytes)
//
// 2 xrefs:
// > kmMat4Inverse @ 0x1800b7fb8
// > ??> @ 0x1801b8c64
//
// 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_1800B76D0(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
float *v4; // rcx
char *v5; // rax
int v7; // r10d
int v8; // r11d
__int64 v9; // r13
float v10; // xmm0_4
int v11; // r8d
float *v12; // rdx
__int64 v13; // rdi
int v14; // ecx
int v15; // ecx
int v16; // ecx
int v17; // ecx
int v18; // xmm0_4
int v19; // eax
int v20; // xmm0_4
int v21; // eax
int v22; // xmm0_4
int v23; // eax
int v24; // xmm0_4
int v25; // xmm0_4
int v26; // eax
int v27; // xmm1_4
int v28; // eax
int v29; // xmm0_4
int v30; // eax
int v31; // xmm1_4
__int64 v32; // rcx
float v33; // xmm0_4
float *v34; // rax
__int64 v35; // rcx
__int64 v36; // r8
float v37; // xmm1_4
float v38; // xmm4_4
float v39; // xmm3_4
float v40; // xmm0_4
__int64 v42; // rax
__int64 v43; // rcx
__int64 v44; // rdx
int v45; // xmm0_4
__int64 v46; // r8
int v47; // xmm0_4
int v48; // xmm1_4
int v49; // xmm0_4
char *v50; // [rsp+0h] [rbp-88h]
__int128 v51; // [rsp+8h] [rbp-80h] BYREF
__int128 v52; // [rsp+18h] [rbp-70h]
__int128 v53; // [rsp+28h] [rbp-60h]
v2 = 0;
v4 = (float *)(a1 + 32);
v5 = (char *)&v51 - a1;
v50 = (char *)&v51 - a1;
v7 = 0;
v8 = 0;
v53 = 0;
v9 = 0;
v52 = 0;
v51 = 0;
while ( 1 )
{
v10 = 0.0;
v11 = 0;
v12 = v4;
v13 = 4;
do
{
if ( *(_DWORD *)((char *)v12 + (_QWORD)v5 - 32) != 1 )
{
if ( !(_DWORD)v51 )
{
v14 = -(int)*(v12 - 8);
if ( (int)*(v12 - 8) > 0 )
v14 = (int)*(v12 - 8);
if ( (float)v14 >= v10 )
{
v10 = (float)v14;
v8 = v11;
v7 = 0;
}
}
if ( !DWORD1(v51) )
{
v15 = -(int)*(v12 - 4);
if ( (int)*(v12 - 4) > 0 )
v15 = (int)*(v12 - 4);
if ( (float)v15 >= v10 )
{
v10 = (float)v15;
v7 = 1;
v8 = v11;
}
}
if ( !DWORD2(v51) )
{
v16 = -(int)*v12;
if ( (int)*v12 > 0 )
v16 = (int)*v12;
if ( (float)v16 >= v10 )
{
v10 = (float)v16;
v7 = 2;
v8 = v11;
}
}
if ( HIDWORD(v51) )
{
v5 = v50;
}
else
{
v17 = -(int)v12[4];
if ( (int)v12[4] > 0 )
v17 = (int)v12[4];
v5 = v50;
if ( (float)v17 >= v10 )
{
v10 = (float)v17;
v7 = 3;
v8 = v11;
}
}
}
++v11;
++v12;
--v13;
}
while ( v13 );
++*((_DWORD *)&v51 + v7);
if ( v8 != v7 )
{
v18 = *(_DWORD *)(a1 + 4LL * v8);
*(_DWORD *)(a1 + 4LL * v8) = *(_DWORD *)(a1 + 4LL * v7);
v19 = *(_DWORD *)(a1 + 4LL * v7 + 16);
*(_DWORD *)(a1 + 4LL * v7) = v18;
v20 = *(_DWORD *)(a1 + 4LL * v8 + 16);
*(_DWORD *)(a1 + 4LL * v8 + 16) = v19;
v21 = *(_DWORD *)(a1 + 4LL * v7 + 32);
*(_DWORD *)(a1 + 4LL * v7 + 16) = v20;
v22 = *(_DWORD *)(a1 + 4LL * v8 + 32);
*(_DWORD *)(a1 + 4LL * v8 + 32) = v21;
v23 = *(_DWORD *)(a1 + 4LL * v7 + 48);
*(_DWORD *)(a1 + 4LL * v7 + 32) = v22;
v24 = *(_DWORD *)(a1 + 4LL * v8 + 48);
*(_DWORD *)(a1 + 4LL * v8 + 48) = v23;
*(_DWORD *)(a1 + 4LL * v7 + 48) = v24;
v25 = *(_DWORD *)(a2 + 4LL * v8);
*(_DWORD *)(a2 + 4LL * v8) = *(_DWORD *)(a2 + 4LL * v7);
v26 = *(_DWORD *)(a2 + 4LL * v7 + 16);
*(_DWORD *)(a2 + 4LL * v7) = v25;
v27 = *(_DWORD *)(a2 + 4LL * v8 + 16);
*(_DWORD *)(a2 + 4LL * v8 + 16) = v26;
v28 = *(_DWORD *)(a2 + 4LL * v7 + 32);
*(_DWORD *)(a2 + 4LL * v7 + 16) = v27;
v29 = *(_DWORD *)(a2 + 4LL * v8 + 32);
*(_DWORD *)(a2 + 4LL * v8 + 32) = v28;
v30 = *(_DWORD *)(a2 + 4LL * v7 + 48);
*(_DWORD *)(a2 + 4LL * v7 + 32) = v29;
v31 = *(_DWORD *)(a2 + 4LL * v8 + 48);
*(_DWORD *)(a2 + 4LL * v8 + 48) = v30;
*(_DWORD *)(a2 + 4LL * v7 + 48) = v31;
}
*(_DWORD *)((char *)&v52 + v9) = v8;
v32 = 5 * v7;
*(_DWORD *)((char *)&v53 + v9) = v7;
v33 = *(float *)(a1 + 4 * v32);
if ( v33 == 0.0 )
return 0;
*(_DWORD *)(a1 + 4 * v32) = 1065353216;
v34 = (float *)(a1 + 16);
v35 = 0;
v36 = a2 - a1;
*(float *)(a1 + 4LL * v7) = (float)(1.0 / v33) * *(float *)(a1 + 4LL * v7);
*(float *)(a1 + 4LL * v7 + 16) = (float)(1.0 / v33) * *(float *)(a1 + 4LL * v7 + 16);
*(float *)(a1 + 4LL * v7 + 32) = (float)(1.0 / v33) * *(float *)(a1 + 4LL * v7 + 32);
*(float *)(a1 + 4LL * v7 + 48) = (float)(1.0 / v33) * *(float *)(a1 + 4LL * v7 + 48);
*(float *)(a2 + 4LL * v7) = (float)(1.0 / v33) * *(float *)(a2 + 4LL * v7);
*(float *)(a2 + 4LL * v7 + 16) = (float)(1.0 / v33) * *(float *)(a2 + 4LL * v7 + 16);
v37 = (float)(1.0 / v33) * *(float *)(a2 + 4LL * v7 + 48);
*(float *)(a2 + 4LL * v7 + 32) = (float)(1.0 / v33) * *(float *)(a2 + 4LL * v7 + 32);
*(float *)(a2 + 4LL * v7 + 48) = v37;
do
{
if ( v35 != v7 )
{
v38 = v34[4 * v7 - 4];
v34[4 * v7 - 4] = 0.0;
v39 = *(v34 - 4) - (float)(v38 * *(float *)(a1 + 4LL * v7));
v40 = *v34;
*(v34 - 4) = v39;
*v34 = v40 - (float)(v38 * *(float *)(a1 + 4LL * v7 + 16));
v34[4] = v34[4] - (float)(v38 * *(float *)(a1 + 4LL * v7 + 32));
v34[8] = v34[8] - (float)(v38 * *(float *)(a1 + 4LL * v7 + 48));
*(float *)((char *)v34 + v36 - 16) = v39 - (float)(v38 * *(float *)(a2 + 4LL * v7));
*(float *)((char *)v34 + v36) = *v34 - (float)(v38 * *(float *)(a2 + 4LL * v7 + 16));
*(float *)((char *)v34 + v36 + 16) = v34[4] - (float)(v38 * *(float *)(a2 + 4LL * v7 + 32));
*(float *)((char *)v34 + v36 + 32) = v34[8] - (float)(v38 * *(float *)(a2 + 4LL * v7 + 48));
}
++v35;
++v34;
}
while ( v35 < 4 );
v9 += 4;
if ( v9 >= 16 )
break;
v5 = v50;
v4 = (float *)(a1 + 32);
}
do
{
v42 = *(int *)((char *)&v52 + v2 + 12);
v43 = *(int *)((char *)&v53 + v2 + 12);
if ( (_DWORD)v42 != (_DWORD)v43 )
{
v44 = 4 * v42;
v45 = *(_DWORD *)(a1 + 16 * v42);
v46 = 4 * v43;
*(_DWORD *)(a1 + 4 * v44) = *(_DWORD *)(a1 + 16 * v43);
*(_DWORD *)(a1 + 4 * v46) = v45;
v47 = *(_DWORD *)(a1 + 16 * v42 + 4);
*(_DWORD *)(a1 + 4 * v44 + 4) = *(_DWORD *)(a1 + 16 * v43 + 4);
*(_DWORD *)(a1 + 4 * v46 + 4) = v47;
v48 = *(_DWORD *)(a1 + 16 * v42 + 8);
*(_DWORD *)(a1 + 4 * v44 + 8) = *(_DWORD *)(a1 + 16 * v43 + 8);
*(_DWORD *)(a1 + 4 * v46 + 8) = v48;
v49 = *(_DWORD *)(a1 + 16 * v42 + 12);
*(_DWORD *)(a1 + 4 * v44 + 12) = *(_DWORD *)(a1 + 16 * v43 + 12);
*(_DWORD *)(a1 + 4 * v46 + 12) = v49;
}
v2 -= 4;
}
while ( v2 >= -12 );
return 1;
}