//
// sub_1402B07B0 from 0x1402b07b0 to 0x1402b090d (349 bytes)
//
// 4 xrefs:
// > sub_1402B07B0 @ 0x1402b0808
// > GJSmartTemplate::logTemplateStatus @ 0x1402b4a08
// > GJSmartTemplate::getTemplateState @ 0x1402b4fab
// > ??> @ 0x1406d230c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=2
void __fastcall sub_1402B07B0(__int64 a1, __int64 a2, int a3, __int64 a4, __int64 a5)
{
int v6; // esi
__int64 v8; // rbx
__int64 v9; // rbp
_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;
v8 = 0;
if ( a3 != 8 )
{
v9 = a3;
do
{
*(_DWORD *)(a2 + 4 * v9) = 0;
sub_1402B07B0(8, a2, ++v6, a4, a5);
*(_DWORD *)(a2 + 4 * v9++) = 1;
}
while ( v6 != 8 );
}
fmt::BasicWriter::BasicWriter(v15);
do
{
fmt::BasicWriter::operator<<(v15, *(unsigned int *)(v8 + a2));
v8 += 4;
}
while ( v8 < 32 );
v10 = (_BYTE *)fmt::BasicWriter::c_str(v15);
*(_OWORD *)Block = 0;
v14 = 0;
v11 = -1;
do
++v11;
while ( v10[v11] );
sub_14003A930(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 )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v12);
}
}