#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*/ assert(int);
double atan(double);
double cos(double const);
double fabs(double);
double sin(double const);
int ti_msw_start(double const *);
int ti_msw(int size, double const *const *inputs, double const *options,
           double *const *outputs) {
  const double *input = inputs[0];
  double *sine = outputs[0];
  double *lead = outputs[1];
  const int period = (int)options[0];
  if (period < 1)
    return 1;
  if (size <= ti_msw_start(options))
    return 0;
  const double pi = 3.1415926;
  const double tpi = 2 * pi;
  double weight = 0, phase;
  double rp, ip;
  int i, j;
  for (i = period; i < size; ++i) {
    rp = 0;
    ip = 0;
    for (j = 0; j < period; ++j) {
      weight = input[i - j];
      rp = rp + cos(tpi * j / period) * weight;
      ip = ip + sin(tpi * j / period) * weight;
    }
    if (fabs(rp) > .001) {
      phase = atan(ip / rp);
    } else {
      phase = tpi / 2.0 * (ip < 0 ? -1.0 : 1.0);
    }
    if (rp < 0.0)
      phase += pi;
    phase += pi / 2.0;
    if (phase < 0.0)
      phase += tpi;
    if (phase > tpi)
      phase -= tpi;
    *sine++ = sin(phase);
    *lead++ = sin(phase + pi / 4.0);
  }
  assert(sine - outputs[0] == size - ti_msw_start(options));
  assert(lead - outputs[1] == size - ti_msw_start(options));
  return 0;
}


x86 assembly (clang, -O0):
<ti_msw>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x1,-0x3c(%rbp)
jge    11ad <ti_msw+0x5d>
movl   $0x1,-0x4(%rbp)
jmp    14ca <ti_msw+0x37a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <ti_msw_start@plt>
mov    %eax,%ecx
mov    -0x7c(%rbp),%eax
cmp    %ecx,%eax
jg     11d5 <ti_msw+0x85>
movl   $0x0,-0x4(%rbp)
jmp    14ca <ti_msw+0x37a>
movsd  0xe2b(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe16(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1424 <ti_msw+0x2d4>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    12dd <ti_msw+0x18d>
mov    -0x28(%rbp),%rax
mov    -0x74(%rbp),%ecx
sub    -0x78(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
cvtsi2sdl -0x78(%rbp),%xmm1
movsd  0xda3(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x3c(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1060 <cos@plt>
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0x58(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
cvtsi2sdl -0x78(%rbp),%xmm1
movsd  0xd5d(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x3c(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x58(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1220 <ti_msw+0xd0>
movsd  -0x68(%rbp),%xmm0
movaps 0xd57(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xd1b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1318 <ti_msw+0x1c8>
movsd  -0x70(%rbp),%xmm0
divsd  -0x68(%rbp),%xmm0
call   1050 <atan@plt>
movsd  %xmm0,-0x60(%rbp)
jmp    1355 <ti_msw+0x205>
movsd  -0x70(%rbp),%xmm1
movsd  0xcf3(%rip),%xmm3
movsd  0xcf3(%rip),%xmm2
xorps  %xmm0,%xmm0
cmpltsd %xmm0,%xmm1
movaps %xmm1,%xmm0
andpd  %xmm3,%xmm0
andnpd %xmm2,%xmm1
orpd   %xmm0,%xmm1
movsd  0xcbc(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x68(%rbp),%xmm0
jbe    1375 <ti_msw+0x225>
movsd  0xc9d(%rip),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xcab(%rip),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    13a7 <ti_msw+0x257>
movsd  0xc63(%rip),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xc4c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13d4 <ti_msw+0x284>
movsd  -0x60(%rbp),%xmm0
movsd  0xc35(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1040 <sin@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x30(%rbp)
movsd  %xmm0,(%rax)
movsd  0xc37(%rip),%xmm0
addsd  -0x60(%rbp),%xmm0
call   1040 <sin@plt>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x38(%rbp)
movsd  %xmm0,(%rax)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11fd <ti_msw+0xad>
mov    -0x30(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%rcx
sub    %rcx,%rax
sar    $0x3,%rax
mov    %rax,-0xa8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <ti_msw_start@plt>
mov    -0xac(%rbp),%ecx
mov    %eax,%edx
mov    -0xa8(%rbp),%rax
sub    %edx,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x38(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    0x8(%rcx),%rcx
sub    %rcx,%rax
sar    $0x3,%rax
mov    %rax,-0x98(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <ti_msw_start@plt>
mov    -0x9c(%rbp),%ecx
mov    %eax,%edx
mov    -0x98(%rbp),%rax
sub    %edx,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ti_msw>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
cvttsd2si (%rdx),%r14d
test   %r14d,%r14d
jle    137c <ti_msw+0x22c>
mov    %rdx,%rbp
mov    %edi,%r12d
mov    (%rsi),%rax
mov    %rax,(%rsp)
mov    (%rcx),%rbx
mov    %rcx,%r15
mov    0x8(%rcx),%r13
mov    %rdx,%rdi
call   1070 <ti_msw_start@plt>
xor    %ecx,%ecx
cmp    %r12d,%eax
jge    13df <ti_msw+0x28f>
mov    (%rsp),%rcx
mov    %r15,0x30(%rsp)
mov    %r13,0x18(%rsp)
mov    %rbp,0x38(%rsp)
cmp    %r12d,%r14d
mov    %r12d,0x24(%rsp)
jge    1383 <ti_msw+0x233>
cvtsi2sd %r14d,%xmm1
mov    %r14d,%r14d
movslq %r12d,%rax
mov    %rax,0x40(%rsp)
lea    (%rcx,%r14,8),%r15
mov    %r14,%r13
movsd  %xmm1,0x28(%rsp)
jmp    12b3 <ti_msw+0x163>
nopl   0x0(%rax)
xor    %eax,%eax
xorpd  %xmm3,%xmm3
ucomisd %xmm2,%xmm3
seta   %al
lea    0xe4c(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
movsd  0xdff(%rip),%xmm2
movapd %xmm0,%xmm1
addsd  0xe03(%rip),%xmm1
cmpltsd %xmm3,%xmm4
andpd  %xmm4,%xmm1
andnpd %xmm0,%xmm4
orpd   %xmm1,%xmm4
addsd  0xdf2(%rip),%xmm4
movapd %xmm4,%xmm0
addsd  %xmm2,%xmm0
movapd %xmm4,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm0
andnpd %xmm4,%xmm1
orpd   %xmm0,%xmm1
movapd %xmm1,%xmm0
addsd  0xdd1(%rip),%xmm0
cmpltsd %xmm1,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm0,%xmm2
movapd %xmm2,(%rsp)
movapd %xmm2,%xmm0
call   1040 <sin@plt>
movsd  %xmm0,(%rbx)
add    $0x8,%rbx
movapd (%rsp),%xmm0
addsd  0xda5(%rip),%xmm0
call   1040 <sin@plt>
mov    0x18(%rsp),%rax
movsd  %xmm0,(%rax)
add    $0x8,%rax
mov    %rax,0x18(%rsp)
add    $0x1,%r13
add    $0x8,%r15
cmp    0x40(%rsp),%r13
movsd  0x28(%rsp),%xmm1
je     1383 <ti_msw+0x233>
xorps  %xmm2,%xmm2
mov    %r15,%r12
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movaps %xmm2,(%rsp)
xorps  %xmm2,%xmm2
cvtsi2sd %ebp,%xmm2
mulsd  0xd2d(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,0x48(%rsp)
movsd  (%r12),%xmm0
movaps %xmm0,0x60(%rsp)
movapd %xmm2,%xmm0
call   1060 <cos@plt>
movapd %xmm0,0x50(%rsp)
movsd  0x48(%rsp),%xmm0
call   1040 <sin@plt>
movapd (%rsp),%xmm2
movsd  0x28(%rsp),%xmm1
unpcklpd 0x50(%rsp),%xmm0
movapd 0x60(%rsp),%xmm3
unpcklpd %xmm3,%xmm3
mulpd  %xmm0,%xmm3
addpd  %xmm3,%xmm2
add    $0x1,%rbp
add    $0xfffffffffffffff8,%r12
cmp    %rbp,%r14
jne    12c0 <ti_msw+0x170>
movapd %xmm2,%xmm4
unpckhpd %xmm2,%xmm4
movapd %xmm4,%xmm0
andpd  0xcea(%rip),%xmm0
ucomisd 0xcba(%rip),%xmm0
jbe    11e0 <ti_msw+0x90>
divsd  %xmm4,%xmm2
movapd %xmm2,%xmm0
movapd %xmm4,(%rsp)
call   1050 <atan@plt>
movapd (%rsp),%xmm4
movsd  0xc8d(%rip),%xmm2
xorpd  %xmm3,%xmm3
jmp    1201 <ti_msw+0xb1>
mov    $0x1,%ecx
jmp    13df <ti_msw+0x28f>
mov    0x30(%rsp),%r15
sub    (%r15),%rbx
sar    $0x3,%rbx
mov    0x38(%rsp),%r14
mov    %r14,%rdi
call   1070 <ti_msw_start@plt>
mov    0x24(%rsp),%ebp
mov    %ebp,%ecx
sub    %eax,%ecx
movslq %ecx,%rax
xor    %edi,%edi
cmp    %rax,%rbx
sete   %dil
call   1030 <assert@plt>
mov    0x18(%rsp),%rbx
sub    0x8(%r15),%rbx
sar    $0x3,%rbx
mov    %r14,%rdi
call   1070 <ti_msw_start@plt>
sub    %eax,%ebp
movslq %ebp,%rax
xor    %edi,%edi
cmp    %rax,%rbx
sete   %dil
call   1030 <assert@plt>
xor    %ecx,%ecx
mov    %ecx,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ti_msw(i32 %0, double** %1, double* %2, double** %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double**
%8 = alloca double*
%9 = alloca double**
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca i32
%21 = alloca i32
store i32 %0, i32* %6
store double** %1, double*** %7
store double* %2, double** %8
store double** %3, double*** %9
%22 = load double**, double*** %7
%23 = getelementptr inbounds double*, double** %22, i64 0
%24 = load double*, double** %23
store double* %24, double** %10
%25 = load double**, double*** %9
%26 = getelementptr inbounds double*, double** %25, i64 0
%27 = load double*, double** %26
store double* %27, double** %11
%28 = load double**, double*** %9
%29 = getelementptr inbounds double*, double** %28, i64 1
%30 = load double*, double** %29
store double* %30, double** %12
%31 = load double*, double** %8
%32 = getelementptr inbounds double, double* %31, i64 0
%33 = load double, double* %32
%34 = fptosi double %33 to i32
store i32 %34, i32* %13
%35 = load i32, i32* %13
%36 = icmp slt i32 %35, 1
br i1 %36, label %37, label %38
37: ; preds = %4
store i32 1, i32* %5
br label %167
38: ; preds = %4
%39 = load i32, i32* %6
%40 = load double*, double** %8
%41 = call i32 @ti_msw_start(double* %40)
%42 = icmp sle i32 %39, %41
br i1 %42, label %43, label %44
43: ; preds = %38
store i32 0, i32* %5
br label %167
44: ; preds = %38
store double 0x400921FB4D12D84A, double* %14
store double 0x401921FB4D12D84A, double* %15
store double 0.000000e+00, double* %16
%45 = load i32, i32* %13
store i32 %45, i32* %20
br label %46
46: ; preds = %131, %44
%47 = load i32, i32* %20
%48 = load i32, i32* %6
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %134
50: ; preds = %46
store double 0.000000e+00, double* %18
store double 0.000000e+00, double* %19
store i32 0, i32* %21
br label %51
51: ; preds = %83, %50
%52 = load i32, i32* %21
%53 = load i32, i32* %13
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %86
55: ; preds = %51
%56 = load double*, double** %10
%57 = load i32, i32* %20
%58 = load i32, i32* %21
%59 = sub nsw i32 %57, %58
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %56, i64 %60
%62 = load double, double* %61
store double %62, double* %16
%63 = load double, double* %18
%64 = load i32, i32* %21
%65 = sitofp i32 %64 to double
%66 = fmul double 0x401921FB4D12D84A, %65
%67 = load i32, i32* %13
%68 = sitofp i32 %67 to double
%69 = fdiv double %66, %68
%70 = call double @cos(double %69)
%71 = load double, double* %16
%72 = call double @llvm.fmuladd.f64(double %70, double %71, double %63)
store double %72, double* %18
%73 = load double, double* %19
%74 = load i32, i32* %21
%75 = sitofp i32 %74 to double
%76 = fmul double 0x401921FB4D12D84A, %75
%77 = load i32, i32* %13
%78 = sitofp i32 %77 to double
%79 = fdiv double %76, %78
%80 = call double @sin(double %79)
%81 = load double, double* %16
%82 = call double @llvm.fmuladd.f64(double %80, double %81, double %73)
store double %82, double* %19
br label %83
83: ; preds = %55
%84 = load i32, i32* %21
%85 = add nsw i32 %84, 1
store i32 %85, i32* %21
br label %51
86: ; preds = %51
%87 = load double, double* %18
%88 = call double @llvm.fabs.f64(double %87)
%89 = fcmp ogt double %88, 1.000000e-03
br i1 %89, label %90, label %95
90: ; preds = %86
%91 = load double, double* %19
%92 = load double, double* %18
%93 = fdiv double %91, %92
%94 = call double @atan(double %93)
store double %94, double* %17
br label %101
95: ; preds = %86
%96 = load double, double* %19
%97 = fcmp olt double %96, 0.000000e+00
%98 = zext i1 %97 to i64
%99 = select i1 %97, double -1.000000e+00, double 1.000000e+00
%100 = fmul double 0x400921FB4D12D84A, %99
store double %100, double* %17
br label %101
101: ; preds = %95, %90
%102 = load double, double* %18
%103 = fcmp olt double %102, 0.000000e+00
br i1 %103, label %104, label %107
104: ; preds = %101
%105 = load double, double* %17
%106 = fadd double %105, 0x400921FB4D12D84A
store double %106, double* %17
br label %107
107: ; preds = %104, %101
%108 = load double, double* %17
%109 = fadd double %108, 0x3FF921FB4D12D84A
store double %109, double* %17
%110 = load double, double* %17
%111 = fcmp olt double %110, 0.000000e+00
br i1 %111, label %112, label %115
112: ; preds = %107
%113 = load double, double* %17
%114 = fadd double %113, 0x401921FB4D12D84A
store double %114, double* %17
br label %115
115: ; preds = %112, %107
%116 = load double, double* %17
%117 = fcmp ogt double %116, 0x401921FB4D12D84A
br i1 %117, label %118, label %121
118: ; preds = %115
%119 = load double, double* %17
%120 = fsub double %119, 0x401921FB4D12D84A
store double %120, double* %17
br label %121
121: ; preds = %118, %115
%122 = load double, double* %17
%123 = call double @sin(double %122)
%124 = load double*, double** %11
%125 = getelementptr inbounds double, double* %124, i32 1
store double* %125, double** %11
store double %123, double* %124
%126 = load double, double* %17
%127 = fadd double %126, 0x3FE921FB4D12D84A
%128 = call double @sin(double %127)
%129 = load double*, double** %12
%130 = getelementptr inbounds double, double* %129, i32 1
store double* %130, double** %12
store double %128, double* %129
br label %131
131: ; preds = %121
%132 = load i32, i32* %20
%133 = add nsw i32 %132, 1
store i32 %133, i32* %20
br label %46
134: ; preds = %46
%135 = load double*, double** %11
%136 = load double**, double*** %9
%137 = getelementptr inbounds double*, double** %136, i64 0
%138 = load double*, double** %137
%139 = ptrtoint double* %135 to i64
%140 = ptrtoint double* %138 to i64
%141 = sub i64 %139, %140
%142 = sdiv exact i64 %141, 8
%143 = load i32, i32* %6
%144 = load double*, double** %8
%145 = call i32 @ti_msw_start(double* %144)
%146 = sub nsw i32 %143, %145
%147 = sext i32 %146 to i64
%148 = icmp eq i64 %142, %147
%149 = zext i1 %148 to i32
%150 = call i32 @assert(i32 %149)
%151 = load double*, double** %12
%152 = load double**, double*** %9
%153 = getelementptr inbounds double*, double** %152, i64 1
%154 = load double*, double** %153
%155 = ptrtoint double* %151 to i64
%156 = ptrtoint double* %154 to i64
%157 = sub i64 %155, %156
%158 = sdiv exact i64 %157, 8
%159 = load i32, i32* %6
%160 = load double*, double** %8
%161 = call i32 @ti_msw_start(double* %160)
%162 = sub nsw i32 %159, %161
%163 = sext i32 %162 to i64
%164 = icmp eq i64 %158, %163
%165 = zext i1 %164 to i32
%166 = call i32 @assert(i32 %165)
store i32 0, i32* %5
br label %167
167: ; preds = %134, %43, %37
%168 = load i32, i32* %5
ret i32 %168
}

LLVM IR (-O2):
define i32 @ti_msw(i32 %0, double** nocapture %1, double* %2, double** nocapture %3) {
%5 = load double*, double** %1
%6 = getelementptr inbounds double*, double** %3, i64 1
%7 = load double, double* %2
%8 = fptosi double %7 to i32
%9 = icmp slt i32 %8, 1
br i1 %9, label %101, label %10
10: ; preds = %4
%11 = load double*, double** %6
%12 = load double*, double** %3
%13 = tail call i32 @ti_msw_start(double* %2)
%14 = icmp slt i32 %13, %0
br i1 %14, label %15, label %101
15: ; preds = %10
%16 = icmp slt i32 %8, %0
br i1 %16, label %17, label %76
17: ; preds = %15
%18 = sitofp i32 %8 to double
%19 = zext i32 %8 to i64
%20 = sext i32 %0 to i64
%21 = zext i32 %8 to i64
br label %22
22: ; preds = %17, %57
%23 = phi i64 [ %19, %17 ], [ %74, %57 ]
%24 = phi double* [ %12, %17 ], [ %70, %57 ]
%25 = phi double* [ %11, %17 ], [ %73, %57 ]
br label %26
26: ; preds = %22, %26
%27 = phi i64 [ 0, %22 ], [ %43, %26 ]
%28 = phi <2 x double> [ zeroinitializer, %22 ], [ %42, %26 ]
%29 = sub nsw i64 %23, %27
%30 = getelementptr inbounds double, double* %5, i64 %29
%31 = load double, double* %30
%32 = trunc i64 %27 to i32
%33 = sitofp i32 %32 to double
%34 = fmul double %33, 0x401921FB4D12D84A
%35 = fdiv double %34, %18
%36 = tail call double @cos(double %35)
%37 = tail call double @sin(double %35)
%38 = insertelement <2 x double> poison, double %37, i64 0
%39 = insertelement <2 x double> %38, double %36, i64 1
%40 = insertelement <2 x double> poison, double %31, i64 0
%41 = shufflevector <2 x double> %40, <2 x double> poison, <2 x i32> zeroinitializer
%42 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %41, <2 x double> %28)
%43 = add nuw nsw i64 %27, 1
%44 = icmp eq i64 %43, %21
br i1 %44, label %45, label %26
45: ; preds = %26
%46 = extractelement <2 x double> %42, i64 1
%47 = tail call double @llvm.fabs.f64(double %46)
%48 = fcmp ogt double %47, 1.000000e-03
br i1 %48, label %49, label %53
49: ; preds = %45
%50 = extractelement <2 x double> %42, i64 0
%51 = fdiv double %50, %46
%52 = tail call double @atan(double %51)
br label %57
53: ; preds = %45
%54 = extractelement <2 x double> %42, i64 0
%55 = fcmp olt double %54, 0.000000e+00
%56 = select i1 %55, double 0xC00921FB4D12D84A, double 0x400921FB4D12D84A
br label %57
57: ; preds = %53, %49
%58 = phi double [ %52, %49 ], [ %56, %53 ]
%59 = fcmp olt double %46, 0.000000e+00
%60 = fadd double %58, 0x400921FB4D12D84A
%61 = select i1 %59, double %60, double %58
%62 = fadd double %61, 0x3FF921FB4D12D84A
%63 = fcmp olt double %62, 0.000000e+00
%64 = fadd double %62, 0x401921FB4D12D84A
%65 = select i1 %63, double %64, double %62
%66 = fcmp ogt double %65, 0x401921FB4D12D84A
%67 = fadd double %65, 0xC01921FB4D12D84A
%68 = select i1 %66, double %67, double %65
%69 = tail call double @sin(double %68)
%70 = getelementptr inbounds double, double* %24, i64 1
store double %69, double* %24
%71 = fadd double %68, 0x3FE921FB4D12D84A
%72 = tail call double @sin(double %71)
%73 = getelementptr inbounds double, double* %25, i64 1
store double %72, double* %25
%74 = add nuw nsw i64 %23, 1
%75 = icmp eq i64 %74, %20
br i1 %75, label %76, label %22
76: ; preds = %57, %15
%77 = phi double* [ %11, %15 ], [ %73, %57 ]
%78 = phi double* [ %12, %15 ], [ %70, %57 ]
%79 = load double*, double** %3
%80 = ptrtoint double* %78 to i64
%81 = ptrtoint double* %79 to i64
%82 = sub i64 %80, %81
%83 = ashr exact i64 %82, 3
%84 = tail call i32 @ti_msw_start(double* %2)
%85 = sub nsw i32 %0, %84
%86 = sext i32 %85 to i64
%87 = icmp eq i64 %83, %86
%88 = zext i1 %87 to i32
%89 = tail call i32 @assert(i32 %88)
%90 = load double*, double** %6
%91 = ptrtoint double* %77 to i64
%92 = ptrtoint double* %90 to i64
%93 = sub i64 %91, %92
%94 = ashr exact i64 %93, 3
%95 = tail call i32 @ti_msw_start(double* %2)
%96 = sub nsw i32 %0, %95
%97 = sext i32 %96 to i64
%98 = icmp eq i64 %94, %97
%99 = zext i1 %98 to i32
%100 = tail call i32 @assert(i32 %99)
br label %101
101: ; preds = %10, %4, %76
%102 = phi i32 [ 0, %76 ], [ 1, %4 ], [ 0, %10 ]
ret i32 %102
}