#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(int argc, const char *argv[]) {
  double a = 1.0;
  double b = 2.0;
  int i = (int)a / b;
  int j = (int)(a / b);
  int c = 5;
  int d = 6;
  double e = (double)(c / d);
  printf("%d\n", i);
  printf("%d\n", j);
  printf("%lf\n", e);
  printf("%d\n", (short)32768);
  printf("%d\n", (char)32768);
  int k = 32768;
  short kk = (short)k;
  printf("%d\n", k);
  int n;
  int m;
  n = 1 + 2, 3 + 4;
  m = (1 + 2, 3 + 4);
  printf("%d\n", n);
  printf("%d\n", m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xeda(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xec5(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm0
divsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x28(%rbp)
movl   $0x5,-0x2c(%rbp)
movl   $0x6,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
cltd
idivl  -0x30(%rbp)
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
cvttsd2si -0x38(%rbp),%esi
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
lea    0xe56(%rip),%rdi
mov    $0xffff8000,%esi
call   1030 <printf@plt>
lea    0xe45(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
movl   $0x8000,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %ax,-0x3e(%rbp)
mov    -0x3c(%rbp),%esi
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
movl   $0x3,-0x44(%rbp)
movl   $0x7,-0x48(%rbp)
mov    -0x44(%rbp),%esi
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
mov    -0x48(%rbp),%esi
lea    0xdfa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xffff8000,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x8000,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"%lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca i32
%14 = alloca i16
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 1.000000e+00, double* %6
store double 2.000000e+00, double* %7
%17 = load double, double* %6
%18 = fptosi double %17 to i32
%19 = sitofp i32 %18 to double
%20 = load double, double* %7
%21 = fdiv double %19, %20
%22 = fptosi double %21 to i32
store i32 %22, i32* %8
%23 = load double, double* %6
%24 = load double, double* %7
%25 = fdiv double %23, %24
%26 = fptosi double %25 to i32
store i32 %26, i32* %9
store i32 5, i32* %10
store i32 6, i32* %11
%27 = load i32, i32* %10
%28 = load i32, i32* %11
%29 = sdiv i32 %27, %28
%30 = sitofp i32 %29 to double
store double %30, double* %12
%31 = load i32, i32* %8
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %9
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = load double, double* %12
%36 = fptosi double %35 to i32
%37 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -32768)
%39 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
store i32 32768, i32* %13
%40 = load i32, i32* %13
%41 = trunc i32 %40 to i16
store i16 %41, i16* %14
%42 = load i32, i32* %13
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %42)
store i32 3, i32* %15
store i32 7, i32* %16
%44 = load i32, i32* %15
%45 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %16
%47 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"%lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -32768)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 32768)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 7)
ret i32 0
}