//
// SecretLayer2::updateSearchLabel from 0x14057cc90 to 0x14057cfad (797 bytes)
//
// 5 xrefs:
// > SecretLayer2::init @ 0x140578b73
// > SecretLayer2::textInputClosed @ 0x14057cc24
// > SecretLayer4::init @ 0x140586000
// > ??> @ 0x14092c894
// > ??> @ 0x14092c8a0
//
// 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:34:25 +0000
//
// Merged with: SecretLayer2::updateSearchLabel, SecretLayer4::updateSearchLabel
__int64 __fastcall SecretLayer2::updateSearchLabel(__int64 a1, _BYTE *a2)
{
size_t v3; // rbx
size_t v4; // r8
char v5; // si
void **v6; // rcx
char *v7; // r15
unsigned __int64 v8; // r13
__int64 v9; // r14
size_t v10; // r8
unsigned __int64 v11; // r14
unsigned __int64 v12; // rdi
char *v13; // rbx
bool v14; // r12
void **v15; // rcx
unsigned __int64 v16; // r12
size_t v17; // r8
char *v18; // rax
void *v19; // rcx
char *v20; // rax
int v22; // [rsp+30h] [rbp-79h] BYREF
__int64 v23; // [rsp+38h] [rbp-71h]
void *v24[2]; // [rsp+40h] [rbp-69h] BYREF
__int64 v25; // [rsp+50h] [rbp-59h]
__int64 v26; // [rsp+58h] [rbp-51h]
__int64 v27; // [rsp+60h] [rbp-49h]
__int128 Buf2; // [rsp+68h] [rbp-41h] BYREF
__int64 v29; // [rsp+78h] [rbp-31h]
__int64 v30; // [rsp+80h] [rbp-29h]
void *Buf1[2]; // [rsp+88h] [rbp-21h] BYREF
__int64 v32; // [rsp+98h] [rbp-11h]
unsigned __int64 v33; // [rsp+A0h] [rbp-9h]
void *Block[2]; // [rsp+A8h] [rbp-1h] BYREF
unsigned __int64 v35; // [rsp+B8h] [rbp+Fh]
unsigned __int64 v36; // [rsp+C0h] [rbp+17h]
v27 = a1;
v22 = 0;
v23 = *(_QWORD *)(*(_QWORD *)(a1 + 456) + 616LL);
Buf2 = 0;
v29 = 0;
v30 = 15;
LOBYTE(Buf2) = 0;
v22 = 1;
*(_OWORD *)Buf1 = 0;
v32 = 0;
v33 = 0;
v3 = -1;
v4 = -1;
do
++v4;
while ( a2[v4] );
sub_14003D230(Buf1, a2, v4);
v5 = 3;
v6 = Buf1;
v7 = (char *)Buf1[0];
v8 = v33;
if ( v33 > 0xF )
v6 = (void **)Buf1[0];
v9 = v32;
v10 = v32;
if ( v32 )
v10 = 0;
if ( memcmp(v6, &Buf2, v10) || v9 )
{
*(_OWORD *)v24 = 0;
v25 = 3;
v11 = 15;
v26 = 15;
LOWORD(v24[0]) = *(_WORD *)"...";
WORD1(v24[0]) = (unsigned __int8)asc_14070EB14[2];
v22 = 7;
*(_OWORD *)Block = 0;
v35 = 0;
v36 = 0;
do
++v3;
while ( a2[v3] );
sub_14003D230(Block, a2, v3);
v5 = 15;
v15 = Block;
v13 = (char *)Block[0];
v12 = v36;
if ( v36 > 0xF )
v15 = (void **)Block[0];
v16 = v35;
v17 = v35;
if ( v35 > 3 )
v17 = 3;
v14 = !memcmp(v15, v24, v17) && v16 == 3;
}
else
{
v11 = v26;
v12 = v36;
v13 = (char *)Block[0];
v14 = 1;
}
if ( (v5 & 8) != 0 )
{
v5 &= ~8u;
if ( v12 > 0xF )
{
v18 = v13;
if ( v12 + 1 >= 0x1000 )
{
v13 = *((char **)v13 - 1);
if ( (unsigned __int64)(v18 - v13 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v13);
}
}
if ( (v5 & 4) != 0 )
{
v5 &= ~4u;
if ( v11 > 0xF )
{
v19 = v24[0];
if ( v11 + 1 >= 0x1000 )
{
v19 = *((void **)v24[0] - 1);
if ( (unsigned __int64)((char *)v24[0] - (char *)v19 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v19);
}
}
if ( (v5 & 2) != 0 && v8 > 0xF )
{
v20 = v7;
if ( v8 + 1 >= 0x1000 )
{
v7 = *((char **)v7 - 1);
if ( (unsigned __int64)(v20 - v7 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v7);
}
if ( v14 )
{
*(_OWORD *)Buf1 = 0;
v32 = 3;
v33 = 15;
LOWORD(Buf1[0]) = *(_WORD *)"...";
WORD1(Buf1[0]) = (unsigned __int8)asc_14070EB14[2];
CCTextInputNode::updateLabel(*(_QWORD *)(v27 + 456), (__int64 *)Buf1);
LOWORD(v22) = -26260;
BYTE2(v22) = -40;
}
else
{
LOWORD(v22) = -1;
BYTE2(v22) = -1;
}
return (**(__int64 (__fastcall ***)(__int64, int *))(v23 + 368))(v23 + 368, &v22);
}