//
// sub_1800A6180 from 0x1800a6180 to 0x1800a63d8 (600 bytes)
//
// 3 xrefs:
// > cocos2d::ZipUtils::urlDecode @ 0x1800a84ed
// > cocos2d::ZipUtils::urlDecode @ 0x1800a85e7
// > ??> @ 0x1801c1ca4
//
// 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:22:15 +0000
//
// Hidden C++ exception states: #wind=3
__int64 __fastcall sub_1800A6180(__int64 a1, unsigned __int8 a2)
{
__int64 v3; // r14
unsigned int v4; // ebx
__int64 v5; // r12
__int64 v6; // rax
bool v7; // al
__int64 v8; // rax
__int64 v9; // r15
__int16 v10; // ax
__int64 v11; // r8
__int64 v12; // rdi
unsigned __int8 v13; // si
__int64 v14; // rcx
int v15; // eax
int v16; // ecx
__int64 v17; // rax
__int64 v18; // rdi
unsigned __int8 v19; // si
__int64 v20; // rax
int v21; // eax
int v22; // ecx
__int64 v23; // rax
unsigned int v27; // [rsp+70h] [rbp+18h]
v3 = a1;
v4 = 0;
v27 = 0;
v5 = a1;
v6 = std::ios::rdbuf(a1 + *(int *)(*(_QWORD *)a1 + 4LL));
if ( v6 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v6 + 8LL))(v6);
v7 = std::ios_base::good((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL)));
if ( v7 )
{
v8 = std::ios::tie(v3 + *(int *)(*(_QWORD *)v3 + 4LL));
if ( !v8 || v8 == v3 )
{
v7 = 1;
}
else
{
std::ostream::flush(v8);
v7 = std::ios_base::good((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL)));
}
}
if ( v7 )
{
if ( std::ios_base::width((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL))) > 1 )
v9 = std::ios_base::width((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL))) - 1;
else
v9 = 0;
v10 = std::ios_base::flags((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL)));
try
{
if ( (v10 & 0x1C0) == 0x40 )
{
LABEL_19:
v17 = std::ios::rdbuf(v3 + *(int *)(*(_QWORD *)v3 + 4LL));
if ( (unsigned int)std::streambuf::sputc(v17, a2) == -1 )
v4 = 4;
v27 = v4;
while ( !v4 && v9 > 0 )
{
v18 = v3 + *(int *)(*(_QWORD *)v3 + 4LL);
v19 = std::ios::fill(v18);
v20 = std::ios::rdbuf(v18);
v21 = std::streambuf::sputc(v20, v19);
--v9;
v22 = 4;
if ( v21 != -1 )
v22 = 0;
v4 = v22;
v27 = v22;
}
}
else
{
while ( !v4 )
{
if ( v9 <= 0 )
goto LABEL_19;
v12 = v3 + *(int *)(*(_QWORD *)v3 + 4LL);
v13 = std::ios::fill(v12);
v14 = std::ios::rdbuf(v12);
v15 = std::streambuf::sputc(v14, v13);
--v9;
v16 = 4;
if ( v15 != -1 )
v16 = 0;
v4 = v16;
v27 = v16;
}
}
}
catch ( ... )
{
LOBYTE(v11) = 1;
std::ios::setstate(a1 + *(int *)(*(_QWORD *)a1 + 4LL), 4, v11);
v3 = a1;
v4 = v27;
v5 = a1;
}
}
std::ios_base::width((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL)), 0);
std::ios::setstate(v3 + *(int *)(*(_QWORD *)v3 + 4LL), v4, 0);
if ( !std::uncaught_exception() )
std::ostream::_Osfx(v5);
v23 = std::ios::rdbuf(v5 + *(int *)(*(_QWORD *)v5 + 4LL));
if ( v23 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v23 + 16LL))(v23);
return v3;
}