//
// TIFFVStripSize64 from 0xc60344 to 0xc60538 (500 bytes)
//
// 3 xrefs:
// > TIFFVStripSize @ 0xc60538
// > TIFFStripSize64 @ 0xc6054c
// > ??> @ 0xb0868
//
// 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 __int64 __fastcall TIFFVStripSize64(__int64 a1, unsigned int a2)
{
unsigned int v2; // w20
__int64 v4; // x21
unsigned __int64 v5; // x0
unsigned int v7; // w5
__int64 v8; // x1
unsigned __int64 v9; // x23
unsigned __int64 v10; // x24
char v11; // w0
unsigned __int64 v12; // x2
unsigned __int64 v13; // x1
unsigned __int16 v14; // [xsp+48h] [xbp+48h] BYREF
unsigned __int16 v15; // [xsp+4Ah] [xbp+4Ah] BYREF
v2 = a2;
v4 = a1 + 56;
if ( a2 == -1 )
v2 = *(_DWORD *)(a1 + 92);
if ( *(_WORD *)(a1 + 170) == 1 && *(_WORD *)(a1 + 122) == 6 && (*(_DWORD *)(a1 + 16) & 0x4000) == 0 )
{
if ( *(_WORD *)(a1 + 130) == 3 )
{
TIFFGetFieldDefaulted(a1, 530, &v14, &v15);
if ( ((unsigned __int16)(v14 - 1) <= 1u || v14 == 4) && ((unsigned __int16)(v15 - 1) <= 1u || v15 == 4) )
{
v7 = *(_DWORD *)(v4 + 32);
v8 = 0;
if ( v7 < -v14 )
v8 = (v7 - 1 + v14) / v14;
v9 = 0;
if ( v2 < -v15 )
v9 = (v15 - 1 + v2) / v15;
v10 = TIFFMultiply64(a1, v8, (unsigned __int16)(v15 * v14 + 2), "TIFFVStripSize64");
v11 = TIFFMultiply64(a1, v10, *(unsigned __int16 *)(v4 + 60), "TIFFVStripSize64");
v12 = *(unsigned __int16 *)(v4 + 60);
if ( (v11 & 7) != 0 )
v13 = (TIFFMultiply64(a1, v10, v12, "TIFFVStripSize64") >> 3) + 1;
else
v13 = TIFFMultiply64(a1, v10, v12, "TIFFVStripSize64") >> 3;
return TIFFMultiply64(a1, v13, v9, "TIFFVStripSize64");
}
else
{
TIFFErrorExt(*(_QWORD *)(a1 + 952), (__int64)"TIFFVStripSize64", "Invalid YCbCr subsampling (%dx%d)", v14, v15);
return 0;
}
}
else
{
TIFFErrorExt(*(_QWORD *)(a1 + 952), (__int64)"TIFFVStripSize64", "Invalid td_samplesperpixel value");
return 0;
}
}
else
{
v5 = TIFFScanlineSize64(a1);
return TIFFMultiply64(a1, v2, v5, "TIFFVStripSize64");
}
}