#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 */
int fabs(double);
int Stopping_Rule(double x0, double x1) {
  double xm = 0.5 * fabs(x0 + x1);
  if (xm <= 1.0) {
    if (fabs(x1 - x0) < 1e-3) {
      return 0;
    } else {
      return 1;
    }
  } else {
    if (fabs(x1 - x0) < 1e-3 * xm) {
      return 0;
    } else {
      return 1;
    }
  }
}


x86 assembly (clang, -O0):
<Stopping_Rule>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xecb(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeb2(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     1196 <Stopping_Rule+0x86>
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe9c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    118a <Stopping_Rule+0x7a>
movl   $0x0,-0x4(%rbp)
jmp    11d3 <Stopping_Rule+0xc3>
movl   $0x1,-0x4(%rbp)
jmp    11d3 <Stopping_Rule+0xc3>
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe5f(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11cc <Stopping_Rule+0xbc>
movl   $0x0,-0x4(%rbp)
jmp    11d3 <Stopping_Rule+0xc3>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Stopping_Rule>:
sub    $0x18,%rsp
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
addsd  %xmm1,%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xec9(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
call   1030 <fabs@plt>
xor    %ecx,%ecx
test   %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
setg   %cl
movsd  0xea5(%rip),%xmm1
movsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
setbe  %al
movsd  0xe92(%rip),%xmm0
ucomisd %xmm2,%xmm0
cmovb  %eax,%ecx
movzbl %cl,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @Stopping_Rule(double %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fadd double %7, %8
%10 = call i32 @fabs(double %9)
%11 = sitofp i32 %10 to double
%12 = fmul double 5.000000e-01, %11
store double %12, double* %6
%13 = load double, double* %6
%14 = fcmp ole double %13, 1.000000e+00
br i1 %14, label %15, label %24
15: ; preds = %2
%16 = load double, double* %5
%17 = load double, double* %4
%18 = fsub double %16, %17
%19 = call i32 @fabs(double %18)
%20 = sitofp i32 %19 to double
%21 = fcmp olt double %20, 1.000000e-03
br i1 %21, label %22, label %23
22: ; preds = %15
store i32 0, i32* %3
br label %35
23: ; preds = %15
store i32 1, i32* %3
br label %35
24: ; preds = %2
%25 = load double, double* %5
%26 = load double, double* %4
%27 = fsub double %25, %26
%28 = call i32 @fabs(double %27)
%29 = sitofp i32 %28 to double
%30 = load double, double* %6
%31 = fmul double 1.000000e-03, %30
%32 = fcmp olt double %29, %31
br i1 %32, label %33, label %34
33: ; preds = %24
store i32 0, i32* %3
br label %35
34: ; preds = %24
store i32 1, i32* %3
br label %35
35: ; preds = %34, %33, %23, %22
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
define i32 @Stopping_Rule(double %0, double %1) {
%3 = fadd double %0, %1
%4 = tail call i32 @fabs(double %3)
%5 = sitofp i32 %4 to double
%6 = fmul double %5, 5.000000e-01
%7 = fcmp ugt double %6, 1.000000e+00
%8 = fsub double %1, %0
%9 = tail call i32 @fabs(double %8)
%10 = icmp sgt i32 %9, 0
%11 = sitofp i32 %9 to double
%12 = fmul double %6, 1.000000e-03
%13 = fcmp ule double %12, %11
%14 = select i1 %7, i1 %13, i1 %10
%15 = zext i1 %14 to i32
ret i32 %15
}