//
// sub_100613454 from 0x100613454 to 0x1006135b4 (352 bytes)
//
// 6 xrefs:
// > sub_100530708 @ 0x100530740
// > sub_100534C30 @ 0x100534c6c
// > sub_1005D818C @ 0x1005d81c0
// > sub_1005F9900 @ 0x1005f9954
// > sub_1005F9900 @ 0x1005f9ea0
// > sub_1006080FC @ 0x10060815c
//
// 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
//
__int64 __fastcall sub_100613454(
char *__s,
int __c,
int a3,
__int64 (__fastcall *a4)(char *, __int64, __int64),
__int64 a5)
{
char *v9; // x23
unsigned __int8 v10; // w8
__uint32_t v11; // w0
int v12; // t1
char *v13; // x0
char *v14; // x24
size_t v15; // x27
char *v16; // x0
__int64 v17; // x1
__int64 v18; // x0
__uint32_t v19; // w0
__int64 result; // x0
v9 = __s;
if ( __s )
{
while ( 1 )
{
if ( a3 )
{
v10 = *v9;
if ( *v9 )
{
do
{
if ( (char)v10 < 0 )
v11 = __maskrune(v10, 0x4000u);
else
v11 = _DefaultRuneLocale.__runetype[v10] & 0x4000;
if ( !v11 )
break;
v12 = (unsigned __int8)*++v9;
v10 = v12;
}
while ( v12 );
}
}
v13 = strchr(v9, __c);
v14 = v13;
if ( v13 == v9 || !*v9 )
{
v16 = nullptr;
v17 = 0;
}
else
{
if ( v13 )
v15 = (size_t)(v13 - 1);
else
v15 = (size_t)&v9[strlen(v9) - 1];
if ( a3 )
{
++v15;
do
{
v18 = *(unsigned __int8 *)(v15 - 1);
if ( *(char *)(v15 - 1) < 0 )
v19 = __maskrune(v18, 0x4000u);
else
v19 = _DefaultRuneLocale.__runetype[v18] & 0x4000;
--v15;
}
while ( v19 );
}
v17 = (unsigned int)(1 - (_DWORD)v9 + v15);
v16 = v9;
}
result = a4(v16, v17, a5);
if ( (int)result < 1 )
break;
v9 = v14 + 1;
if ( !v14 )
return 1;
}
}
else
{
sub_1005E0E48(14, 119, 115, (__int64)"conf_mod.c", 567);
return 0;
}
return result;
}