//
// sub_10042AA18 from 0x10042aa18 to 0x10042ac3c (548 bytes)
//
// 0 xrefs:
//
// 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
//
size_t __fastcall sub_10042AA18(__int64 a1, FILE *__stream)
{
size_t result; // x0
unsigned __int64 v5; // x23
unsigned int i; // w24
unsigned __int64 v7; // x8
unsigned int v8; // w22
unsigned int v9; // w8
unsigned int v10; // w23
char v11; // w25
unsigned int v12; // w9
if ( !a1 )
return fwrite("bitreader is NULL\n", 0x12u, 1u, __stream);
result = fprintf(
__stream,
"bitreader: capacity=%u words=%u bytes=%u consumed: words=%u, bits=%u\n",
*(_DWORD *)(a1 + 8),
*(_DWORD *)(a1 + 12),
*(_DWORD *)(a1 + 16),
*(_DWORD *)(a1 + 20),
*(_DWORD *)(a1 + 24));
if ( *(_DWORD *)(a1 + 12) )
{
v5 = 0;
do
{
fprintf(__stream, "%08X: ", v5);
for ( i = 0; i != 32; ++i )
{
v7 = *(unsigned int *)(a1 + 20);
if ( v5 < v7 || v5 == v7 && i < *(_DWORD *)(a1 + 24) )
fputc(46, __stream);
else
fprintf(__stream, "%01u", *(_DWORD *)(*(_QWORD *)a1 + 4 * v5) << i >> 31);
}
result = fputc(10, __stream);
++v5;
}
while ( v5 < *(unsigned int *)(a1 + 12) );
v8 = v5;
if ( !*(_DWORD *)(a1 + 16) )
return result;
}
else
{
v8 = 0;
if ( !*(_DWORD *)(a1 + 16) )
return result;
}
fprintf(__stream, "%08X: ", v8);
v9 = 8 * *(_DWORD *)(a1 + 16);
if ( v9 )
{
v10 = 0;
v11 = -1;
do
{
v12 = *(_DWORD *)(a1 + 20);
if ( v8 < v12 || v8 == v12 && v10 < *(_DWORD *)(a1 + 24) )
fputc(46, __stream);
else
fprintf(__stream, "%01u", (*(_DWORD *)(*(_QWORD *)a1 + 4LL * v8) >> (v9 + v11)) & 1);
++v10;
v9 = 8 * *(_DWORD *)(a1 + 16);
--v11;
}
while ( v10 < v9 );
}
return fputc(10, __stream);
}