//
// sub_1800B7670 from 0x1800b7670 to 0x1800b7759 (233 bytes)
//
// 4 xrefs:
// > sub_1800B4680 @ 0x1800b4922
// > ??> @ 0x180189808
// > ??> @ 0x180189818
// > ??> @ 0x1801fd158
//
// 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_1800B7670(__int64 a1, int a2, int *a3, _DWORD *a4)
{
int v4; // ebp
__int64 v5; // r15
int v9; // ebx
__int64 i; // rax
char **v11; // rdi
int v12; // ebx
__int64 v13; // rax
__int64 j; // rcx
v4 = 0;
v5 = a2;
v9 = 0;
if ( a2 > 0 )
{
for ( i = 0; i < a2; ++i )
{
if ( (*(_BYTE *)(i + a1) & 0xDF) == 0 )
break;
++v9;
}
}
if ( v9 >= a2 )
return 31;
v11 = off_1801AEA80;
*(_BYTE *)(v9 + a1) = 0;
while ( (unsigned int)sub_1800B7CF0(a1, *v11) )
{
++v4;
if ( (__int64)++v11 >= (__int64)&qword_1801AEA98 )
goto LABEL_11;
}
*a3 = v4;
LABEL_11:
if ( v4 >= 3 )
return 31;
v12 = v9 + 1;
v13 = v12;
for ( j = v12; v13 < v5; ++v13 )
{
if ( (*(_BYTE *)(v13 + a1) & 0xDF) == 0 )
break;
++v12;
}
if ( v12 >= (int)v5 )
return 31;
*(_BYTE *)(v12 + a1) = 0;
*a4 = unknown_libname_28(a1 + j);
return 0;
}