#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() {
  float eps_f = 1.0f;
  float eps_d = 1.0;
  while (1.0f + eps_f > 1.0f)
    eps_f /= 2.0;
  while (1.0 + eps_d > 1.0)
    eps_d /= 2.0;
  printf("Epsilon for float: %.17g\n", eps_f);
  printf("Epsilon for double: %.17g\n", eps_d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xed9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xecc(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xebf(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  0xeb2(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    117a <main+0x6a>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1139 <main+0x29>
jmp    117f <main+0x6f>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe78(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe6c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c9 <main+0xb9>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe59(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    117f <main+0x6f>
movss  -0x8(%rbp),%xmm0
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movss  0xee7(%rip),%xmm3
movss  0xee3(%rip),%xmm0
movsd  0xee7(%rip),%xmm1
nopl   0x0(%rax)
mulss  %xmm0,%xmm3
mulss  %xmm0,%xmm3
mulss  %xmm0,%xmm3
mulss  %xmm0,%xmm3
mulss  %xmm0,%xmm3
xorps  %xmm2,%xmm2
cvtss2sd %xmm3,%xmm2
addsd  %xmm1,%xmm2
ucomisd %xmm1,%xmm2
jbe    1163 <main+0x53>
mulss  %xmm0,%xmm3
mulss  %xmm0,%xmm3
mulss  %xmm0,%xmm3
jmp    1130 <main+0x20>
lea    0xeae(%rip),%rdi
movss  0xe96(%rip),%xmm0
movss  %xmm3,0x4(%rsp)
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
movss  0x4(%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Epsilon for float: %.17g\0A\00"
@.str.1 = [27 x i8] c"Epsilon for double: %.17g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 1.000000e+00, float* %2
store float 1.000000e+00, float* %3
br label %4
4: ; preds = %8, %0
%5 = load float, float* %2
%6 = fadd float 1.000000e+00, %5
%7 = fcmp ogt float %6, 1.000000e+00
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = load float, float* %2
%10 = fpext float %9 to double
%11 = fdiv double %10, 2.000000e+00
%12 = fptrunc double %11 to float
store float %12, float* %2
br label %4
13: ; preds = %4
br label %14
14: ; preds = %19, %13
%15 = load float, float* %3
%16 = fpext float %15 to double
%17 = fadd double 1.000000e+00, %16
%18 = fcmp ogt double %17, 1.000000e+00
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = load float, float* %3
%21 = fpext float %20 to double
%22 = fdiv double %21, 2.000000e+00
%23 = fptrunc double %22 to float
store float %23, float* %3
br label %14
24: ; preds = %14
%25 = load float, float* %2
%26 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), float %25)
%27 = load float, float* %3
%28 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), float %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Epsilon for float: %.17g\0A\00"
@.str.1 = [27 x i8] c"Epsilon for double: %.17g\0A\00"
define i32 @main() {
br label %1
1: ; preds = %11, %0
%2 = phi float [ 1.000000e+00, %0 ], [ %14, %11 ]
%3 = fmul float %2, 5.000000e-01
%4 = fmul float %3, 5.000000e-01
%5 = fmul float %4, 5.000000e-01
%6 = fmul float %5, 5.000000e-01
%7 = fmul float %6, 5.000000e-01
%8 = fpext float %7 to double
%9 = fadd double %8, 1.000000e+00
%10 = fcmp ogt double %9, 1.000000e+00
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = fmul float %7, 5.000000e-01
%13 = fmul float %12, 5.000000e-01
%14 = fmul float %13, 5.000000e-01
br label %1
15: ; preds = %1
%16 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), float 0x3E70000000000000)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), float %7)
ret i32 0
}