//
// TIFFReverseBits from 0xc61aa8 to 0xc61bf0 (328 bytes)
//
// 7 xrefs:
// > TIFFFillStrip @ 0xc5f410
// > TIFFFillTile @ 0xc5f964
// > TIFFReadScanline @ 0xc5fef0
// > TIFFWriteEncodedStrip @ 0xc63a74
// > TIFFWriteEncodedTile @ 0xc63d24
// > TIFFFlushData1 @ 0xc63f90
// > ??> @ 0x84ed0
//
// 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
//
unsigned __int8 *__fastcall TIFFReverseBits(unsigned __int8 *result, __int64 a2)
{
unsigned __int64 v2; // x13
unsigned __int8 *v3; // x3
__int64 v4; // x10
unsigned __int8 v5; // w9
unsigned __int8 v6; // w8
unsigned __int8 v7; // w7
unsigned __int8 v8; // w6
unsigned __int8 v9; // w5
unsigned __int8 v10; // w4
unsigned __int8 v11; // w2
if ( a2 <= 8 )
{
v3 = result;
}
else
{
v2 = (unsigned __int64)(a2 - 9) >> 3;
v3 = &result[8 * v2 + 8];
do
{
v4 = *result;
result += 8;
v5 = byte_F51370[*(result - 7)];
v6 = byte_F51370[*(result - 6)];
v7 = byte_F51370[*(result - 5)];
v8 = byte_F51370[*(result - 4)];
v9 = byte_F51370[*(result - 3)];
v10 = byte_F51370[*(result - 2)];
v11 = byte_F51370[*(result - 1)];
*(result - 8) = byte_F51370[v4];
*(result - 7) = v5;
*(result - 6) = v6;
*(result - 5) = v7;
*(result - 4) = v8;
*(result - 3) = v9;
*(result - 2) = v10;
*(result - 1) = v11;
}
while ( result != v3 );
a2 = a2 - 8 - 8 * v2;
}
if ( a2 > 0 )
{
result = byte_F51370;
*v3 = byte_F51370[*v3];
if ( a2 > 1 )
{
v3[1] = byte_F51370[v3[1]];
if ( a2 > 2 )
{
v3[2] = byte_F51370[v3[2]];
if ( a2 > 3 )
{
v3[3] = byte_F51370[v3[3]];
if ( a2 > 4 )
{
v3[4] = byte_F51370[v3[4]];
if ( a2 > 5 )
{
v3[5] = byte_F51370[v3[5]];
if ( a2 > 6 )
{
v3[6] = byte_F51370[v3[6]];
if ( a2 > 7 )
{
result = (unsigned __int8 *)byte_F51370[v3[7]];
v3[7] = (unsigned __int8)result;
}
}
}
}
}
}
}
}
return result;
}