//
// TIFFSetupStrips from 0xc62c30 to 0xc62d40 (272 bytes)
//
// 3 xrefs:
// > TIFFCheckpointDirectory @ 0xc41ab8
// > TIFFWriteCheck @ 0xc62e8c
// > ??> @ 0xaa3e8
//
// 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 TIFFSetupStrips(__int64 a1)
{
__int64 v2; // x19
unsigned int v3; // w0
int v4; // w1
void *v5; // x0
int v7; // w1
if ( (*(_DWORD *)(a1 + 16) & 0x400) == 0 )
{
if ( (*(_QWORD *)(a1 + 56) & 0x20000) == 0 || *(_DWORD *)(a1 + 92) )
{
v2 = a1 + 56;
v3 = TIFFNumberOfStrips(a1);
v7 = *(unsigned __int16 *)(a1 + 170);
*(_DWORD *)(a1 + 224) = v3;
*(_DWORD *)(a1 + 228) = v3;
if ( v7 != 2 )
goto LABEL_6;
LABEL_12:
*(_DWORD *)(v2 + 168) = v3 / *(unsigned __int16 *)(v2 + 74);
goto LABEL_6;
}
goto LABEL_4;
}
if ( (*(_QWORD *)(a1 + 56) & 4) != 0 && !*(_DWORD *)(a1 + 92) )
{
LABEL_4:
v2 = a1 + 56;
v3 = *(unsigned __int16 *)(a1 + 130);
goto LABEL_5;
}
v2 = a1 + 56;
v3 = TIFFNumberOfTiles((_DWORD *)a1);
LABEL_5:
v4 = *(unsigned __int16 *)(v2 + 114);
*(_DWORD *)(v2 + 168) = v3;
*(_DWORD *)(v2 + 172) = v3;
if ( v4 == 2 )
goto LABEL_12;
LABEL_6:
*(_QWORD *)(v2 + 176) = TIFFmalloc(8LL * v3);
v5 = TIFFmalloc(8LL * *(unsigned int *)(v2 + 172));
*(_QWORD *)(v2 + 184) = v5;
if ( !v5 || !*(_QWORD *)(v2 + 176) )
return 0;
TIFFmemset(*(void **)(v2 + 176), 0, 8LL * *(unsigned int *)(v2 + 172));
TIFFmemset(*(void **)(v2 + 184), 0, 8LL * *(unsigned int *)(v2 + 172));
*(_QWORD *)(a1 + 56) |= 0x3000000uLL;
return 1;
}