//
// sub_10004B590 from 0x10004b590 to 0x10004b724 (404 bytes)
//
// 2 xrefs:
// > sub_1001F599C @ 0x1001f5cc8
// > sub_10037D90C @ 0x10037d9ac
//
// This function is hookable on this platform (idp: arm, 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 10:57:41 +0000
//
__int64 __fastcall sub_10004B590(char *a1, char *__s)
{
unsigned __int64 v4; // x24
signed __int64 v5; // x20
char *v6; // x25
signed __int64 v7; // x23
__int64 v8; // x21
__int64 v9; // x8
char *v10; // x25
char *v11; // x26
__int64 v12; // x10
bool v13; // cf
signed __int64 v14; // x9
char *v15; // x0
int v16; // w22
char *v17; // x0
char *v18; // x23
char *v20; // x26
int v21; // w21
void *v22; // x0
char *v23; // x0
char *v24; // x23
v4 = a1[23];
if ( (v4 & 0x8000000000000000LL) != 0 )
{
v7 = *((_QWORD *)a1 + 1);
if ( v7 )
{
v5 = strlen(__s);
v6 = *(char **)a1;
if ( v5 )
goto LABEL_4;
LABEL_8:
v9 = 0;
LABEL_9:
if ( (v4 & 0x80000000) == 0LL )
v10 = a1;
else
v10 = *(char **)a1;
if ( (v4 & 0x80000000) != 0LL )
v4 = *((_QWORD *)a1 + 1);
v11 = &v10[v4];
LODWORD(v8) = 1;
while ( 1 )
{
v8 = (unsigned int)(v8 + 1);
v12 = v9 + v5;
v13 = v4 >= v9 + v5;
v14 = v4 - (v9 + v5);
if ( v4 < v9 + v5 )
v9 = -1;
else
v9 += v5;
if ( v5 && v13 )
break;
LABEL_30:
if ( v9 == -1 )
return v8;
}
if ( v14 >= v5 )
{
v15 = &v10[v12];
v16 = *__s;
while ( v14 - v5 != -1 )
{
v17 = (char *)memchr(v15, v16, v14 - v5 + 1);
if ( !v17 )
break;
v18 = v17;
if ( !memcmp(v17, __s, v5) )
{
if ( v18 == v11 )
return v8;
v9 = v18 - v10;
goto LABEL_30;
}
v15 = v18 + 1;
v14 = v11 - (v18 + 1);
if ( v14 < v5 )
return v8;
}
}
return v8;
}
return 0;
}
if ( !a1[23] )
return 0;
v5 = strlen(__s);
v6 = a1;
v7 = v4;
if ( !v5 )
goto LABEL_8;
LABEL_4:
if ( v7 >= v5 )
{
v20 = &v6[v7];
v21 = *__s;
v22 = v6;
do
{
if ( v7 - v5 == -1 )
break;
v23 = (char *)memchr(v22, v21, v7 - v5 + 1);
if ( !v23 )
break;
v24 = v23;
if ( !memcmp(v23, __s, v5) )
{
v8 = 1;
if ( v24 != v20 )
{
v9 = v24 - v6;
if ( v24 - v6 != -1 )
goto LABEL_9;
}
return v8;
}
v22 = v24 + 1;
v7 = v20 - (v24 + 1);
}
while ( v7 >= v5 );
}
return 1;
}