#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 DECIMAL_DIG;
int /*<<< orphan*/ printf(char *, double, float);
int main() {
  int val_i = 0xffffffff;
  float val_f = 0xffffffff;
  float convert_f = (float)val_i;
  int convert_i = (int)val_f;
  printf("Signed integer value = %d, %x\n", val_i, val_i);
  printf("Float value = %.*e\n", DECIMAL_DIG, val_f);
  printf("Convert float to signed integer: %d, %x\n", convert_i, convert_i);
  printf("Convert signed integer to float = %.*e\n", DECIMAL_DIG, convert_f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movss  0xed2(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
cvttss2si -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e7e(%rip),%rax
movsd  (%rax),%xmm0
movss  -0xc(%rbp),%xmm1
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sdl -0x14(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e4c(%rip),%rax
movsd  (%rax),%xmm0
movss  -0x10(%rbp),%xmm1
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xef8(%rip),%rdi
movsd  0xee0(%rip),%xmm0
movss  0xee0(%rip),%xmm1
call   1030 <printf@plt>
mov    0x2eac(%rip),%rbx
movsd  (%rbx),%xmm0
lea    0xef0(%rip),%rdi
movss  0xec5(%rip),%xmm1
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
call   1030 <printf@plt>
movsd  (%rbx),%xmm0
lea    0xf09(%rip),%rdi
movss  0xe9d(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Signed integer value = %d, %x\0A\00"
@.str.1 = [20 x i8] c"Float value = %.*e\0A\00"
@DECIMAL_DIG = global double 0.000000e+00
@.str.2 = [41 x i8] c"Convert float to signed integer: %d, %x\0A\00"
@.str.3 = [40 x i8] c"Convert signed integer to float = %.*e\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
store float 0x41F0000000000000, float* %3
%6 = load i32, i32* %2
%7 = sitofp i32 %6 to float
store float %7, float* %4
%8 = load float, float* %3
%9 = fptosi float %8 to i32
store i32 %9, i32* %5
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to double
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to float
%14 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), double %11, float %13)
%15 = load double, double* @DECIMAL_DIG
%16 = load float, float* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %15, float %16)
%18 = load i32, i32* %5
%19 = sitofp i32 %18 to double
%20 = load i32, i32* %5
%21 = sitofp i32 %20 to float
%22 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), double %19, float %21)
%23 = load double, double* @DECIMAL_DIG
%24 = load float, float* %4
%25 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), double %23, float %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Signed integer value = %d, %x\0A\00"
@.str.1 = [20 x i8] c"Float value = %.*e\0A\00"
@DECIMAL_DIG = global double 0.000000e+00
@.str.2 = [41 x i8] c"Convert float to signed integer: %d, %x\0A\00"
@.str.3 = [40 x i8] c"Convert signed integer to float = %.*e\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), double -1.000000e+00, float -1.000000e+00)
%2 = load double, double* @DECIMAL_DIG
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %2, float 0x41F0000000000000)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), double poison, float poison)
%5 = load double, double* @DECIMAL_DIG
%6 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), double %5, float -1.000000e+00)
ret i32 0
}