//
// sub_10057D8A0 from 0x10057d8a0 to 0x10057da38 (408 bytes)
//
// 3 xrefs:
// > sub_1005278E0 @ 0x100527abb
// > sub_100527B60 @ 0x100527c52
// > sub_100527D10 @ 0x100528194
//
// 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 12:32:19 +0000
//
void __fastcall sub_10057D8A0(__int64 a1, unsigned int a2, const std::string *a3, int a4)
{
_QWORD *i; // rbx
__int64 v6; // r14
std::string *v7; // r13
unsigned int v8; // eax
std::string::size_type size; // rax
bool v10; // zf
int v11; // eax
__int64 v12; // rax
unsigned int v13; // eax
__int64 v14; // rax
unsigned int v15; // eax
int v16; // edx
_QWORD *v17; // [rsp+0h] [rbp-60h] BYREF
_QWORD *v18; // [rsp+8h] [rbp-58h]
_QWORD *v19; // [rsp+18h] [rbp-48h]
__int64 v20; // [rsp+20h] [rbp-40h]
void *__p; // [rsp+28h] [rbp-38h]
int v22; // [rsp+34h] [rbp-2Ch]
v22 = a4;
sub_10057E250(&v17, a1, a2);
__p = v17;
v19 = v18;
if ( v17 != v18 )
{
for ( i = __p; i != v19; ++i )
{
v6 = *i;
v7 = (std::string *)(*i + 1784LL);
std::string::operator=(v7, a3);
if ( v22 >= 0 )
{
v8 = (unsigned int)a3->__r_.__value_.__l.0;
if ( (v8 & 1) != 0 )
size = a3->__r_.__value_.__l.__size_;
else
size = v8 >> 1;
v10 = size == 0;
v11 = v22;
if ( v10 )
v11 = 0;
*(_DWORD *)(v6 + 1808) = v11;
}
if ( *(_DWORD *)(v6 + 900) != 5 )
continue;
if ( *(_BYTE *)(v6 + 1000) != 1 )
continue;
if ( *(_BYTE *)(v6 + 1844) )
continue;
v12 = GameManager::sharedState();
if ( (unsigned __int8)GameManager::getGameVariable(v12, "0203") )
continue;
v13 = *(unsigned __int8 *)(v6 + 1816);
if ( (v13 & 1) != 0 )
v14 = *(_QWORD *)(v6 + 1824);
else
v14 = v13 >> 1;
v20 = v14;
std::string::operator=((std::string *)(v6 + 1816), v7);
v15 = *(unsigned __int8 *)(v6 + 1816);
if ( !v20 )
{
if ( (v15 & 1) != 0 )
{
v16 = 1;
if ( *(_QWORD *)(v6 + 1824) )
goto LABEL_3;
}
else
{
v16 = 1;
if ( v15 >> 1 )
goto LABEL_3;
}
}
if ( (v15 & 1) != 0 )
{
if ( *(_QWORD *)(v6 + 1824) )
continue;
}
else if ( v15 >> 1 )
{
continue;
}
v16 = 0;
LABEL_3:
*(_DWORD *)(v6 + 1840) = v16;
}
}
if ( __p )
operator delete(__p);
}