//
// png_handle_tEXt from 0x86e1f0 to 0x86e310 (288 bytes)
//
// 3 xrefs:
// > png_push_read_chunk @ 0x862c38
// > png_read_info @ 0x865998
// > png_read_end @ 0x8674d0
//
// 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:02:56 +0000
//
int __fastcall png_handle_tEXt(_DWORD *a1, int a2, unsigned int a3)
{
int v4; // r3
int v7; // r3
int v8; // r3
_BYTE *v9; // r6
unsigned int v10; // r8
int result; // r0
const char *v12; // r2
const char *v13; // r3
_BYTE *v15; // r0
_DWORD v16[7]; // [sp+4h] [bp-1Ch] BYREF
v4 = a1[214];
if ( v4 )
{
if ( v4 == 1 )
return png_crc_finish(a1, a3);
v7 = v4 - 1;
a1[214] = v7;
if ( v7 == 1 )
{
png_crc_finish(a1, a3);
return png_chunk_benign_error((int)a1, "no space in chunk cache");
}
}
v8 = a1[77];
if ( (v8 & 1) == 0 )
png_chunk_error((int)a1, "missing IHDR");
v9 = (_BYTE *)a1[222];
if ( (v8 & 4) != 0 )
v8 |= 8u;
v10 = a3 + 1;
if ( (a1[77] & 4) != 0 )
a1[77] = v8;
if ( v9 )
{
if ( v10 <= a1[223] )
goto LABEL_11;
a1[222] = 0;
a1[223] = 0;
png_free((int)a1, v9);
}
v15 = png_malloc_base((int)a1, a3 + 1);
v9 = v15;
if ( !v15 )
{
png_chunk_warning((int)a1, "insufficient memory to read chunk");
return png_chunk_benign_error((int)a1, "out of memory");
}
a1[222] = v15;
a1[223] = v10;
LABEL_11:
png_crc_read(a1, (int)v9, a3);
result = png_crc_finish(a1, 0);
if ( !result )
{
v9[a3] = 0;
v12 = &v9[a3];
if ( *v9 )
{
v13 = v9;
while ( *++v13 )
;
}
else
{
v13 = v9;
}
v16[1] = v9;
if ( v13 != v12 )
v12 = v13 + 1;
v16[2] = v12;
v16[0] = -1;
memset(&v16[4], 0, 12);
v16[3] = strlen(v12);
result = png_set_text_2(a1, a2, v16, 1);
if ( result )
return png_warning((int)a1, "Insufficient memory to process text chunk");
}
return result;
}