#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 M_PI;
int /*<<< orphan*/ printf(char *, int, int, double);
int main() {
  double a = M_PI;
  double b = M_PI;
  int i = 3;
  int j = a / i;
  printf("%lf + %lf = %lf \n", a, b, a + b);
  printf("%d + %lf = %lf \n", 1, b, 1 + b);
  printf("%lf / %d = %d \n", a, i, j);
  printf("%d / %d = %lf \n", 3, 2, (double)3 / 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0x2eb2(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x3,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x20(%rbp)
cvttsd2si -0x10(%rbp),%esi
cvttsd2si -0x18(%rbp),%edx
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
cvttsd2si -0x18(%rbp),%edx
movsd  0xe80(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
lea    0xe8e(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
cvttsd2si -0x10(%rbp),%esi
mov    -0x1c(%rbp),%edx
cvtsi2sdl -0x20(%rbp),%xmm0
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
lea    0xe85(%rip),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
movsd  0xe30(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0x2ecc(%rip),%rax
movsd  (%rax),%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
divsd  0xece(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
cvttsd2si %xmm1,%ebx
movapd %xmm1,%xmm0
addsd  %xmm1,%xmm0
lea    0xecd(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xea6(%rip),%xmm0
lea    0xec1(%rip),%rdi
mov    $0x1,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
cvttpd2dq 0x10(%rsp),%xmm0
cvtdq2pd %xmm0,%xmm0
lea    0xeb5(%rip),%rdi
mov    %ebx,%esi
mov    $0x3,%edx
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
movsd  0xe6f(%rip),%xmm0
mov    $0x3,%esi
mov    $0x2,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
@.str = [18 x i8] c"%lf + %lf = %lf \0A\00"
@.str.1 = [17 x i8] c"%d + %lf = %lf \0A\00"
@.str.2 = [16 x i8] c"%lf / %d = %d \0A\00"
@.str.3 = [16 x i8] c"%d / %d = %lf \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = load double, double* @M_PI
store double %6, double* %2
%7 = load double, double* @M_PI
store double %7, double* %3
store i32 3, i32* %4
%8 = load double, double* %2
%9 = load i32, i32* %4
%10 = sitofp i32 %9 to double
%11 = fdiv double %8, %10
%12 = fptosi double %11 to i32
store i32 %12, i32* %5
%13 = load double, double* %2
%14 = fptosi double %13 to i32
%15 = load double, double* %3
%16 = fptosi double %15 to i32
%17 = load double, double* %2
%18 = load double, double* %3
%19 = fadd double %17, %18
%20 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16, double %19)
%21 = load double, double* %3
%22 = fptosi double %21 to i32
%23 = load double, double* %3
%24 = fadd double 1.000000e+00, %23
%25 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %22, double %24)
%26 = load double, double* %2
%27 = fptosi double %26 to i32
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = sitofp i32 %29 to double
%31 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %27, i32 %28, double %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 3, i32 2, double 1.500000e+00)
ret i32 0
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
@.str = [18 x i8] c"%lf + %lf = %lf \0A\00"
@.str.1 = [17 x i8] c"%d + %lf = %lf \0A\00"
@.str.2 = [16 x i8] c"%lf / %d = %d \0A\00"
@.str.3 = [16 x i8] c"%d / %d = %lf \0A\00"
define i32 @main() {
%1 = load double, double* @M_PI
%2 = fdiv double %1, 3.000000e+00
%3 = fptosi double %2 to i32
%4 = fptosi double %1 to i32
%5 = fadd double %1, %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %4, double %5)
%7 = fadd double %1, 1.000000e+00
%8 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %4, double %7)
%9 = sitofp i32 %3 to double
%10 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %4, i32 3, double %9)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 3, i32 2, double 1.500000e+00)
ret i32 0
}