#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*/ dd_cos_taylor(double *, double *);
int /*<<< orphan*/ dd_dec(double *, double *);
int /*<<< orphan*/ dd_inc(double *, double *);
int dd_is_zero(double const *);
int /*<<< orphan*/ dd_minus(double *);
int /*<<< orphan*/ dd_mul(double *, double *, double *);
int /*<<< orphan*/ dd_reduce_modulo_2pi(double const *, double *, int *, int *,
                                        int *, int *);
int /*<<< orphan*/ dd_sin_taylor(double *, double *);
int /*<<< orphan*/ dd_sincos_taylor(double *, double *, double *);
int /*<<< orphan*/ sincostables(double *, double *, double *, double *);
void dd_cos(const double *a, double *cos_a) {
  if (dd_is_zero(a) == 1) {
    cos_a[0] = 1.0;
    cos_a[1] = 0.0;
  } else {
    double t[2];
    int j, k, abs_k, fail;
    dd_reduce_modulo_2pi(a, t, &j, &k, &abs_k, &fail);
    if (fail == 1) {
      cos_a[0] = -2.0;
      cos_a[1] = 0.0;
    } else if (k == 0) {
      if (j == 0) {
        dd_cos_taylor(t, cos_a);
      } else if (j == 1) {
        dd_sin_taylor(t, cos_a);
        dd_minus(cos_a);
      } else if (j == -1) {
        dd_sin_taylor(t, cos_a);
      } else {
        dd_cos_taylor(t, cos_a);
        dd_minus(cos_a);
      }
    } else {
      double u[2], v[2], w[2], t_sin[2], t_cos[2];
      double sintabhi[4], sintablo[4];
      double costabhi[4], costablo[4];
      sincostables(sintabhi, sintablo, costabhi, costablo);
      u[0] = costabhi[abs_k - 1];
      u[1] = costablo[abs_k - 1];
      v[0] = sintabhi[abs_k - 1];
      v[1] = sintablo[abs_k - 1];
      dd_sincos_taylor(t, t_sin, t_cos);
      if (j == 0) {
        dd_mul(u, t_cos, cos_a);
        dd_mul(v, t_sin, w);
        if (k > 0)
          dd_dec(cos_a, w);
        else
          dd_inc(cos_a, w);
      } else if (j == 1) {
        dd_mul(v, t_cos, cos_a);
        dd_mul(u, t_sin, w);
        if (k > 0) {
          dd_minus(cos_a);
          dd_dec(cos_a, w);
        } else {
          dd_dec(cos_a, w);
        }
      } else if (j == -1) {
        dd_mul(u, t_sin, cos_a);
        dd_mul(v, t_cos, w);
        if (k > 0)
          dd_inc(cos_a, w);
        else
          dd_dec(cos_a, w);
      } else {
        dd_mul(v, t_sin, cos_a);
        dd_mul(u, t_cos, w);
        if (k > 0) {
          dd_dec(cos_a, w);
        } else {
          dd_minus(cos_a);
          dd_dec(cos_a, w);
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<dd_cos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <dd_is_zero@plt>
cmp    $0x1,%eax
jne    11e6 <dd_cos+0x46>
mov    -0x10(%rbp),%rax
movsd  0xe37(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
jmp    14cd <dd_cos+0x32d>
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x2c(%rbp),%r8
lea    -0x30(%rbp),%r9
call   1070 <dd_reduce_modulo_2pi@plt>
cmpl   $0x1,-0x30(%rbp)
jne    122e <dd_cos+0x8e>
mov    -0x10(%rbp),%rax
movsd  0xde7(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
jmp    14c8 <dd_cos+0x328>
cmpl   $0x0,-0x28(%rbp)
jne    12ba <dd_cos+0x11a>
cmpl   $0x0,-0x24(%rbp)
jne    1254 <dd_cos+0xb4>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <dd_cos_taylor@plt>
jmp    12b5 <dd_cos+0x115>
cmpl   $0x1,-0x24(%rbp)
jne    1279 <dd_cos+0xd9>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10b0 <dd_sin_taylor@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <dd_minus@plt>
jmp    12b0 <dd_cos+0x110>
cmpl   $0xffffffff,-0x24(%rbp)
jne    1295 <dd_cos+0xf5>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10b0 <dd_sin_taylor@plt>
jmp    12ab <dd_cos+0x10b>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <dd_cos_taylor@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <dd_minus@plt>
jmp    12b0 <dd_cos+0x110>
jmp    12b5 <dd_cos+0x115>
jmp    14c3 <dd_cos+0x323>
lea    -0xa0(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
lea    -0x100(%rbp),%rcx
call   1090 <sincostables@plt>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0xe0(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0x100(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0xa0(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x50(%rbp)
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0xc0(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x48(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x70(%rbp),%rsi
lea    -0x80(%rbp),%rdx
call   1060 <dd_sincos_taylor@plt>
cmpl   $0x0,-0x24(%rbp)
jne    139e <dd_cos+0x1fe>
lea    -0x40(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   10a0 <dd_mul@plt>
lea    -0x50(%rbp),%rdi
lea    -0x70(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   10a0 <dd_mul@plt>
cmpl   $0x0,-0x28(%rbp)
jle    138c <dd_cos+0x1ec>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <dd_dec@plt>
jmp    1399 <dd_cos+0x1f9>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1040 <dd_inc@plt>
jmp    14be <dd_cos+0x31e>
cmpl   $0x1,-0x24(%rbp)
jne    1401 <dd_cos+0x261>
lea    -0x50(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   10a0 <dd_mul@plt>
lea    -0x40(%rbp),%rdi
lea    -0x70(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   10a0 <dd_mul@plt>
cmpl   $0x0,-0x28(%rbp)
jle    13ef <dd_cos+0x24f>
mov    -0x10(%rbp),%rdi
call   10c0 <dd_minus@plt>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <dd_dec@plt>
jmp    13fc <dd_cos+0x25c>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <dd_dec@plt>
jmp    14b9 <dd_cos+0x319>
cmpl   $0xffffffff,-0x24(%rbp)
jne    145b <dd_cos+0x2bb>
lea    -0x40(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   10a0 <dd_mul@plt>
lea    -0x50(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   10a0 <dd_mul@plt>
cmpl   $0x0,-0x28(%rbp)
jle    1449 <dd_cos+0x2a9>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1040 <dd_inc@plt>
jmp    1456 <dd_cos+0x2b6>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <dd_dec@plt>
jmp    14b4 <dd_cos+0x314>
lea    -0x50(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   10a0 <dd_mul@plt>
lea    -0x40(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   10a0 <dd_mul@plt>
cmpl   $0x0,-0x28(%rbp)
jle    1499 <dd_cos+0x2f9>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <dd_dec@plt>
jmp    14af <dd_cos+0x30f>
mov    -0x10(%rbp),%rdi
call   10c0 <dd_minus@plt>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <dd_dec@plt>
jmp    14b4 <dd_cos+0x314>
jmp    14b9 <dd_cos+0x319>
jmp    14be <dd_cos+0x31e>
jmp    14c3 <dd_cos+0x323>
jmp    14c8 <dd_cos+0x328>
jmp    14cd <dd_cos+0x32d>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dd_cos>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <dd_is_zero@plt>
cmp    $0x1,%eax
jne    11cb <dd_cos+0x2b>
movsd  0xe46(%rip),%xmm0
movups %xmm0,(%r14)
jmp    13d9 <dd_cos+0x239>
lea    0x50(%rsp),%rsi
lea    0x24(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x2c(%rsp),%r8
lea    0x28(%rsp),%r9
mov    %rbx,%rdi
call   1070 <dd_reduce_modulo_2pi@plt>
cmpl   $0x1,0x28(%rsp)
jne    1204 <dd_cos+0x64>
movsd  0xe05(%rip),%xmm0
movups %xmm0,(%r14)
jmp    13d9 <dd_cos+0x239>
cmpl   $0x0,0xc(%rsp)
je     12d3 <dd_cos+0x133>
lea    0xe0(%rsp),%rdi
lea    0xc0(%rsp),%rsi
lea    0xa0(%rsp),%rdx
lea    0x80(%rsp),%rcx
call   1090 <sincostables@plt>
movslq 0x2c(%rsp),%rax
movsd  0x98(%rsp,%rax,8),%xmm0
movsd  %xmm0,0x40(%rsp)
movsd  0x78(%rsp,%rax,8),%xmm0
movsd  %xmm0,0x48(%rsp)
movsd  0xd8(%rsp,%rax,8),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0xb8(%rsp,%rax,8),%xmm0
movsd  %xmm0,0x38(%rsp)
lea    0x50(%rsp),%rdi
lea    0x70(%rsp),%rsi
lea    0x60(%rsp),%rdx
call   1060 <dd_sincos_taylor@plt>
mov    0x24(%rsp),%eax
cmp    $0xffffffff,%eax
je     1303 <dd_cos+0x163>
cmp    $0x1,%eax
je     1342 <dd_cos+0x1a2>
test   %eax,%eax
jne    1386 <dd_cos+0x1e6>
lea    0x40(%rsp),%rdi
lea    0x60(%rsp),%rsi
mov    %r14,%rdx
call   10a0 <dd_mul@plt>
lea    0x30(%rsp),%rdi
lea    0x70(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   10a0 <dd_mul@plt>
cmpl   $0x0,0xc(%rsp)
jg     1377 <dd_cos+0x1d7>
jmp    1330 <dd_cos+0x190>
mov    0x24(%rsp),%eax
lea    0x50(%rsp),%rdi
cmp    $0xffffffff,%eax
je     13b5 <dd_cos+0x215>
cmp    $0x1,%eax
je     13bf <dd_cos+0x21f>
test   %eax,%eax
jne    13c9 <dd_cos+0x229>
mov    %r14,%rsi
call   1080 <dd_cos_taylor@plt>
jmp    13d9 <dd_cos+0x239>
lea    0x40(%rsp),%rdi
lea    0x70(%rsp),%rsi
mov    %r14,%rdx
call   10a0 <dd_mul@plt>
lea    0x30(%rsp),%rdi
lea    0x60(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   10a0 <dd_mul@plt>
cmpl   $0x0,0xc(%rsp)
jle    1377 <dd_cos+0x1d7>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1040 <dd_inc@plt>
jmp    13d9 <dd_cos+0x239>
lea    0x30(%rsp),%rdi
lea    0x60(%rsp),%rsi
mov    %r14,%rdx
call   10a0 <dd_mul@plt>
lea    0x40(%rsp),%rdi
lea    0x70(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   10a0 <dd_mul@plt>
cmpl   $0x0,0xc(%rsp)
jle    1377 <dd_cos+0x1d7>
mov    %r14,%rdi
call   10c0 <dd_minus@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1030 <dd_dec@plt>
jmp    13d9 <dd_cos+0x239>
lea    0x30(%rsp),%rdi
lea    0x70(%rsp),%rsi
mov    %r14,%rdx
call   10a0 <dd_mul@plt>
lea    0x40(%rsp),%rdi
lea    0x60(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   10a0 <dd_mul@plt>
cmpl   $0x0,0xc(%rsp)
jg     1377 <dd_cos+0x1d7>
jmp    136f <dd_cos+0x1cf>
mov    %r14,%rsi
call   10b0 <dd_sin_taylor@plt>
jmp    13d9 <dd_cos+0x239>
mov    %r14,%rsi
call   10b0 <dd_sin_taylor@plt>
jmp    13d1 <dd_cos+0x231>
mov    %r14,%rsi
call   1080 <dd_cos_taylor@plt>
mov    %r14,%rdi
call   10c0 <dd_minus@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @dd_cos(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca [2 x double]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [2 x double]
%11 = alloca [2 x double]
%12 = alloca [2 x double]
%13 = alloca [2 x double]
%14 = alloca [2 x double]
%15 = alloca [4 x double]
%16 = alloca [4 x double]
%17 = alloca [4 x double]
%18 = alloca [4 x double]
store double* %0, double** %3
store double* %1, double** %4
%19 = load double*, double** %3
%20 = call i32 @dd_is_zero(double* %19)
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %27
22: ; preds = %2
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 0
store double 1.000000e+00, double* %24
%25 = load double*, double** %4
%26 = getelementptr inbounds double, double* %25, i64 1
store double 0.000000e+00, double* %26
br label %204
27: ; preds = %2
%28 = load double*, double** %3
%29 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%30 = call i32 @dd_reduce_modulo_2pi(double* %28, double* %29, i32* %6, i32* %7, i32* %8, i32* %9)
%31 = load i32, i32* %9
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %38
33: ; preds = %27
%34 = load double*, double** %4
%35 = getelementptr inbounds double, double* %34, i64 0
store double -2.000000e+00, double* %35
%36 = load double*, double** %4
%37 = getelementptr inbounds double, double* %36, i64 1
store double 0.000000e+00, double* %37
br label %203
38: ; preds = %27
%39 = load i32, i32* %7
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %73
41: ; preds = %38
%42 = load i32, i32* %6
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%46 = load double*, double** %4
%47 = call i32 @dd_cos_taylor(double* %45, double* %46)
br label %72
48: ; preds = %41
%49 = load i32, i32* %6
%50 = icmp eq i32 %49, 1
br i1 %50, label %51, label %57
51: ; preds = %48
%52 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%53 = load double*, double** %4
%54 = call i32 @dd_sin_taylor(double* %52, double* %53)
%55 = load double*, double** %4
%56 = call i32 @dd_minus(double* %55)
br label %71
57: ; preds = %48
%58 = load i32, i32* %6
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %64
60: ; preds = %57
%61 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%62 = load double*, double** %4
%63 = call i32 @dd_sin_taylor(double* %61, double* %62)
br label %70
64: ; preds = %57
%65 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%66 = load double*, double** %4
%67 = call i32 @dd_cos_taylor(double* %65, double* %66)
%68 = load double*, double** %4
%69 = call i32 @dd_minus(double* %68)
br label %70
70: ; preds = %64, %60
br label %71
71: ; preds = %70, %51
br label %72
72: ; preds = %71, %44
br label %202
73: ; preds = %38
%74 = getelementptr inbounds [4 x double], [4 x double]* %15, i64 0, i64 0
%75 = getelementptr inbounds [4 x double], [4 x double]* %16, i64 0, i64 0
%76 = getelementptr inbounds [4 x double], [4 x double]* %17, i64 0, i64 0
%77 = getelementptr inbounds [4 x double], [4 x double]* %18, i64 0, i64 0
%78 = call i32 @sincostables(double* %74, double* %75, double* %76, double* %77)
%79 = load i32, i32* %8
%80 = sub nsw i32 %79, 1
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [4 x double], [4 x double]* %17, i64 0, i64 %81
%83 = load double, double* %82
%84 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
store double %83, double* %84
%85 = load i32, i32* %8
%86 = sub nsw i32 %85, 1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [4 x double], [4 x double]* %18, i64 0, i64 %87
%89 = load double, double* %88
%90 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 1
store double %89, double* %90
%91 = load i32, i32* %8
%92 = sub nsw i32 %91, 1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [4 x double], [4 x double]* %15, i64 0, i64 %93
%95 = load double, double* %94
%96 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
store double %95, double* %96
%97 = load i32, i32* %8
%98 = sub nsw i32 %97, 1
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [4 x double], [4 x double]* %16, i64 0, i64 %99
%101 = load double, double* %100
%102 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 1
store double %101, double* %102
%103 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%104 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
%105 = getelementptr inbounds [2 x double], [2 x double]* %14, i64 0, i64 0
%106 = call i32 @dd_sincos_taylor(double* %103, double* %104, double* %105)
%107 = load i32, i32* %6
%108 = icmp eq i32 %107, 0
br i1 %108, label %109, label %129
109: ; preds = %73
%110 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%111 = getelementptr inbounds [2 x double], [2 x double]* %14, i64 0, i64 0
%112 = load double*, double** %4
%113 = call i32 @dd_mul(double* %110, double* %111, double* %112)
%114 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
%115 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
%116 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%117 = call i32 @dd_mul(double* %114, double* %115, double* %116)
%118 = load i32, i32* %7
%119 = icmp sgt i32 %118, 0
br i1 %119, label %120, label %124
120: ; preds = %109
%121 = load double*, double** %4
%122 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%123 = call i32 @dd_dec(double* %121, double* %122)
br label %128
124: ; preds = %109
%125 = load double*, double** %4
%126 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%127 = call i32 @dd_inc(double* %125, double* %126)
br label %128
128: ; preds = %124, %120
br label %201
129: ; preds = %73
%130 = load i32, i32* %6
%131 = icmp eq i32 %130, 1
br i1 %131, label %132, label %154
132: ; preds = %129
%133 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
%134 = getelementptr inbounds [2 x double], [2 x double]* %14, i64 0, i64 0
%135 = load double*, double** %4
%136 = call i32 @dd_mul(double* %133, double* %134, double* %135)
%137 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%138 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
%139 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%140 = call i32 @dd_mul(double* %137, double* %138, double* %139)
%141 = load i32, i32* %7
%142 = icmp sgt i32 %141, 0
br i1 %142, label %143, label %149
143: ; preds = %132
%144 = load double*, double** %4
%145 = call i32 @dd_minus(double* %144)
%146 = load double*, double** %4
%147 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%148 = call i32 @dd_dec(double* %146, double* %147)
br label %153
149: ; preds = %132
%150 = load double*, double** %4
%151 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%152 = call i32 @dd_dec(double* %150, double* %151)
br label %153
153: ; preds = %149, %143
br label %200
154: ; preds = %129
%155 = load i32, i32* %6
%156 = icmp eq i32 %155, -1
br i1 %156, label %157, label %177
157: ; preds = %154
%158 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%159 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
%160 = load double*, double** %4
%161 = call i32 @dd_mul(double* %158, double* %159, double* %160)
%162 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
%163 = getelementptr inbounds [2 x double], [2 x double]* %14, i64 0, i64 0
%164 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%165 = call i32 @dd_mul(double* %162, double* %163, double* %164)
%166 = load i32, i32* %7
%167 = icmp sgt i32 %166, 0
br i1 %167, label %168, label %172
168: ; preds = %157
%169 = load double*, double** %4
%170 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%171 = call i32 @dd_inc(double* %169, double* %170)
br label %176
172: ; preds = %157
%173 = load double*, double** %4
%174 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%175 = call i32 @dd_dec(double* %173, double* %174)
br label %176
176: ; preds = %172, %168
br label %199
177: ; preds = %154
%178 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
%179 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
%180 = load double*, double** %4
%181 = call i32 @dd_mul(double* %178, double* %179, double* %180)
%182 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%183 = getelementptr inbounds [2 x double], [2 x double]* %14, i64 0, i64 0
%184 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%185 = call i32 @dd_mul(double* %182, double* %183, double* %184)
%186 = load i32, i32* %7
%187 = icmp sgt i32 %186, 0
br i1 %187, label %188, label %192
188: ; preds = %177
%189 = load double*, double** %4
%190 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%191 = call i32 @dd_dec(double* %189, double* %190)
br label %198
192: ; preds = %177
%193 = load double*, double** %4
%194 = call i32 @dd_minus(double* %193)
%195 = load double*, double** %4
%196 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%197 = call i32 @dd_dec(double* %195, double* %196)
br label %198
198: ; preds = %192, %188
br label %199
199: ; preds = %198, %176
br label %200
200: ; preds = %199, %153
br label %201
201: ; preds = %200, %128
br label %202
202: ; preds = %201, %72
br label %203
203: ; preds = %202, %33
br label %204
204: ; preds = %203, %22
ret void
}

LLVM IR (-O2):
define void @dd_cos(double* %0, double* %1) {
%3 = alloca [2 x double]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [2 x double]
%9 = alloca [2 x double]
%10 = alloca [2 x double]
%11 = alloca [2 x double]
%12 = alloca [2 x double]
%13 = alloca [4 x double]
%14 = alloca [4 x double]
%15 = alloca [4 x double]
%16 = alloca [4 x double]
%17 = tail call i32 @dd_is_zero(double* %0)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = bitcast double* %1 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 0.000000e+00>, <2 x double>* %20
br label %126
21: ; preds = %2
%22 = bitcast [2 x double]* %3 to i8*
%23 = bitcast i32* %4 to i8*
%24 = bitcast i32* %5 to i8*
%25 = bitcast i32* %6 to i8*
%26 = bitcast i32* %7 to i8*
%27 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%28 = call i32 @dd_reduce_modulo_2pi(double* %0, double* %27, i32* %4, i32* %5, i32* %6, i32* %7)
%29 = load i32, i32* %7
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %33
31: ; preds = %21
%32 = bitcast double* %1 to <2 x double>*
store <2 x double> <double -2.000000e+00, double 0.000000e+00>, <2 x double>* %32
br label %125
33: ; preds = %21
%34 = load i32, i32* %5
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %48
36: ; preds = %33
%37 = load i32, i32* %4
switch i32 %37, label %45 [
i32 0, label %38
i32 1, label %40
i32 -1, label %43
]
38: ; preds = %36
%39 = call i32 @dd_cos_taylor(double* %27, double* %1)
br label %125
40: ; preds = %36
%41 = call i32 @dd_sin_taylor(double* %27, double* %1)
%42 = call i32 @dd_minus(double* %1)
br label %125
43: ; preds = %36
%44 = call i32 @dd_sin_taylor(double* %27, double* %1)
br label %125
45: ; preds = %36
%46 = call i32 @dd_cos_taylor(double* %27, double* %1)
%47 = call i32 @dd_minus(double* %1)
br label %125
48: ; preds = %33
%49 = bitcast [2 x double]* %8 to i8*
%50 = bitcast [2 x double]* %9 to i8*
%51 = bitcast [2 x double]* %10 to i8*
%52 = bitcast [2 x double]* %11 to i8*
%53 = bitcast [2 x double]* %12 to i8*
%54 = bitcast [4 x double]* %13 to i8*
%55 = bitcast [4 x double]* %14 to i8*
%56 = bitcast [4 x double]* %15 to i8*
%57 = bitcast [4 x double]* %16 to i8*
%58 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%59 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%60 = getelementptr inbounds [4 x double], [4 x double]* %15, i64 0, i64 0
%61 = getelementptr inbounds [4 x double], [4 x double]* %16, i64 0, i64 0
%62 = call i32 @sincostables(double* %58, double* %59, double* %60, double* %61)
%63 = load i32, i32* %6
%64 = add nsw i32 %63, -1
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [4 x double], [4 x double]* %15, i64 0, i64 %65
%67 = load double, double* %66
%68 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 0
store double %67, double* %68
%69 = getelementptr inbounds [4 x double], [4 x double]* %16, i64 0, i64 %65
%70 = load double, double* %69
%71 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 1
store double %70, double* %71
%72 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 %65
%73 = load double, double* %72
%74 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 0
store double %73, double* %74
%75 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 %65
%76 = load double, double* %75
%77 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 1
store double %76, double* %77
%78 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
%79 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%80 = call i32 @dd_sincos_taylor(double* %27, double* %78, double* %79)
%81 = load i32, i32* %4
switch i32 %81, label %113 [
i32 0, label %82
i32 1, label %92
i32 -1, label %103
]
82: ; preds = %48
%83 = call i32 @dd_mul(double* %68, double* %79, double* %1)
%84 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%85 = call i32 @dd_mul(double* %74, double* %78, double* %84)
%86 = load i32, i32* %5
%87 = icmp sgt i32 %86, 0
br i1 %87, label %88, label %90
88: ; preds = %82
%89 = call i32 @dd_dec(double* %1, double* %84)
br label %124
90: ; preds = %82
%91 = call i32 @dd_inc(double* %1, double* %84)
br label %124
92: ; preds = %48
%93 = call i32 @dd_mul(double* %74, double* %79, double* %1)
%94 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%95 = call i32 @dd_mul(double* %68, double* %78, double* %94)
%96 = load i32, i32* %5
%97 = icmp sgt i32 %96, 0
br i1 %97, label %98, label %101
98: ; preds = %92
%99 = call i32 @dd_minus(double* %1)
%100 = call i32 @dd_dec(double* %1, double* %94)
br label %124
101: ; preds = %92
%102 = call i32 @dd_dec(double* %1, double* %94)
br label %124
103: ; preds = %48
%104 = call i32 @dd_mul(double* %68, double* %78, double* %1)
%105 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%106 = call i32 @dd_mul(double* %74, double* %79, double* %105)
%107 = load i32, i32* %5
%108 = icmp sgt i32 %107, 0
br i1 %108, label %109, label %111
109: ; preds = %103
%110 = call i32 @dd_inc(double* %1, double* %105)
br label %124
111: ; preds = %103
%112 = call i32 @dd_dec(double* %1, double* %105)
br label %124
113: ; preds = %48
%114 = call i32 @dd_mul(double* %74, double* %78, double* %1)
%115 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%116 = call i32 @dd_mul(double* %68, double* %79, double* %115)
%117 = load i32, i32* %5
%118 = icmp sgt i32 %117, 0
br i1 %118, label %119, label %121
119: ; preds = %113
%120 = call i32 @dd_dec(double* %1, double* %115)
br label %124
121: ; preds = %113
%122 = call i32 @dd_minus(double* %1)
%123 = call i32 @dd_dec(double* %1, double* %115)
br label %124
124: ; preds = %101, %98, %119, %121, %109, %111, %88, %90
br label %125
125: ; preds = %124, %40, %45, %43, %38, %31
br label %126
126: ; preds = %125, %19
ret void
}