//
// _TIFFSetupFields from 0xc33cf8 to 0xc33e00 (264 bytes)
//
// 4 xrefs:
// > TIFFDefaultDirectory @ 0xc32754
// > TIFFCreateCustomDirectory @ 0xc32884
// > TIFFReadCustomDirectory @ 0xc3bbc8
// > ??> @ 0x2adc8
//
// 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
//
__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;
}