//
// sub_14026E4B0 from 0x14026e4b0 to 0x14026e6a7 (503 bytes)
//
// 3 xrefs:
// > sub_14026C9F0 @ 0x14026ca46
// > ??> @ 0x1406d0c44
// > ??> @ 0x1406d0c50
//
// 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
//
unsigned __int64 *__fastcall sub_14026E4B0(
unsigned __int64 *a1,
unsigned __int64 a2,
unsigned __int64 a3,
unsigned __int8 (__fastcall *a4)(__int64, unsigned __int64))
{
unsigned __int64 v4; // rbp
unsigned __int64 v5; // r13
unsigned __int64 v6; // rbx
unsigned __int64 v8; // rsi
unsigned __int64 v9; // rdi
unsigned __int64 v10; // rdi
unsigned __int64 v11; // r14
unsigned __int64 v12; // r12
__int64 v13; // rbp
unsigned __int64 v14; // rbp
v4 = a2;
v5 = a3;
v6 = a2 + ((__int64)(a3 - a2) >> 7 << 6);
sub_14026F730(a2, v6, a3 - 64);
v8 = v6 + 64;
if ( v4 < v6 )
{
do
{
v9 = v6 - 64;
if ( a4(v6 - 64, v6) )
break;
if ( a4(v6, v6 - 64) )
break;
v6 -= 64LL;
}
while ( v4 < v9 );
}
for ( ; v8 < v5; v8 += 64LL )
{
if ( a4(v8, v6) )
break;
if ( a4(v6, v8) )
break;
}
v10 = v8;
v11 = v6;
while ( 1 )
{
while ( 1 )
{
if ( v10 < v5 )
{
do
{
if ( !a4(v6, v10) )
{
if ( a4(v10, v6) )
break;
if ( v8 != v10 )
sub_14026F920(v8, v10);
v8 += 64LL;
}
v10 += 64LL;
}
while ( v10 < v5 );
v4 = a2;
}
v12 = v10;
if ( v4 < v11 )
{
v13 = v11 - 64;
do
{
if ( !a4(v13, v6) )
{
if ( a4(v6, v13) )
break;
v6 -= 64LL;
if ( v6 != v13 )
sub_14026F920(v6, v13);
}
v11 -= 64LL;
v13 -= 64;
}
while ( a2 < v11 );
v5 = a3;
}
v14 = v6;
if ( v11 == a2 )
break;
v11 -= 64LL;
if ( v10 != v5 )
{
v14 = v10;
v12 = v11;
goto LABEL_36;
}
v6 -= 64LL;
if ( v11 != v6 )
sub_14026F920(v11, v6);
v8 -= 64LL;
sub_14026F920(v6, v8);
v4 = a2;
}
if ( v10 == v5 )
break;
if ( v8 != v10 )
sub_14026F920(v6, v8);
v8 += 64LL;
v6 += 64LL;
LABEL_36:
v10 += 64LL;
sub_14026F920(v14, v12);
v4 = a2;
}
*a1 = v6;
a1[1] = v8;
return a1;
}