//
// _TIFFSetupFields from 0x6a8208 to 0x6a835c (340 bytes)
//
// 4 xrefs:
// > TIFFCreateCustomDirectory @ 0x6a6a14
// > TIFFDefaultDirectory @ 0x6a6ae0
// > TIFFReadCustomDirectory @ 0x6b2af8
// > ??> @ 0x57f6c
//
// 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 TIFFSetupFields(_DWORD *a1, int a2)
{
int result; // r0
unsigned int i; // [sp+8h] [bp-Ch]
int v6; // [sp+Ch] [bp-8h]
if ( a1[164] && a1[165] )
{
for ( i = 0; a1[165] > i; ++i )
{
v6 = *(_DWORD *)(a1[164] + 4 * i);
if ( *(_WORD *)(v6 + 24) == 65 && !strncmp("Tag ", *(const char **)(v6 + 28), 4u) )
{
TIFFfree(*(_DWORD *)(v6 + 28));
TIFFfree(v6);
}
}
TIFFfree(a1[164]);
a1[164] = 0;
a1[165] = 0;
}
result = TIFFMergeFields(a1, *(_DWORD *)(a2 + 12), *(_DWORD *)(a2 + 8));
if ( !result )
return TIFFErrorExt(a1[157], "_TIFFSetupFields", "Setting up field info failed");
return result;
}