#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double MAX(double, double);
bool approx(int i_one, int i_two) {
  double one = i_one, one_bump = one * 0.01;
  double two = i_two, two_bump = two * 0.01;
  one_bump = one + MAX(one_bump, 2.0);
  two_bump = two + MAX(two_bump, 2.0);
  if (one == two || (one > two && one <= two_bump) ||
      (two > one && two <= one_bump))
    return true;
  return false;
}


x86 assembly (clang, -O0):
<approx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xed8(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xebc(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe93(%rip),%xmm1
call   1030 <MAX@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe66(%rip),%xmm1
call   1030 <MAX@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne    11cb <approx+0xbb>
jp     11cb <approx+0xbb>
jmp    1213 <approx+0x103>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11ef <approx+0xdf>
movsd  -0x18(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jae    1213 <approx+0x103>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    121f <approx+0x10f>
movsd  -0x28(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     121f <approx+0x10f>
movl   $0x1,-0x4(%rbp)
jmp    1226 <approx+0x116>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<approx>:
sub    $0x28,%rsp
cvtsi2sd %edi,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0xeda(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sd %esi,%xmm2
movsd  %xmm2,0x18(%rsp)
mulsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0xec2(%rip),%xmm1
call   1030 <MAX@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0xea9(%rip),%xmm1
call   1030 <MAX@plt>
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
mov    $0x1,%eax
ucomisd %xmm2,%xmm1
jne    1182 <approx+0x72>
jp     1182 <approx+0x72>
add    $0x28,%rsp
ret
movsd  0x8(%rsp),%xmm3
jbe    1194 <approx+0x84>
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jae    117d <approx+0x6d>
addsd  %xmm1,%xmm3
ucomisd %xmm1,%xmm2
seta   %al
ucomisd %xmm2,%xmm3
setae  %cl
and    %al,%cl
movzbl %cl,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @approx(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
%10 = load i32, i32* %4
%11 = sitofp i32 %10 to double
store double %11, double* %6
%12 = load double, double* %6
%13 = fmul double %12, 1.000000e-02
store double %13, double* %7
%14 = load i32, i32* %5
%15 = sitofp i32 %14 to double
store double %15, double* %8
%16 = load double, double* %8
%17 = fmul double %16, 1.000000e-02
store double %17, double* %9
%18 = load double, double* %6
%19 = load double, double* %7
%20 = call double @MAX(double %19, double 2.000000e+00)
%21 = fadd double %18, %20
store double %21, double* %7
%22 = load double, double* %8
%23 = load double, double* %9
%24 = call double @MAX(double %23, double 2.000000e+00)
%25 = fadd double %22, %24
store double %25, double* %9
%26 = load double, double* %6
%27 = load double, double* %8
%28 = fcmp oeq double %26, %27
br i1 %28, label %45, label %29
29: ; preds = %2
%30 = load double, double* %6
%31 = load double, double* %8
%32 = fcmp ogt double %30, %31
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load double, double* %6
%35 = load double, double* %9
%36 = fcmp ole double %34, %35
br i1 %36, label %45, label %37
37: ; preds = %33, %29
%38 = load double, double* %8
%39 = load double, double* %6
%40 = fcmp ogt double %38, %39
br i1 %40, label %41, label %46
41: ; preds = %37
%42 = load double, double* %8
%43 = load double, double* %7
%44 = fcmp ole double %42, %43
br i1 %44, label %45, label %46
45: ; preds = %41, %33, %2
store i32 1, i32* %3
br label %47
46: ; preds = %41, %37
store i32 0, i32* %3
br label %47
47: ; preds = %46, %45
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
define i32 @approx(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to double
%4 = fmul double %3, 1.000000e-02
%5 = sitofp i32 %1 to double
%6 = fmul double %5, 1.000000e-02
%7 = tail call double @MAX(double %4, double 2.000000e+00)
%8 = fadd double %7, %3
%9 = tail call double @MAX(double %6, double 2.000000e+00)
%10 = fcmp oeq double %3, %5
br i1 %10, label %21, label %11
11: ; preds = %2
%12 = fadd double %9, %5
%13 = fcmp ule double %3, %5
%14 = fcmp ult double %12, %3
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = fcmp ogt double %5, %3
%18 = fcmp oge double %8, %5
%19 = select i1 %17, i1 %18, i1 false
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %16, %2, %11
%22 = phi i32 [ 1, %11 ], [ 1, %2 ], [ %20, %16 ]
ret i32 %22
}