#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*/ FLT_DIG;
int FLT_MAX;
double FLT_MIN;
int /*<<< orphan*/ printf(char *, double, ...);
int /*<<< orphan*/ puts(char *);
int main() {
  puts("\nCharacteristics of the type float\n");
  printf("Storage size: %zu bytes\n"
         "Smallest positive value: %E\n"
         "Greatest positive value: %E\n"
         "Precision: %d decimal digits\n",
         sizeof(float), FLT_MIN, FLT_MAX, FLT_DIG);
  puts("\nAn example of float precision:\n");
  double d_var = 12345.6;
  float f_var = (float)d_var;
  printf("The floating-point number"
         "%18.10f\n",
         d_var);
  printf("has been stored in a variable\n"
         "of type float as the value "
         "%18.10f\n",
         f_var);
  printf("The rounding error is "
         "%18.10f\n",
         d_var - f_var);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e9e(%rip),%rax
movsd  (%rax),%xmm1
mov    0x2e8b(%rip),%rax
mov    (%rax),%esi
mov    0x2ea2(%rip),%rax
mov    (%rax),%edx
lea    0xed5(%rip),%rdi
movsd  0xea1(%rip),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xf2d(%rip),%rdi
call   1030 <puts@plt>
movsd  0xe7e(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xf22(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xf2d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
subsd  %xmm1,%xmm0
lea    0xf4f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
movsd  (%rax),%xmm1
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
lea    0xef3(%rip),%rdi
movsd  0xea7(%rip),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xf4b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf60(%rip),%rdi
movsd  0xe8d(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xf6c(%rip),%rdi
movsd  0xe7f(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xf98(%rip),%rdi
movsd  0xe71(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"\0ACharacteristics of the type float\0A\00"
@.str.1 = [110 x i8] c"Storage size: %zu bytes\0ASmallest positive value: %E\0AGreatest positive value: %E\0APrecision: %d decimal digits\0A\00"
@FLT_MIN = global double 0.000000e+00
@FLT_MAX = global i32 0
@FLT_DIG = global i32 0
@.str.2 = [33 x i8] c"\0AAn example of float precision:\0A\00"
@.str.3 = [34 x i8] c"The floating-point number%18.10f\0A\00"
@.str.4 = [66 x i8] c"has been stored in a variable\0Aof type float as the value %18.10f\0A\00"
@.str.5 = [31 x i8] c"The rounding error is %18.10f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%5 = load double, double* @FLT_MIN
%6 = load i32, i32* @FLT_MAX
%7 = load i32, i32* @FLT_DIG
%8 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str.1, i64 0, i64 0), double 4.000000e+00, double %5, i32 %6, i32 %7)
%9 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store double 1.234560e+04, double* %2
%10 = load double, double* %2
%11 = fptrunc double %10 to float
store float %11, float* %3
%12 = load double, double* %2
%13 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), double %12)
%14 = load float, float* %3
%15 = fpext float %14 to double
%16 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.4, i64 0, i64 0), double %15)
%17 = load double, double* %2
%18 = load float, float* %3
%19 = fpext float %18 to double
%20 = fsub double %17, %19
%21 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), double %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"\0ACharacteristics of the type float\0A\00"
@.str.1 = [110 x i8] c"Storage size: %zu bytes\0ASmallest positive value: %E\0AGreatest positive value: %E\0APrecision: %d decimal digits\0A\00"
@FLT_MIN = global double 0.000000e+00
@FLT_MAX = global i32 0
@FLT_DIG = global i32 0
@.str.2 = [33 x i8] c"\0AAn example of float precision:\0A\00"
@.str.3 = [34 x i8] c"The floating-point number%18.10f\0A\00"
@.str.4 = [66 x i8] c"has been stored in a variable\0Aof type float as the value %18.10f\0A\00"
@.str.5 = [31 x i8] c"The rounding error is %18.10f\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%2 = load double, double* @FLT_MIN
%3 = load i32, i32* @FLT_MAX
%4 = load i32, i32* @FLT_DIG
%5 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str.1, i64 0, i64 0), double 4.000000e+00, double %2, i32 %3, i32 %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), double 1.234560e+04)
%8 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.4, i64 0, i64 0), double 0x40C81CCCC0000000)
%9 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), double 0x3F3999999A000000)
ret i32 0
}