//
// sub_100167880 from 0x100167880 to 0x100167a11 (401 bytes)
//
// 1 xrefs:
// > sub_100167620 @ 0x1001677c4
//
// 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_100167880(__int64 *a1, _QWORD *a2)
{
__int64 *v2; // r14
__int64 v3; // r12
__int64 v4; // r13
__int64 v5; // r15
__int128 v6; // xmm0
__int64 v7; // r14
__int64 v8; // r15
__int64 v9; // rax
__int64 v10; // rcx
__int64 v11; // rdx
void *v12; // rdi
__int64 v13; // rax
__int64 v14; // rax
__int64 v15; // rax
__int64 result; // rax
__int64 v17; // [rsp+10h] [rbp-30h]
v2 = a1;
v3 = *a1;
v4 = a1[1];
v5 = a2[1] + *a1 - v4;
if ( *a1 != v4 )
{
v6 = 0;
v7 = a2[1] + *a1 - v4;
v8 = *a1;
v17 = v7;
do
{
*(_QWORD *)v7 = *(_QWORD *)v8;
v9 = v7 + 8;
v10 = *(_QWORD *)(v8 + 8);
*(_QWORD *)(v7 + 8) = v10;
v11 = *(_QWORD *)(v8 + 16);
*(_QWORD *)(v7 + 16) = v11;
if ( v11 )
{
*(_QWORD *)(v10 + 16) = v9;
*(_QWORD *)v8 = v8 + 8;
*(_OWORD *)(v8 + 8) = v6;
}
else
{
*(_QWORD *)v7 = v9;
}
memcpy((void *)(v7 + 24), (const void *)(v8 + 24), 0xB4u);
*(_OWORD *)(v7 + 208) = 0;
*(_QWORD *)(v7 + 224) = 0;
*(_OWORD *)(v7 + 208) = *(_OWORD *)(v8 + 208);
*(_QWORD *)(v7 + 224) = *(_QWORD *)(v8 + 224);
*(_OWORD *)(v8 + 208) = 0;
*(_QWORD *)(v8 + 224) = 0;
*(_DWORD *)(v7 + 232) = *(_DWORD *)(v8 + 232);
v8 += 240;
v7 += 240;
v6 = 0;
}
while ( v8 != v4 );
v2 = a1;
v5 = v17;
do
{
v12 = *(void **)(v3 + 208);
if ( v12 )
{
*(_QWORD *)(v3 + 216) = v12;
operator delete(v12);
}
sub_100054D90(v3, *(_QWORD **)(v3 + 8));
v3 += 240;
}
while ( v3 != v4 );
}
a2[1] = v5;
v13 = *v2;
v2[1] = *v2;
*v2 = a2[1];
a2[1] = v13;
v14 = v2[1];
v2[1] = a2[2];
a2[2] = v14;
v15 = v2[2];
v2[2] = a2[3];
a2[3] = v15;
result = a2[1];
*a2 = result;
return result;
}