//
// WebPDecode from 0x9104bc to 0x910866 (938 bytes)
//
// 0 xrefs:
//
// 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:26 +0000
//
char *__fastcall WebPDecode(unsigned __int8 *a1, unsigned int *a2, char *a3)
{
char *result; // r0
unsigned int *v7; // r12
unsigned __int8 *v8; // r3
int v9; // r0
unsigned __int8 *v10; // r3
unsigned int *v11; // r12
bool v12; // cf
unsigned int v13; // r1
char v14; // lr
int v15; // r0
int v16; // r2
int v17; // r1
unsigned __int8 v18; // r2
int v19; // r2
_BOOL4 v20; // r0
int v21; // r3
int v22; // r5
int v23; // r0
_BOOL4 v24; // lr
unsigned int *v25; // r0
unsigned int *v26; // r2
int v27; // r3
_BOOL4 v28; // r0
unsigned int *v30; // [sp+10h] [bp-1D8h]
unsigned int *v31; // [sp+10h] [bp-1D8h]
unsigned __int8 *v32; // [sp+14h] [bp-1D4h]
int v33; // [sp+1Ch] [bp-1CCh]
unsigned __int8 *v34; // [sp+20h] [bp-1C8h]
unsigned int v35; // [sp+20h] [bp-1C8h]
int v36; // [sp+20h] [bp-1C8h]
unsigned int v37; // [sp+24h] [bp-1C4h]
int v38; // [sp+24h] [bp-1C4h]
__int64 v39; // [sp+28h] [bp-1C0h]
int v40; // [sp+28h] [bp-1C0h]
int v41; // [sp+30h] [bp-1B8h]
int v42; // [sp+34h] [bp-1B4h]
unsigned __int8 *v43; // [sp+38h] [bp-1B0h] BYREF
unsigned int *v44; // [sp+3Ch] [bp-1ACh] BYREF
int v45; // [sp+40h] [bp-1A8h] BYREF
int v46; // [sp+44h] [bp-1A4h] BYREF
unsigned int *v47[104]; // [sp+48h] [bp-1A0h] BYREF
if ( !a3 || !a1 )
return (_BYTE *)(&dword_0 + 2);
v30 = nullptr;
memset(a3, 0, 0x28u);
v43 = a1;
v44 = a2;
v45 = 0;
v46 = 0;
if ( (unsigned int)a2 <= 0xB )
return (_BYTE *)(&dword_0 + 3);
memset(&v47[2], 0, 28);
v47[0] = (unsigned int *)a1;
v47[1] = a2;
if ( !memcmp(a1, "RIFF", 4u) )
{
if ( memcmp(a1 + 8, "WEBP", 4u) )
return (_BYTE *)(&dword_0 + 3);
v30 = (unsigned int *)(a1[4] | (a1[5] << 8) | ((a1[6] | (a1[7] << 8)) << 16));
if ( (unsigned int)(v30 - 3) > 0xFFFFFFEA )
return (_BYTE *)(&dword_0 + 3);
v7 = a2 - 3;
v44 = a2 - 3;
v47[7] = v30;
v8 = a1 + 12;
v43 = a1 + 12;
if ( (unsigned int)(a2 - 3) <= 7 )
return (_BYTE *)(&dword_0 + 3);
v33 = 1;
}
else
{
v33 = 0;
v7 = a2;
v8 = a1;
}
v37 = (unsigned int)v7;
v34 = v8;
v9 = memcmp(v8, "VP8X", 4u);
v10 = v34;
v11 = (unsigned int *)v37;
if ( v9 )
{
v17 = 0;
v15 = 0;
v36 = 0;
v18 = v33 ^ 1;
v41 = 0;
v38 = 0;
v14 = 1;
v42 = 0;
v40 = 0;
}
else
{
if ( (v34[4] | (v34[5] << 8) | ((v34[6] | (v34[7] << 8)) << 16)) != 0xA || v37 <= 0x11 )
return (_BYTE *)(&dword_0 + 3);
v38 = ((v34[14] << 16) | (v34[13] << 8) | v34[12]) + 1;
v41 = ((v34[17] << 16) | (v34[16] << 8) | v34[15]) + 1;
v39 = v41 * (__int64)v38;
v35 = v34[8] | (v34[9] << 8) | ((v34[10] | (v34[11] << 8)) << 16);
v12 = HIDWORD(v39) != 0;
if ( HIDWORD(v39) == 1 )
v12 = 1;
if ( v12 )
return (_BYTE *)(&dword_0 + 3);
v10 += 18;
v11 = (unsigned int *)((char *)v11 - 18);
v43 = v10;
v44 = v11;
if ( !v33 )
return (_BYTE *)(&dword_0 + 3);
v13 = v35;
v14 = 0;
v40 = (v35 >> 1) & 1;
v36 = v33;
v15 = v40;
v16 = v13 & 1;
v17 = (v13 >> 4) & 1;
v42 = v16;
v18 = 0;
}
*((_DWORD *)a3 + 3) = v15;
*((_DWORD *)a3 + 2) = v17;
v45 = v38;
v46 = v41;
*((_DWORD *)a3 + 4) = 0;
if ( v36 )
{
if ( v42 | v40 )
{
v19 = v41;
v20 = 0;
v21 = v38;
LABEL_23:
*(_DWORD *)a3 = v21;
*((_DWORD *)a3 + 1) = v19;
*((_DWORD *)a3 + 2) = v17 | v20;
memset(v47, 0, 0x178u);
v47[0] = (unsigned int *)(a3 + 40);
v47[5] = (unsigned int *)(a3 + 124);
return sub_90F434(a1, (unsigned int)a2, v47);
}
if ( (unsigned int)v11 <= 3 )
{
LABEL_26:
if ( v36 )
{
LABEL_27:
v21 = v45;
v19 = v46;
v17 = *((_DWORD *)a3 + 2);
v20 = v47[4] != nullptr;
goto LABEL_23;
}
return (_BYTE *)(&dword_0 + 3);
}
if ( v33 )
goto LABEL_31;
}
else if ( (unsigned int)v11 <= 3 )
{
return (_BYTE *)(&dword_0 + 3);
}
if ( ((unsigned __int8)v14 & v18) == 0 || memcmp(v10, "ALPH", 4u) )
{
LABEL_34:
v32 = v43;
v31 = v47[7];
v22 = memcmp(v43, "VP8 ", 4u);
v23 = memcmp(v32, "VP8L", 4u);
if ( (unsigned int)v44 <= 7 )
goto LABEL_26;
v24 = v23 == 0;
if ( v22 && v23 )
{
v28 = VP8LCheckSignature(v32, (unsigned int)v44);
v47[6] = v44;
v47[8] = (unsigned int *)v28;
}
else
{
v25 = (unsigned int *)(v32[4] | (v32[5] << 8) | ((v32[6] | (v32[7] << 8)) << 16));
if ( (unsigned int)v31 > 0xB && v25 > v31 - 3 )
return (_BYTE *)(&dword_0 + 3);
v43 = v32 + 8;
v44 -= 2;
v47[6] = v25;
v47[8] = (unsigned int *)v24;
}
v26 = v47[6];
if ( v47[6] > (unsigned int *)0xFFFFFFF6 )
return (_BYTE *)(&dword_0 + 3);
if ( !v42 && !v40 )
{
if ( v47[8] )
v27 = 2;
else
v27 = 1;
*((_DWORD *)a3 + 4) = v27;
}
if ( v47[8] )
{
if ( (unsigned int)v44 <= 4 )
goto LABEL_26;
if ( !VP8LGetInfo(v43, (unsigned int)v44, &v45, &v46, (int *)a3 + 2) )
return (_BYTE *)(&dword_0 + 3);
}
else
{
if ( (unsigned int)v44 <= 9 )
goto LABEL_26;
if ( !VP8GetInfo(v43, (unsigned int)v44, (unsigned int)v26, &v45, &v46) )
return (_BYTE *)(&dword_0 + 3);
}
if ( !v36 )
goto LABEL_27;
v21 = v45;
if ( v45 == v38 )
{
v19 = v46;
if ( v46 == v41 )
{
v17 = *((_DWORD *)a3 + 2);
v20 = v47[4] != nullptr;
goto LABEL_23;
}
}
return (_BYTE *)(&dword_0 + 3);
}
LABEL_31:
result = (char *)sub_90F328(
&v43,
(unsigned int *)&v44,
(unsigned int)v30,
(unsigned __int8 **)&v47[4],
(unsigned int *)&v47[5]);
if ( !result )
goto LABEL_34;
if ( result == &byte_7 )
goto LABEL_26;
return result;
}