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


x86 assembly (clang, -O0):
<Sec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xedb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x4(%rbp),%xmm0
movss  0xe86(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    118e <Sec+0x5e>
jp     118e <Sec+0x5e>
jmp    11ec <Sec+0xbc>
movss  -0x4(%rbp),%xmm0
movss  0xe69(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11af <Sec+0x7f>
jp     11af <Sec+0x7f>
jmp    11ec <Sec+0xbc>
movss  -0x4(%rbp),%xmm0
movss  0xe4c(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11d0 <Sec+0xa0>
jp     11d0 <Sec+0xa0>
jmp    11ec <Sec+0xbc>
movss  -0x4(%rbp),%xmm0
movss  0xe2f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1208 <Sec+0xd8>
jp     1208 <Sec+0xd8>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe69(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1268 <Sec+0x138>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdff(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xdd5(%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    0xe1c(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sec>:
push   %rax
lea    0xf33(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb4(%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 <Sec+0x66>
lea    0xeaa(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
pop    %rax
ret
mulsd  0xe62(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <cos@plt>
movsd  0xe59(%rip),%xmm1
divsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe83(%rip),%rdi
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"Sec(%.2f) is undefined.\00"
@.str.4 = [28 x i8] c"Sec(%.2f) is equal to %.2f.\00"
define void @Sec() {
%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 %38
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 double @cos(float %29)
%31 = fdiv double 1.000000e+00, %30
%32 = fptrunc double %31 to float
store float %32, float* %3
%33 = load float, float* %1
%34 = fpext float %33 to double
%35 = load float, float* %3
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), double %34, double %36)
br label %38
38: ; 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"Sec(%.2f) is undefined.\00"
@.str.4 = [28 x i8] c"Sec(%.2f) is equal to %.2f.\00"
@str = [29 x i8] c"Enter the angle in degrees: \00"
define void @Sec() {
%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 %27
17: ; preds = %0
%18 = fmul double %14, 0x3F91DCF4D98B0955
%19 = fptrunc double %18 to float
%20 = call double @cos(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
}