//
// png_ascii_from_fixed from 0xe3dfc0 to 0xe3e43c (1148 bytes)
//
// 3 xrefs:
// > png_set_sCAL_fixed @ 0xe5a1a0
// > png_set_sCAL_fixed @ 0xe5a1b8
// > ??> @ 0xd2bc8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:10:01 +0000
//
__int64 __fastcall png_ascii_from_fixed(__int64 a1, _BYTE *a2, unsigned __int64 a3, unsigned int a4)
{
unsigned int v4; // w4
unsigned int v5; // w3
unsigned int v6; // w19
unsigned int v7; // w22
unsigned int v8; // w0
unsigned int v9; // w4
bool v10; // zf
char v11; // w4
char v12; // w3
unsigned int v13; // w3
unsigned int v14; // w0
char v15; // w0
char v16; // w4
unsigned int v17; // w2
unsigned int v18; // w3
char v19; // w3
char v20; // w4
unsigned int v21; // w0
unsigned int v22; // w2
char v23; // w2
char v24; // w4
int v25; // w4
unsigned int v26; // w3
unsigned int v27; // w0
char v28; // w0
char v29; // w5
unsigned int v30; // w2
unsigned int v31; // w3
char v32; // w3
char v33; // w5
unsigned int v34; // w0
unsigned int v35; // w2
char v36; // w2
char v37; // w5
unsigned int v38; // w2
unsigned int v39; // w0
char v40; // w0
char v41; // w4
char v42; // w2
char v43; // w0
__int64 v44; // x4
_BYTE *v45; // x2
char *v46; // x0
unsigned int v48; // w22
_BYTE v49[5]; // [xsp+48h] [xbp+48h]
char v50; // [xsp+4Dh] [xbp+4Dh]
char v51; // [xsp+4Eh] [xbp+4Eh]
char v52; // [xsp+4Fh] [xbp+4Fh]
char v53; // [xsp+50h] [xbp+50h]
char v54; // [xsp+51h] [xbp+51h]
if ( a3 <= 0xC )
png_error(a1, "ASCII conversion buffer too small");
if ( (a4 & 0x80000000) != 0 )
{
a4 = -a4;
*a2++ = 45;
}
if ( !a4 )
{
v45 = a2 + 1;
*a2 = 48;
goto LABEL_68;
}
v4 = a4 / 0xA;
v5 = a4 % 0xA;
v49[0] = v5 + 48;
if ( v5 )
v6 = 1;
else
v6 = 16;
if ( !v4 )
{
v7 = 1;
goto LABEL_70;
}
v7 = 2;
v8 = v4 / 0xA;
v9 = v4 % 0xA;
v10 = v9 == 0;
v11 = v9 + 48;
v12 = !v10;
v49[1] = v11;
if ( ((unsigned __int8)v12 & (v6 == 16)) != 0 )
v6 = 2;
if ( !v8 )
goto LABEL_70;
v7 = 3;
v13 = v8 / 0xA;
v14 = v8 % 0xA;
v10 = v14 == 0;
v15 = v14 + 48;
v16 = !v10;
v49[2] = v15;
if ( ((unsigned __int8)v16 & (v6 == 16)) != 0 )
v6 = 3;
if ( !v13 )
goto LABEL_70;
v7 = 4;
v17 = v13 / 0xA;
v18 = v13 % 0xA;
v10 = v18 == 0;
v19 = v18 + 48;
v20 = !v10;
v49[3] = v19;
if ( ((unsigned __int8)v20 & (v6 == 16)) != 0 )
v6 = 4;
if ( !v17 )
{
LABEL_70:
if ( v6 <= 5 )
{
*a2 = 46;
v46 = (char *)memset(a2 + 1, 48, 4 - v7 + 1LL) + 4 - v7 + 1;
v45 = v46;
if ( v7 < v6 )
goto LABEL_68;
goto LABEL_72;
}
goto LABEL_77;
}
v7 = 5;
v21 = v17 / 0xA;
v22 = v17 % 0xA;
v10 = v22 == 0;
v23 = v22 + 48;
v24 = !v10;
v49[4] = v23;
if ( ((unsigned __int8)v24 & (v6 == 16)) != 0 )
v6 = 5;
if ( !v21 )
{
if ( v6 <= 5 )
{
v46 = a2 + 1;
*a2 = 46;
goto LABEL_72;
}
LABEL_77:
v45 = a2;
goto LABEL_68;
}
v25 = 6;
v26 = v21 / 0xA;
v27 = v21 % 0xA;
v10 = v27 == 0;
v28 = v27 + 48;
v29 = !v10;
v50 = v28;
if ( ((unsigned __int8)v29 & (v6 == 16)) != 0 )
v6 = 6;
if ( v26 )
{
v25 = 7;
v30 = v26 / 0xA;
v31 = v26 % 0xA;
v10 = v31 == 0;
v32 = v31 + 48;
v33 = !v10;
v51 = v32;
if ( ((unsigned __int8)v33 & (v6 == 16)) != 0 )
v6 = 7;
if ( v30 )
{
v25 = 8;
v34 = v30 / 0xA;
v35 = v30 % 0xA;
v10 = v35 == 0;
v36 = v35 + 48;
v37 = !v10;
v52 = v36;
if ( ((unsigned __int8)v37 & (v6 == 16)) != 0 )
v6 = 8;
if ( v34 )
{
v38 = v34 / 0xA;
v39 = v34 % 0xA;
v10 = v39 == 0;
v40 = v39 + 48;
v41 = !v10;
v53 = v40;
if ( ((unsigned __int8)v41 & (v6 == 16)) != 0 )
v6 = 9;
if ( v38 )
{
v25 = 10;
v42 = v38 + 48;
if ( v6 == 16 )
v6 = 10;
v54 = v42;
}
else
{
v25 = 9;
}
}
}
v43 = v49[v25 - 2];
*a2 = v49[v25 - 1];
a2[1] = v43;
if ( v25 != 7 )
{
a2[2] = v49[v25 - 3];
if ( v25 != 8 )
{
a2[3] = v49[v25 - 4];
if ( v25 == 10 )
a2[4] = v50;
}
}
}
else
{
*a2 = v28;
}
v44 = (unsigned int)(v25 - 6) + 1LL;
v45 = &a2[v44];
if ( v6 <= 5 )
{
v46 = v45 + 1;
v7 = 5;
a2[v44] = 46;
LABEL_72:
v45 = v46 + 1;
*v46 = v49[v7 - 1];
if ( v7 - 1 >= v6 )
{
v45 = v46 + 2;
v46[1] = v49[v7 - 2];
if ( v7 - 2 >= v6 )
{
v45 = v46 + 3;
v46[2] = v49[v7 - 3];
if ( v7 - 3 >= v6 )
{
v48 = v7 - 4;
v45 = v46 + 4;
v46[3] = v49[v48];
if ( v6 <= v48 )
{
v45 = v46 + 5;
v46[4] = v49[0];
}
}
}
}
}
LABEL_68:
*v45 = 0;
return _stack_chk_guard;
}