//
// sub_140077030 from 0x140077030 to 0x14007723a (522 bytes)
//
// 3 xrefs:
// > GManager::loadDataFromFile @ 0x1400778c6
// > GManager::loadDataFromFile @ 0x140077931
// > ??> @ 0x140911b70
//
// 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:25:51 +0000
//
// Hidden C++ exception states: #wind=3
_QWORD *__fastcall sub_140077030(_QWORD *a1, _BYTE *a2, __int64 a3, _BYTE *a4)
{
size_t v6; // rbx
size_t v7; // r8
unsigned __int64 v8; // rdi
size_t v9; // r15
void **v10; // rdx
_QWORD *v11; // r14
unsigned __int64 v12; // r8
unsigned __int64 v13; // rcx
char *v14; // rbx
__int64 v15; // rax
char *v16; // r9
void *v17; // rcx
void *v18; // rcx
void *Block[2]; // [rsp+40h] [rbp-29h] BYREF
size_t v21; // [rsp+50h] [rbp-19h]
unsigned __int64 v22; // [rsp+58h] [rbp-11h]
void *v23[2]; // [rsp+60h] [rbp-9h] BYREF
unsigned __int64 v24; // [rsp+70h] [rbp+7h]
unsigned __int64 v25; // [rsp+78h] [rbp+Fh]
*(_OWORD *)a1 = 0;
a1[2] = 0;
a1[3] = 0;
v6 = -1;
v7 = -1;
do
++v7;
while ( a2[v7] );
sub_14003D230(a1, a2, v7);
*(_OWORD *)v23 = 0;
v24 = 0;
v25 = 0;
sub_14003D230(v23, ".dat", 4u);
*(_OWORD *)Block = 0;
v21 = 0;
v22 = 0;
do
++v6;
while ( a4[v6] );
sub_14003D230(Block, a4, v6);
v8 = 0;
v9 = v21;
while ( 1 )
{
v10 = v23;
if ( v25 > 0xF )
v10 = (void **)v23[0];
v11 = a1;
if ( a1[3] > 0xFu )
v11 = (_QWORD *)*a1;
v12 = v24;
v13 = a1[2];
if ( v24 > v13 || v8 > v13 - v24 )
break;
if ( v24 )
{
v14 = (char *)v11 + v13;
v15 = sub_1406774C0((char *)v11 + v8, (char *)v11 + v13, v10, v24);
if ( (char *)v15 == v14 )
break;
v8 = v15 - (_QWORD)v11;
v12 = v24;
}
if ( v8 == -1 )
break;
v16 = (char *)Block;
if ( v22 > 0xF )
v16 = (char *)Block[0];
sub_140045CE0(a1, v8, v12, v16, v9);
v9 = v21;
v8 += v21;
}
if ( v22 > 0xF )
{
v17 = Block[0];
if ( v22 + 1 >= 0x1000 )
{
v17 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v17);
}
if ( v25 > 0xF )
{
v18 = v23[0];
if ( v25 + 1 >= 0x1000 )
{
v18 = *((void **)v23[0] - 1);
if ( (unsigned __int64)((char *)v23[0] - (char *)v18 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v18);
}
return a1;
}