#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 /*<<< orphan*/ printf(char *, float);
int main(void) {
  float max = 1.0, min = 0.0, test;
  int i;
  for (i = 0; i < 100000; i++) {
    test = (max + min) / 2.0;
    if ((1.0 + test) != 1.0)
      max = test;
    if ((1.0 + test) == 1.0)
      min = test;
  }
  printf("The epsilon machine is %.50lf\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xed9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x186a0,-0x14(%rbp)
jge    11f1 <main+0xe1>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb2(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe8c(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe80(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    119d <main+0x8d>
jp     119d <main+0x8d>
jmp    11a7 <main+0x97>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe50(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe44(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11de <main+0xce>
jp     11de <main+0xce>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11e3 <main+0xd3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113b <main+0x2b>
movss  -0x8(%rbp),%xmm0
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xorps  %xmm1,%xmm1
movss  0xee4(%rip),%xmm0
mov    $0x186a0,%eax
movss  0xedb(%rip),%xmm2
movsd  0xed7(%rip),%xmm3
jmp    1145 <main+0x35>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xfffffffe,%eax
je     11a3 <main+0x93>
movaps %xmm1,%xmm5
addss  %xmm0,%xmm5
mulss  %xmm2,%xmm5
xorps  %xmm4,%xmm4
cvtss2sd %xmm5,%xmm4
addsd  %xmm3,%xmm4
ucomisd %xmm3,%xmm4
movaps %xmm5,%xmm4
jne    116c <main+0x5c>
movaps %xmm5,%xmm4
jp     116c <main+0x5c>
movaps %xmm0,%xmm4
jne    1173 <main+0x63>
jp     1173 <main+0x63>
movaps %xmm5,%xmm1
movaps %xmm1,%xmm5
addss  %xmm4,%xmm5
mulss  %xmm2,%xmm5
xorps  %xmm0,%xmm0
cvtss2sd %xmm5,%xmm0
addsd  %xmm3,%xmm0
ucomisd %xmm3,%xmm0
movaps %xmm5,%xmm0
jne    119a <main+0x8a>
movaps %xmm5,%xmm0
jp     119a <main+0x8a>
movaps %xmm4,%xmm0
jne    1140 <main+0x30>
jp     1140 <main+0x30>
movaps %xmm5,%xmm1
jmp    1140 <main+0x30>
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"The epsilon machine is %.50lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store i32 0, i32* %1
store float 1.000000e+00, float* %2
store float 0.000000e+00, float* %3
store i32 0, i32* %5
br label %6
6: ; preds = %30, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 100000
br i1 %8, label %9, label %33
9: ; preds = %6
%10 = load float, float* %2
%11 = load float, float* %3
%12 = fadd float %10, %11
%13 = fpext float %12 to double
%14 = fdiv double %13, 2.000000e+00
%15 = fptrunc double %14 to float
store float %15, float* %4
%16 = load float, float* %4
%17 = fpext float %16 to double
%18 = fadd double 1.000000e+00, %17
%19 = fcmp une double %18, 1.000000e+00
br i1 %19, label %20, label %22
20: ; preds = %9
%21 = load float, float* %4
store float %21, float* %2
br label %22
22: ; preds = %20, %9
%23 = load float, float* %4
%24 = fpext float %23 to double
%25 = fadd double 1.000000e+00, %24
%26 = fcmp oeq double %25, 1.000000e+00
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = load float, float* %4
store float %28, float* %3
br label %29
29: ; preds = %27, %22
br label %30
30: ; preds = %29
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %6
33: ; preds = %6
%34 = load float, float* %2
%35 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), float %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"The epsilon machine is %.50lf\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %21, %1 ]
%3 = phi float [ 1.000000e+00, %0 ], [ %18, %1 ]
%4 = phi float [ 0.000000e+00, %0 ], [ %20, %1 ]
%5 = fadd float %4, %3
%6 = fmul float %5, 5.000000e-01
%7 = fpext float %6 to double
%8 = fadd double %7, 1.000000e+00
%9 = fcmp une double %8, 1.000000e+00
%10 = select i1 %9, float %6, float %3
%11 = fcmp oeq double %8, 1.000000e+00
%12 = select i1 %11, float %6, float %4
%13 = fadd float %12, %10
%14 = fmul float %13, 5.000000e-01
%15 = fpext float %14 to double
%16 = fadd double %15, 1.000000e+00
%17 = fcmp une double %16, 1.000000e+00
%18 = select i1 %17, float %14, float %10
%19 = fcmp oeq double %16, 1.000000e+00
%20 = select i1 %19, float %14, float %12
%21 = add nuw nsw i32 %2, 2
%22 = icmp eq i32 %21, 100000
br i1 %22, label %23, label %1
23: ; preds = %1
%24 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), float %18)
ret i32 0
}