#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 */
scalar_t__ DBL_MAX;
scalar_t__ FLT_MAX;
scalar_t__ INT_MAX;
int /*<<< orphan*/ printf(char *, float);
int main() {
  printf("FLT_MAX rzutowane na int %d\n", (int)FLT_MAX);
  printf("DBL_MAX rzutowane na int %d\n", (int)DBL_MAX);
  printf("INT_MAX rzutowane na short %d\n", (short)INT_MAX);
  printf("FLT_MAX rzutowane na short %d\n", (short)FLT_MAX);
  printf("INT_MAX rzutowane na float %f\n", (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
mov    %rax,-0x10(%rbp)
cvtsi2ssl (%rax),%xmm0
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8f(%rip),%rax
cvtsi2ssl (%rax),%xmm0
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e90(%rip),%rax
movswl (%rax),%eax
cvtsi2ss %eax,%xmm0
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movswl (%rax),%eax
cvtsi2ss %eax,%xmm0
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e5f(%rip),%rax
cvtsi2ssq (%rax),%xmm0
lea    0xee3(%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),%r14
cvtsi2ssl (%r14),%xmm0
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9d(%rip),%rax
xorps  %xmm0,%xmm0
cvtsi2ssl (%rax),%xmm0
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9b(%rip),%rbx
movswl (%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
movswl (%r14),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
lea    0xee4(%rip),%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2ssq (%rbx),%xmm0
lea    0xeef(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"FLT_MAX rzutowane na int %d\0A\00"
@FLT_MAX = global i64 0
@.str.1 = [29 x i8] c"DBL_MAX rzutowane na int %d\0A\00"
@DBL_MAX = global i64 0
@.str.2 = [31 x i8] c"INT_MAX rzutowane na short %d\0A\00"
@INT_MAX = global i64 0
@.str.3 = [31 x i8] c"FLT_MAX rzutowane na short %d\0A\00"
@.str.4 = [31 x i8] c"INT_MAX rzutowane na float %f\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i64, i64* @FLT_MAX
%3 = trunc i64 %2 to i32
%4 = sitofp i32 %3 to float
%5 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), float %4)
%6 = load i64, i64* @DBL_MAX
%7 = trunc i64 %6 to i32
%8 = sitofp i32 %7 to float
%9 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), float %8)
%10 = load i64, i64* @INT_MAX
%11 = trunc i64 %10 to i16
%12 = sitofp i16 %11 to float
%13 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), float %12)
%14 = load i64, i64* @FLT_MAX
%15 = trunc i64 %14 to i16
%16 = sitofp i16 %15 to float
%17 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), float %16)
%18 = load i64, i64* @INT_MAX
%19 = sitofp i64 %18 to float
%20 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), float %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"FLT_MAX rzutowane na int %d\0A\00"
@FLT_MAX = global i64 0
@.str.1 = [29 x i8] c"DBL_MAX rzutowane na int %d\0A\00"
@DBL_MAX = global i64 0
@.str.2 = [31 x i8] c"INT_MAX rzutowane na short %d\0A\00"
@INT_MAX = global i64 0
@.str.3 = [31 x i8] c"FLT_MAX rzutowane na short %d\0A\00"
@.str.4 = [31 x i8] c"INT_MAX rzutowane na float %f\0A\00"
define i32 @main() {
%1 = load i64, i64* @FLT_MAX
%2 = trunc i64 %1 to i32
%3 = sitofp i32 %2 to float
%4 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), float %3)
%5 = load i64, i64* @DBL_MAX
%6 = trunc i64 %5 to i32
%7 = sitofp i32 %6 to float
%8 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), float %7)
%9 = load i64, i64* @INT_MAX
%10 = trunc i64 %9 to i16
%11 = sitofp i16 %10 to float
%12 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), float %11)
%13 = load i64, i64* @FLT_MAX
%14 = trunc i64 %13 to i16
%15 = sitofp i16 %14 to float
%16 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), float %15)
%17 = load i64, i64* @INT_MAX
%18 = sitofp i64 %17 to float
%19 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), float %18)
ret i32 0
}