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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  0xec4(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb6(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xeaa(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1194 <main+0x84>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe97(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1141 <main+0x31>
mov    -0x8(%rbp),%esi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe70(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xe34(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe27(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  0xe1a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    121c <main+0x10c>
movsd  -0x18(%rbp),%xmm0
movsd  0xe0b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d9 <main+0xc9>
mov    -0x8(%rbp),%esi
movsd  -0x18(%rbp),%xmm1
lea    0xdf5(%rip),%rdi
mov    $0x2,%al
movaps %xmm1,%xmm0
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
lea    0xdf4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
fld1
fstpt  -0x30(%rbp)
fldt   -0x30(%rbp)
fld1
fadd   %st,%st(1)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    1283 <main+0x173>
jmp    1267 <main+0x157>
fldt   -0x30(%rbp)
flds   0xd94(%rip)
fdivrp %st,%st(1)
fstpt  -0x30(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    124f <main+0x13f>
mov    -0x8(%rbp),%esi
fldt   -0x30(%rbp)
fld    %st(0)
mov    %rsp,%rax
fxch   %st(1)
fstpt  0x10(%rax)
fstpt  (%rax)
lea    0xda9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xf10(%rip),%rdi
call   1030 <puts@plt>
lea    0xed4(%rip),%rbx
movsd  0xec0(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x36,%esi
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x36,%esi
movsd  0xe92(%rip),%xmm0
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
flds   0xe7e(%rip)
fld    %st(0)
fstpt  0x10(%rsp)
fstpt  (%rsp)
lea    0xe89(%rip),%rdi
mov    $0x41,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [23 x i8] c"%i dzielen, %f -> %e\0A\0A\00"
@.str.4 = [25 x i8] c"%i dzielen, %Lf -> %Le\0A\0A\00"
@str = [7 x i8] c"FLOAT:\00"
@str.5 = [8 x i8] c"DOUBLE:\00"
@str.6 = [13 x i8] c"LONG DOUBLE:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 54, double 0x3CA0000000000000, double 0x3CA0000000000000)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 54, double 0x3CA0000000000000, double 0x3CA0000000000000)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.6, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 65, x86_fp80 0xK3FBF8000000000000000, x86_fp80 0xK3FBF8000000000000000)
ret i32 0
}