//
// sub_1403B6BE0 from 0x1403b6be0 to 0x1403b6d5c (380 bytes)
//
// 4 xrefs:
// > sub_1403B6BE0 @ 0x1403b6c48
// > GJSmartTemplate::logTemplateStatus @ 0x1403baeb8
// > GJSmartTemplate::getTemplateState @ 0x1403bb48b
// > ??> @ 0x140923ccc
//
// 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:31:24 +0000
//
// Hidden C++ exception states: #wind=2
void __fastcall sub_1403B6BE0(__int64 a1, __int64 a2, int a3, __int64 a4, __int64 a5)
{
int v6; // ebx
_DWORD *v8; // rsi
__int64 i; // rbx
_BYTE *v10; // rax
size_t v11; // r8
void *v12; // rcx
void *Block[2]; // [rsp+38h] [rbp-270h] BYREF
__int128 v14; // [rsp+48h] [rbp-260h]
_BYTE v15[528]; // [rsp+60h] [rbp-248h] BYREF
v6 = a3;
if ( a3 != 8 )
{
v8 = (_DWORD *)(a2 + 4LL * a3);
do
{
*v8 = 0;
sub_1403B6BE0(8, a2, ++v6, a4, a5);
*v8++ = 1;
}
while ( v6 != 8 );
}
fmt::BasicWriter::BasicWriter(v15);
for ( i = 0; i < 8; ++i )
fmt::BasicWriter::operator<<(v15, *(unsigned int *)(a2 + 4 * i));
v10 = (_BYTE *)fmt::BasicWriter::c_str(v15);
*(_OWORD *)Block = 0;
v14 = 0;
v11 = -1;
do
++v11;
while ( v10[v11] );
sub_14003D230(Block, v10, v11);
fmt::BasicWriter::~BasicWriter(v15);
cocos2d::CCDictionary::setObject(a4, a5, Block);
if ( *((_QWORD *)&v14 + 1) > 0xFu )
{
v12 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v14 + 1) + 1LL) >= 0x1000 )
{
v12 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v12 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v12);
}
}