//
// _TIFFSetupFields from 0xea9eb8 to 0xea9fc0 (264 bytes)
//
// 4 xrefs:
// > TIFFDefaultDirectory @ 0xea8914
// > TIFFCreateCustomDirectory @ 0xea8a44
// > TIFFReadCustomDirectory @ 0xeb1d88
// > ??> @ 0x413b0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:11:11 +0000
//
__int64 __fastcall TIFFSetupFields(_QWORD *a1, __int64 a2)
{
_QWORD *v2; // x21
unsigned __int64 v5; // x22
__int64 v6; // x0
unsigned int v7; // w19
__int64 v8; // x20
char *v9; // x25
__int64 result; // x0
v2 = (_QWORD *)a1[126];
if ( v2 )
{
v5 = a1[127];
if ( v5 )
{
v6 = 0;
v7 = 0;
do
{
while ( 1 )
{
v8 = v2[v6];
++v7;
if ( *(_WORD *)(v8 + 24) == 65 )
{
v9 = *(char **)(v8 + 32);
if ( !strncmp("Tag ", v9, 4u) )
break;
}
v6 = v7;
if ( v7 >= v5 )
goto LABEL_8;
}
TIFFfree(v9);
TIFFfree((void *)v8);
v5 = a1[127];
v6 = v7;
v2 = (_QWORD *)a1[126];
}
while ( v7 < v5 );
LABEL_8:
TIFFfree(v2);
a1[126] = 0;
a1[127] = 0;
}
}
result = TIFFMergeFields(a1, *(int **)(a2 + 16), *(_DWORD *)(a2 + 8));
if ( !(_DWORD)result )
return TIFFErrorExt(a1[119], "_TIFFSetupFields", "Setting up field info failed");
return result;
}