#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 M_PI;
double cos(int);
int /*<<< orphan*/ printf(char *, double, ...);
int main() {
  float a = 1.3;
  float b = 4.5;
  printf("%f + %f = %f\n", a, b, a + b);
  printf("0./0. = %f, 1./0. = %f, -1./0. = %f\n", 0. / 0., 1. / 0., -1. / 0.);
  printf("cos(pi/6) = %f\n", cos(M_PI / 6));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xee5(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xed4(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x8(%rbp),%xmm2
addss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xeb0(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
movsd  0xe7a(%rip),%xmm0
movsd  0xe7a(%rip),%xmm1
movsd  0xe7a(%rip),%xmm2
mov    $0x3,%al
call   1030 <printf@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <cos@plt>
lea    0xe97(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf08(%rip),%rdi
movsd  0xed0(%rip),%xmm0
movsd  0xed0(%rip),%xmm1
movsd  0xed0(%rip),%xmm2
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
movsd  0xec2(%rip),%xmm0
movsd  0xec2(%rip),%xmm1
movsd  0xec2(%rip),%xmm2
mov    $0x3,%al
call   1030 <printf@plt>
mov    0x2e74(%rip),%rax
movslq (%rax),%rax
imul   $0x2aaaaaab,%rax,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
shr    $0x20,%rdi
add    %eax,%edi
call   1040 <cos@plt>
lea    0xecc(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%f + %f = %f\0A\00"
@.str.1 = [37 x i8] c"0./0. = %f, 1./0. = %f, -1./0. = %f\0A\00"
@.str.2 = [16 x i8] c"cos(pi/6) = %f\0A\00"
@M_PI = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 0x3FF4CCCCC0000000, float* %2
store float 4.500000e+00, float* %3
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = load float, float* %3
%7 = fpext float %6 to double
%8 = load float, float* %2
%9 = load float, float* %3
%10 = fadd float %8, %9
%11 = fpext float %10 to double
%12 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %5, double %7, double %11)
%13 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), double 0x7FF8000000000000, double 0x7FF0000000000000, double 0xFFF0000000000000)
%14 = load i32, i32* @M_PI
%15 = sdiv i32 %14, 6
%16 = call double @cos(i32 %15)
%17 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"%f + %f = %f\0A\00"
@.str.1 = [37 x i8] c"0./0. = %f, 1./0. = %f, -1./0. = %f\0A\00"
@.str.2 = [16 x i8] c"cos(pi/6) = %f\0A\00"
@M_PI = global i32 0
define i32 @main() {
%1 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double 0x3FF4CCCCC0000000, double 4.500000e+00, double 0x4017333340000000)
%2 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), double 0x7FF8000000000000, double 0x7FF0000000000000, double 0xFFF0000000000000)
%3 = load i32, i32* @M_PI
%4 = sdiv i32 %3, 6
%5 = tail call double @cos(i32 %4)
%6 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %5)
ret i32 0
}