//
// sub_6B70FC from 0x6b70fc to 0x6b72f8 (508 bytes)
//
// 2 xrefs:
// > TIFFReadDirectory @ 0x6b1b24
// > TIFFReadDirectory @ 0x6b1b50
//
// 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_6B70FC(_DWORD *a1, unsigned __int16 *a2, int a3, int *a4)
{
const char *v4; // r12
int v11; // [sp+18h] [bp-14h] BYREF
int v12; // [sp+1Ch] [bp-10h]
int v13; // [sp+20h] [bp-Ch]
int v14; // [sp+24h] [bp-8h]
v12 = sub_6AD70C(a1, (int)a2, &v11);
if ( !v12 )
{
if ( *((_QWORD *)a2 + 1) != a3 )
{
v14 = TIFFCheckMalloc(a1, a3, 8, "for strip array");
if ( !v14 )
{
TIFFfree(v11);
return 0;
}
if ( (unsigned __int64)(unsigned int)a3 <= *((_QWORD *)a2 + 1) )
{
TIFFmemcpy(v14, v11, 8 * a3);
}
else
{
TIFFmemcpy(v14, v11, 8 * *((_DWORD *)a2 + 2));
TIFFmemset(v14 + 8 * *((_DWORD *)a2 + 2), 0, 8 * (a3 - *((_DWORD *)a2 + 2)));
}
TIFFfree(v11);
v11 = v14;
}
*a4 = v11;
return 1;
}
v13 = TIFFFieldWithTag((int)a1, *a2);
if ( v13 )
v4 = *(const char **)(v13 + 28);
else
v4 = "unknown tagname";
sub_6B0B30((int)a1, v12, (int)"TIFFFetchStripThing", v4, 0);
return 0;
}