//
// sub_70D5CC from 0x70d5cc to 0x70d65c (144 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
//
int __fastcall sub_70D5CC(int a1, int *a2)
{
int v2; // r2
unsigned int v3; // r1
unsigned int v4; // r3
unsigned int v5; // r5
unsigned int v6; // r2
bool v7; // cc
int v8; // r0
bool v9; // cc
int v10; // r1
unsigned int v11; // r0
unsigned int v12; // r2
unsigned int v13; // r3
int v14; // r2
v2 = *a2;
v3 = *(a2 - 1);
v4 = (a1 & v2) + (((v2 ^ a1) & 0xFEFEFEFE) >> 1);
v5 = BYTE2(v4) + ((BYTE2(v4) - BYTE2(v3) + (BYTE2(v4) < (unsigned int)BYTE2(v3))) >> 1);
v6 = HIBYTE(v4) + (int)(HIBYTE(v4) - HIBYTE(v3)) / 2;
v7 = v6 > 0xFF;
if ( v6 > 0xFF )
v6 = ~v6;
v8 = BYTE1(v4) - BYTE1(v3) + (BYTE1(v4) < (unsigned int)BYTE1(v3));
if ( v7 )
v6 >>= 24;
v9 = v5 > 0xFF;
v10 = (unsigned __int8)v4 - (unsigned __int8)v3;
v11 = BYTE1(v4) + (v8 >> 1);
if ( v5 > 0xFF )
v5 = ~v5;
v12 = v6 << 24;
if ( v9 )
v5 >>= 24;
v13 = (unsigned __int8)v4 + v10 / 2;
v14 = v12 | (v5 << 16);
if ( v11 > 0xFF )
v11 = ~v11 >> 24;
if ( v13 > 0xFF )
v13 = ~v13 >> 24;
return v14 | (v11 << 8) | v13;
}