#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 *);
double tan(float);
void Cot() {
  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 == 0 || deg == 360 || deg == -360) {
    printf("Cot(%.2f) is undefined.", deg);
  } else {
    rad = deg * (3.14 / 180.0);
    angle = 1.0 / (tan(rad));
    printf("Cot(%.2f) is equal to %.2f.", deg, angle);
  }
}


x86 assembly (clang, -O0):
<Cot>:
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
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1189 <Cot+0x59>
jp     1189 <Cot+0x59>
jmp    11c6 <Cot+0x96>
movss  -0x4(%rbp),%xmm0
movss  0xe6a(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11aa <Cot+0x7a>
jp     11aa <Cot+0x7a>
jmp    11c6 <Cot+0x96>
movss  -0x4(%rbp),%xmm0
movss  0xe4d(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11e2 <Cot+0xb2>
jp     11e2 <Cot+0xb2>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe87(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1242 <Cot+0x112>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe1d(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <tan@plt>
movaps %xmm0,%xmm1
movsd  0xdf3(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe3a(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cot>:
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
ucomiss 0xe7d(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
jne    118e <Cot+0x4e>
jnp    11e2 <Cot+0xa2>
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm1
jne    1198 <Cot+0x58>
jnp    11e2 <Cot+0xa2>
ucomiss 0xe65(%rip),%xmm1
jne    11a3 <Cot+0x63>
jnp    11e2 <Cot+0xa2>
mulsd  0xe5d(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <tan@plt>
movsd  0xe54(%rip),%xmm1
divsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe7e(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
pop    %rax
ret
lea    0xe56(%rip),%rdi
mov    $0x1,%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"Cot(%.2f) is undefined.\00"
@.str.4 = [28 x i8] c"Cot(%.2f) is equal to %.2f.\00"
define void @Cot() {
%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, 0.000000e+00
br i1 %10, label %17, label %11
11: ; preds = %0
%12 = load float, float* %1
%13 = fcmp oeq float %12, 3.600000e+02
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load float, float* %1
%16 = fcmp oeq float %15, -3.600000e+02
br i1 %16, label %17, label %21
17: ; preds = %14, %11, %0
%18 = load float, float* %1
%19 = fpext float %18 to double
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), double %19)
br label %35
21: ; preds = %14
%22 = load float, float* %1
%23 = fpext float %22 to double
%24 = fmul double %23, 0x3F91DCF4D98B0955
%25 = fptrunc double %24 to float
store float %25, float* %2
%26 = load float, float* %2
%27 = call double @tan(float %26)
%28 = fdiv double 1.000000e+00, %27
%29 = fptrunc double %28 to float
store float %29, float* %3
%30 = load float, float* %1
%31 = fpext float %30 to double
%32 = load float, float* %3
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), double %31, double %33)
br label %35
35: ; preds = %21, %17
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"Cot(%.2f) is undefined.\00"
@.str.4 = [28 x i8] c"Cot(%.2f) is equal to %.2f.\00"
@str = [29 x i8] c"Enter the angle in degrees: \00"
define void @Cot() {
%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 = fcmp oeq float %8, 0.000000e+00
%10 = fcmp oeq float %8, 3.600000e+02
%11 = or i1 %9, %10
%12 = fcmp oeq float %8, -3.600000e+02
%13 = or i1 %12, %11
%14 = fpext float %8 to double
br i1 %13, label %15, label %17
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 %27
17: ; preds = %0
%18 = fmul double %14, 0x3F91DCF4D98B0955
%19 = fptrunc double %18 to float
%20 = call double @tan(float %19)
%21 = fdiv double 1.000000e+00, %20
%22 = fptrunc double %21 to float
%23 = load float, float* %1
%24 = fpext float %23 to double
%25 = fpext float %22 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), double %24, double %25)
br label %27
27: ; preds = %17, %15
ret void
}