#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, ...);
int main(void) {
  float f1 = 123.925, f2;
  int i1, i2 = -150;
  i1 = f1;
  printf("%f assigned to an int produces %i\n", f1, i1);
  f1 = i2;
  printf("%i assigned to a float produces %f\n", i2, f1);
  f1 = i2 / 100;
  printf("%i dvided 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);
  int i3 = (int)29.55 + (int)21.99;
  printf("(int) 29.55 + (int) 21.99 = %i\n", i3);
  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)
cvttss2si -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cvttss2si -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2ssl -0x14(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x14(%rbp),%esi
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec5(%rip),%rdi
mov    $0x1,%al
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
cvtss2sd %xmm0,%xmm0
lea    0xebb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xe58(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x14(%rbp),%esi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cvtsi2ssl -0x14(%rbp),%xmm0
movss  0xe1c(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x14(%rbp),%esi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe96(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x32,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf00(%rip),%rdi
mov    $0x7b,%esi
mov    $0x7b,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf0b(%rip),%rdi
movsd  0xec8(%rip),%xmm0
mov    $0xffffff6a,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf14(%rip),%rdi
movsd  0xeb5(%rip),%xmm0
mov    $0xffffff6a,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf17(%rip),%rdi
movsd  0xea2(%rip),%xmm0
mov    $0xffffff6a,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf1d(%rip),%rdi
mov    $0xffffff6a,%esi
movsd  0xe82(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf29(%rip),%rdi
mov    $0x32,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"%f assigned to an int produces %i\0A\00"
@.str.1 = [36 x i8] c"%i assigned to a float produces %f\0A\00"
@.str.2 = [30 x i8] c"%i dvided 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"
@.str.5 = [32 x i8] c"(int) 29.55 + (int) 21.99 = %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store float 0x405EFB3340000000, float* %2
store i32 -150, i32* %5
%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 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
%13 = load i32, i32* %5
%14 = sitofp i32 %13 to float
store float %14, float* %2
%15 = load i32, i32* %5
%16 = load float, float* %2
%17 = fpext float %16 to double
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %15, double %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 = fpext float %23 to double
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %22, double %24)
%26 = load i32, i32* %5
%27 = sitofp i32 %26 to double
%28 = fdiv double %27, 1.000000e+02
%29 = fptrunc double %28 to float
store float %29, float* %3
%30 = load i32, i32* %5
%31 = load float, float* %3
%32 = fpext float %31 to double
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %30, double %32)
%34 = load i32, i32* %5
%35 = sitofp i32 %34 to float
%36 = fdiv float %35, 1.000000e+02
store float %36, float* %3
%37 = load i32, i32* %5
%38 = load float, float* %3
%39 = fpext float %38 to double
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %37, double %39)
store i32 50, i32* %6
%41 = load i32, i32* %6
%42 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 %41)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"%f assigned to an int produces %i\0A\00"
@.str.1 = [36 x i8] c"%i assigned to a float produces %f\0A\00"
@.str.2 = [30 x i8] c"%i dvided 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"
@.str.5 = [32 x i8] c"(int) 29.55 + (int) 21.99 = %i\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 123, i32 123)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 -150, double -1.500000e+02)
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 -150, double -1.000000e+00)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 -150, double -1.500000e+00)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 -150, double -1.500000e+00)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 50)
ret i32 0
}