#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
float tan(float);
void Tan() {
  float deg, rad, angle;
  printf("Enter the angle in degrees: \n");
  scanf("%f", &deg);
  printf("The angle you have input is %.2f. \n", deg);
  if (deg == 90 || deg == -90 || deg == -270 || deg == 270) {
    printf("Tan(%.2f) is undefined.", deg);
  } else {
    rad = deg * (3.14 / 180.0);
    angle = tan(rad);
    printf("Tan(%.2f) is equal to %.2f.", deg, angle);
  }
}


x86 assembly (clang, -O0):
<Tan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xed3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x4(%rbp),%xmm0
movss  0xe86(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    118e <Tan+0x5e>
jp     118e <Tan+0x5e>
jmp    11ec <Tan+0xbc>
movss  -0x4(%rbp),%xmm0
movss  0xe69(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11af <Tan+0x7f>
jp     11af <Tan+0x7f>
jmp    11ec <Tan+0xbc>
movss  -0x4(%rbp),%xmm0
movss  0xe4c(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11d0 <Tan+0xa0>
jp     11d0 <Tan+0xa0>
jmp    11ec <Tan+0xbc>
movss  -0x4(%rbp),%xmm0
movss  0xe2f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1208 <Tan+0xd8>
jp     1208 <Tan+0xd8>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe61(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1255 <Tan+0x125>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf7(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <tan@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe27(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Tan>:
push   %rax
lea    0xf2b(%rip),%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeac(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
shufps $0x0,%xmm1,%xmm1
cmpeqps 0xe71(%rip),%xmm1
movmskps %xmm1,%eax
test   %eax,%eax
je     11a6 <Tan+0x66>
lea    0xea2(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
pop    %rax
ret
mulsd  0xe62(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <tan@plt>
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xe88(%rip),%rdi
movaps %xmm2,%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Enter the angle in degrees: \0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [36 x i8] c"The angle you have input is %.2f. \0A\00"
@.str.3 = [24 x i8] c"Tan(%.2f) is undefined.\00"
@.str.4 = [28 x i8] c"Tan(%.2f) is equal to %.2f.\00"
define void @Tan() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 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* %1)
%6 = load float, float* %1
%7 = fpext float %6 to double
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %7)
%9 = load float, float* %1
%10 = fcmp oeq float %9, 9.000000e+01
br i1 %10, label %20, label %11
11: ; preds = %0
%12 = load float, float* %1
%13 = fcmp oeq float %12, -9.000000e+01
br i1 %13, label %20, label %14
14: ; preds = %11
%15 = load float, float* %1
%16 = fcmp oeq float %15, -2.700000e+02
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load float, float* %1
%19 = fcmp oeq float %18, 2.700000e+02
br i1 %19, label %20, label %24
20: ; preds = %17, %14, %11, %0
%21 = load float, float* %1
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), double %22)
br label %36
24: ; preds = %17
%25 = load float, float* %1
%26 = fpext float %25 to double
%27 = fmul double %26, 0x3F91DCF4D98B0955
%28 = fptrunc double %27 to float
store float %28, float* %2
%29 = load float, float* %2
%30 = call float @tan(float %29)
store float %30, float* %3
%31 = load float, float* %1
%32 = fpext float %31 to double
%33 = load float, float* %3
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), double %32, double %34)
br label %36
36: ; preds = %24, %20
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [36 x i8] c"The angle you have input is %.2f. \0A\00"
@.str.3 = [24 x i8] c"Tan(%.2f) is undefined.\00"
@.str.4 = [28 x i8] c"Tan(%.2f) is equal to %.2f.\00"
@str = [29 x i8] c"Enter the angle in degrees: \00"
define void @Tan() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %6)
%8 = load float, float* %1
%9 = insertelement <4 x float> poison, float %8, i64 0
%10 = shufflevector <4 x float> %9, <4 x float> poison, <4 x i32> zeroinitializer
%11 = fcmp oeq <4 x float> %10, <float 2.700000e+02, float -2.700000e+02, float 9.000000e+01, float -9.000000e+01>
%12 = bitcast <4 x i1> %11 to i4
%13 = icmp eq i4 %12, 0
%14 = fpext float %8 to double
br i1 %13, label %17, label %15
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), double %14)
br label %25
17: ; preds = %0
%18 = fmul double %14, 0x3F91DCF4D98B0955
%19 = fptrunc double %18 to float
%20 = call float @tan(float %19)
%21 = load float, float* %1
%22 = fpext float %21 to double
%23 = fpext float %20 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), double %22, double %23)
br label %25
25: ; preds = %17, %15
ret void
}