//
// sub_100459A98 from 0x100459a98 to 0x100459d24 (652 bytes)
//
// 1 xrefs:
// > kmMat4Inverse @ 0x100459d78
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:05:25 +0000
//
__int64 __fastcall sub_100459A98(float *a1, __int64 a2)
{
__int64 v2; // x8
int v3; // w9
int v4; // w10
__int64 v5; // x15
float v6; // s1
float *v7; // x16
__int64 v8; // x17
float *v9; // x2
int v10; // w3
float *v11; // x15
__int64 v12; // x16
__int64 v13; // x3
float *v14; // x4
float v15; // s1
__int64 v16; // x3
__int64 v17; // x2
int v18; // s1
float v19; // s1
__int64 v20; // x17
int v21; // w2
float v22; // s1
__int64 i; // x17
__int64 v24; // x17
__int64 v25; // x3
float *v26; // x4
__int64 v27; // x6
float v28; // s1
__int64 j; // x6
__int64 v30; // x11
__int64 v31; // x10
__int64 v32; // x12
__int64 v33; // x13
__int64 v34; // x11
float *v35; // x12
float *v36; // x13
float v37; // s0
_QWORD v39[2]; // [xsp+8h] [xbp-38h]
_QWORD v40[2]; // [xsp+18h] [xbp-28h]
_QWORD v41[2]; // [xsp+28h] [xbp-18h]
v2 = 0;
v3 = 0;
v4 = 0;
v41[0] = 0;
v41[1] = 0;
v40[0] = 0;
v40[1] = 0;
v39[0] = 0;
v39[1] = 0;
do
{
v5 = 0;
v6 = 0.0;
v7 = a1;
do
{
if ( *((_DWORD *)v39 + v5) != 1 )
{
v8 = 0;
v9 = v7;
do
{
if ( !*((_DWORD *)v39 + v8) )
{
v10 = (int)*v9;
if ( v10 < 0 )
v10 = -v10;
if ( v6 <= (float)(unsigned int)v10 )
{
v4 = v5;
v3 = v8;
v6 = (float)(unsigned int)v10;
}
}
++v8;
v9 += 4;
}
while ( v8 != 4 );
}
++v5;
++v7;
}
while ( v5 != 4 );
++*((_DWORD *)v39 + v3);
v11 = &a1[v3];
v12 = a2 + 4LL * v3;
if ( v4 != v3 )
{
v13 = 0;
v14 = &a1[v4];
do
{
v15 = v14[v13];
v14[v13] = v11[v13];
v11[v13] = v15;
v13 += 4;
}
while ( v13 != 16 );
v16 = 0;
v17 = a2 + 4LL * v4;
do
{
v18 = *(_DWORD *)(v17 + v16);
*(_DWORD *)(v17 + v16) = *(_DWORD *)(v12 + v16);
*(_DWORD *)(v12 + v16) = v18;
v16 += 16;
}
while ( v16 != 64 );
}
*((_DWORD *)v40 + v2) = v4;
*((_DWORD *)v41 + v2) = v3;
v19 = a1[5 * v3];
if ( v19 == 0.0 )
return 0;
v20 = 0;
v21 = 4 * v3;
a1[5 * v3] = 1.0;
v22 = 1.0 / v19;
do
{
v11[v20] = v22 * v11[v20];
v20 += 4;
}
while ( v20 != 16 );
for ( i = 0; i != 64; i += 16 )
*(float *)(v12 + i) = v22 * *(float *)(v12 + i);
v24 = 0;
v25 = a2;
v26 = a1;
do
{
if ( v24 != v3 )
{
v27 = 0;
v28 = a1[v24 + v21];
a1[v24 + v21] = 0.0;
do
{
v26[v27] = v26[v27] - (float)(v11[v27] * v28);
v27 += 4;
}
while ( v27 != 16 );
for ( j = 0; j != 16; j += 4 )
*(float *)(v25 + j * 4) = v26[j] - (float)(*(float *)(v12 + j * 4) * v28);
}
++v24;
++v26;
v25 += 4;
}
while ( v24 != 4 );
++v2;
}
while ( v2 != 4 );
v30 = 3;
do
{
v31 = v30;
v32 = *((int *)v40 + v30);
v33 = *((int *)v41 + v30);
if ( (_DWORD)v32 != (_DWORD)v33 )
{
v34 = 0;
v35 = &a1[4 * v32];
v36 = &a1[4 * v33];
do
{
v37 = v35[v34];
v35[v34] = v36[v34];
v36[v34++] = v37;
}
while ( v34 != 4 );
}
v30 = v31 - 1;
}
while ( v31 );
return 1;
}