#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;
int /*<<< orphan*/ printf(char *, ...);
int sqrt(int);
double tan(double);
int main(void) {
  double rad_0;
  double rad_30;
  double rad_45;
  double rad_60;
  double rad_90;
  double val_30 = 1 / sqrt(3);
  double val_45 = 1.0;
  double val_60 = sqrt(3);
  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("tan(0(deg)) = %lf\n", tan(rad_0));
  printf("tan(30(deg)) = %lf\n", tan(rad_30));
  printf("tan(45(deg)) = %lf\n", tan(rad_45));
  printf("tan(60(deg)) = %lf\n", tan(rad_60));
  printf("tan(90(deg)) = %lf\n", tan(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    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe9c(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    $0x3,%edi
call   1050 <sqrt@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
imul   $0x0,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0x2e48(%rip),%rax
mov    (%rax),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
imul   $0x1e,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
imul   $0x2d,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2e0e(%rip),%rax
mov    (%rax),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
imul   $0x3c,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2df1(%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    0xdef(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xde9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xde4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xddf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
lea    0xdda(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
lea    0xdc7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x40(%rbp),%xmm0
lea    0xdc2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x48(%rbp),%xmm0
lea    0xdbd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
call   1040 <tan@plt>
lea    0xda5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
call   1040 <tan@plt>
lea    0xda0(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
call   1040 <tan@plt>
lea    0xd9c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
call   1040 <tan@plt>
lea    0xd98(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
call   1040 <tan@plt>
lea    0xd94(%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>
lea    0x1(%rax),%ecx
xor    %edx,%edx
cmp    $0x3,%ecx
cmovae %edx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x28(%rsp)
mov    $0x3,%edi
call   1060 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x30(%rsp)
mov    0x2e67(%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    0xe1d(%rip),%rdi
xorpd  %xmm0,%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe18(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe12(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe0c(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe06(%rip),%rdi
movsd  0x20(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdf6(%rip),%rdi
movsd  0x28(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xdf0(%rip),%rdi
movsd  0xd8d(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xde8(%rip),%rdi
movsd  0x30(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdd8(%rip),%rdi
xorps  %xmm0,%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   1050 <tan@plt>
lea    0xdcf(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
call   1050 <tan@plt>
lea    0xdca(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
call   1050 <tan@plt>
lea    0xdc5(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm0
call   1050 <tan@plt>
lea    0xdc0(%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"tan(0(deg)) = %lf\0A\00"
@.str.10 = [20 x i8] c"tan(30(deg)) = %lf\0A\00"
@.str.11 = [20 x i8] c"tan(45(deg)) = %lf\0A\00"
@.str.12 = [20 x i8] c"tan(60(deg)) = %lf\0A\00"
@.str.13 = [20 x i8] c"tan(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 1, %10
%12 = sitofp i32 %11 to double
store double %12, double* %7
store double 1.000000e+00, double* %8
%13 = call i32 @sqrt(i32 3)
%14 = sitofp i32 %13 to double
store double %14, double* %9
%15 = load i32, i32* @M_PI
%16 = sdiv i32 %15, 180
%17 = mul nsw i32 0, %16
%18 = sitofp i32 %17 to double
store double %18, double* %2
%19 = load i32, i32* @M_PI
%20 = sdiv i32 %19, 180
%21 = mul nsw i32 30, %20
%22 = sitofp i32 %21 to double
store double %22, double* %3
%23 = load i32, i32* @M_PI
%24 = sdiv i32 %23, 180
%25 = mul nsw i32 45, %24
%26 = sitofp i32 %25 to double
store double %26, double* %4
%27 = load i32, i32* @M_PI
%28 = sdiv i32 %27, 180
%29 = mul nsw i32 60, %28
%30 = sitofp i32 %29 to double
store double %30, double* %5
%31 = load i32, i32* @M_PI
%32 = sdiv i32 %31, 180
%33 = mul nsw i32 90, %32
%34 = sitofp i32 %33 to double
store double %34, double* %6
%35 = load double, double* %2
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %35)
%37 = load double, double* %3
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %37)
%39 = load double, double* %4
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %39)
%41 = load double, double* %5
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %41)
%43 = load double, double* %6
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %43)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%46 = load double, double* %7
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %46)
%48 = load double, double* %8
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), double %48)
%50 = load double, double* %9
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), double %50)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%53 = load double, double* %2
%54 = call double @tan(double %53)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), double %54)
%56 = load double, double* %3
%57 = call double @tan(double %56)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), double %57)
%59 = load double, double* %4
%60 = call double @tan(double %59)
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), double %60)
%62 = load double, double* %5
%63 = call double @tan(double %62)
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), double %63)
%65 = load double, double* %6
%66 = call double @tan(double %65)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0), double %66)
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"tan(0(deg)) = %lf\0A\00"
@.str.10 = [20 x i8] c"tan(30(deg)) = %lf\0A\00"
@.str.11 = [20 x i8] c"tan(45(deg)) = %lf\0A\00"
@.str.12 = [20 x i8] c"tan(60(deg)) = %lf\0A\00"
@.str.13 = [20 x i8] c"tan(90(deg)) = %lf\0A\00"
define i32 @main() {
%1 = tail call i32 @sqrt(i32 3)
%2 = add i32 %1, 1
%3 = icmp ult i32 %2, 3
%4 = select i1 %3, i32 %1, i32 0
%5 = sitofp i32 %4 to double
%6 = tail call i32 @sqrt(i32 3)
%7 = sitofp i32 %6 to double
%8 = load i32, i32* @M_PI
%9 = sdiv i32 %8, 180
%10 = mul nsw i32 %9, 30
%11 = sitofp i32 %10 to double
%12 = mul nsw i32 %9, 45
%13 = sitofp i32 %12 to double
%14 = mul nsw i32 %9, 60
%15 = sitofp i32 %14 to double
%16 = mul nsw i32 %9, 90
%17 = sitofp i32 %16 to double
%18 = 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)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %11)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %13)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %15)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %17)
%23 = tail call i32 @putchar(i32 10)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %5)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), double 1.000000e+00)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), double %7)
%27 = tail call i32 @putchar(i32 10)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), double 0.000000e+00)
%29 = tail call double @tan(double %11)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), double %29)
%31 = tail call double @tan(double %13)
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), double %31)
%33 = tail call double @tan(double %15)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), double %33)
%35 = tail call double @tan(double %17)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0), double %35)
ret i32 0
}