//
// cocos2d::tgaFlipImage from 0xb21dec to 0xb21edc (240 bytes)
//
// 2 xrefs:
// > cocos2d::tgaLoad @ 0xb220b8
// > ??> @ 0x54780
//
// 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
//
void __fastcall cocos2d::tgaFlipImage(__int64 a1)
{
int v2; // w22
void *v3; // x23
int v4; // w19
__int64 v5; // x26
int v6; // w24
__int64 v7; // x27
int v8; // w25
void *v9; // x0
v2 = *(__int16 *)(a1 + 6) * (*(unsigned __int8 *)(a1 + 5) >> 3);
v3 = malloc(v2);
if ( v3 )
{
v4 = *(__int16 *)(a1 + 8);
v5 = 0;
v6 = 0;
if ( v4 > 1 )
{
do
{
v7 = *(_QWORD *)(a1 + 16);
v8 = ~v6++;
memcpy(v3, (const void *)(v7 + v5), v2);
v9 = (void *)(*(_QWORD *)(a1 + 16) + v5);
v5 += v2;
memcpy(v9, (const void *)(v7 + (v4 + v8) * v2), v2);
memcpy((void *)(*(_QWORD *)(a1 + 16) + (v8 + *(__int16 *)(a1 + 8)) * v2), v3, v2);
v4 = *(__int16 *)(a1 + 8);
}
while ( *(__int16 *)(a1 + 8) / 2 > v6 );
}
free(v3);
*(_DWORD *)(a1 + 24) = 0;
}
}