//
// TIFFSetupStrips from 0x6f4544 to 0x6f473c (504 bytes)
//
// 3 xrefs:
// > TIFFCheckpointDirectory @ 0x6b7950
// > TIFFWriteCheck @ 0x6f48bc
// > ??> @ 0x5822c
//
// 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
//
int __fastcall TIFFSetupStrips(int a1)
{
unsigned int v1; // r3
unsigned int v2; // r3
int v6; // [sp+Ch] [bp-8h]
v6 = a1 + 40;
if ( (*(_DWORD *)(a1 + 12) & 0x400) != 0 )
{
if ( (*(_DWORD *)(a1 + 40) & 4) == 0 || *(_DWORD *)(a1 + 60) )
v1 = TIFFNumberOfTiles((_DWORD *)a1);
else
v1 = *(unsigned __int16 *)(a1 + 98);
*(_DWORD *)(v6 + 124) = v1;
}
else
{
if ( (*(_DWORD *)(a1 + 40) & 0x20000) == 0 || *(_DWORD *)(a1 + 60) )
v2 = TIFFNumberOfStrips(a1);
else
v2 = *(unsigned __int16 *)(a1 + 98);
*(_DWORD *)(v6 + 124) = v2;
}
*(_DWORD *)(v6 + 128) = *(_DWORD *)(v6 + 124);
if ( *(_WORD *)(v6 + 86) == 2 )
*(_DWORD *)(v6 + 124) /= (unsigned int)*(unsigned __int16 *)(v6 + 58);
*(_DWORD *)(v6 + 132) = TIFFmalloc(8 * *(_DWORD *)(v6 + 128));
*(_DWORD *)(v6 + 136) = TIFFmalloc(8 * *(_DWORD *)(v6 + 128));
if ( !*(_DWORD *)(v6 + 132) || !*(_DWORD *)(v6 + 136) )
return 0;
TIFFmemset(*(_DWORD *)(v6 + 132), 0, 8 * *(_DWORD *)(v6 + 128));
TIFFmemset(*(_DWORD *)(v6 + 136), 0, 8 * *(_DWORD *)(v6 + 128));
*(_DWORD *)(a1 + 40) |= 0x2000000u;
*(_DWORD *)(a1 + 40) |= 0x1000000u;
return 1;
}