//
// sub_14035B080 from 0x14035b080 to 0x14035b394 (788 bytes)
//
// 2 xrefs:
// > sub_140356160 @ 0x1403561c7
// > ??> @ 0x140920dc8
//
// This function is hookable on this platform (idp: pc, 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:30:51 +0000
//
unsigned __int64 *__fastcall sub_14035B080(
unsigned __int64 *a1,
unsigned __int64 a2,
unsigned __int64 a3,
unsigned __int8 (__fastcall *a4)(unsigned __int64, unsigned __int64))
{
unsigned __int64 v7; // rbx
unsigned __int64 v8; // rsi
unsigned __int64 v9; // rdi
unsigned __int64 v10; // rdi
unsigned __int64 v11; // r14
bool v12; // zf
unsigned __int64 v13; // rbp
void *v16[25]; // [rsp+30h] [rbp-148h] BYREF
_BYTE v17[40]; // [rsp+F8h] [rbp-80h] BYREF
v7 = a2 + 232 * (((__int64)((unsigned __int128)((__int64)(a3 - a2) * (__int128)0x469EE58469EE5847LL) >> 64) >> 6) / 2);
sub_14035CAE0(a2, v7, a3 - 232);
v8 = v7 + 232;
if ( a2 < v7 )
{
do
{
v9 = v7 - 232;
if ( a4(v7 - 232, v7) )
break;
if ( a4(v7, v7 - 232) )
break;
v7 -= 232LL;
}
while ( a2 < v9 );
}
for ( ; v8 < a3; v8 += 232LL )
{
if ( a4(v8, v7) )
break;
if ( a4(v7, v8) )
break;
}
v10 = v8;
v11 = v7;
while ( 1 )
{
while ( 1 )
{
for ( ; v10 < a3; v10 += 232LL )
{
if ( !a4(v7, v10) )
{
if ( a4(v10, v7) )
break;
if ( v8 != v10 )
sub_14035CCF0(v8, v10);
v8 += 232LL;
}
}
v12 = v11 == a2;
if ( v11 > a2 )
{
v13 = v11 - 232;
do
{
if ( !a4(v13, v7) )
{
if ( a4(v7, v13) )
break;
v7 -= 232LL;
if ( v7 != v13 )
sub_14035CCF0(v7, v13);
}
v11 -= 232LL;
v13 -= 232LL;
}
while ( a2 < v11 );
v12 = v11 == a2;
}
if ( v12 )
break;
v11 -= 232LL;
if ( v10 == a3 )
{
v7 -= 232LL;
if ( v11 != v7 )
sub_14035CCF0(v11, v7);
v8 -= 232LL;
sub_14035C1D0(v16, v7);
sub_140359F40(v7, v8);
sub_140359F40(v8, (__int64)v16);
sub_140069730((__int64)v17);
sub_140358980(v16, (__int64)v16);
}
else
{
sub_14035C1D0(v16, v10);
sub_140359F40(v10, v11);
sub_140359F40(v11, (__int64)v16);
sub_140069730((__int64)v17);
sub_140358980(v16, (__int64)v16);
v10 += 232LL;
}
}
if ( v10 == a3 )
break;
if ( v8 != v10 )
{
sub_14035C1D0(v16, v7);
sub_140359F40(v7, v8);
sub_140359F40(v8, (__int64)v16);
sub_140069730((__int64)v17);
sub_140358980(v16, (__int64)v16);
}
v8 += 232LL;
sub_14035C1D0(v16, v7);
sub_140359F40(v7, v10);
sub_140359F40(v10, (__int64)v16);
sub_140069730((__int64)v17);
sub_140358980(v16, (__int64)v16);
v7 += 232LL;
v10 += 232LL;
}
*a1 = v7;
a1[1] = v8;
return a1;
}