//
// sub_BCC8A8 from 0xbcc8a8 to 0xbccaa4 (508 bytes)
//
// 2 xrefs:
// > png_chunk_warning @ 0xbcd08c
// > png_chunk_error @ 0xbcd240
//
// 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_BCC8A8(__int64 result, _BYTE *a2, __int64 a3)
{
int v3; // w3
int v4; // w4
int v5; // w3
int v6; // w6
int v7; // w0
int v8; // w3
__int64 v9; // x7
int v10; // w6
char v11; // w10
char v12; // w10
char v13; // w6
if ( (unsigned int)BYTE3(result) - 91 <= 5 || (unsigned int)BYTE3(result) - 65 > 0x39 )
{
*a2 = 91;
v3 = 4;
v13 = a0123456789abcd_5[BYTE3(result) >> 4];
a2[2] = a0123456789abcd_5[BYTE3(result) & 0xF];
a2[1] = v13;
a2[3] = 93;
}
else
{
*a2 = BYTE3(result);
v3 = 1;
}
if ( (unsigned int)BYTE2(result) - 91 <= 5 || (unsigned int)BYTE2(result) - 65 > 0x39 )
{
v12 = a0123456789abcd_5[BYTE2(result) >> 4];
a2[v3] = 91;
v4 = v3 + 4;
a2[v3 + 1] = v12;
a2[v3 + 2] = a0123456789abcd_5[WORD1(result) & 0xFLL];
a2[v3 + 3] = 93;
}
else
{
v4 = v3 + 1;
a2[v3] = BYTE2(result);
}
if ( (unsigned int)BYTE1(result) - 91 <= 5 || (unsigned int)BYTE1(result) - 65 > 0x39 )
{
v11 = a0123456789abcd_5[BYTE1(result) >> 4];
a2[v4] = 91;
v5 = v4 + 4;
a2[v4 + 1] = v11;
a2[v4 + 2] = a0123456789abcd_5[((unsigned int)result >> 8) & 0xFLL];
a2[v4 + 3] = 93;
}
else
{
v5 = v4 + 1;
a2[v4] = BYTE1(result);
}
if ( (unsigned int)(unsigned __int8)result - 91 > 5 && (unsigned int)(unsigned __int8)result - 65 <= 0x39 )
{
a2[v5] = result;
v6 = v5 + 1;
if ( a3 )
goto LABEL_13;
LABEL_18:
a2[v6] = 0;
return result;
}
a2[v5] = 91;
a2[v5 + 1] = a0123456789abcd_5[(unsigned __int8)result >> 4];
v6 = v5 + 4;
a2[v5 + 2] = a0123456789abcd_5[result & 0xF];
result = 93;
a2[v5 + 3] = 93;
if ( !a3 )
goto LABEL_18;
LABEL_13:
v7 = v6 + 1;
v8 = v6 + 2;
a2[v6] = 58;
v9 = v6 + 2;
v10 = v6 + 197;
a2[v7] = 32;
result = 0;
do
{
if ( !*(_BYTE *)(a3 + result) )
break;
++v8;
a2[v9 + result] = *(_BYTE *)(a3 + result);
++result;
}
while ( v8 != v10 );
a2[v8] = 0;
return result;
}