//
// png_do_packswap from 0xbe59f0 to 0xbe5a68 (120 bytes)
//
// 3 xrefs:
// > png_do_read_transformations @ 0xbda4b8
// > png_do_write_transformations @ 0xbe98d8
// > ??> @ 0xa9bd8
//
// 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 png_do_packswap(__int64 result, unsigned __int8 *a2)
{
unsigned int v2; // w3
unsigned __int8 *v3; // x3
unsigned __int8 *v4; // x2
v2 = *(unsigned __int8 *)(result + 17);
if ( v2 <= 7 )
{
switch ( v2 )
{
case 1u:
v3 = (unsigned __int8 *)&unk_F2EE40;
break;
case 2u:
v3 = (unsigned __int8 *)&unk_F2EF40;
break;
case 4u:
v3 = (unsigned __int8 *)&unk_F2F040;
break;
default:
return result;
}
v4 = &a2[*(_QWORD *)(result + 8)];
if ( a2 < v4 )
{
do
{
result = v3[*a2];
*a2++ = result;
}
while ( a2 != v4 );
}
}
return result;
}