long double cosd(long double x) {
  long int n;
  long double y;
  long double xn;
  long double x_int, x_fract;
  long double f, g, result;
  int sign = 1;
  if (x < 0.0L) {
    x = -x;
  }
  y = ((long double)(x) + (long double)((1.5707963267948966192313216916398L)));
  if (y > ((843314852.0L))) {
    return 0.0L;
  }
  x_int = ((long double)(((long)(x))));
  x_fract = ((long double)(x) - (long double)(x_int));
  n = ((long)((
      (long double)(((long double)(y) *
                     (long double)((0.31830988618379067153776752674503L)))) +
      (long double)(0.5))));
  xn = ((long double)(n));
  xn = ((long double)(xn) - (long double)(0.5L));
  f = ((long double)(x_int) -
       (long double)(((long double)(xn) * (long double)((3.1416015625L)))));
  f = ((long double)(f) + (long double)(x_fract));
  f = ((long double)(f) -
       (long double)(((long double)(xn) *
                      (long double)((-8.90891033122898079454898834228e-6L)))));
  f = ((long double)(f) -
       (long double)(((long double)(xn) *
                      (long double)((1.2446744343793226784516935341e-13L)))));
  if (n & 0x0001) {
    sign = -sign;
  }
  if (f < 0.0L) {
    g = -f;
  } else {
    g = f;
  }
  if (g < (+1.490116119385e-8L)) {
    result = f;
    if (sign < 0) {
      result = -result;
    }
    return result;
  }
  g = ((long double)(f) * (long double)(f));
  result = ((long double)(g) * (long double)((+2.7204790957888846175e-15L)));
  result =
      ((long double)(result) + (long double)((-7.6429178068910467734e-13L)));
  result = ((long double)(result) * (long double)(g));
  result =
      ((long double)(result) + (long double)((+1.6058936490371589114e-10L)));
  result = ((long double)(result) * (long double)(g));
  result =
      ((long double)(result) + (long double)((-2.5052106798274584544e-8L)));
  result = ((long double)(result) * (long double)(g));
  result =
      ((long double)(result) + (long double)((+2.7557319210152756119e-6L)));
  result = ((long double)(result) * (long double)(g));
  result =
      ((long double)(result) + (long double)((-1.9841269841201840457e-4L)));
  result = ((long double)(result) * (long double)(g));
  result =
      ((long double)(result) + (long double)((+8.3333333333331650314e-3L)));
  result = ((long double)(result) * (long double)(g));
  result =
      ((long double)(result) + (long double)((-1.6666666666666665052e-1L)));
  result = ((long double)(result) * (long double)(g));
  result = ((long double)(result) * (long double)(f));
  result = ((long double)(result) + (long double)(f));
  if (sign < 0) {
    result = -result;
  }
  if (result > 1.0L) {
    result = 1.0L;
  } else if (result < -1.0L) {
    result = -1.0L;
  }
  return (result);
}


x86 assembly (clang, -O0):
<cosd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
movl   $0x1,-0xa4(%rbp)
fldt   -0x20(%rbp)
fldz
fucomip %st(1),%st
fstp   %st(0)
jbe    1134 <cosd+0x34>
jmp    112c <cosd+0x2c>
fldt   -0x20(%rbp)
fchs
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
fldt   0xec3(%rip)
faddp  %st,%st(1)
fstpt  -0x40(%rbp)
fldt   -0x40(%rbp)
fldl   0xf75(%rip)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    1166 <cosd+0x66>
jmp    115c <cosd+0x5c>
fldz
fstpt  -0x10(%rbp)
jmp    14c6 <cosd+0x3c6>
fldt   -0x20(%rbp)
fnstcw -0xca(%rbp)
movzwl -0xca(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0xcc(%rbp)
fldcw  -0xcc(%rbp)
fistpll -0xc8(%rbp)
fldcw  -0xca(%rbp)
mov    -0xc8(%rbp),%rax
mov    %rax,-0xc0(%rbp)
fildll -0xc0(%rbp)
fstpt  -0x60(%rbp)
fldt   -0x20(%rbp)
fldt   -0x60(%rbp)
fsubrp %st,%st(1)
fstpt  -0x70(%rbp)
fldt   -0x40(%rbp)
fldt   0xe51(%rip)
fmulp  %st,%st(1)
flds   0xf09(%rip)
fadd   %st,%st(1)
fnstcw -0xce(%rbp)
movzwl -0xce(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0xd0(%rbp)
fldcw  -0xd0(%rbp)
fxch   %st(1)
fistpll -0xb8(%rbp)
fldcw  -0xce(%rbp)
mov    -0xb8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0xb0(%rbp)
fildll -0xb0(%rbp)
fstpt  -0x50(%rbp)
fldt   -0x50(%rbp)
fsubp  %st,%st(1)
fstpt  -0x50(%rbp)
fldt   -0x60(%rbp)
fldt   -0x50(%rbp)
flds   0xeab(%rip)
fmulp  %st,%st(1)
faddp  %st,%st(1)
fstpt  -0x80(%rbp)
fldt   -0x80(%rbp)
fldt   -0x70(%rbp)
faddp  %st,%st(1)
fstpt  -0x80(%rbp)
fldt   -0x80(%rbp)
fldt   -0x50(%rbp)
fldl   0xe81(%rip)
fmulp  %st,%st(1)
faddp  %st,%st(1)
fstpt  -0x80(%rbp)
fldt   -0x80(%rbp)
fldt   -0x50(%rbp)
fldt   0xdc6(%rip)
fmulp  %st,%st(1)
faddp  %st,%st(1)
fstpt  -0x80(%rbp)
mov    -0x28(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1281 <cosd+0x181>
xor    %eax,%eax
sub    -0xa4(%rbp),%eax
mov    %eax,-0xa4(%rbp)
fldt   -0x80(%rbp)
fldz
fucomip %st(1),%st
fstp   %st(0)
jbe    12a5 <cosd+0x1a5>
jmp    1295 <cosd+0x195>
fldt   -0x80(%rbp)
fchs
fstpt  -0x90(%rbp)
jmp    12ae <cosd+0x1ae>
fldt   -0x80(%rbp)
fstpt  -0x90(%rbp)
fldt   -0x90(%rbp)
fldt   0xd76(%rip)
fucomip %st(1),%st
fstp   %st(0)
jbe    12fb <cosd+0x1fb>
jmp    12c9 <cosd+0x1c9>
fldt   -0x80(%rbp)
fstpt  -0xa0(%rbp)
cmpl   $0x0,-0xa4(%rbp)
jge    12ed <cosd+0x1ed>
fldt   -0xa0(%rbp)
fchs
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fstpt  -0x10(%rbp)
jmp    14c6 <cosd+0x3c6>
fldt   -0x80(%rbp)
fmul   %st,%st(0)
fstpt  -0x90(%rbp)
fldt   -0x90(%rbp)
fldt   0xd2e(%rip)
fmulp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   0xd2a(%rip)
faddp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   -0x90(%rbp)
fmulp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   0xd12(%rip)
faddp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   -0x90(%rbp)
fmulp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   0xcfa(%rip)
faddp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   -0x90(%rbp)
fmulp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   0xce2(%rip)
faddp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   -0x90(%rbp)
fmulp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   0xcca(%rip)
faddp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   -0x90(%rbp)
fmulp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   0xcb2(%rip)
faddp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   -0x90(%rbp)
fmulp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   0xc9a(%rip)
faddp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   -0x90(%rbp)
fmulp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   -0x80(%rbp)
fmulp  %st,%st(1)
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fldt   -0x80(%rbp)
faddp  %st,%st(1)
fstpt  -0xa0(%rbp)
cmpl   $0x0,-0xa4(%rbp)
jge    146f <cosd+0x36f>
fldt   -0xa0(%rbp)
fchs
fstpt  -0xa0(%rbp)
fldt   -0xa0(%rbp)
fld1
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    1495 <cosd+0x395>
jmp    1488 <cosd+0x388>
fld1
fstpt  -0xa0(%rbp)
jmp    14bd <cosd+0x3bd>
fldt   -0xa0(%rbp)
fld1
fchs
fucomip %st(1),%st
fstp   %st(0)
jbe    14b8 <cosd+0x3b8>
jmp    14ae <cosd+0x3ae>
fld1
fchs
fstpt  -0xa0(%rbp)
jmp    14bd <cosd+0x3bd>
fldt   -0xa0(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cosd>:
fldt   0x8(%rsp)
fldz
fucomi %st(1),%st
fld    %st(1)
fchs
fxch   %st(2)
fcmovnbe %st(2),%st
fstp   %st(2)
fldt   0xee8(%rip)
fadd   %st(2),%st
fldl   0xfa0(%rip)
fxch   %st(1)
fucomi %st(1),%st
fstp   %st(1)
ja     1279 <cosd+0x179>
fstp   %st(1)
fnstcw -0x26(%rsp)
movzwl -0x26(%rsp),%eax
or     $0xc00,%eax
mov    %ax,-0x22(%rsp)
fldcw  -0x22(%rsp)
fld    %st(1)
fistpll -0x20(%rsp)
fldcw  -0x26(%rsp)
mov    -0x20(%rsp),%rax
mov    %rax,-0x18(%rsp)
fildll -0x18(%rsp)
fsubr  %st,%st(2)
fldt   0xeab(%rip)
fmulp  %st,%st(2)
fxch   %st(1)
fadds  0xf61(%rip)
fnstcw -0x28(%rsp)
movzwl -0x28(%rsp),%eax
or     $0xc00,%eax
mov    %ax,-0x24(%rsp)
fldcw  -0x24(%rsp)
fistpll -0x10(%rsp)
fldcw  -0x28(%rsp)
mov    -0x10(%rsp),%rax
mov    %rax,-0x8(%rsp)
fildll -0x8(%rsp)
fadds  0xf32(%rip)
fld    %st(0)
fmuls  0xf2e(%rip)
faddp  %st,%st(2)
fxch   %st(2)
faddp  %st,%st(1)
fld    %st(1)
fmull  0xf10(%rip)
faddp  %st,%st(1)
fldt   0xe60(%rip)
fmulp  %st,%st(2)
faddp  %st,%st(1)
fldz
fucomip %st(1),%st
fld    %st(0)
fchs
fld    %st(1)
fcmovnbe %st(1),%st
fldt   0xe5a(%rip)
fucomip %st(1),%st
fstp   %st(0)
jbe    11e7 <cosd+0xe7>
test   $0x1,%al
fcmove %st(1),%st
fstp   %st(1)
jmp    126f <cosd+0x16f>
fstp   %st(0)
test   $0x1,%al
fld    %st(0)
fmul   %st(1),%st
fldt   0xe4b(%rip)
fmul   %st(1),%st
fldt   0xe53(%rip)
faddp  %st,%st(1)
fmul   %st(1),%st
fldt   0xe59(%rip)
faddp  %st,%st(1)
fmul   %st(1),%st
fldt   0xe5f(%rip)
faddp  %st,%st(1)
fmul   %st(1),%st
fldt   0xe65(%rip)
faddp  %st,%st(1)
fmul   %st(1),%st
fldt   0xe6b(%rip)
faddp  %st,%st(1)
fmul   %st(1),%st
fldt   0xe71(%rip)
faddp  %st,%st(1)
fmul   %st(1),%st
fldt   0xe77(%rip)
faddp  %st,%st(1)
fmulp  %st,%st(1)
fmul   %st(1),%st
faddp  %st,%st(1)
fld    %st(0)
fchs
fcmove %st(1),%st
fstp   %st(1)
fld1
fxch   %st(1)
fucomi %st(1),%st
fldz
fxch   %st(1)
fxch   %st(2)
fxch   %st(1)
ja     1279 <cosd+0x179>
fstp   %st(1)
fstp   %st(0)
fld1
fchs
fucomi %st(1),%st
fldz
fxch   %st(2)
fxch   %st(1)
jbe    1279 <cosd+0x179>
fstp   %st(2)
fstp   %st(0)
fldz
fldz
fxch   %st(1)
fxch   %st(2)
fxch   %st(1)
fstp   %st(2)
fstp   %st(1)
ret

LLVM IR (-O0):
define x86_fp80 @cosd(x86_fp80 %0) {
%2 = alloca x86_fp80
%3 = alloca x86_fp80
%4 = alloca i64
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = alloca x86_fp80
%8 = alloca x86_fp80
%9 = alloca x86_fp80
%10 = alloca x86_fp80
%11 = alloca x86_fp80
%12 = alloca i32
store x86_fp80 %0, x86_fp80* %3
store i32 1, i32* %12
%13 = load x86_fp80, x86_fp80* %3
%14 = fcmp olt x86_fp80 %13, 0xK00000000000000000000
br i1 %14, label %15, label %18
15: ; preds = %1
%16 = load x86_fp80, x86_fp80* %3
%17 = fneg x86_fp80 %16
store x86_fp80 %17, x86_fp80* %3
br label %18
18: ; preds = %15, %1
%19 = load x86_fp80, x86_fp80* %3
%20 = fadd x86_fp80 %19, 0xK3FFFC90FDAA22168C235
store x86_fp80 %20, x86_fp80* %5
%21 = load x86_fp80, x86_fp80* %5
%22 = fcmp ogt x86_fp80 %21, 0xK401CC90FDA9000000000
br i1 %22, label %23, label %24
23: ; preds = %18
store x86_fp80 0xK00000000000000000000, x86_fp80* %2
br label %142
24: ; preds = %18
%25 = load x86_fp80, x86_fp80* %3
%26 = fptosi x86_fp80 %25 to i64
%27 = sitofp i64 %26 to x86_fp80
store x86_fp80 %27, x86_fp80* %7
%28 = load x86_fp80, x86_fp80* %3
%29 = load x86_fp80, x86_fp80* %7
%30 = fsub x86_fp80 %28, %29
store x86_fp80 %30, x86_fp80* %8
%31 = load x86_fp80, x86_fp80* %5
%32 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %31, x86_fp80 0xK3FFDA2F9836E4E44152A, x86_fp80 0xK3FFE8000000000000000)
%33 = fptosi x86_fp80 %32 to i64
store i64 %33, i64* %4
%34 = load i64, i64* %4
%35 = sitofp i64 %34 to x86_fp80
store x86_fp80 %35, x86_fp80* %6
%36 = load x86_fp80, x86_fp80* %6
%37 = fsub x86_fp80 %36, 0xK3FFE8000000000000000
store x86_fp80 %37, x86_fp80* %6
%38 = load x86_fp80, x86_fp80* %7
%39 = load x86_fp80, x86_fp80* %6
%40 = fneg x86_fp80 %39
%41 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %40, x86_fp80 0xK4000C910000000000000, x86_fp80 %38)
store x86_fp80 %41, x86_fp80* %9
%42 = load x86_fp80, x86_fp80* %9
%43 = load x86_fp80, x86_fp80* %8
%44 = fadd x86_fp80 %42, %43
store x86_fp80 %44, x86_fp80* %9
%45 = load x86_fp80, x86_fp80* %9
%46 = load x86_fp80, x86_fp80* %6
%47 = fneg x86_fp80 %46
%48 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %47, x86_fp80 0xKBFEE95777A8000000000, x86_fp80 %45)
store x86_fp80 %48, x86_fp80* %9
%49 = load x86_fp80, x86_fp80* %9
%50 = load x86_fp80, x86_fp80* %6
%51 = fneg x86_fp80 %50
%52 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %51, x86_fp80 0xK3FD48C234C4C6628B80E, x86_fp80 %49)
store x86_fp80 %52, x86_fp80* %9
%53 = load i64, i64* %4
%54 = and i64 %53, 1
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %24
%57 = load i32, i32* %12
%58 = sub nsw i32 0, %57
store i32 %58, i32* %12
br label %59
59: ; preds = %56, %24
%60 = load x86_fp80, x86_fp80* %9
%61 = fcmp olt x86_fp80 %60, 0xK00000000000000000000
br i1 %61, label %62, label %65
62: ; preds = %59
%63 = load x86_fp80, x86_fp80* %9
%64 = fneg x86_fp80 %63
store x86_fp80 %64, x86_fp80* %10
br label %67
65: ; preds = %59
%66 = load x86_fp80, x86_fp80* %9
store x86_fp80 %66, x86_fp80* %10
br label %67
67: ; preds = %65, %62
%68 = load x86_fp80, x86_fp80* %10
%69 = fcmp olt x86_fp80 %68, 0xK3FE580000000001622D7
br i1 %69, label %70, label %79
70: ; preds = %67
%71 = load x86_fp80, x86_fp80* %9
store x86_fp80 %71, x86_fp80* %11
%72 = load i32, i32* %12
%73 = icmp slt i32 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %70
%75 = load x86_fp80, x86_fp80* %11
%76 = fneg x86_fp80 %75
store x86_fp80 %76, x86_fp80* %11
br label %77
77: ; preds = %74, %70
%78 = load x86_fp80, x86_fp80* %11
store x86_fp80 %78, x86_fp80* %2
br label %142
79: ; preds = %67
%80 = load x86_fp80, x86_fp80* %9
%81 = load x86_fp80, x86_fp80* %9
%82 = fmul x86_fp80 %80, %81
store x86_fp80 %82, x86_fp80* %10
%83 = load x86_fp80, x86_fp80* %10
%84 = fmul x86_fp80 %83, 0xK3FCEC407FB4C9EFCA5FE
store x86_fp80 %84, x86_fp80* %11
%85 = load x86_fp80, x86_fp80* %11
%86 = fadd x86_fp80 %85, 0xKBFD6D72106E0424CDF56
store x86_fp80 %86, x86_fp80* %11
%87 = load x86_fp80, x86_fp80* %11
%88 = load x86_fp80, x86_fp80* %10
%89 = fmul x86_fp80 %87, %88
store x86_fp80 %89, x86_fp80* %11
%90 = load x86_fp80, x86_fp80* %11
%91 = fadd x86_fp80 %90, 0xK3FDEB091E34356A17FA8
store x86_fp80 %91, x86_fp80* %11
%92 = load x86_fp80, x86_fp80* %11
%93 = load x86_fp80, x86_fp80* %10
%94 = fmul x86_fp80 %92, %93
store x86_fp80 %94, x86_fp80* %11
%95 = load x86_fp80, x86_fp80* %11
%96 = fadd x86_fp80 %95, 0xKBFE5D7322A5AEE055B44
store x86_fp80 %96, x86_fp80* %11
%97 = load x86_fp80, x86_fp80* %11
%98 = load x86_fp80, x86_fp80* %10
%99 = fmul x86_fp80 %97, %98
store x86_fp80 %99, x86_fp80* %11
%100 = load x86_fp80, x86_fp80* %11
%101 = fadd x86_fp80 %100, 0xK3FECB8EF1D2927831824
store x86_fp80 %101, x86_fp80* %11
%102 = load x86_fp80, x86_fp80* %11
%103 = load x86_fp80, x86_fp80* %10
%104 = fmul x86_fp80 %102, %103
store x86_fp80 %104, x86_fp80* %11
%105 = load x86_fp80, x86_fp80* %11
%106 = fadd x86_fp80 %105, 0xKBFF2D00D00D009F0D114
store x86_fp80 %106, x86_fp80* %11
%107 = load x86_fp80, x86_fp80* %11
%108 = load x86_fp80, x86_fp80* %10
%109 = fmul x86_fp80 %107, %108
store x86_fp80 %109, x86_fp80* %11
%110 = load x86_fp80, x86_fp80* %11
%111 = fadd x86_fp80 %110, 0xK3FF88888888888858061
store x86_fp80 %111, x86_fp80* %11
%112 = load x86_fp80, x86_fp80* %11
%113 = load x86_fp80, x86_fp80* %10
%114 = fmul x86_fp80 %112, %113
store x86_fp80 %114, x86_fp80* %11
%115 = load x86_fp80, x86_fp80* %11
%116 = fadd x86_fp80 %115, 0xKBFFCAAAAAAAAAAAAA603
store x86_fp80 %116, x86_fp80* %11
%117 = load x86_fp80, x86_fp80* %11
%118 = load x86_fp80, x86_fp80* %10
%119 = fmul x86_fp80 %117, %118
store x86_fp80 %119, x86_fp80* %11
%120 = load x86_fp80, x86_fp80* %11
%121 = load x86_fp80, x86_fp80* %9
%122 = fmul x86_fp80 %120, %121
store x86_fp80 %122, x86_fp80* %11
%123 = load x86_fp80, x86_fp80* %11
%124 = load x86_fp80, x86_fp80* %9
%125 = fadd x86_fp80 %123, %124
store x86_fp80 %125, x86_fp80* %11
%126 = load i32, i32* %12
%127 = icmp slt i32 %126, 0
br i1 %127, label %128, label %131
128: ; preds = %79
%129 = load x86_fp80, x86_fp80* %11
%130 = fneg x86_fp80 %129
store x86_fp80 %130, x86_fp80* %11
br label %131
131: ; preds = %128, %79
%132 = load x86_fp80, x86_fp80* %11
%133 = fcmp ogt x86_fp80 %132, 0xK3FFF8000000000000000
br i1 %133, label %134, label %135
134: ; preds = %131
store x86_fp80 0xK3FFF8000000000000000, x86_fp80* %11
br label %140
135: ; preds = %131
%136 = load x86_fp80, x86_fp80* %11
%137 = fcmp olt x86_fp80 %136, 0xKBFFF8000000000000000
br i1 %137, label %138, label %139
138: ; preds = %135
store x86_fp80 0xKBFFF8000000000000000, x86_fp80* %11
br label %139
139: ; preds = %138, %135
br label %140
140: ; preds = %139, %134
%141 = load x86_fp80, x86_fp80* %11
store x86_fp80 %141, x86_fp80* %2
br label %142
142: ; preds = %140, %77, %23
%143 = load x86_fp80, x86_fp80* %2
ret x86_fp80 %143
}

LLVM IR (-O2):
define x86_fp80 @cosd(x86_fp80 %0) {
%2 = fcmp olt x86_fp80 %0, 0xK00000000000000000000
%3 = fneg x86_fp80 %0
%4 = select i1 %2, x86_fp80 %3, x86_fp80 %0
%5 = fadd x86_fp80 %4, 0xK3FFFC90FDAA22168C235
%6 = fcmp ogt x86_fp80 %5, 0xK401CC90FDA9000000000
br i1 %6, label %53, label %7
7: ; preds = %1
%8 = fptosi x86_fp80 %4 to i64
%9 = sitofp i64 %8 to x86_fp80
%10 = fsub x86_fp80 %4, %9
%11 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %5, x86_fp80 0xK3FFDA2F9836E4E44152A, x86_fp80 0xK3FFE8000000000000000)
%12 = fptosi x86_fp80 %11 to i64
%13 = sitofp i64 %12 to x86_fp80
%14 = fadd x86_fp80 %13, 0xKBFFE8000000000000000
%15 = fneg x86_fp80 %14
%16 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %15, x86_fp80 0xK4000C910000000000000, x86_fp80 %9)
%17 = fadd x86_fp80 %10, %16
%18 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %15, x86_fp80 0xKBFEE95777A8000000000, x86_fp80 %17)
%19 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %15, x86_fp80 0xK3FD48C234C4C6628B80E, x86_fp80 %18)
%20 = and i64 %12, 1
%21 = icmp eq i64 %20, 0
%22 = fcmp olt x86_fp80 %19, 0xK00000000000000000000
%23 = fneg x86_fp80 %19
%24 = select i1 %22, x86_fp80 %23, x86_fp80 %19
%25 = fcmp olt x86_fp80 %24, 0xK3FE580000000001622D7
br i1 %25, label %26, label %28
26: ; preds = %7
%27 = select i1 %21, x86_fp80 %19, x86_fp80 %23
br label %53
28: ; preds = %7
%29 = fmul x86_fp80 %19, %19
%30 = fmul x86_fp80 %29, 0xK3FCEC407FB4C9EFCA5FE
%31 = fadd x86_fp80 %30, 0xKBFD6D72106E0424CDF56
%32 = fmul x86_fp80 %29, %31
%33 = fadd x86_fp80 %32, 0xK3FDEB091E34356A17FA8
%34 = fmul x86_fp80 %29, %33
%35 = fadd x86_fp80 %34, 0xKBFE5D7322A5AEE055B44
%36 = fmul x86_fp80 %29, %35
%37 = fadd x86_fp80 %36, 0xK3FECB8EF1D2927831824
%38 = fmul x86_fp80 %29, %37
%39 = fadd x86_fp80 %38, 0xKBFF2D00D00D009F0D114
%40 = fmul x86_fp80 %29, %39
%41 = fadd x86_fp80 %40, 0xK3FF88888888888858061
%42 = fmul x86_fp80 %29, %41
%43 = fadd x86_fp80 %42, 0xKBFFCAAAAAAAAAAAAA603
%44 = fmul x86_fp80 %29, %43
%45 = fmul x86_fp80 %19, %44
%46 = fadd x86_fp80 %19, %45
%47 = fneg x86_fp80 %46
%48 = select i1 %21, x86_fp80 %46, x86_fp80 %47
%49 = fcmp ogt x86_fp80 %48, 0xK3FFF8000000000000000
br i1 %49, label %53, label %50
50: ; preds = %28
%51 = fcmp olt x86_fp80 %48, 0xKBFFF8000000000000000
br i1 %51, label %52, label %53
52: ; preds = %50
br label %53
53: ; preds = %52, %50, %28, %1, %26
%54 = phi x86_fp80 [ %27, %26 ], [ 0xK00000000000000000000, %1 ], [ 0xKBFFF8000000000000000, %52 ], [ %48, %50 ], [ 0xK3FFF8000000000000000, %28 ]
ret x86_fp80 %54
}