//
// sub_7343E4 from 0x7343e4 to 0x73449c (184 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall sub_7343E4(int a1)
{
char *v2; // r2
unsigned int v3; // r3
int v4; // lr
unsigned int v5; // r3
__int64 v6; // r0
bool v7; // zf
size_t v8; // r5
unsigned __int64 v9; // r6
bool v10; // zf
_BOOL4 v11; // r1
unsigned int v12; // r3
unsigned int v13; // r6
char *v14; // r0
char *v15; // r7
int v16; // r3
int v17; // r2
v2 = *(char **)(a1 + 12);
v3 = *(_DWORD *)(a1 + 16);
if ( v3 < (unsigned int)(v2 + 2) )
{
v4 = *(_DWORD *)(a1 + 8);
v5 = v3 - v4;
v6 = (int)v5 + 0x8000LL;
v7 = HIDWORD(v6) == 0;
if ( !HIDWORD(v6) )
v7 = 1;
if ( !v7 )
goto LABEL_5;
v8 = (size_t)&v2[-v4];
v9 = (unsigned int)v6 + (unsigned __int64)(unsigned int)&v2[-v4];
v10 = HIDWORD(v9) == 0;
if ( !HIDWORD(v9) )
v10 = 1;
if ( !v10 )
goto LABEL_5;
v11 = v5 >= (unsigned int)v9;
if ( !v5 )
v11 = 0;
if ( !v11 )
{
v12 = (3 * v5) >> 1;
if ( v12 < (unsigned int)v9 )
v12 = (unsigned int)&v2[v6 - v4];
v13 = (v12 & 0xFFFFFC00) + 1024;
v14 = (char *)WebPSafeMalloc(1, 0, v13);
v15 = v14;
if ( !v14 )
{
v4 = *(_DWORD *)(a1 + 8);
LABEL_5:
*(_DWORD *)(a1 + 12) = v4;
*(_DWORD *)(a1 + 20) = 1;
return;
}
if ( v8 )
memcpy(v14, *(const void **)(a1 + 8), v8);
WebPSafeFree(*(void **)(a1 + 8));
v2 = &v15[v8];
*(_DWORD *)(a1 + 16) = &v15[v13];
*(_DWORD *)(a1 + 12) = &v15[v8];
*(_DWORD *)(a1 + 8) = v15;
}
}
*(_WORD *)v2 = *(_DWORD *)a1;
v16 = *(_DWORD *)(a1 + 4);
v17 = *(_DWORD *)(a1 + 12) + 2;
*(_DWORD *)a1 = *(unsigned __int16 *)(a1 + 2);
*(_DWORD *)(a1 + 12) = v17;
*(_DWORD *)(a1 + 4) = v16 - 16;
}