//
// sub_1800155E0 from 0x1800155e0 to 0x180015844 (612 bytes)
//
// 17 xrefs:
// > DS_Dictionary::setRectArrayForKey @ 0x18001f8e8
// > DS_Dictionary::setRectArrayForKey @ 0x18001f90c
// > DS_Dictionary::setRectArrayForKey @ 0x18001f931
// > DS_Dictionary::setRectArrayForKey @ 0x18001f956
// > DS_Dictionary::setRectArrayForKey @ 0x18001f97b
// > DS_Dictionary::setRectForKey @ 0x18001fcb1
// > DS_Dictionary::setRectForKey @ 0x18001fcd1
// > DS_Dictionary::setRectForKey @ 0x18001fcf2
// > DS_Dictionary::setRectForKey @ 0x18001fd13
// > DS_Dictionary::setRectForKey @ 0x18001fd34
// > DS_Dictionary::setVec2ArrayForKey @ 0x18002084a
// > DS_Dictionary::setVec2ArrayForKey @ 0x18002086e
// > DS_Dictionary::setVec2ArrayForKey @ 0x180020893
// > DS_Dictionary::setVec2ForKey @ 0x180020bd1
// > DS_Dictionary::setVec2ForKey @ 0x180020bf1
// > DS_Dictionary::setVec2ForKey @ 0x180020c12
// > ??> @ 0x1801b8578
//
// 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:21:24 +0000
//
// Hidden C++ exception states: #wind=3
__int64 __fastcall sub_1800155E0(__int64 a1, const char *a2)
{
const char *v2; // rbx
__int64 v3; // rsi
unsigned int v4; // r15d
signed __int64 v5; // r13
__int64 v6; // r14
__int64 v7; // r12
__int64 v8; // rax
bool v9; // al
__int64 v10; // rax
__int16 v11; // ax
__int64 v12; // rbx
unsigned __int8 v13; // di
__int64 v14; // rcx
__int64 v15; // rax
__int64 v16; // rbx
unsigned __int8 v17; // di
__int64 v18; // rax
__int64 v19; // r8
__int64 v20; // rax
__int64 v22; // [rsp+20h] [rbp-48h]
int v25; // [rsp+80h] [rbp+18h]
v2 = a2;
v3 = a1;
v4 = 0;
v25 = 0;
v5 = strlen(a2);
if ( std::ios_base::width((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL))) <= 0
|| std::ios_base::width((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL))) <= v5 )
{
v6 = 0;
}
else
{
v6 = std::ios_base::width((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL))) - v5;
}
v7 = v3;
v22 = v3;
v8 = std::ios::rdbuf(v3 + *(int *)(*(_QWORD *)v3 + 4LL));
if ( v8 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v8 + 8LL))(v8);
v9 = std::ios_base::good((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL)));
if ( v9 )
{
v10 = std::ios::tie(v3 + *(int *)(*(_QWORD *)v3 + 4LL));
if ( !v10 || v10 == v3 )
{
v9 = 1;
}
else
{
std::ostream::flush(v10);
v9 = std::ios_base::good((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL)));
}
}
if ( v9 )
{
v11 = std::ios_base::flags((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL)));
try
{
if ( (v11 & 0x1C0) != 0x40 )
{
while ( v6 > 0 )
{
v12 = v3 + *(int *)(*(_QWORD *)v3 + 4LL);
v13 = std::ios::fill(v12);
v14 = std::ios::rdbuf(v12);
if ( (unsigned int)std::streambuf::sputc(v14, v13) == -1 )
goto LABEL_24;
--v6;
}
v2 = a2;
}
v15 = std::ios::rdbuf(v3 + *(int *)(*(_QWORD *)v3 + 4LL));
if ( std::streambuf::sputn(v15, v2, v5) == v5 )
{
while ( v6 > 0 )
{
v16 = v3 + *(int *)(*(_QWORD *)v3 + 4LL);
v17 = std::ios::fill(v16);
v18 = std::ios::rdbuf(v16);
if ( (unsigned int)std::streambuf::sputc(v18, v17) == -1 )
goto LABEL_24;
--v6;
}
}
else
{
LABEL_24:
v4 = 4;
v25 = 4;
}
std::ios_base::width((std::ios_base *)(v3 + *(int *)(*(_QWORD *)v3 + 4LL)), 0);
}
catch ( ... )
{
LOBYTE(v19) = 1;
std::ios::setstate(a1 + *(int *)(*(_QWORD *)a1 + 4LL), 4, v19);
v3 = a1;
v4 = v25;
v7 = v22;
}
}
else
{
v4 = 4;
}
std::ios::setstate(v3 + *(int *)(*(_QWORD *)v3 + 4LL), v4, 0);
if ( !std::uncaught_exception() )
std::ostream::_Osfx(v7);
v20 = std::ios::rdbuf(v7 + *(int *)(*(_QWORD *)v7 + 4LL));
if ( v20 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v20 + 16LL))(v20);
return v3;
}