#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 */
float cos(float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
void Cos() {
  float deg, rad, angle;
  printf("Enter the angle in degrees: \n");
  scanf("%f", &deg);
  printf("The angle you have input is %.2f. \n", deg);
  for (int i = 0; i >= 0.0; i++) {
    rad = deg * (3.14 / 180.0);
    angle = cos(rad);
    break;
  }
  printf("Cos(%.2f) is equal to %.2f.", deg, angle);
}


x86 assembly (clang, -O0):
<Cos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11b3 <Cos+0x83>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe69(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1050 <cos@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe81(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cos>:
push   %rax
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe78(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <cos@plt>
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xe86(%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 = [28 x i8] c"Cos(%.2f) is equal to %.2f.\00"
define void @Cos() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = load float, float* %1
%8 = fpext float %7 to double
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %8)
store i32 0, i32* %4
br label %10
10: ; preds = %21, %0
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to double
%13 = fcmp oge double %12, 0.000000e+00
br i1 %13, label %14, label %24
14: ; preds = %10
%15 = load float, float* %1
%16 = fpext float %15 to double
%17 = fmul double %16, 0x3F91DCF4D98B0955
%18 = fptrunc double %17 to float
store float %18, float* %2
%19 = load float, float* %2
%20 = call float @cos(float %19)
store float %20, float* %3
br label %24
21: ; No predecessors!
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %10
24: ; preds = %14, %10
%25 = load float, float* %1
%26 = fpext float %25 to double
%27 = load float, float* %3
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), double %26, double %28)
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 = [28 x i8] c"Cos(%.2f) is equal to %.2f.\00"
@str = [29 x i8] c"Enter the angle in degrees: \00"
define void @Cos() {
%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 = fpext float %8 to double
%10 = fmul double %9, 0x3F91DCF4D98B0955
%11 = fptrunc double %10 to float
%12 = call float @cos(float %11)
%13 = load float, float* %1
%14 = fpext float %13 to double
%15 = fpext float %12 to double
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), double %14, double %15)
ret void
}