#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 */
double DBL_MAX;
double FLT_MAX;
int INT_MAX;
int LDBL_MAX;
int LONG_MAX;
int /*<<< orphan*/ printf(char *, int, float);
int main() {
  printf("FLT_MAX -> (int)FLT_MAX:\n%e -> %i\n\n", FLT_MAX, (int)FLT_MAX);
  printf("INT_MAX -> (float)INT_MAX:\n%i -> %e\n\n", INT_MAX, (float)INT_MAX);
  printf("DBL_MAX -> (int)DBL_MAX:\n%e -> %i\n\n", DBL_MAX, (int)DBL_MAX);
  printf("INT_MAX -> (double)INT_MAX:\n%i -> %e\n\n", INT_MAX, (double)INT_MAX);
  printf("LDBL_MAX -> (double)LDBL_MAX:\n%Le -> %e\n\n", LDBL_MAX,
         (double)LDBL_MAX);
  printf("LONG_MAX -> (float)LONG_MAX:\n%li -> %e\n\n", LONG_MAX,
         (float)LONG_MAX);
  printf("INT_MAX -> (float)INT_MAX:\n%i -> %e\n\n", INT_MAX, (float)INT_MAX);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
cvttsd2si (%rax),%esi
mov    0x2eaf(%rip),%rax
cvttsd2si (%rax),%eax
cvtsi2ss %eax,%xmm0
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
mov    0x2e93(%rip),%rax
cvtsi2ssl (%rax),%xmm0
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e54(%rip),%rax
cvttsd2si (%rax),%esi
mov    0x2e49(%rip),%rax
cvttsd2si (%rax),%eax
cvtsi2ss %eax,%xmm0
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%esi
mov    0x2e4d(%rip),%rax
cvtsi2sdl (%rax),%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%esi
mov    0x2e11(%rip),%rax
cvtsi2sdl (%rax),%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%esi
mov    0x2de5(%rip),%rax
cvtsi2ssl (%rax),%xmm0
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%esi
mov    0x2de5(%rip),%rax
cvtsi2ssl (%rax),%xmm0
lea    0xe16(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ec5(%rip),%rax
movsd  (%rax),%xmm0
cvttsd2si %xmm0,%esi
cvttpd2dq %xmm0,%xmm0
cvtdq2ps %xmm0,%xmm0
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eab(%rip),%rbx
mov    (%rbx),%esi
xorps  %xmm0,%xmm0
cvtsi2ss %esi,%xmm0
lea    0xed7(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x2e64(%rip),%rax
movsd  (%rax),%xmm0
cvttsd2si %xmm0,%esi
cvttpd2dq %xmm0,%xmm0
cvtdq2ps %xmm0,%xmm0
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
mov    (%rbx),%esi
xorps  %xmm0,%xmm0
cvtsi2ss %esi,%xmm0
lea    0xee7(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%esi
xorps  %xmm0,%xmm0
cvtsi2ss %esi,%xmm0
lea    0xef2(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%esi
xorps  %xmm0,%xmm0
cvtsi2ss %esi,%xmm0
lea    0xf00(%rip),%rdi
call   1030 <printf@plt>
mov    (%rbx),%esi
xorps  %xmm0,%xmm0
cvtsi2ss %esi,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [36 x i8] c"FLT_MAX -> (int)FLT_MAX:\0A%e -> %i\0A\0A\00"
@FLT_MAX = global double 0.000000e+00
@.str.1 = [38 x i8] c"INT_MAX -> (float)INT_MAX:\0A%i -> %e\0A\0A\00"
@INT_MAX = global i32 0
@.str.2 = [36 x i8] c"DBL_MAX -> (int)DBL_MAX:\0A%e -> %i\0A\0A\00"
@DBL_MAX = global double 0.000000e+00
@.str.3 = [39 x i8] c"INT_MAX -> (double)INT_MAX:\0A%i -> %e\0A\0A\00"
@.str.4 = [42 x i8] c"LDBL_MAX -> (double)LDBL_MAX:\0A%Le -> %e\0A\0A\00"
@LDBL_MAX = global i32 0
@.str.5 = [41 x i8] c"LONG_MAX -> (float)LONG_MAX:\0A%li -> %e\0A\0A\00"
@LONG_MAX = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load double, double* @FLT_MAX
%3 = fptosi double %2 to i32
%4 = load double, double* @FLT_MAX
%5 = fptosi double %4 to i32
%6 = sitofp i32 %5 to float
%7 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %3, float %6)
%8 = load i32, i32* @INT_MAX
%9 = load i32, i32* @INT_MAX
%10 = sitofp i32 %9 to float
%11 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %8, float %10)
%12 = load double, double* @DBL_MAX
%13 = fptosi double %12 to i32
%14 = load double, double* @DBL_MAX
%15 = fptosi double %14 to i32
%16 = sitofp i32 %15 to float
%17 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %13, float %16)
%18 = load i32, i32* @INT_MAX
%19 = load i32, i32* @INT_MAX
%20 = sitofp i32 %19 to double
%21 = fptrunc double %20 to float
%22 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %18, float %21)
%23 = load i32, i32* @LDBL_MAX
%24 = load i32, i32* @LDBL_MAX
%25 = sitofp i32 %24 to double
%26 = fptrunc double %25 to float
%27 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i32 %23, float %26)
%28 = load i32, i32* @LONG_MAX
%29 = load i32, i32* @LONG_MAX
%30 = sitofp i32 %29 to float
%31 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %28, float %30)
%32 = load i32, i32* @INT_MAX
%33 = load i32, i32* @INT_MAX
%34 = sitofp i32 %33 to float
%35 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %32, float %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"FLT_MAX -> (int)FLT_MAX:\0A%e -> %i\0A\0A\00"
@FLT_MAX = global double 0.000000e+00
@.str.1 = [38 x i8] c"INT_MAX -> (float)INT_MAX:\0A%i -> %e\0A\0A\00"
@INT_MAX = global i32 0
@.str.2 = [36 x i8] c"DBL_MAX -> (int)DBL_MAX:\0A%e -> %i\0A\0A\00"
@DBL_MAX = global double 0.000000e+00
@.str.3 = [39 x i8] c"INT_MAX -> (double)INT_MAX:\0A%i -> %e\0A\0A\00"
@.str.4 = [42 x i8] c"LDBL_MAX -> (double)LDBL_MAX:\0A%Le -> %e\0A\0A\00"
@LDBL_MAX = global i32 0
@.str.5 = [41 x i8] c"LONG_MAX -> (float)LONG_MAX:\0A%li -> %e\0A\0A\00"
@LONG_MAX = global i32 0
define i32 @main() {
%1 = load double, double* @FLT_MAX
%2 = fptosi double %1 to i32
%3 = sitofp i32 %2 to float
%4 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %2, float %3)
%5 = load i32, i32* @INT_MAX
%6 = sitofp i32 %5 to float
%7 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %5, float %6)
%8 = load double, double* @DBL_MAX
%9 = fptosi double %8 to i32
%10 = sitofp i32 %9 to float
%11 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %9, float %10)
%12 = load i32, i32* @INT_MAX
%13 = sitofp i32 %12 to float
%14 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %12, float %13)
%15 = load i32, i32* @LDBL_MAX
%16 = sitofp i32 %15 to float
%17 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i32 %15, float %16)
%18 = load i32, i32* @LONG_MAX
%19 = sitofp i32 %18 to float
%20 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %18, float %19)
%21 = load i32, i32* @INT_MAX
%22 = sitofp i32 %21 to float
%23 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %21, float %22)
ret i32 0
}