//
// sub_8CBF30 from 0x8cbf30 to 0x8cc1e4 (692 bytes)
//
// 1 xrefs:
// > sub_8C7DD0 @ 0x8c8aa0
//
// 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:04:04 +0000
//
int __fastcall sub_8CBF30(int a1, _DWORD *a2, int a3)
{
__int64 v8; // [sp+18h] [bp-24h]
int v9; // [sp+24h] [bp-18h]
int v10; // [sp+28h] [bp-14h]
_DWORD *v11; // [sp+2Ch] [bp-10h]
_DWORD *v12; // [sp+30h] [bp-Ch]
unsigned __int16 i; // [sp+36h] [bp-6h]
if ( !*(_WORD *)(a1 + 184) )
return 1;
if ( a3 )
{
v8 = *(_QWORD *)(a1 + 464);
if ( (*(_DWORD *)(a1 + 12) & 0x80000) != 0 )
{
v9 = sub_8CD370(a1, a2, a3, 330, *(unsigned __int16 *)(a1 + 184), *(_DWORD *)(a1 + 188));
}
else
{
v10 = TIFFmalloc(4 * *(unsigned __int16 *)(a1 + 184));
if ( !v10 )
{
TIFFErrorExt(*(_DWORD *)(a1 + 628), "TIFFWriteDirectoryTagSubifd", "Out of memory");
return 0;
}
v11 = *(_DWORD **)(a1 + 188);
v12 = (_DWORD *)v10;
for ( i = 0; i < (unsigned int)*(unsigned __int16 *)(a1 + 184); ++i )
{
if ( !v11 )
_assert2();
if ( v11[1] )
_assert2();
*v12++ = *v11;
v11 += 2;
}
v9 = sub_8CD2A8(a1, a2, a3, 330, *(unsigned __int16 *)(a1 + 184), v10);
TIFFfree(v10);
}
if ( v9 )
{
*(_DWORD *)(a1 + 12) |= 0x2000u;
*(_WORD *)(a1 + 472) = *(_WORD *)(a1 + 184);
if ( *(_WORD *)(a1 + 184) == 1 )
*(_QWORD *)(a1 + 480) = 0;
else
*(_QWORD *)(a1 + 480) = v8;
return 1;
}
else
{
return 0;
}
}
else
{
++*a2;
return 1;
}
}