//
// _TIFFSetupFields from 0x8b7dcc to 0x8b7f20 (340 bytes)
//
// 4 xrefs:
// > TIFFCreateCustomDirectory @ 0x8b6a94
// > TIFFDefaultDirectory @ 0x8b6b60
// > TIFFReadCustomDirectory @ 0x8c26b8
// > ??> @ 0x6af8c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:03:56 +0000
//
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;
}