//
// sub_B41824 from 0xb41824 to 0xb419c4 (416 bytes)
//
// 4 xrefs:
// > DS_Dictionary::saveRootSubDictToFile @ 0xb41c5c
// > DS_Dictionary::saveRootSubDictToFile @ 0xb41c70
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0xb42780
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0xb42794
//
// 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 __usercall sub_B41824@(char *a1@, char *a2@, __int64 a3@)
{
__int64 v5; // x19
void *v6; // x0
char *v7; // x0
unsigned int *v9; // x1
int v10; // w2
unsigned int *v11; // x1
int v12; // w2
char *v13; // [xsp+48h] [xbp+48h] BYREF
__int64 v14; // [xsp+50h] [xbp+50h] BYREF
sub_D153B8(a3, a1);
sub_D153B8((int)&v13, ".dat");
sub_D153B8((int)&v14, a2);
while ( 1 )
{
v5 = sub_D1641C(a3, v13);
if ( v5 == -1 )
break;
sub_D1861C(a3, v5, *((_QWORD *)v13 - 3), v14, *(_QWORD *)(v14 - 24));
}
v6 = (void *)(v14 - 24);
if ( (__int64 *)(v14 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v14 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v14 - 8);
*(_DWORD *)(v14 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v6);
}
v7 = v13 - 24;
if ( v13 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v13 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *((_DWORD *)v13 - 2);
*((_DWORD *)v13 - 2) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v7);
}
return a3;
}