//
// sub_8B547C from 0x8b547c to 0x8b6500 (4228 bytes)
//
// 3 xrefs:
// > TIFFDefaultDirectory @ 0x8b6c24
// > TIFFDefaultDirectory @ 0x8b6c28
// > ??> @ 0x8b6cb8
//
// 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:55 +0000
//
int __fastcall sub_8B547C(int a1, unsigned int a2, _DWORD **a3)
{
_BOOL2 v3; // r3
_DWORD **v4; // r3
const char *v5; // r2
const char *v6; // r3
_DWORD **v7; // r3
_DWORD **v10; // [sp+Ch] [bp-50h]
_DWORD **v11; // [sp+Ch] [bp-50h]
int v14; // [sp+1Ch] [bp-40h]
int v15; // [sp+20h] [bp-3Ch]
int (__fastcall *v16)(_DWORD, _DWORD); // [sp+24h] [bp-38h]
int v17; // [sp+28h] [bp-34h]
unsigned __int16 i; // [sp+2Eh] [bp-2Eh]
double v19; // [sp+30h] [bp-2Ch]
unsigned __int16 j; // [sp+3Eh] [bp-1Eh]
double v21; // [sp+40h] [bp-1Ch]
int k; // [sp+4Ch] [bp-10h]
int v23; // [sp+50h] [bp-Ch]
_BYTE *v24; // [sp+54h] [bp-8h]
v14 = a1 + 40;
v15 = 1;
v16 = (int (__fastcall *)(_DWORD, _DWORD))a2;
v17 = TIFFFindField(a1, a2, 0);
if ( *(_WORD *)(v17 + 24) == 65 )
v16 = nullptr;
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))&dword_128 )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 84);
return v15;
}
if ( (unsigned int)v16 > 0x128 )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_150 + 2) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 116);
*a3[1] = *(_DWORD *)(v14 + 120);
return v15;
}
if ( (unsigned int)v16 > 0x152 )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&stru_20C.st_value + 3) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 156);
return v15;
}
if ( (unsigned int)v16 > 0x213 )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))&stru_80DC.st_size )
{
switch ( *(_WORD *)(v14 + 46) )
{
case 1:
*(_WORD *)*a3 = 2;
break;
case 2:
*(_WORD *)*a3 = 1;
break;
case 3:
*(_WORD *)*a3 = 3;
break;
case 4:
*(_WORD *)*a3 = 0;
break;
default:
return v15;
}
return v15;
}
if ( (unsigned int)v16 > 0x80E4 )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&stru_80DC.st_size + 1) )
{
**a3 = *(_DWORD *)(v14 + 24);
return v15;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&stru_80DC.st_size + 2) )
{
**a3 = *(_DWORD *)(v14 + 36);
return v15;
}
}
else
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))&stru_20C.st_size )
{
**a3 = *(_DWORD *)(v14 + 172);
return v15;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&stru_80DC.st_value + 3) )
{
v3 = *(_WORD *)(v14 + 116) == 1 && **(_WORD **)(v14 + 120) == 1;
*(_WORD *)*a3 = v3;
return v15;
}
}
}
else
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))"/system/bin/linker" )
{
if ( (*(_DWORD *)(a1 + 12) & 0x400000) != 0 )
{
**a3 = *(_DWORD *)(v14 + 68);
}
else
{
v19 = *(double *)*(_DWORD *)(v14 + 68);
for ( i = 1; i < (unsigned int)*(unsigned __int16 *)(v14 + 58); ++i )
{
if ( *(double *)(*(_DWORD *)(v14 + 68) + 8 * i) < v19 )
v19 = *(double *)(*(_DWORD *)(v14 + 68) + 8 * i);
}
*(double *)*a3 = v19;
}
return v15;
}
if ( (unsigned int)v16 < 0x154 )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 46);
return v15;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))"system/bin/linker" )
{
if ( (*(_DWORD *)(a1 + 12) & 0x400000) != 0 )
{
**a3 = *(_DWORD *)(v14 + 72);
}
else
{
v21 = *(double *)*(_DWORD *)(v14 + 72);
for ( j = 1; j < (unsigned int)*(unsigned __int16 *)(v14 + 58); ++j )
{
if ( *(double *)(*(_DWORD *)(v14 + 72) + 8 * j) > v21 )
v21 = *(double *)(*(_DWORD *)(v14 + 72) + 8 * j);
}
*(double *)*a3 = v21;
}
return v15;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&stru_20C.st_value + 2) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 152);
*(_WORD *)a3[1] = *(_WORD *)(v14 + 154);
return v15;
}
}
goto LABEL_130;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_140 + 2) )
{
**a3 = *(_DWORD *)(v14 + 28);
return v15;
}
if ( (unsigned int)v16 <= 0x142 )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_12C + 1) )
{
v4 = a3;
v10 = a3 + 1;
**v4 = *(_DWORD *)(v14 + 160);
if ( *(unsigned __int16 *)(v14 + 58) - *(unsigned __int16 *)(v14 + 116) > 1 )
{
**v10 = *(_DWORD *)(v14 + 164);
*v10[1] = *(_DWORD *)(v14 + 168);
}
return v15;
}
if ( (unsigned int)v16 > 0x12D )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))&dword_140 )
{
**a3 = *(_DWORD *)(v14 + 100);
*a3[1] = *(_DWORD *)(v14 + 104);
*a3[2] = *(_DWORD *)(v14 + 108);
return v15;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_140 + 1) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 112);
*(_WORD *)a3[1] = *(_WORD *)(v14 + 114);
return v15;
}
}
else if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_128 + 1) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 96);
*(_WORD *)a3[1] = *(_WORD *)(v14 + 98);
return v15;
}
goto LABEL_130;
}
if ( v16 != (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_144 + 1) )
{
if ( (unsigned int)v16 > 0x145 )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_148 + 2) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 144);
*a3[1] = *(_DWORD *)(v14 + 148);
return v15;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_14C + 1) )
{
**a3 = *(_DWORD *)(v14 + 180);
return v15;
}
goto LABEL_130;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_140 + 3) )
{
**a3 = *(_DWORD *)(v14 + 32);
return v15;
}
LABEL_105:
TIFFFillStriles(a1);
**a3 = *(_DWORD *)(v14 + 132);
return v15;
}
LABEL_106:
TIFFFillStriles(a1);
**a3 = *(_DWORD *)(v14 + 136);
return v15;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_110 + 2) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 56);
return v15;
}
if ( (unsigned int)v16 > 0x112 )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_118 + 1) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 66);
return v15;
}
if ( (unsigned int)v16 > 0x119 )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))&off_11C )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 86);
return v15;
}
if ( (unsigned int)v16 <= 0x11C )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_118 + 2) )
**a3 = *(_DWORD *)(v14 + 76);
else
**a3 = *(_DWORD *)(v14 + 80);
return v15;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&off_11C + 2) )
{
**a3 = *(_DWORD *)(v14 + 88);
return v15;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&off_11C + 3) )
{
**a3 = *(_DWORD *)(v14 + 92);
return v15;
}
goto LABEL_130;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_114 + 2) )
{
**a3 = *(_DWORD *)(v14 + 60);
return v15;
}
if ( (unsigned int)v16 <= 0x116 )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_114 + 1) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 58);
return v15;
}
goto LABEL_130;
}
if ( v16 != (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_114 + 3) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 64);
return v15;
}
goto LABEL_106;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_100 + 3) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 48);
return v15;
}
if ( (unsigned int)v16 <= 0x103 )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))&dword_100 )
{
**a3 = *(_DWORD *)(v14 + 16);
return v15;
}
if ( (unsigned int)v16 > 0x100 )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_100 + 1) )
**a3 = *(_DWORD *)(v14 + 20);
else
*(_WORD *)*a3 = *(_WORD *)(v14 + 44);
return v15;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_FC + 2) )
{
**a3 = *(_DWORD *)(v14 + 40);
return v15;
}
goto LABEL_130;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_104 + 3) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 52);
return v15;
}
if ( (unsigned int)v16 <= 0x107 )
{
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_104 + 2) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 50);
return v15;
}
goto LABEL_130;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_108 + 2) )
{
*(_WORD *)*a3 = *(_WORD *)(v14 + 54);
return v15;
}
if ( v16 == (int (__fastcall *)(_DWORD, _DWORD))((char *)&dword_110 + 1) )
goto LABEL_105;
LABEL_130:
if ( v17 && *(_WORD *)(v17 + 24) == 65 )
{
v15 = 0;
for ( k = 0; *(_DWORD *)(v14 + 184) > k; ++k )
{
v23 = *(_DWORD *)(v14 + 188) + 12 * k;
if ( **(_DWORD **)v23 == a2 )
{
if ( *(_BYTE *)(v17 + 27) )
{
v7 = a3;
v11 = a3 + 1;
if ( *(__int16 *)(v17 + 4) == -3 )
**v7 = *(_DWORD *)(v23 + 4);
else
*(_WORD *)*v7 = *(_DWORD *)(v23 + 4);
**v11 = *(_DWORD *)(v23 + 8);
return 1;
}
else if ( *(_DWORD *)v17 == 336 && !strcmp(*(const char **)(v17 + 28), "DotRange") )
{
*(_WORD *)*a3 = **(_WORD **)(v23 + 8);
*(_WORD *)a3[1] = *(_WORD *)(*(_DWORD *)(v23 + 8) + 2);
return 1;
}
else if ( *(_DWORD *)(v17 + 8) == 2
|| *(__int16 *)(v17 + 4) == -1
|| *(__int16 *)(v17 + 4) == -3
|| *(__int16 *)(v17 + 4) == -2
|| *(int *)(v23 + 4) > 1 )
{
**a3 = *(_DWORD *)(v23 + 8);
return 1;
}
else
{
v24 = *(_BYTE **)(v23 + 8);
if ( *(_DWORD *)(v23 + 4) != 1 )
_assert2();
switch ( *(_DWORD *)(v17 + 8) )
{
case 1:
case 7:
*(_BYTE *)*a3 = *v24;
v15 = 1;
break;
case 3:
*(_WORD *)*a3 = *(_WORD *)v24;
v15 = 1;
break;
case 4:
case 0xD:
**a3 = *(_DWORD *)v24;
v15 = 1;
break;
case 5:
case 0xA:
case 0xB:
**a3 = *(_DWORD *)v24;
v15 = 1;
break;
case 6:
*(_BYTE *)*a3 = *v24;
v15 = 1;
break;
case 8:
*(_WORD *)*a3 = *(_WORD *)v24;
v15 = 1;
break;
case 9:
**a3 = *(_DWORD *)v24;
v15 = 1;
break;
case 0xC:
*(_QWORD *)*a3 = *(_QWORD *)v24;
v15 = 1;
break;
case 0x10:
case 0x12:
*(_QWORD *)*a3 = *(_QWORD *)v24;
v15 = 1;
break;
case 0x11:
*(_QWORD *)*a3 = *(_QWORD *)v24;
v15 = 1;
break;
default:
v15 = 0;
break;
}
}
return v15;
}
}
}
else
{
if ( a2 <= 0xFFFF )
v5 = (const char *)&unk_C22F0C;
else
v5 = "pseudo-";
if ( v17 )
v6 = *(const char **)(v17 + 28);
else
v6 = "Unknown";
TIFFErrorExt(
*(_DWORD *)(a1 + 628),
"_TIFFVGetField",
"%s: Invalid %stag \"%s\" (not supported by codec)",
*(const char **)a1,
v5,
v6);
return 0;
}
return v15;
}