//
// png_write_sCAL_s from 0x875acc to 0x875b7c (176 bytes)
//
// 1 xrefs:
// > png_write_info @ 0x871bda
//
// 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:02 +0000
//
void *__fastcall png_write_sCAL_s(_DWORD *a1, char a2, char *a3, const char *a4)
{
size_t v8; // r6
size_t v9; // r8
unsigned int v10; // r5
void *result; // r0
_BYTE v12[4]; // [sp+0h] [bp-48h] BYREF
_BYTE v13[4]; // [sp+4h] [bp-44h] BYREF
char v14; // [sp+8h] [bp-40h] BYREF
_BYTE v15[63]; // [sp+9h] [bp-3Fh] BYREF
v8 = strlen(a3);
v9 = strlen(a4);
v10 = v8 + v9 + 2;
if ( v10 > 0x40 )
return (void *)png_warning((int)a1, "Can't write sCAL (buffer too small)");
v14 = a2;
memcpy(v15, a3, v8 + 1);
result = memcpy(v15 + v8 + 1, a4, v9);
if ( a1 )
{
a1[225] = 34;
png_save_uint_32(v12, v10);
png_save_uint_32(v13, 1933787468);
png_write_data((int)a1);
a1[119] = 1933787468;
png_reset_crc((int)a1);
png_calculate_crc(a1, (int)v13, 4);
a1[225] = 66;
png_write_chunk_data(a1, (int)&v14, v10);
return (void *)png_write_chunk_end((int)a1);
}
return result;
}