//
// sub_70D504 from 0x70d504 to 0x70d554 (80 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
//
unsigned int __fastcall sub_70D504(unsigned int a1, int *a2)
{
unsigned int v2; // r7
unsigned int v4; // r5
int v5; // r6
int v6; // r6
int v7; // r6
int v8; // r0
char v9; // cc
unsigned int result; // r0
v2 = *(a2 - 1);
v4 = *a2;
v5 = sub_70D424(HIBYTE(*a2), HIBYTE(a1), HIBYTE(v2));
v6 = v5 + sub_70D424(BYTE2(v4), BYTE2(a1), BYTE2(v2));
v7 = v6 + sub_70D424(BYTE1(v4), BYTE1(a1), BYTE1(v2));
v8 = sub_70D424((unsigned __int8)v4, (unsigned __int8)a1, (unsigned __int8)v2);
v9 = (v7 + v8 < 0) ^ __OFADD__(v7, v8) | (v7 + v8 == 0);
result = v4;
if ( !v9 )
return a1;
return result;
}