#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 */
scalar_t__ FP_Cmp(float, float);
float __addsf3(float, float);
float __divsf3(float, float);
float __floatsisf(int);
float __mulsf3(float, float);
float __negsf2(float);
float __subsf3(float, float);
float FP_Cos(float rad) {
  int n;
  float answer, x2, top, bottom, sign;
  while (FP_Cmp(rad, ((float)(((float)3.1415926) * 2.0))) > 0)
    rad = __subsf3(rad, ((float)(((float)3.1415926) * 2.0)));
  while (FP_Cmp(rad, (float)0.0) < 0)
    rad = __addsf3(rad, ((float)(((float)3.1415926) * 2.0)));
  answer = 1.0;
  sign = 1.0;
  if (FP_Cmp(rad, ((float)3.1415926)) >= 0) {
    rad = __subsf3(rad, ((float)3.1415926));
    sign = __floatsisf(-1);
  }
  if (FP_Cmp(rad, ((float)(((float)3.1415926) / 2.0))) >= 0) {
    rad = __subsf3(((float)3.1415926), rad);
    sign = __negsf2(sign);
  }
  x2 = __mulsf3(rad, rad);
  top = 1.0;
  bottom = 1.0;
  for (n = 2; n < 12; n += 2) {
    top = __mulsf3(top, __negsf2(x2));
    bottom = __mulsf3(bottom, __floatsisf((n - 1) * n));
    answer = __addsf3(answer, __divsf3(top, bottom));
  }
  return __mulsf3(answer, sign);
}


x86 assembly (clang, -O0):
<FP_Cos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xe76(%rip),%xmm1
call   1070 <FP_Cmp@plt>
cmp    $0x0,%rax
jle    11b5 <FP_Cos+0x45>
movss  -0x4(%rbp),%xmm0
movss  0xe5a(%rip),%xmm1
call   1050 <__subsf3@plt>
movss  %xmm0,-0x4(%rbp)
jmp    117d <FP_Cos+0xd>
jmp    11ba <FP_Cos+0x4a>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
call   1070 <FP_Cmp@plt>
cmp    $0x0,%rax
jge    11ed <FP_Cos+0x7d>
movss  -0x4(%rbp),%xmm0
movss  0xe22(%rip),%xmm1
call   1090 <__addsf3@plt>
movss  %xmm0,-0x4(%rbp)
jmp    11ba <FP_Cos+0x4a>
movss  0xe13(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe06(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xdf0(%rip),%xmm1
call   1070 <FP_Cmp@plt>
cmp    $0x0,%rax
jl     1249 <FP_Cos+0xd9>
movss  -0x4(%rbp),%xmm0
movss  0xdd4(%rip),%xmm1
call   1050 <__subsf3@plt>
movss  %xmm0,-0x4(%rbp)
mov    $0xffffffff,%edi
call   1040 <__floatsisf@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xdb6(%rip),%xmm1
call   1070 <FP_Cmp@plt>
cmp    $0x0,%rax
jl     128b <FP_Cos+0x11b>
movss  -0x4(%rbp),%xmm1
movss  0xd92(%rip),%xmm0
call   1050 <__subsf3@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1080 <__negsf2@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
call   1060 <__mulsf3@plt>
movss  %xmm0,-0x10(%rbp)
movss  0xd61(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xd54(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0xc,-0x8(%rbp)
jge    1354 <FP_Cos+0x1e4>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x10(%rbp),%xmm0
call   1080 <__negsf2@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
call   1060 <__mulsf3@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
imul   -0x8(%rbp),%edi
call   1040 <__floatsisf@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
call   1060 <__mulsf3@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
call   1030 <__divsf3@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
call   1090 <__addsf3@plt>
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    12c0 <FP_Cos+0x150>
movss  -0xc(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
call   1060 <__mulsf3@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FP_Cos>:
sub    $0x18,%rsp
movss  0xe84(%rip),%xmm1
movss  %xmm0,0x4(%rsp)
call   1070 <FP_Cmp@plt>
test   %rax,%rax
jle    11cd <FP_Cos+0x5d>
movss  0x4(%rsp),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  0xe58(%rip),%xmm1
call   1050 <__subsf3@plt>
movss  %xmm0,0x4(%rsp)
movss  0xe45(%rip),%xmm1
call   1070 <FP_Cmp@plt>
movss  0x4(%rsp),%xmm0
test   %rax,%rax
jg     11a0 <FP_Cos+0x30>
jmp    11d3 <FP_Cos+0x63>
movss  0x4(%rsp),%xmm0
xorps  %xmm1,%xmm1
movss  %xmm0,0x4(%rsp)
call   1070 <FP_Cmp@plt>
test   %rax,%rax
js     11ee <FP_Cos+0x7e>
movss  0x4(%rsp),%xmm0
jmp    1226 <FP_Cos+0xb6>
movss  0x4(%rsp),%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movss  0xdf8(%rip),%xmm1
call   1090 <__addsf3@plt>
movss  %xmm0,0x4(%rsp)
xorps  %xmm1,%xmm1
call   1070 <FP_Cmp@plt>
movss  0x4(%rsp),%xmm0
test   %rax,%rax
js     1200 <FP_Cos+0x90>
movss  %xmm0,0x4(%rsp)
movss  0xdd0(%rip),%xmm1
call   1070 <FP_Cmp@plt>
test   %rax,%rax
js     1263 <FP_Cos+0xf3>
movss  0xdbe(%rip),%xmm1
movss  0x4(%rsp),%xmm0
call   1050 <__subsf3@plt>
movss  %xmm0,0x4(%rsp)
mov    $0xffffffff,%edi
call   1040 <__floatsisf@plt>
jmp    126b <FP_Cos+0xfb>
movss  0xd9d(%rip),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0xd93(%rip),%xmm1
movss  0x4(%rsp),%xmm0
call   1070 <FP_Cmp@plt>
test   %rax,%rax
js     12b3 <FP_Cos+0x143>
movss  0xd73(%rip),%xmm0
movss  0x4(%rsp),%xmm1
call   1050 <__subsf3@plt>
movss  %xmm0,0x4(%rsp)
movss  0x14(%rsp),%xmm0
call   1080 <__negsf2@plt>
movss  %xmm0,0x14(%rsp)
movss  0x4(%rsp),%xmm0
movaps %xmm0,%xmm1
call   1060 <__mulsf3@plt>
movss  %xmm0,0x4(%rsp)
call   1080 <__negsf2@plt>
movaps %xmm0,%xmm1
movss  0xd31(%rip),%xmm0
call   1060 <__mulsf3@plt>
movss  %xmm0,0x8(%rsp)
mov    $0x2,%edi
call   1040 <__floatsisf@plt>
movaps %xmm0,%xmm1
movss  0xd11(%rip),%xmm0
call   1060 <__mulsf3@plt>
movaps %xmm0,%xmm1
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1030 <__divsf3@plt>
movaps %xmm0,%xmm1
movss  0xced(%rip),%xmm0
call   1090 <__addsf3@plt>
movss  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
call   1080 <__negsf2@plt>
movaps %xmm0,%xmm1
movss  0x8(%rsp),%xmm0
call   1060 <__mulsf3@plt>
movss  %xmm0,0x8(%rsp)
mov    $0xc,%edi
call   1040 <__floatsisf@plt>
movaps %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
call   1060 <__mulsf3@plt>
movaps %xmm0,%xmm1
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1030 <__divsf3@plt>
movaps %xmm0,%xmm1
movss  0x10(%rsp),%xmm0
call   1090 <__addsf3@plt>
movss  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
call   1080 <__negsf2@plt>
movaps %xmm0,%xmm1
movss  0x8(%rsp),%xmm0
call   1060 <__mulsf3@plt>
movss  %xmm0,0x8(%rsp)
mov    $0x1e,%edi
call   1040 <__floatsisf@plt>
movaps %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
call   1060 <__mulsf3@plt>
movaps %xmm0,%xmm1
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1030 <__divsf3@plt>
movaps %xmm0,%xmm1
movss  0x10(%rsp),%xmm0
call   1090 <__addsf3@plt>
movss  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
call   1080 <__negsf2@plt>
movaps %xmm0,%xmm1
movss  0x8(%rsp),%xmm0
call   1060 <__mulsf3@plt>
movss  %xmm0,0x8(%rsp)
mov    $0x38,%edi
call   1040 <__floatsisf@plt>
movaps %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
call   1060 <__mulsf3@plt>
movaps %xmm0,%xmm1
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1030 <__divsf3@plt>
movaps %xmm0,%xmm1
movss  0x10(%rsp),%xmm0
call   1090 <__addsf3@plt>
movss  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
call   1080 <__negsf2@plt>
movaps %xmm0,%xmm1
movss  0x8(%rsp),%xmm0
call   1060 <__mulsf3@plt>
movss  %xmm0,0x4(%rsp)
mov    $0x5a,%edi
call   1040 <__floatsisf@plt>
movaps %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
call   1060 <__mulsf3@plt>
movaps %xmm0,%xmm1
movss  0x4(%rsp),%xmm0
call   1030 <__divsf3@plt>
movaps %xmm0,%xmm1
movss  0x10(%rsp),%xmm0
call   1090 <__addsf3@plt>
movss  0x14(%rsp),%xmm1
add    $0x18,%rsp
jmp    1060 <__mulsf3@plt>

LLVM IR (-O0):
define float @FP_Cos(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %2
br label %9
9: ; preds = %13, %1
%10 = load float, float* %2
%11 = call i64 @FP_Cmp(float %10, float 0x401921FB40000000)
%12 = icmp sgt i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load float, float* %2
%15 = call float @__subsf3(float %14, float 0x401921FB40000000)
store float %15, float* %2
br label %9
16: ; preds = %9
br label %17
17: ; preds = %21, %16
%18 = load float, float* %2
%19 = call i64 @FP_Cmp(float %18, float 0.000000e+00)
%20 = icmp slt i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load float, float* %2
%23 = call float @__addsf3(float %22, float 0x401921FB40000000)
store float %23, float* %2
br label %17
24: ; preds = %17
store float 1.000000e+00, float* %4
store float 1.000000e+00, float* %8
%25 = load float, float* %2
%26 = call i64 @FP_Cmp(float %25, float 0x400921FB40000000)
%27 = icmp sge i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %24
%29 = load float, float* %2
%30 = call float @__subsf3(float %29, float 0x400921FB40000000)
store float %30, float* %2
%31 = call float @__floatsisf(i32 -1)
store float %31, float* %8
br label %32
32: ; preds = %28, %24
%33 = load float, float* %2
%34 = call i64 @FP_Cmp(float %33, float 0x3FF921FB40000000)
%35 = icmp sge i64 %34, 0
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = load float, float* %2
%38 = call float @__subsf3(float 0x400921FB40000000, float %37)
store float %38, float* %2
%39 = load float, float* %8
%40 = call float @__negsf2(float %39)
store float %40, float* %8
br label %41
41: ; preds = %36, %32
%42 = load float, float* %2
%43 = load float, float* %2
%44 = call float @__mulsf3(float %42, float %43)
store float %44, float* %5
store float 1.000000e+00, float* %6
store float 1.000000e+00, float* %7
store i32 2, i32* %3
br label %45
45: ; preds = %65, %41
%46 = load i32, i32* %3
%47 = icmp slt i32 %46, 12
br i1 %47, label %48, label %68
48: ; preds = %45
%49 = load float, float* %6
%50 = load float, float* %5
%51 = call float @__negsf2(float %50)
%52 = call float @__mulsf3(float %49, float %51)
store float %52, float* %6
%53 = load float, float* %7
%54 = load i32, i32* %3
%55 = sub nsw i32 %54, 1
%56 = load i32, i32* %3
%57 = mul nsw i32 %55, %56
%58 = call float @__floatsisf(i32 %57)
%59 = call float @__mulsf3(float %53, float %58)
store float %59, float* %7
%60 = load float, float* %4
%61 = load float, float* %6
%62 = load float, float* %7
%63 = call float @__divsf3(float %61, float %62)
%64 = call float @__addsf3(float %60, float %63)
store float %64, float* %4
br label %65
65: ; preds = %48
%66 = load i32, i32* %3
%67 = add nsw i32 %66, 2
store i32 %67, i32* %3
br label %45
68: ; preds = %45
%69 = load float, float* %4
%70 = load float, float* %8
%71 = call float @__mulsf3(float %69, float %70)
ret float %71
}

LLVM IR (-O2):
define float @FP_Cos(float %0) {
%2 = tail call i64 @FP_Cmp(float %0, float 0x401921FB40000000)
%3 = icmp sgt i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %8, %1
%5 = phi float [ %0, %1 ], [ %10, %8 ]
%6 = tail call i64 @FP_Cmp(float %5, float 0.000000e+00)
%7 = icmp slt i64 %6, 0
br i1 %7, label %13, label %18
8: ; preds = %1, %8
%9 = phi float [ %10, %8 ], [ %0, %1 ]
%10 = tail call float @__subsf3(float %9, float 0x401921FB40000000)
%11 = tail call i64 @FP_Cmp(float %10, float 0x401921FB40000000)
%12 = icmp sgt i64 %11, 0
br i1 %12, label %8, label %4
13: ; preds = %4, %13
%14 = phi float [ %15, %13 ], [ %5, %4 ]
%15 = tail call float @__addsf3(float %14, float 0x401921FB40000000)
%16 = tail call i64 @FP_Cmp(float %15, float 0.000000e+00)
%17 = icmp slt i64 %16, 0
br i1 %17, label %13, label %18
18: ; preds = %13, %4
%19 = phi float [ %5, %4 ], [ %15, %13 ]
%20 = tail call i64 @FP_Cmp(float %19, float 0x400921FB40000000)
%21 = icmp sgt i64 %20, -1
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = tail call float @__subsf3(float %19, float 0x400921FB40000000)
%24 = tail call float @__floatsisf(i32 -1)
br label %25
25: ; preds = %22, %18
%26 = phi float [ %23, %22 ], [ %19, %18 ]
%27 = phi float [ %24, %22 ], [ 1.000000e+00, %18 ]
%28 = tail call i64 @FP_Cmp(float %26, float 0x3FF921FB40000000)
%29 = icmp sgt i64 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = tail call float @__subsf3(float 0x400921FB40000000, float %26)
%32 = tail call float @__negsf2(float %27)
br label %33
33: ; preds = %30, %25
%34 = phi float [ %31, %30 ], [ %26, %25 ]
%35 = phi float [ %32, %30 ], [ %27, %25 ]
%36 = tail call float @__mulsf3(float %34, float %34)
%37 = tail call float @__negsf2(float %36)
%38 = tail call float @__mulsf3(float 1.000000e+00, float %37)
%39 = tail call float @__floatsisf(i32 2)
%40 = tail call float @__mulsf3(float 1.000000e+00, float %39)
%41 = tail call float @__divsf3(float %38, float %40)
%42 = tail call float @__addsf3(float 1.000000e+00, float %41)
%43 = tail call float @__negsf2(float %36)
%44 = tail call float @__mulsf3(float %38, float %43)
%45 = tail call float @__floatsisf(i32 12)
%46 = tail call float @__mulsf3(float %40, float %45)
%47 = tail call float @__divsf3(float %44, float %46)
%48 = tail call float @__addsf3(float %42, float %47)
%49 = tail call float @__negsf2(float %36)
%50 = tail call float @__mulsf3(float %44, float %49)
%51 = tail call float @__floatsisf(i32 30)
%52 = tail call float @__mulsf3(float %46, float %51)
%53 = tail call float @__divsf3(float %50, float %52)
%54 = tail call float @__addsf3(float %48, float %53)
%55 = tail call float @__negsf2(float %36)
%56 = tail call float @__mulsf3(float %50, float %55)
%57 = tail call float @__floatsisf(i32 56)
%58 = tail call float @__mulsf3(float %52, float %57)
%59 = tail call float @__divsf3(float %56, float %58)
%60 = tail call float @__addsf3(float %54, float %59)
%61 = tail call float @__negsf2(float %36)
%62 = tail call float @__mulsf3(float %56, float %61)
%63 = tail call float @__floatsisf(i32 90)
%64 = tail call float @__mulsf3(float %58, float %63)
%65 = tail call float @__divsf3(float %62, float %64)
%66 = tail call float @__addsf3(float %60, float %65)
%67 = tail call float @__mulsf3(float %66, float %35)
ret float %67
}