//
// sub_14026E8B0 from 0x14026e8b0 to 0x14026e9d2 (290 bytes)
//
// 3 xrefs:
// > sub_1402694F0 @ 0x1402695c0
// > sub_1402694F0 @ 0x14026960f
// > ??> @ 0x1406d0c8c
//
// 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
//
// Hidden C++ exception states: #wind=2
unsigned __int64 __fastcall sub_14026E8B0(__int64 a1, __int64 a2, __int64 a3)
{
__int64 *v4; // rsi
__int64 v5; // rcx
unsigned __int64 result; // rax
unsigned __int64 v7; // rdx
__int64 v8; // rbx
_QWORD *v9; // rax
__int64 v10; // rbx
__int64 v11; // rbp
__int64 v12; // rdi
__int64 v13; // rdi
*(_DWORD *)a2 = *(_DWORD *)a3;
v4 = (__int64 *)(a2 + 8);
*(_QWORD *)(a2 + 8) = 0;
*(_QWORD *)(a2 + 16) = 0;
*(_QWORD *)(a2 + 24) = 0;
v5 = *(_QWORD *)(a3 + 16) - *(_QWORD *)(a3 + 8);
result = (unsigned __int64)((unsigned __int128)(v5 * (__int128)0x4924924924924925LL) >> 64) >> 63;
v7 = v5 / 56;
if ( v5 / 56 )
{
if ( v7 > 0x492492492492492LL )
sub_140062A20(v5, v7);
v8 = 7 * v7;
v9 = sub_14003AA10(56 * v7);
*v4 = (__int64)v9;
v4[1] = (__int64)v9;
result = (unsigned __int64)&v9[v8];
v4[2] = result;
v10 = *v4;
v11 = *(_QWORD *)(a3 + 16);
v12 = *(_QWORD *)(a3 + 8);
if ( v12 != v11 )
{
v13 = v12 + 8;
do
{
*(_BYTE *)v10 = *(_BYTE *)(v13 - 8);
*(_DWORD *)(v10 + 4) = *(_DWORD *)(v13 - 4);
*(_DWORD *)(v10 + 8) = *(_DWORD *)v13;
*(_DWORD *)(v10 + 12) = *(_DWORD *)(v13 + 4);
*(_DWORD *)(v10 + 16) = *(_DWORD *)(v13 + 8);
*(_DWORD *)(v10 + 20) = *(_DWORD *)(v13 + 12);
*(_DWORD *)(v10 + 24) = *(_DWORD *)(v13 + 16);
*(_BYTE *)(v10 + 28) = *(_BYTE *)(v13 + 20);
sub_14024B270((_QWORD *)(v10 + 32), v13 + 24);
v10 += 56;
v13 += 56;
result = v13 - 8;
}
while ( v13 - 8 != v11 );
}
v4[1] = v10;
}
return result;
}