#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 *, ...);
int main() {
  printf("dla FLOAT:\n");
  float x = 1.0;
  while (1.0 + x > 1.0) {
    x = x / 2.0;
  }
  printf("%f -> %e\n\n", x, x);
  printf("dla DOUBLE:\n");
  double y = 1.0;
  while (1.0 + y > 1.0) {
    y = y / 2.0;
  }
  printf("%f -> %e\n\n", y, y);
  printf("dla LONG DOUBLE:\n");
  long double z = 1.0;
  while (1.0 + z > 1.0) {
    z = z / 2.0;
  }
  printf("%Lf -> %Le\n\n", z, z);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  0xecb(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xebd(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xeb1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1184 <main+0x74>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    113a <main+0x2a>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe87(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xe4e(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe41(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xe34(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11f9 <main+0xe9>
movsd  -0x10(%rbp),%xmm0
movsd  0xe25(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11bf <main+0xaf>
movsd  -0x10(%rbp),%xmm1
lea    0xe1f(%rip),%rdi
mov    $0x2,%al
movaps %xmm1,%xmm0
call   1030 <printf@plt>
lea    0xe26(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
fld1
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
fld1
fadd   %st,%st(1)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    124d <main+0x13d>
jmp    123a <main+0x12a>
fldt   -0x20(%rbp)
flds   0xdc1(%rip)
fdivrp %st,%st(1)
fstpt  -0x20(%rbp)
jmp    1222 <main+0x112>
fldt   -0x20(%rbp)
fld    %st(0)
mov    %rsp,%rax
fxch   %st(1)
fstpt  0x10(%rax)
fstpt  (%rax)
lea    0xdeb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xf0c(%rip),%rdi
call   1030 <puts@plt>
movss  0xec7(%rip),%xmm1
movss  0xec3(%rip),%xmm2
movsd  0xec7(%rip),%xmm3
nopl   0x0(%rax)
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movaps %xmm0,%xmm4
addsd  %xmm3,%xmm4
ucomisd %xmm3,%xmm4
jbe    1186 <main+0x66>
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm1
jmp    1150 <main+0x30>
lea    0xe93(%rip),%rbx
mov    %rbx,%rdi
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
movsd  0xe6a(%rip),%xmm0
mov    %rbx,%rdi
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
flds   0xe3b(%rip)
fld    %st(0)
fstpt  0x10(%rsp)
fstpt  (%rsp)
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"dla FLOAT:\0A\00"
@.str.1 = [11 x i8] c"%f -> %e\0A\0A\00"
@.str.2 = [13 x i8] c"dla DOUBLE:\0A\00"
@.str.3 = [18 x i8] c"dla LONG DOUBLE:\0A\00"
@.str.4 = [13 x i8] c"%Lf -> %Le\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca double
%4 = alloca x86_fp80
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store float 1.000000e+00, float* %2
br label %6
6: ; preds = %11, %0
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = fadd double 1.000000e+00, %8
%10 = fcmp ogt double %9, 1.000000e+00
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = load float, float* %2
%13 = fpext float %12 to double
%14 = fdiv double %13, 2.000000e+00
%15 = fptrunc double %14 to float
store float %15, float* %2
br label %6
16: ; preds = %6
%17 = load float, float* %2
%18 = fpext float %17 to double
%19 = load float, float* %2
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), double %18, double %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store double 1.000000e+00, double* %3
br label %23
23: ; preds = %27, %16
%24 = load double, double* %3
%25 = fadd double 1.000000e+00, %24
%26 = fcmp ogt double %25, 1.000000e+00
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load double, double* %3
%29 = fdiv double %28, 2.000000e+00
store double %29, double* %3
br label %23
30: ; preds = %23
%31 = load double, double* %3
%32 = load double, double* %3
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), double %31, double %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
store x86_fp80 0xK3FFF8000000000000000, x86_fp80* %4
br label %35
35: ; preds = %39, %30
%36 = load x86_fp80, x86_fp80* %4
%37 = fadd x86_fp80 0xK3FFF8000000000000000, %36
%38 = fcmp ogt x86_fp80 %37, 0xK3FFF8000000000000000
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = load x86_fp80, x86_fp80* %4
%41 = fdiv x86_fp80 %40, 0xK40008000000000000000
store x86_fp80 %41, x86_fp80* %4
br label %35
42: ; preds = %35
%43 = load x86_fp80, x86_fp80* %4
%44 = load x86_fp80, x86_fp80* %4
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), x86_fp80 %43, x86_fp80 %44)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"%f -> %e\0A\0A\00"
@.str.4 = [13 x i8] c"%Lf -> %Le\0A\0A\00"
@str = [11 x i8] c"dla FLOAT:\00"
@str.5 = [12 x i8] c"dla DOUBLE:\00"
@str.6 = [17 x i8] c"dla LONG DOUBLE:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %12, %0
%3 = phi float [ 1.000000e+00, %0 ], [ %15, %12 ]
%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 = fmul float %7, 5.000000e-01
%9 = fpext float %8 to double
%10 = fadd double %9, 1.000000e+00
%11 = fcmp ogt double %10, 1.000000e+00
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = fmul float %8, 5.000000e-01
%14 = fmul float %13, 5.000000e-01
%15 = fmul float %14, 5.000000e-01
br label %2
16: ; preds = %2
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), double %9, double %9)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), double 0x3CA0000000000000, double 0x3CA0000000000000)
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0))
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), x86_fp80 0xK3FBF8000000000000000, x86_fp80 0xK3FBF8000000000000000)
ret i32 0
}