//
// sub_71CD14 from 0x71cd14 to 0x71cf6e (602 bytes)
//
// 1 xrefs:
// > sub_71CF70 @ 0x71d026
//
// 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
//
int __fastcall sub_71CD14(
int a1,
int a2,
int a3,
int a4,
int a5,
int a6,
int a7,
int a8,
_DWORD *a9,
_DWORD *a10,
_DWORD *a11)
{
void *v14; // r9
unsigned int v15; // r4
int v16; // r1
int v17; // r6
int v18; // r8
int v19; // r10
int v20; // r9
_BOOL4 v21; // r2
unsigned __int8 *v22; // r3
int v23; // r0
unsigned __int8 *v24; // lr
int v25; // t1
_DWORD *v26; // r3
int v27; // r9
int v28; // t1
int v29; // r11
int v30; // r4
int v31; // r0
int v32; // r1
int v33; // r2
int v34; // r6
int v35; // r7
int v37; // r3
char v38; // r0
_BOOL4 v39; // r3
_DWORD v41[56]; // [sp+28h] [bp-1E4h] BYREF
_DWORD v42[65]; // [sp+108h] [bp-104h] BYREF
if ( a6 != 6 )
{
if ( a6 )
{
v41[0] = -1;
sub_7340D8(&v41[1], 0);
v14 = (void *)WebPSafeMalloc(1, 0, a4);
if ( v14 )
{
v15 = 15;
goto LABEL_5;
}
return 0;
}
goto LABEL_25;
}
memset(v42, 0, 0x100u);
if ( a3 > 0 )
{
v22 = (unsigned __int8 *)a1;
v23 = 0;
do
{
v24 = &v22[a2];
if ( a2 > 0 )
{
do
{
v25 = *v22++;
*((_BYTE *)v42 + v25) = 1;
}
while ( v24 != v22 );
}
++v23;
v22 = v24;
}
while ( v23 != a3 );
}
v26 = (_DWORD *)((char *)&v41[55] + 3);
v27 = 0;
do
{
v28 = *((unsigned __int8 *)v26 + 1);
v26 = (_DWORD *)((char *)v26 + 1);
if ( v28 )
++v27;
}
while ( v26 != (_DWORD *)((char *)&v42[63] + 3) );
if ( v27 > 16 )
{
v38 = sub_7346DC(a1, a2, a3, a2);
v39 = v27 > 192 || a8 > 3;
v15 = 1 << v38;
if ( v39 )
v15 |= 1u;
}
else
{
if ( a8 <= 3 )
{
LABEL_25:
v41[0] = -1;
sub_7340D8(&v41[1], 0);
goto LABEL_26;
}
v15 = 1;
}
v41[0] = -1;
sub_7340D8(&v41[1], 0);
if ( v15 == 1 )
{
LABEL_26:
v29 = sub_71CC10(a1, a2, a3, a5, 0, a7, a8, 0, v41);
if ( !v29 )
{
LABEL_32:
sub_734318(&v41[1]);
return v29;
}
goto LABEL_27;
}
v14 = (void *)WebPSafeMalloc(1, 0, a4);
if ( !v14 )
return 0;
if ( !v15 )
{
v29 = 1;
goto LABEL_31;
}
LABEL_5:
v16 = a2;
v17 = (int)v14;
v18 = 1;
v19 = 0;
v20 = v16;
do
{
if ( (v15 & 1) != 0 )
{
v18 = sub_71CC10(a1, v20, a3, a5, v19, a7, a8, v17, v42);
if ( v18 && v42[0] < v41[0] )
{
sub_734318(&v41[1]);
memcpy(v41, v42, sizeof(v41));
}
else
{
sub_734318(&v42[1]);
}
}
v15 >>= 1;
++v19;
if ( v18 )
v21 = v15 != 0;
else
v21 = 0;
}
while ( v21 );
v14 = (void *)v17;
v29 = v18;
LABEL_31:
WebPSafeFree(v14);
if ( !v29 )
goto LABEL_32;
LABEL_27:
if ( a11 )
{
v30 = v41[47];
v31 = v41[48];
v32 = v41[49];
v33 = v41[50];
v34 = v41[51];
v35 = v41[52];
a11[37] = v41[46];
a11[38] = v30;
a11[41] = v33;
a11[39] = v31;
a11[40] = v32;
a11[42] = v34;
a11[43] = v35;
a11[44] = v41[53];
}
v37 = v41[5];
*a10 = v41[6];
*a9 = v37;
return v29;
}