#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 cos(float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
double sin(float);
double tan(float);
int main() {
  float pi = 3.14159265359;
  float a;
  printf("Enter an angle: ");
  scanf("%f", &a);
  printf("sin(%.2f) = %.6f\n", a, sin(a * pi / 180.0));
  printf("cos(%.2f) = %.6f\n", a, cos(a * pi / 180.0));
  printf("tan(%.2f) = %.6f\n", a, tan(a * pi / 180.0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xea1(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe52(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
lea    0xe56(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe0b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
lea    0xe21(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdc4(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
lea    0xdec(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mulss  0xe75(%rip),%xmm0
divss  0xe71(%rip),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
lea    0xe7a(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mulss  0xe36(%rip),%xmm0
divss  0xe32(%rip),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
lea    0xe4d(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mulss  0xdf7(%rip),%xmm0
divss  0xdf3(%rip),%xmm0
call   1050 <tan@plt>
movaps %xmm0,%xmm1
lea    0xe20(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter an angle: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [18 x i8] c"sin(%.2f) = %.6f\0A\00"
@.str.3 = [18 x i8] c"cos(%.2f) = %.6f\0A\00"
@.str.4 = [18 x i8] c"tan(%.2f) = %.6f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 0x400921FB60000000, float* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%6 = load float, float* %3
%7 = fpext float %6 to double
%8 = load float, float* %3
%9 = load float, float* %2
%10 = fmul float %8, %9
%11 = fpext float %10 to double
%12 = fdiv double %11, 1.800000e+02
%13 = fptrunc double %12 to float
%14 = call double @sin(float %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %7, double %14)
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = load float, float* %3
%19 = load float, float* %2
%20 = fmul float %18, %19
%21 = fpext float %20 to double
%22 = fdiv double %21, 1.800000e+02
%23 = fptrunc double %22 to float
%24 = call double @cos(float %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), double %17, double %24)
%26 = load float, float* %3
%27 = fpext float %26 to double
%28 = load float, float* %3
%29 = load float, float* %2
%30 = fmul float %28, %29
%31 = fpext float %30 to double
%32 = fdiv double %31, 1.800000e+02
%33 = fptrunc double %32 to float
%34 = call double @tan(float %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %27, double %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter an angle: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [18 x i8] c"sin(%.2f) = %.6f\0A\00"
@.str.3 = [18 x i8] c"cos(%.2f) = %.6f\0A\00"
@.str.4 = [18 x i8] c"tan(%.2f) = %.6f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = fmul float %5, 0x400921FB60000000
%8 = fdiv float %7, 1.800000e+02
%9 = call double @sin(float %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %6, double %9)
%11 = load float, float* %1
%12 = fpext float %11 to double
%13 = fmul float %11, 0x400921FB60000000
%14 = fdiv float %13, 1.800000e+02
%15 = call double @cos(float %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), double %12, double %15)
%17 = load float, float* %1
%18 = fpext float %17 to double
%19 = fmul float %17, 0x400921FB60000000
%20 = fdiv float %19, 1.800000e+02
%21 = call double @tan(float %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %18, double %21)
ret i32 0
}