#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(double);
int /*<<< orphan*/ printf(char *, ...);
int sqrt(int);
int main(void) {
  double rad_0;
  double rad_30;
  double rad_45;
  double rad_60;
  double rad_90;
  double val_30 = sqrt(3) / 2;
  double val_45 = 1 / (sqrt(2));
  double val_60 = 1.0 / 2.0;
  rad_0 = 0 * (M_PI / 180);
  rad_30 = 30 * (M_PI / 180);
  rad_45 = 45 * (M_PI / 180);
  rad_60 = 60 * (M_PI / 180);
  rad_90 = 90 * (M_PI / 180);
  printf("rad_0 = %lf\n", rad_0);
  printf("rad_30 = %lf\n", rad_30);
  printf("rad_45 = %lf\n", rad_45);
  printf("rad_60 = %lf\n", rad_60);
  printf("rad_90 = %lf\n", rad_90);
  printf("\n");
  printf("val_30 = %lf\n", val_30);
  printf("val_45 = %lf\n", val_45);
  printf("val_60 = %lf\n", val_60);
  printf("\n");
  printf("cos(0(deg)) = %lf\n", cos(rad_0));
  printf("cos(30(deg)) = %lf\n", cos(rad_30));
  printf("cos(45(deg)) = %lf\n", cos(rad_45));
  printf("cos(60(deg)) = %lf\n", cos(rad_60));
  printf("cos(90(deg)) = %lf\n", cos(rad_90));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
call   1050 <sqrt@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    $0x2,%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe81(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    0x2e5d(%rip),%rax
mov    (%rax),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
imul   $0x0,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0x2e40(%rip),%rax
mov    (%rax),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
imul   $0x1e,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2e23(%rip),%rax
mov    (%rax),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
imul   $0x2d,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2e06(%rip),%rax
mov    (%rax),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
imul   $0x3c,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2de9(%rip),%rax
mov    (%rax),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
imul   $0x5a,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xde7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xde1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xddc(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xdd7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
lea    0xdd2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
lea    0xdbf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x40(%rbp),%xmm0
lea    0xdba(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x48(%rbp),%xmm0
lea    0xdb5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
lea    0xd9d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
lea    0xd98(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
lea    0xd94(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
lea    0xd90(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
lea    0xd8c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
mov    $0x3,%edi
call   1060 <sqrt@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
cvtsi2sd %ecx,%xmm0
movsd  %xmm0,0x30(%rsp)
mov    $0x2,%edi
call   1060 <sqrt@plt>
lea    0x1(%rax),%ecx
xor    %edx,%edx
cmp    $0x3,%ecx
cmovae %edx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x28(%rsp)
mov    0x2e5e(%rip),%rax
movslq (%rax),%rax
imul   $0xffffffffb60b60b7,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x7,%ecx
add    %eax,%ecx
mov    %ecx,%eax
shl    $0x5,%eax
sub    %ecx,%eax
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    (%rcx,%rcx,8),%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
imul   $0x3c,%ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x18(%rsp)
imul   $0x5a,%ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0xe1c(%rip),%rdi
xorpd  %xmm0,%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe17(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe11(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe0b(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe05(%rip),%rdi
movsd  0x20(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdf5(%rip),%rdi
movsd  0x30(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xdef(%rip),%rdi
movsd  0x28(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xde9(%rip),%rdi
movsd  0xd70(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdd7(%rip),%rdi
movsd  0xd58(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
lea    0xdc9(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
lea    0xdc4(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
call   1050 <cos@plt>
lea    0xdbf(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
lea    0xdba(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@M_PI = global i32 0
@.str = [13 x i8] c"rad_0 = %lf\0A\00"
@.str.1 = [14 x i8] c"rad_30 = %lf\0A\00"
@.str.2 = [14 x i8] c"rad_45 = %lf\0A\00"
@.str.3 = [14 x i8] c"rad_60 = %lf\0A\00"
@.str.4 = [14 x i8] c"rad_90 = %lf\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [14 x i8] c"val_30 = %lf\0A\00"
@.str.7 = [14 x i8] c"val_45 = %lf\0A\00"
@.str.8 = [14 x i8] c"val_60 = %lf\0A\00"
@.str.9 = [19 x i8] c"cos(0(deg)) = %lf\0A\00"
@.str.10 = [20 x i8] c"cos(30(deg)) = %lf\0A\00"
@.str.11 = [20 x i8] c"cos(45(deg)) = %lf\0A\00"
@.str.12 = [20 x i8] c"cos(60(deg)) = %lf\0A\00"
@.str.13 = [20 x i8] c"cos(90(deg)) = %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 0, i32* %1
%10 = call i32 @sqrt(i32 3)
%11 = sdiv i32 %10, 2
%12 = sitofp i32 %11 to double
store double %12, double* %7
%13 = call i32 @sqrt(i32 2)
%14 = sdiv i32 1, %13
%15 = sitofp i32 %14 to double
store double %15, double* %8
store double 5.000000e-01, double* %9
%16 = load i32, i32* @M_PI
%17 = sdiv i32 %16, 180
%18 = mul nsw i32 0, %17
%19 = sitofp i32 %18 to double
store double %19, double* %2
%20 = load i32, i32* @M_PI
%21 = sdiv i32 %20, 180
%22 = mul nsw i32 30, %21
%23 = sitofp i32 %22 to double
store double %23, double* %3
%24 = load i32, i32* @M_PI
%25 = sdiv i32 %24, 180
%26 = mul nsw i32 45, %25
%27 = sitofp i32 %26 to double
store double %27, double* %4
%28 = load i32, i32* @M_PI
%29 = sdiv i32 %28, 180
%30 = mul nsw i32 60, %29
%31 = sitofp i32 %30 to double
store double %31, double* %5
%32 = load i32, i32* @M_PI
%33 = sdiv i32 %32, 180
%34 = mul nsw i32 90, %33
%35 = sitofp i32 %34 to double
store double %35, double* %6
%36 = load double, double* %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %36)
%38 = load double, double* %3
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %38)
%40 = load double, double* %4
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %40)
%42 = load double, double* %5
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %42)
%44 = load double, double* %6
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%47 = load double, double* %7
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %47)
%49 = load double, double* %8
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), double %49)
%51 = load double, double* %9
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), double %51)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%54 = load double, double* %2
%55 = call double @cos(double %54)
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), double %55)
%57 = load double, double* %3
%58 = call double @cos(double %57)
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), double %58)
%60 = load double, double* %4
%61 = call double @cos(double %60)
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), double %61)
%63 = load double, double* %5
%64 = call double @cos(double %63)
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), double %64)
%66 = load double, double* %6
%67 = call double @cos(double %66)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0), double %67)
ret i32 0
}

LLVM IR (-O2):
@M_PI = global i32 0
@.str = [13 x i8] c"rad_0 = %lf\0A\00"
@.str.1 = [14 x i8] c"rad_30 = %lf\0A\00"
@.str.2 = [14 x i8] c"rad_45 = %lf\0A\00"
@.str.3 = [14 x i8] c"rad_60 = %lf\0A\00"
@.str.4 = [14 x i8] c"rad_90 = %lf\0A\00"
@.str.6 = [14 x i8] c"val_30 = %lf\0A\00"
@.str.7 = [14 x i8] c"val_45 = %lf\0A\00"
@.str.8 = [14 x i8] c"val_60 = %lf\0A\00"
@.str.9 = [19 x i8] c"cos(0(deg)) = %lf\0A\00"
@.str.10 = [20 x i8] c"cos(30(deg)) = %lf\0A\00"
@.str.11 = [20 x i8] c"cos(45(deg)) = %lf\0A\00"
@.str.12 = [20 x i8] c"cos(60(deg)) = %lf\0A\00"
@.str.13 = [20 x i8] c"cos(90(deg)) = %lf\0A\00"
define i32 @main() {
%1 = tail call i32 @sqrt(i32 3)
%2 = sdiv i32 %1, 2
%3 = sitofp i32 %2 to double
%4 = tail call i32 @sqrt(i32 2)
%5 = add i32 %4, 1
%6 = icmp ult i32 %5, 3
%7 = select i1 %6, i32 %4, i32 0
%8 = sitofp i32 %7 to double
%9 = load i32, i32* @M_PI
%10 = sdiv i32 %9, 180
%11 = mul nsw i32 %10, 30
%12 = sitofp i32 %11 to double
%13 = mul nsw i32 %10, 45
%14 = sitofp i32 %13 to double
%15 = mul nsw i32 %10, 60
%16 = sitofp i32 %15 to double
%17 = mul nsw i32 %10, 90
%18 = sitofp i32 %17 to double
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double 0.000000e+00)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %12)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %14)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %16)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %18)
%24 = tail call i32 @putchar(i32 10)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %3)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), double %8)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), double 5.000000e-01)
%28 = tail call i32 @putchar(i32 10)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), double 1.000000e+00)
%30 = tail call double @cos(double %12)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), double %30)
%32 = tail call double @cos(double %14)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), double %32)
%34 = tail call double @cos(double %16)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), double %34)
%36 = tail call double @cos(double %18)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0), double %36)
ret i32 0
}