//
// sub_6EE01C from 0x6ee01c to 0x6ee350 (820 bytes)
//
// 2 xrefs:
// > TIFFReadRawStrip @ 0x6ee554
// > TIFFFillStrip @ 0x6ee9d4
//
// 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 sub_6EE01C(int a1, int a2, int a3, int a4, int a5)
{
__int64 v6; // r2
__int64 v7; // r0
int v8; // r0
int v14; // [sp+2Ch] [bp-20h]
int v15; // [sp+34h] [bp-18h]
int v16; // [sp+38h] [bp-14h]
int v17; // [sp+3Ch] [bp-10h]
v14 = a1 + 40;
if ( TIFFFillStriles() )
{
if ( (*(_DWORD *)(a1 + 12) & 0x20000) != 0 )
_assert2();
if ( (*(_DWORD *)(a1 + 12) & 0x800) != 0 )
{
v15 = *(_DWORD *)(*(_DWORD *)(v14 + 132) + 8 * a2);
v16 = v15 + a4;
if ( v15 == *(_QWORD *)(*(_DWORD *)(v14 + 132) + 8 * a2) && *(_DWORD *)(a1 + 616) >= v15 )
{
if ( v16 >= v15 && v16 >= a4 && *(_DWORD *)(a1 + 616) >= v16 )
v17 = a4;
else
v17 = *(_DWORD *)(a1 + 616) - v15;
}
else
{
v17 = 0;
}
if ( v17 != a4 )
{
TIFFErrorExt(
*(_DWORD *)(a1 + 628),
a5,
"Read error at scanline %lu, strip %lu; got %llu bytes, expected %llu",
*(_DWORD *)(a1 + 444),
a2,
(__int64)v17,
(__int64)a4);
return -1;
}
TIFFmemcpy(a3, *(_DWORD *)(a1 + 612) + v15, a4);
}
else
{
v6 = *(_QWORD *)(*(_DWORD *)(v14 + 132) + 8 * a2);
LODWORD(v7) = (*(int (__fastcall **)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD))(a1 + 640))(
*(_DWORD *)(a1 + 628),
*(_DWORD *)(a1 + 640),
v6,
HIDWORD(v6),
0);
if ( v7 != *(_QWORD *)(*(_DWORD *)(v14 + 132) + 8 * a2) )
{
TIFFErrorExt(*(_DWORD *)(a1 + 628), a5, "Seek error at scanline %lu, strip %lu", *(_DWORD *)(a1 + 444), a2);
return -1;
}
v8 = (*(int (__fastcall **)(_DWORD, int, int))(a1 + 632))(*(_DWORD *)(a1 + 628), a3, a4);
if ( v8 != a4 )
{
TIFFErrorExt(
*(_DWORD *)(a1 + 628),
a5,
"Read error at scanline %lu; got %llu bytes, expected %llu",
*(_DWORD *)(a1 + 444),
(__int64)v8,
(__int64)a4);
return -1;
}
}
return a4;
}
return -1;
}