ABS

repo: bradharding/doomretro

decompiled_code:
__int64 __fastcall ABS(int a1)
{
return abs32(a1);
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1)
{
return abs32(a1);
}

original_code:
__attribute__((const)) static inline int ABS(int a)
{
    return (a < 0 ? -a : a);
}

variable_types: a int

return_type: int


FixedMul

decompiled_code:
__int64 __fastcall FixedMul(int a1, int a2)
{
return (a2 * (__int64)a1) >> 16;
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1, int a2)
{
return (a2 * (__int64)a1) >> 16;
}

original_code:
__attribute__((const)) static inline fixed_t FixedMul(fixed_t a, fixed_t b)
{
    return (((int64_t)a * b) >> 16);
}

canonical_original_code:
static inline int FixedMul(int a, int b)
{
    return (((long)a * b) >> 16);
}

variable_types: b int


FixedDiv

decompiled_code:
__int64 __fastcall FixedDiv(int a1, int a2)
{
int v2; // eax
int v3; // ecx
int v4; // er8
__int64 result; // rax

ABS(a1);
v2 = ABS(a2);
if ( v4 >> 15 < v2 )
result = ((__int64)v3 << 16) / a2;
else
result = ((a2 ^ v3) >> 31) ^ 0x7FFFFFFFu;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(int a1, int a2)
{
int v2; // eax
int v3; // ecx
int v4; // er8
__int64 result; // rax

func0(a1);
v2 = func0(a2);
if ( v4 >> 15 < v2 )
result = ((__int64)v3 << 16) / a2;
else
result = ((a2 ^ v3) >> 31) ^ 0x7FFFFFFFu;
return result;
}

original_code:
__attribute__((const)) static inline fixed_t FixedDiv(fixed_t a, fixed_t b)
{
    return (((int64_t)ABS(a) >> 15) >= ABS(b) ? (((int64_t)(a ^ b) >> 31) ^ (2147483647)) : (((int64_t)a << 16) / b));
}

canonical_original_code:
static inline int FixedDiv(int a, int b)
{
    return (((long)ABS(a) >> 15) >= ABS(b) ? (((long)(a ^ b) >> 31) ^ (2147483647)) : (((long)a << 16) / b));
}