#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*/ printf(char *, int, float);
int main(void) {
  float f1 = 123.125, f2;
  int i1, i2 = -150;
  char c = 'a';
  i1 = f1;
  printf("%f assigned to an int produce %i\n", f1, i1);
  f1 = i2;
  printf("%i assigned to a float produces %f\n", i2, f1);
  f1 = i2 / 100;
  printf("%i divided by 100 produces %f\n", i2, f1);
  f2 = i2 / 100.0;
  printf("%i divided by 100.0 produces %f\n", i2, f2);
  f2 = (float)i2 / 100;
  printf("(float) %i divided by 100 produces %f\n", i2, f2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xedd(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0xffffff6a,-0x14(%rbp)
movb   $0x61,-0x15(%rbp)
cvttss2si -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cvttss2si -0x8(%rbp),%esi
cvtsi2ssl -0x10(%rbp),%xmm0
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
cvtsi2ssl -0x14(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x14(%rbp),%esi
movss  -0x8(%rbp),%xmm0
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x14(%rbp),%esi
movss  -0x8(%rbp),%xmm0
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xe60(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x14(%rbp),%esi
movss  -0xc(%rbp),%xmm0
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
cvtsi2ssl -0x14(%rbp),%xmm0
movss  0xe2a(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x14(%rbp),%esi
movss  -0xc(%rbp),%xmm0
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
movss  0xee0(%rip),%xmm0
mov    $0x7b,%esi
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
movss  0xecb(%rip),%xmm0
mov    $0xffffff6a,%esi
call   1030 <printf@plt>
lea    0xf35(%rip),%rdi
movss  0xeb6(%rip),%xmm0
mov    $0xffffff6a,%esi
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
movss  0xea1(%rip),%xmm0
mov    $0xffffff6a,%esi
call   1030 <printf@plt>
lea    0xefb(%rip),%rdi
mov    $0xffffff6a,%esi
movss  0xe83(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"%f assigned to an int produce %i\0A\00"
@.str.1 = [36 x i8] c"%i assigned to a float produces %f\0A\00"
@.str.2 = [31 x i8] c"%i divided by 100 produces %f\0A\00"
@.str.3 = [33 x i8] c"%i divided by 100.0 produces %f\0A\00"
@.str.4 = [39 x i8] c"(float) %i divided by 100 produces %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 0, i32* %1
store float 1.231250e+02, float* %2
store i32 -150, i32* %5
store i8 97, i8* %6
%7 = load float, float* %2
%8 = fptosi float %7 to i32
store i32 %8, i32* %4
%9 = load float, float* %2
%10 = fptosi float %9 to i32
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to float
%13 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %10, float %12)
%14 = load i32, i32* %5
%15 = sitofp i32 %14 to float
store float %15, float* %2
%16 = load i32, i32* %5
%17 = load float, float* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %16, float %17)
%19 = load i32, i32* %5
%20 = sdiv i32 %19, 100
%21 = sitofp i32 %20 to float
store float %21, float* %2
%22 = load i32, i32* %5
%23 = load float, float* %2
%24 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %22, float %23)
%25 = load i32, i32* %5
%26 = sitofp i32 %25 to double
%27 = fdiv double %26, 1.000000e+02
%28 = fptrunc double %27 to float
store float %28, float* %3
%29 = load i32, i32* %5
%30 = load float, float* %3
%31 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %29, float %30)
%32 = load i32, i32* %5
%33 = sitofp i32 %32 to float
%34 = fdiv float %33, 1.000000e+02
store float %34, float* %3
%35 = load i32, i32* %5
%36 = load float, float* %3
%37 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %35, float %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"%f assigned to an int produce %i\0A\00"
@.str.1 = [36 x i8] c"%i assigned to a float produces %f\0A\00"
@.str.2 = [31 x i8] c"%i divided by 100 produces %f\0A\00"
@.str.3 = [33 x i8] c"%i divided by 100.0 produces %f\0A\00"
@.str.4 = [39 x i8] c"(float) %i divided by 100 produces %f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 123, float 1.230000e+02)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 -150, float -1.500000e+02)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 -150, float -1.000000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 -150, float -1.500000e+00)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 -150, float -1.500000e+00)
ret i32 0
}