//
// TIFFUnsetField from 0x6a5198 to 0x6a539c (516 bytes)
//
// 1 xrefs:
// > ??> @ 0x57f0c
//
// 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 TIFFUnsetField(_DWORD *a1, int a2)
{
int *v3; // r2
_DWORD *v4; // r3
int v5; // r0
int v6; // r1
int v7; // r2
int v11; // [sp+8h] [bp-14h]
int v12; // [sp+10h] [bp-Ch]
int i; // [sp+14h] [bp-8h]
v11 = TIFFFieldWithTag(a1, a2);
if ( !v11 )
return 0;
if ( *(_WORD *)(v11 + 24) == 65 )
{
v12 = 0;
for ( i = 0; a1[56] > i; ++i )
{
v12 = a1[57] + 12 * i;
if ( **(_DWORD **)v12 == a2 )
break;
}
if ( a1[56] > i )
{
TIFFfree(*(_DWORD *)(v12 + 8));
while ( a1[56] - 1 > i )
{
v3 = (int *)(a1[57] + 12 * (i + 1));
v4 = (_DWORD *)(a1[57] + 12 * i);
v5 = *v3;
v6 = v3[1];
v7 = v3[2];
*v4 = v5;
v4[1] = v6;
v4[2] = v7;
++i;
}
--a1[56];
}
}
else
{
a1[(*(_WORD *)(v11 + 24) >> 5) + 10] &= ~(1 << (*(_WORD *)(v11 + 24) & 0x1F));
}
a1[3] |= 8u;
return 1;
}