//
// SecretLayer2::updateSearchLabel from 0x1403e6fa0 to 0x1403e7284 (740 bytes)
//
// 4 xrefs:
// > SecretLayer2::init @ 0x1403e2fd5
// > SecretLayer2::textInputClosed @ 0x1403e6f44
// > SecretLayer4::init @ 0x1403f0755
// > ??> @ 0x1406d7f94
//
// 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
//
// 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+20h] [rbp-79h] BYREF
__int64 v23; // [rsp+28h] [rbp-71h]
__int64 v24; // [rsp+30h] [rbp-69h]
void *Buf1[2]; // [rsp+38h] [rbp-61h] BYREF
__int64 v26; // [rsp+48h] [rbp-51h]
unsigned __int64 v27; // [rsp+50h] [rbp-49h]
void *Block[2]; // [rsp+58h] [rbp-41h] BYREF
unsigned __int64 v29; // [rsp+68h] [rbp-31h]
unsigned __int64 v30; // [rsp+70h] [rbp-29h]
void *v31[2]; // [rsp+78h] [rbp-21h] BYREF
__int64 v32; // [rsp+88h] [rbp-11h]
__int64 v33; // [rsp+90h] [rbp-9h]
__int128 Buf2; // [rsp+98h] [rbp-1h] BYREF
__int64 v35; // [rsp+A8h] [rbp+Fh]
__int64 v36; // [rsp+B0h] [rbp+17h]
v24 = a1;
v22 = 0;
v23 = *(_QWORD *)(*(_QWORD *)(a1 + 456) + 576LL);
Buf2 = 0;
v35 = 0;
v36 = 15;
LOBYTE(Buf2) = 0;
v22 = 1;
*(_OWORD *)Buf1 = 0;
v26 = 0;
v27 = 0;
v3 = -1;
v4 = -1;
do
++v4;
while ( a2[v4] );
sub_14003A930(Buf1, a2, v4);
v5 = 3;
v6 = Buf1;
v7 = (char *)Buf1[0];
v8 = v27;
if ( v27 > 0xF )
v6 = (void **)Buf1[0];
v9 = v26;
v10 = v26;
if ( v26 )
v10 = 0;
if ( memcmp(v6, &Buf2, v10) || v9 )
{
*(_OWORD *)v31 = 0;
v32 = 3;
v11 = 15;
v33 = 15;
LOWORD(v31[0]) = *(_WORD *)"...";
WORD1(v31[0]) = (unsigned __int8)asc_14053DBB0[2];
v22 = 7;
*(_OWORD *)Block = 0;
v29 = 0;
v30 = 0;
do
++v3;
while ( a2[v3] );
sub_14003A930(Block, a2, v3);
v5 = 15;
v15 = Block;
v13 = (char *)Block[0];
v12 = v30;
if ( v30 > 0xF )
v15 = (void **)Block[0];
v16 = v29;
v17 = v29;
if ( v29 > 3 )
v17 = 3;
v14 = !memcmp(v15, v31, v17) && v16 == 3;
}
else
{
v11 = v33;
v12 = v30;
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 )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v13);
}
}
if ( (v5 & 4) != 0 )
{
v5 &= ~4u;
if ( v11 > 0xF )
{
v19 = v31[0];
if ( v11 + 1 >= 0x1000 )
{
v19 = *((void **)v31[0] - 1);
if ( (unsigned __int64)((char *)v31[0] - (char *)v19 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
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 )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v7);
}
if ( v14 )
{
*(_OWORD *)Buf1 = 0;
v26 = 3;
v27 = 15;
LOWORD(Buf1[0]) = *(_WORD *)"...";
WORD1(Buf1[0]) = (unsigned __int8)asc_14053DBB0[2];
CCTextInputNode::updateLabel(*(CCTextInputNode **)(v24 + 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);
}