#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 EXIT_SUCCESS;
int INT_MAX;
int INT_MIN;
int /*<<< orphan*/ printf(char *, double, int, double, ...);
int main(void) {
  int ival1 = 32769;
  float fval2 = 4147483650.42376;
  float fval2a = -4789213978.879342;
  float fval1 = (float)ival1;
  int ival2 = (int)fval2;
  int ival2a = (int)fval2a;
  double dval1 = (double)ival1;
  double dval2 = 5678765.6786789;
  int ival2b = (int)dval2;
  printf("From int: \'%d\'\n"
         "     to float: \'%f\'\n"
         "     IEEE 754, exponential notation: \'%e\'\n",
         ival1, fval1, fval1);
  printf("From float: \'%f\'\n"
         "     IEEE 754, exponential notation: \'%e\'\n"
         "     to int: \'%d\' INT_MAX: %d\n",
         fval2, fval2, ival2, INT_MAX);
  printf("From float: \'%f\'\n"
         "     IEEE 754, exponential notation: \'%e\'\n"
         "     to int: \'%d\' INT_MIN: %d\n",
         fval2a, fval2a, ival2a, INT_MIN);
  printf("From int: \'%d\'\n"
         "     to double: \'%f\'\n"
         "     IEEE 754, exponential notation: \'%e\'\n",
         ival1, dval1, dval1);
  printf("From double: \'%f\'\n"
         "     to int: \'%d\'\n"
         "     IEEE 754, exponential notation: \'%e\'\n",
         dval2, ival2b, dval2);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x8001,-0x8(%rbp)
movss  0xede(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xecd(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
cvttss2si -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
cvttss2si -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe94(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
cvttsd2si -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
cvttss2si -0x14(%rbp),%esi
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe7d(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvttss2si -0xc(%rbp),%esi
cvtsi2sdl -0x18(%rbp),%xmm1
mov    0x2e34(%rip),%rax
mov    (%rax),%edx
lea    0xea1(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvttss2si -0x10(%rbp),%esi
cvtsi2sdl -0x1c(%rbp),%xmm1
mov    0x2e02(%rip),%rax
mov    (%rax),%edx
lea    0xed1(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
cvttsd2si -0x28(%rbp),%esi
movsd  -0x28(%rbp),%xmm1
lea    0xf0e(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
mov    -0x34(%rbp),%esi
movsd  -0x30(%rbp),%xmm1
lea    0xf42(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    0x2da3(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf08(%rip),%rdi
movsd  0xee0(%rip),%xmm0
mov    $0x8001,%esi
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
mov    0x2eb2(%rip),%rax
mov    (%rax),%edx
lea    0xf2f(%rip),%rdi
movsd  0xec1(%rip),%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edx
lea    0xf6a(%rip),%rdi
movsd  0xeaa(%rip),%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xfae(%rip),%rdi
movsd  0xe84(%rip),%xmm0
mov    $0x8001,%esi
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xfdf(%rip),%rdi
movsd  0xe7e(%rip),%xmm0
mov    $0x56a6ad,%esi
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [78 x i8] c"From int: '%d'\0A to float: '%f'\0A IEEE 754, exponential notation: '%e'\0A\00"
@.str.1 = [90 x i8] c"From float: '%f'\0A IEEE 754, exponential notation: '%e'\0A to int: '%d' INT_MAX: %d\0A\00"
@INT_MAX = global i32 0
@.str.2 = [90 x i8] c"From float: '%f'\0A IEEE 754, exponential notation: '%e'\0A to int: '%d' INT_MIN: %d\0A\00"
@INT_MIN = global i32 0
@.str.3 = [79 x i8] c"From int: '%d'\0A to double: '%f'\0A IEEE 754, exponential notation: '%e'\0A\00"
@.str.4 = [79 x i8] c"From double: '%f'\0A to int: '%d'\0A IEEE 754, exponential notation: '%e'\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
store i32 0, i32* %1
store i32 32769, i32* %2
store float 0x41EEE6B280000000, float* %3
store float 0xC1F1D759C0000000, float* %4
%11 = load i32, i32* %2
%12 = sitofp i32 %11 to float
store float %12, float* %5
%13 = load float, float* %3
%14 = fptosi float %13 to i32
store i32 %14, i32* %6
%15 = load float, float* %4
%16 = fptosi float %15 to i32
store i32 %16, i32* %7
%17 = load i32, i32* %2
%18 = sitofp i32 %17 to double
store double %18, double* %8
store double 0x4155A9AB6B6F79A0, double* %9
%19 = load double, double* %9
%20 = fptosi double %19 to i32
store i32 %20, i32* %10
%21 = load i32, i32* %2
%22 = sitofp i32 %21 to double
%23 = load float, float* %5
%24 = fptosi float %23 to i32
%25 = load float, float* %5
%26 = fpext float %25 to double
%27 = call i32 (i8*, double, i32, double, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), double %22, i32 %24, double %26)
%28 = load float, float* %3
%29 = fpext float %28 to double
%30 = load float, float* %3
%31 = fptosi float %30 to i32
%32 = load i32, i32* %6
%33 = sitofp i32 %32 to double
%34 = load i32, i32* @INT_MAX
%35 = call i32 (i8*, double, i32, double, ...) @printf(i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.1, i64 0, i64 0), double %29, i32 %31, double %33, i32 %34)
%36 = load float, float* %4
%37 = fpext float %36 to double
%38 = load float, float* %4
%39 = fptosi float %38 to i32
%40 = load i32, i32* %7
%41 = sitofp i32 %40 to double
%42 = load i32, i32* @INT_MIN
%43 = call i32 (i8*, double, i32, double, ...) @printf(i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.2, i64 0, i64 0), double %37, i32 %39, double %41, i32 %42)
%44 = load i32, i32* %2
%45 = sitofp i32 %44 to double
%46 = load double, double* %8
%47 = fptosi double %46 to i32
%48 = load double, double* %8
%49 = call i32 (i8*, double, i32, double, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.3, i64 0, i64 0), double %45, i32 %47, double %48)
%50 = load double, double* %9
%51 = load i32, i32* %10
%52 = load double, double* %9
%53 = call i32 (i8*, double, i32, double, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.4, i64 0, i64 0), double %50, i32 %51, double %52)
%54 = load i32, i32* @EXIT_SUCCESS
ret i32 %54
}

LLVM IR (-O2):
@.str = [78 x i8] c"From int: '%d'\0A to float: '%f'\0A IEEE 754, exponential notation: '%e'\0A\00"
@.str.1 = [90 x i8] c"From float: '%f'\0A IEEE 754, exponential notation: '%e'\0A to int: '%d' INT_MAX: %d\0A\00"
@INT_MAX = global i32 0
@.str.2 = [90 x i8] c"From float: '%f'\0A IEEE 754, exponential notation: '%e'\0A to int: '%d' INT_MIN: %d\0A\00"
@INT_MIN = global i32 0
@.str.3 = [79 x i8] c"From int: '%d'\0A to double: '%f'\0A IEEE 754, exponential notation: '%e'\0A\00"
@.str.4 = [79 x i8] c"From double: '%f'\0A to int: '%d'\0A IEEE 754, exponential notation: '%e'\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (i8*, double, i32, double, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), double 3.276900e+04, i32 32769, double 3.276900e+04)
%2 = load i32, i32* @INT_MAX
%3 = tail call i32 (i8*, double, i32, double, ...) @printf(i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.1, i64 0, i64 0), double 0x41EEE6B280000000, i32 poison, double poison, i32 %2)
%4 = load i32, i32* @INT_MIN
%5 = tail call i32 (i8*, double, i32, double, ...) @printf(i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.2, i64 0, i64 0), double 0xC1F1D759C0000000, i32 poison, double poison, i32 %4)
%6 = tail call i32 (i8*, double, i32, double, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.3, i64 0, i64 0), double 3.276900e+04, i32 32769, double 3.276900e+04)
%7 = tail call i32 (i8*, double, i32, double, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.4, i64 0, i64 0), double 0x4155A9AB6B6F79A0, i32 5678765, double 0x4155A9AB6B6F79A0)
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}