#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*/ free(double *);
scalar_t__ malloc(int);
double dtw_distance(double *A, double *B, double *cb, int m, int r,
                    double bsf) {
  double *cost;
  double *cost_prev;
  double *cost_tmp;
  int i, j, k;
  double x, y, z, min_cost;
  cost = (double *)malloc(sizeof(double) * (2 * r + 1));
  for (k = 0; k < 2 * r + 1; k++)
    cost[k] = 1e20;
  cost_prev = (double *)malloc(sizeof(double) * (2 * r + 1));
  for (k = 0; k < 2 * r + 1; k++)
    cost_prev[k] = 1e20;
  for (i = 0; i < m; i++) {
    k = ((0) > (r - i) ? (0) : (r - i));
    min_cost = 1e20;
    for (j = ((0) > (i - r) ? (0) : (i - r));
         j <= ((m - 1) < (i + r) ? (m - 1) : (i + r)); j++, k++) {
      if ((i == 0) && (j == 0)) {
        cost[k] = ((A[0] - B[0]) * (A[0] - B[0]));
        min_cost = cost[k];
        continue;
      }
      if ((j - 1 < 0) || (k - 1 < 0))
        y = 1e20;
      else
        y = cost[k - 1];
      if ((i - 1 < 0) || (k + 1 > 2 * r))
        x = 1e20;
      else
        x = cost_prev[k + 1];
      if ((i - 1 < 0) || (j - 1 < 0))
        z = 1e20;
      else
        z = cost_prev[k];
      cost[k] =
          ((((x) < (y) ? (x) : (y))) < (z) ? (((x) < (y) ? (x) : (y))) : (z)) +
          ((A[i] - B[j]) * (A[i] - B[j]));
      if (cost[k] < min_cost) {
        min_cost = cost[k];
      }
    }
    if (i + r < m - 1 && min_cost + cb[i + r + 1] >= bsf) {
      free(cost);
      free(cost_prev);
      return min_cost + cb[i + r + 1];
    }
    cost_tmp = cost;
    cost = cost_prev;
    cost_prev = cost_tmp;
  }
  k--;
  double final_dtw = cost_prev[k];
  free(cost);
  free(cost_prev);
  return final_dtw;
}


x86 assembly (clang, -O0):
<dtw_distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    -0x28(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x28(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    119b <dtw_distance+0x7b>
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  0xe78(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1164 <dtw_distance+0x44>
mov    -0x28(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x28(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11f3 <dtw_distance+0xd3>
mov    -0x40(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  0xe20(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11bc <dtw_distance+0x9c>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    15c5 <dtw_distance+0x4a5>
mov    -0x28(%rbp),%ecx
sub    -0x4c(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    1223 <dtw_distance+0x103>
xor    %eax,%eax
mov    %eax,-0x84(%rbp)
jmp    122f <dtw_distance+0x10f>
mov    -0x28(%rbp),%eax
sub    -0x4c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x54(%rbp)
movsd  0xdc0(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x4c(%rbp),%ecx
sub    -0x28(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    1262 <dtw_distance+0x142>
xor    %eax,%eax
mov    %eax,-0x88(%rbp)
jmp    126e <dtw_distance+0x14e>
mov    -0x4c(%rbp),%eax
sub    -0x28(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
mov    -0x4c(%rbp),%ecx
add    -0x28(%rbp),%ecx
cmp    %ecx,%eax
jge    12a5 <dtw_distance+0x185>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    12b1 <dtw_distance+0x191>
mov    -0x4c(%rbp),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    -0x8c(%rbp),%eax
mov    -0x90(%rbp),%ecx
cmp    %ecx,%eax
jg     1530 <dtw_distance+0x410>
cmpl   $0x0,-0x4c(%rbp)
jne    1321 <dtw_distance+0x201>
cmpl   $0x0,-0x50(%rbp)
jne    1321 <dtw_distance+0x201>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    1519 <dtw_distance+0x3f9>
mov    -0x50(%rbp),%eax
sub    $0x1,%eax
cmp    $0x0,%eax
jl     133f <dtw_distance+0x21f>
mov    -0x54(%rbp),%eax
sub    $0x1,%eax
cmp    $0x0,%eax
jge    1351 <dtw_distance+0x231>
movsd  0xcb9(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1368 <dtw_distance+0x248>
mov    -0x38(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x4c(%rbp),%eax
sub    $0x1,%eax
cmp    $0x0,%eax
jl     138b <dtw_distance+0x26b>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    -0x28(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jle    139d <dtw_distance+0x27d>
movsd  0xc6d(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    13b4 <dtw_distance+0x294>
mov    -0x40(%rbp),%rax
mov    -0x54(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x4c(%rbp),%eax
sub    $0x1,%eax
cmp    $0x0,%eax
jl     13d2 <dtw_distance+0x2b2>
mov    -0x50(%rbp),%eax
sub    $0x1,%eax
cmp    $0x0,%eax
jge    13e4 <dtw_distance+0x2c4>
movsd  0xc26(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    13f6 <dtw_distance+0x2d6>
mov    -0x40(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    141c <dtw_distance+0x2fc>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    1429 <dtw_distance+0x309>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1488 <dtw_distance+0x368>
movsd  -0x60(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1466 <dtw_distance+0x346>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    1473 <dtw_distance+0x353>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
jmp    1495 <dtw_distance+0x375>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm1
ff
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x50(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movslq -0x50(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1514 <dtw_distance+0x3f4>
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    1519 <dtw_distance+0x3f9>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1277 <dtw_distance+0x157>
mov    -0x4c(%rbp),%eax
add    -0x28(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    159f <dtw_distance+0x47f>
movsd  -0x78(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    -0x28(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
ucomisd -0x30(%rbp),%xmm0
jb     159f <dtw_distance+0x47f>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x78(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    -0x28(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    15fc <dtw_distance+0x4dc>
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11fa <dtw_distance+0xda>
mov    -0x54(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x54(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtw_distance>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %r8d,%ebx
mov    %ecx,%r15d
mov    %rdx,0x28(%rsp)
mov    %rsi,0x30(%rsp)
mov    %rdi,0x10(%rsp)
lea    (%rbx,%rbx,1),%r13d
lea    (%rbx,%rbx,1),%r14d
add    $0x1,%r14d
lea    0x8(,%r13,8),%r12d
mov    %r12d,%edi
call   1040 <malloc@plt>
test   %r14d,%r14d
jle    1184 <dtw_distance+0x64>
mov    %r14d,%ebp
cmp    $0x4,%r14d
mov    %r13,0x20(%rsp)
mov    %r15,0x18(%rsp)
jae    11ac <dtw_distance+0x8c>
xor    %edi,%edi
jmp    1294 <dtw_distance+0x174>
mov    %r12d,%edi
mov    %rax,%r14
call   1040 <malloc@plt>
mov    %r14,%r8
mov    %rax,%r12
xor    %r14d,%r14d
movsd  0x8(%rsp),%xmm4
test   %r15d,%r15d
jg     1420 <dtw_distance+0x300>
jmp    165a <dtw_distance+0x53a>
mov    %ebp,%edi
and    $0xfffffffc,%edi
lea    -0x4(%rdi),%rsi
mov    %rsi,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
mov    %edx,%ecx
and    $0x7,%ecx
cmp    $0x1c,%rsi
jae    11d2 <dtw_distance+0xb2>
xor    %esi,%esi
jmp    1265 <dtw_distance+0x145>
and    $0xfffffffffffffff8,%rdx
xor    %esi,%esi
movapd 0xe20(%rip),%xmm0
movupd %xmm0,(%rax,%rsi,8)
movupd %xmm0,0x10(%rax,%rsi,8)
movupd %xmm0,0x20(%rax,%rsi,8)
movupd %xmm0,0x30(%rax,%rsi,8)
movupd %xmm0,0x40(%rax,%rsi,8)
movupd %xmm0,0x50(%rax,%rsi,8)
movupd %xmm0,0x60(%rax,%rsi,8)
movupd %xmm0,0x70(%rax,%rsi,8)
movupd %xmm0,0x80(%rax,%rsi,8)
movupd %xmm0,0x90(%rax,%rsi,8)
movupd %xmm0,0xa0(%rax,%rsi,8)
movupd %xmm0,0xb0(%rax,%rsi,8)
movupd %xmm0,0xc0(%rax,%rsi,8)
movupd %xmm0,0xd0(%rax,%rsi,8)
movupd %xmm0,0xe0(%rax,%rsi,8)
movupd %xmm0,0xf0(%rax,%rsi,8)
add    $0x20,%rsi
add    $0xfffffffffffffff8,%rdx
jne    11e0 <dtw_distance+0xc0>
test   %rcx,%rcx
je     1294 <dtw_distance+0x174>
lea    (%rax,%rsi,8),%rdx
add    $0x10,%rdx
shl    $0x5,%rcx
xor    %esi,%esi
movapd 0xd80(%rip),%xmm0
movupd %xmm0,-0x10(%rdx,%rsi,1)
movupd %xmm0,(%rdx,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%rcx
jne    1280 <dtw_distance+0x160>
movabs $0x4415af1d78b58c40,%r15
af 15 44
xchg   %ax,%ax
mov    %r15,(%rax,%rdi,8)
add    $0x1,%rdi
cmp    %rdi,%rbp
jne    12a0 <dtw_distance+0x180>
mov    %rax,%r13
mov    %r12d,%edi
call   1040 <malloc@plt>
mov    %rax,%r12
test   %r14d,%r14d
jle    12d6 <dtw_distance+0x1b6>
cmp    $0x4,%r14d
jae    12e7 <dtw_distance+0x1c7>
xor    %eax,%eax
mov    %r13,%r8
movsd  0x8(%rsp),%xmm4
jmp    1400 <dtw_distance+0x2e0>
xor    %r14d,%r14d
mov    %r13,%r8
movsd  0x8(%rsp),%xmm4
jmp    140d <dtw_distance+0x2ed>
mov    %ebp,%eax
and    $0xfffffffc,%eax
lea    -0x4(%rax),%rsi
mov    %rsi,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
mov    %edx,%ecx
and    $0x7,%ecx
cmp    $0x1c,%rsi
mov    %r13,%r8
jae    1316 <dtw_distance+0x1f6>
xor    %esi,%esi
movsd  0x8(%rsp),%xmm4
jmp    13c5 <dtw_distance+0x2a5>
and    $0xfffffffffffffff8,%rdx
xor    %esi,%esi
movapd 0xcdc(%rip),%xmm0
movsd  0x8(%rsp),%xmm4
nopw   0x0(%rax,%rax,1)
movupd %xmm0,(%r12,%rsi,8)
movupd %xmm0,0x10(%r12,%rsi,8)
movupd %xmm0,0x20(%r12,%rsi,8)
movupd %xmm0,0x30(%r12,%rsi,8)
movupd %xmm0,0x40(%r12,%rsi,8)
movupd %xmm0,0x50(%r12,%rsi,8)
movupd %xmm0,0x60(%r12,%rsi,8)
movupd %xmm0,0x70(%r12,%rsi,8)
movupd %xmm0,0x80(%r12,%rsi,8)
movupd %xmm0,0x90(%r12,%rsi,8)
movupd %xmm0,0xa0(%r12,%rsi,8)
movupd %xmm0,0xb0(%r12,%rsi,8)
movupd %xmm0,0xc0(%r12,%rsi,8)
movupd %xmm0,0xd0(%r12,%rsi,8)
movupd %xmm0,0xe0(%r12,%rsi,8)
movupd %xmm0,0xf0(%r12,%rsi,8)
add    $0x20,%rsi
add    $0xfffffffffffffff8,%rdx
jne    1330 <dtw_distance+0x210>
test   %rcx,%rcx
je     1400 <dtw_distance+0x2e0>
lea    (%r12,%rsi,8),%rdx
add    $0x10,%rdx
shl    $0x5,%rcx
xor    %esi,%esi
movapd 0xc20(%rip),%xmm0
movupd %xmm0,-0x10(%rdx,%rsi,1)
movupd %xmm0,(%rdx,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%rcx
jne    13e0 <dtw_distance+0x2c0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,(%r12,%rax,8)
add    $0x1,%rax
cmp    %rax,%rbp
jne    1400 <dtw_distance+0x2e0>
mov    0x18(%rsp),%r15
mov    0x20(%rsp),%r13
test   %r15d,%r15d
jle    165a <dtw_distance+0x53a>
movslq %r13d,%r11
mov    %ebx,%r13d
neg    %r13d
movslq %ebx,%r9
mov    %r15d,%r10d
add    $0xffffffff,%r15d
movsd  0xbd5(%rip),%xmm0
xor    %eax,%eax
mov    %r8,%rdx
mov    %r15,0x18(%rsp)
mov    %r9,0x40(%rsp)
mov    %r10,0x38(%rsp)
jmp    1477 <dtw_distance+0x357>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
add    $0xffffffff,%ebx
add    $0x1,%r13d
mov    %r8,%rdx
cmp    %r10,%rax
je     165a <dtw_distance+0x53a>
mov    %r12,%r8
mov    %rdx,%r12
test   %r13d,%r13d
mov    $0x0,%edx
cmovg  %r13d,%edx
test   %ebx,%ebx
mov    $0x0,%esi
cmovg  %ebx,%esi
mov    %r9,%r14
sub    %rax,%r14
mov    $0x0,%ecx
cmovs  %rcx,%r14
mov    %rax,%rdi
sub    %r9,%rdi
test   %rdi,%rdi
cmovle %ecx,%edi
lea    (%rax,%r9,1),%rcx
cmp    %r10,%rcx
mov    %ecx,%ebp
cmovge %r15d,%ebp
movapd %xmm0,%xmm5
cmp    %edi,%ebp
jl     1609 <dtw_distance+0x4e9>
mov    %rcx,0x48(%rsp)
mov    %rbx,0x20(%rsp)
mov    0x30(%rsp),%rcx
lea    (%rcx,%rdx,8),%rbx
test   %rax,%rax
setne  %r15b
movslq %ebp,%rbp
mov    %r8,0x8(%rsp)
lea    (%r8,%rsi,8),%r8
add    $0x8,%r8
mov    %r12,0x50(%rsp)
lea    (%r12,%rsi,8),%r10
xor    %r9d,%r9d
movapd %xmm0,%xmm5
jmp    1545 <dtw_distance+0x425>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp),%rcx
movsd  (%rcx),%xmm5
mov    0x30(%rsp),%rcx
subsd  (%rcx),%xmm5
mulsd  %xmm5,%xmm5
movsd  %xmm5,(%r10,%r9,8)
lea    (%rdx,%r9,1),%rcx
add    $0x1,%rcx
add    $0x1,%r9
add    $0xffffffffffffffff,%rcx
cmp    %rbp,%rcx
jge    15e0 <dtw_distance+0x4c0>
lea    (%rdx,%r9,1),%r12
mov    %rax,%rdi
or     %r12,%rdi
je     1510 <dtw_distance+0x3f0>
lea    (%rsi,%r9,1),%r14
movapd %xmm0,%xmm1
test   %r12,%r12
je     156e <dtw_distance+0x44e>
movapd %xmm0,%xmm1
test   %r14,%r14
je     156e <dtw_distance+0x44e>
movsd  -0x8(%r10,%r9,8),%xmm1
cmp    %r11,%r14
setl   %cl
and    %r15b,%cl
movapd %xmm0,%xmm2
cmp    $0x1,%cl
jne    1586 <dtw_distance+0x466>
movsd  (%r8,%r9,8),%xmm2
movapd %xmm0,%xmm3
test   %rax,%rax
je     159f <dtw_distance+0x47f>
movapd %xmm0,%xmm3
test   %r12,%r12
je     159f <dtw_distance+0x47f>
movsd  -0x8(%r8,%r9,8),%xmm3
minsd  %xmm1,%xmm2
minsd  %xmm3,%xmm2
mov    0x10(%rsp),%rcx
movsd  (%rcx,%rax,8),%xmm1
subsd  (%rbx,%r9,8),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%r10,%r9,8)
ucomisd %xmm1,%xmm5
jbe    152c <dtw_distance+0x40c>
movapd %xmm1,%xmm5
jmp    152c <dtw_distance+0x40c>
nopl   0x0(%rax,%rax,1)
add    %r9,%rsi
mov    %rsi,%r14
mov    0x8(%rsp),%r8
mov    0x20(%rsp),%rbx
mov    0x18(%rsp),%r15
mov    0x50(%rsp),%r12
mov    0x40(%rsp),%r9
mov    0x38(%rsp),%r10
mov    0x48(%rsp),%rcx
cmp    %r15,%rcx
jge    1460 <dtw_distance+0x340>
mov    %rcx,%rbp
mov    0x28(%rsp),%rcx
movsd  0x8(%rcx,%rbp,8),%xmm1
addsd  %xmm5,%xmm1
ucomisd %xmm4,%xmm1
jb     1460 <dtw_distance+0x340>
mov    %r12,%rdi
mov    %r8,%rbx
movsd  %xmm5,0x10(%rsp)
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movsd  0x10(%rsp),%xmm0
mov    0x28(%rsp),%rax
addsd  0x8(%rax,%rbp,8),%xmm0
jmp    1680 <dtw_distance+0x560>
movslq %r14d,%rax
movsd  -0x8(%r12,%rax,8),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r8,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
movsd  0x10(%rsp),%xmm0
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @dtw_distance(double* %0, double* %1, double* %2, i32 %3, i32 %4, double %5) {
%7 = alloca double
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
store double* %0, double** %8
store double* %1, double** %9
store double* %2, double** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store double %5, double* %13
%25 = load i32, i32* %12
%26 = mul nsw i32 2, %25
%27 = add nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = mul i64 8, %28
%30 = trunc i64 %29 to i32
%31 = call i64 @malloc(i32 %30)
%32 = inttoptr i64 %31 to double*
store double* %32, double** %14
store i32 0, i32* %19
br label %33
33: ; preds = %44, %6
%34 = load i32, i32* %19
%35 = load i32, i32* %12
%36 = mul nsw i32 2, %35
%37 = add nsw i32 %36, 1
%38 = icmp slt i32 %34, %37
br i1 %38, label %39, label %47
39: ; preds = %33
%40 = load double*, double** %14
%41 = load i32, i32* %19
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
store double 1.000000e+20, double* %43
br label %44
44: ; preds = %39
%45 = load i32, i32* %19
%46 = add nsw i32 %45, 1
store i32 %46, i32* %19
br label %33
47: ; preds = %33
%48 = load i32, i32* %12
%49 = mul nsw i32 2, %48
%50 = add nsw i32 %49, 1
%51 = sext i32 %50 to i64
%52 = mul i64 8, %51
%53 = trunc i64 %52 to i32
%54 = call i64 @malloc(i32 %53)
%55 = inttoptr i64 %54 to double*
store double* %55, double** %15
store i32 0, i32* %19
br label %56
56: ; preds = %67, %47
%57 = load i32, i32* %19
%58 = load i32, i32* %12
%59 = mul nsw i32 2, %58
%60 = add nsw i32 %59, 1
%61 = icmp slt i32 %57, %60
br i1 %61, label %62, label %70
62: ; preds = %56
%63 = load double*, double** %15
%64 = load i32, i32* %19
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %63, i64 %65
store double 1.000000e+20, double* %66
br label %67
67: ; preds = %62
%68 = load i32, i32* %19
%69 = add nsw i32 %68, 1
store i32 %69, i32* %19
br label %56
70: ; preds = %56
store i32 0, i32* %17
br label %71
71: ; preds = %307, %70
%72 = load i32, i32* %17
%73 = load i32, i32* %11
%74 = icmp slt i32 %72, %73
br i1 %74, label %75, label %310
75: ; preds = %71
%76 = load i32, i32* %12
%77 = load i32, i32* %17
%78 = sub nsw i32 %76, %77
%79 = icmp sgt i32 0, %78
br i1 %79, label %80, label %81
80: ; preds = %75
br label %85
81: ; preds = %75
%82 = load i32, i32* %12
%83 = load i32, i32* %17
%84 = sub nsw i32 %82, %83
br label %85
85: ; preds = %81, %80
%86 = phi i32 [ 0, %80 ], [ %84, %81 ]
store i32 %86, i32* %19
store double 1.000000e+20, double* %23
%87 = load i32, i32* %17
%88 = load i32, i32* %12
%89 = sub nsw i32 %87, %88
%90 = icmp sgt i32 0, %89
br i1 %90, label %91, label %92
91: ; preds = %85
br label %96
92: ; preds = %85
%93 = load i32, i32* %17
%94 = load i32, i32* %12
%95 = sub nsw i32 %93, %94
br label %96
96: ; preds = %92, %91
%97 = phi i32 [ 0, %91 ], [ %95, %92 ]
store i32 %97, i32* %18
br label %98
98: ; preds = %263, %96
%99 = load i32, i32* %18
%100 = load i32, i32* %11
%101 = sub nsw i32 %100, 1
%102 = load i32, i32* %17
%103 = load i32, i32* %12
%104 = add nsw i32 %102, %103
%105 = icmp slt i32 %101, %104
br i1 %105, label %106, label %109
106: ; preds = %98
%107 = load i32, i32* %11
%108 = sub nsw i32 %107, 1
br label %113
109: ; preds = %98
%110 = load i32, i32* %17
%111 = load i32, i32* %12
%112 = add nsw i32 %110, %111
br label %113
113: ; preds = %109, %106
%114 = phi i32 [ %108, %106 ], [ %112, %109 ]
%115 = icmp sle i32 %99, %114
br i1 %115, label %116, label %268
116: ; preds = %113
%117 = load i32, i32* %17
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %147
119: ; preds = %116
%120 = load i32, i32* %18
%121 = icmp eq i32 %120, 0
br i1 %121, label %122, label %147
122: ; preds = %119
%123 = load double*, double** %8
%124 = getelementptr inbounds double, double* %123, i64 0
%125 = load double, double* %124
%126 = load double*, double** %9
%127 = getelementptr inbounds double, double* %126, i64 0
%128 = load double, double* %127
%129 = fsub double %125, %128
%130 = load double*, double** %8
%131 = getelementptr inbounds double, double* %130, i64 0
%132 = load double, double* %131
%133 = load double*, double** %9
%134 = getelementptr inbounds double, double* %133, i64 0
%135 = load double, double* %134
%136 = fsub double %132, %135
%137 = fmul double %129, %136
%138 = load double*, double** %14
%139 = load i32, i32* %19
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds double, double* %138, i64 %140
store double %137, double* %141
%142 = load double*, double** %14
%143 = load i32, i32* %19
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds double, double* %142, i64 %144
%146 = load double, double* %145
store double %146, double* %23
br label %263
147: ; preds = %119, %116
%148 = load i32, i32* %18
%149 = sub nsw i32 %148, 1
%150 = icmp slt i32 %149, 0
br i1 %150, label %155, label %151
151: ; preds = %147
%152 = load i32, i32* %19
%153 = sub nsw i32 %152, 1
%154 = icmp slt i32 %153, 0
br i1 %154, label %155, label %156
155: ; preds = %151, %147
store double 1.000000e+20, double* %21
br label %163
156: ; preds = %151
%157 = load double*, double** %14
%158 = load i32, i32* %19
%159 = sub nsw i32 %158, 1
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds double, double* %157, i64 %160
%162 = load double, double* %161
store double %162, double* %21
br label %163
163: ; preds = %156, %155
%164 = load i32, i32* %17
%165 = sub nsw i32 %164, 1
%166 = icmp slt i32 %165, 0
br i1 %166, label %173, label %167
167: ; preds = %163
%168 = load i32, i32* %19
%169 = add nsw i32 %168, 1
%170 = load i32, i32* %12
%171 = mul nsw i32 2, %170
%172 = icmp sgt i32 %169, %171
br i1 %172, label %173, label %174
173: ; preds = %167, %163
store double 1.000000e+20, double* %20
br label %181
174: ; preds = %167
%175 = load double*, double** %15
%176 = load i32, i32* %19
%177 = add nsw i32 %176, 1
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds double, double* %175, i64 %178
%180 = load double, double* %179
store double %180, double* %20
br label %181
181: ; preds = %174, %173
%182 = load i32, i32* %17
%183 = sub nsw i32 %182, 1
%184 = icmp slt i32 %183, 0
br i1 %184, label %189, label %185
185: ; preds = %181
%186 = load i32, i32* %18
%187 = sub nsw i32 %186, 1
%188 = icmp slt i32 %187, 0
br i1 %188, label %189, label %190
189: ; preds = %185, %181
store double 1.000000e+20, double* %22
br label %196
190: ; preds = %185
%191 = load double*, double** %15
%192 = load i32, i32* %19
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds double, double* %191, i64 %193
%195 = load double, double* %194
store double %195, double* %22
br label %196
196: ; preds = %190, %189
%197 = load double, double* %20
%198 = load double, double* %21
%199 = fcmp olt double %197, %198
br i1 %199, label %200, label %202
200: ; preds = %196
%201 = load double, double* %20
br label %204
202: ; preds = %196
%203 = load double, double* %21
br label %204
204: ; preds = %202, %200
%205 = phi double [ %201, %200 ], [ %203, %202 ]
%206 = load double, double* %22
%207 = fcmp olt double %205, %206
br i1 %207, label %208, label %218
208: ; preds = %204
%209 = load double, double* %20
%210 = load double, double* %21
%211 = fcmp olt double %209, %210
br i1 %211, label %212, label %214
212: ; preds = %208
%213 = load double, double* %20
br label %216
214: ; preds = %208
%215 = load double, double* %21
br label %216
216: ; preds = %214, %212
%217 = phi double [ %213, %212 ], [ %215, %214 ]
br label %220
218: ; preds = %204
%219 = load double, double* %22
br label %220
220: ; preds = %218, %216
%221 = phi double [ %217, %216 ], [ %219, %218 ]
%222 = load double*, double** %8
%223 = load i32, i32* %17
%224 = sext i32 %223 to i64
%225 = getelementptr inbounds double, double* %222, i64 %224
%226 = load double, double* %225
%227 = load double*, double** %9
%228 = load i32, i32* %18
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds double, double* %227, i64 %229
%231 = load double, double* %230
%232 = fsub double %226, %231
%233 = load double*, double** %8
%234 = load i32, i32* %17
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds double, double* %233, i64 %235
%237 = load double, double* %236
%238 = load double*, double** %9
%239 = load i32, i32* %18
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds double, double* %238, i64 %240
%242 = load double, double* %241
%243 = fsub double %237, %242
%244 = call double @llvm.fmuladd.f64(double %232, double %243, double %221)
%245 = load double*, double** %14
%246 = load i32, i32* %19
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds double, double* %245, i64 %247
store double %244, double* %248
%249 = load double*, double** %14
%250 = load i32, i32* %19
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds double, double* %249, i64 %251
%253 = load double, double* %252
%254 = load double, double* %23
%255 = fcmp olt double %253, %254
br i1 %255, label %256, label %262
256: ; preds = %220
%257 = load double*, double** %14
%258 = load i32, i32* %19
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds double, double* %257, i64 %259
%261 = load double, double* %260
store double %261, double* %23
br label %262
262: ; preds = %256, %220
br label %263
263: ; preds = %262, %122
%264 = load i32, i32* %18
%265 = add nsw i32 %264, 1
store i32 %265, i32* %18
%266 = load i32, i32* %19
%267 = add nsw i32 %266, 1
store i32 %267, i32* %19
br label %98
268: ; preds = %113
%269 = load i32, i32* %17
%270 = load i32, i32* %12
%271 = add nsw i32 %269, %270
%272 = load i32, i32* %11
%273 = sub nsw i32 %272, 1
%274 = icmp slt i32 %271, %273
br i1 %274, label %275, label %303
275: ; preds = %268
%276 = load double, double* %23
%277 = load double*, double** %10
%278 = load i32, i32* %17
%279 = load i32, i32* %12
%280 = add nsw i32 %278, %279
%281 = add nsw i32 %280, 1
%282 = sext i32 %281 to i64
%283 = getelementptr inbounds double, double* %277, i64 %282
%284 = load double, double* %283
%285 = fadd double %276, %284
%286 = load double, double* %13
%287 = fcmp oge double %285, %286
br i1 %287, label %288, label %303
288: ; preds = %275
%289 = load double*, double** %14
%290 = call i32 @free(double* %289)
%291 = load double*, double** %15
%292 = call i32 @free(double* %291)
%293 = load double, double* %23
%294 = load double*, double** %10
%295 = load i32, i32* %17
%296 = load i32, i32* %12
%297 = add nsw i32 %295, %296
%298 = add nsw i32 %297, 1
%299 = sext i32 %298 to i64
%300 = getelementptr inbounds double, double* %294, i64 %299
%301 = load double, double* %300
%302 = fadd double %293, %301
store double %302, double* %7
br label %323
303: ; preds = %275, %268
%304 = load double*, double** %14
store double* %304, double** %16
%305 = load double*, double** %15
store double* %305, double** %14
%306 = load double*, double** %16
store double* %306, double** %15
br label %307
307: ; preds = %303
%308 = load i32, i32* %17
%309 = add nsw i32 %308, 1
store i32 %309, i32* %17
br label %71
310: ; preds = %71
%311 = load i32, i32* %19
%312 = add nsw i32 %311, -1
store i32 %312, i32* %19
%313 = load double*, double** %15
%314 = load i32, i32* %19
%315 = sext i32 %314 to i64
%316 = getelementptr inbounds double, double* %313, i64 %315
%317 = load double, double* %316
store double %317, double* %24
%318 = load double*, double** %14
%319 = call i32 @free(double* %318)
%320 = load double*, double** %15
%321 = call i32 @free(double* %320)
%322 = load double, double* %24
store double %322, double* %7
br label %323
323: ; preds = %310, %288
%324 = load double, double* %7
ret double %324
}

LLVM IR (-O2):
define double @dtw_distance(double* nocapture %0, double* nocapture %1, double* nocapture %2, i32 %3, i32 %4, double %5) {
%7 = shl nsw i32 %4, 1
%8 = or i32 %7, 1
%9 = shl i32 %8, 3
%10 = tail call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to double*
%12 = icmp sgt i32 %8, 0
br i1 %12, label %16, label %13
13: ; preds = %6
%14 = tail call i64 @malloc(i32 %9)
%15 = inttoptr i64 %14 to double*
br label %168
16: ; preds = %6
%17 = zext i32 %8 to i64
%18 = icmp ult i32 %8, 4
br i1 %18, label %86, label %19
19: ; preds = %16
%20 = and i64 %17, 4294967292
%21 = add nsw i64 %20, -4
%22 = lshr exact i64 %21, 2
%23 = add nuw nsw i64 %22, 1
%24 = and i64 %23, 7
%25 = icmp ult i64 %21, 28
br i1 %25, label %73, label %26
26: ; preds = %19
%27 = and i64 %23, 9223372036854775800
br label %28
28: ; preds = %28, %26
%29 = phi i64 [ 0, %26 ], [ %70, %28 ]
%30 = phi i64 [ 0, %26 ], [ %71, %28 ]
%31 = getelementptr inbounds double, double* %11, i64 %29
%32 = bitcast double* %31 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %32
%33 = getelementptr inbounds double, double* %31, i64 2
%34 = bitcast double* %33 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %34
%35 = or i64 %29, 4
%36 = getelementptr inbounds double, double* %11, i64 %35
%37 = bitcast double* %36 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %37
%38 = getelementptr inbounds double, double* %36, i64 2
%39 = bitcast double* %38 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %39
%40 = or i64 %29, 8
%41 = getelementptr inbounds double, double* %11, i64 %40
%42 = bitcast double* %41 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %42
%43 = getelementptr inbounds double, double* %41, i64 2
%44 = bitcast double* %43 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %44
%45 = or i64 %29, 12
%46 = getelementptr inbounds double, double* %11, i64 %45
%47 = bitcast double* %46 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %47
%48 = getelementptr inbounds double, double* %46, i64 2
%49 = bitcast double* %48 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %49
%50 = or i64 %29, 16
%51 = getelementptr inbounds double, double* %11, i64 %50
%52 = bitcast double* %51 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %52
%53 = getelementptr inbounds double, double* %51, i64 2
%54 = bitcast double* %53 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %54
%55 = or i64 %29, 20
%56 = getelementptr inbounds double, double* %11, i64 %55
%57 = bitcast double* %56 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %57
%58 = getelementptr inbounds double, double* %56, i64 2
%59 = bitcast double* %58 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %59
%60 = or i64 %29, 24
%61 = getelementptr inbounds double, double* %11, i64 %60
%62 = bitcast double* %61 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %62
%63 = getelementptr inbounds double, double* %61, i64 2
%64 = bitcast double* %63 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %64
%65 = or i64 %29, 28
%66 = getelementptr inbounds double, double* %11, i64 %65
%67 = bitcast double* %66 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %67
%68 = getelementptr inbounds double, double* %66, i64 2
%69 = bitcast double* %68 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %69
%70 = add nuw i64 %29, 32
%71 = add i64 %30, 8
%72 = icmp eq i64 %71, %27
br i1 %72, label %73, label %28
73: ; preds = %28, %19
%74 = phi i64 [ 0, %19 ], [ %70, %28 ]
%75 = icmp eq i64 %24, 0
br i1 %75, label %86, label %76
76: ; preds = %73, %76
%77 = phi i64 [ %83, %76 ], [ %74, %73 ]
%78 = phi i64 [ %84, %76 ], [ 0, %73 ]
%79 = getelementptr inbounds double, double* %11, i64 %77
%80 = bitcast double* %79 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %80
%81 = getelementptr inbounds double, double* %79, i64 2
%82 = bitcast double* %81 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %82
%83 = add nuw i64 %77, 4
%84 = add i64 %78, 1
%85 = icmp eq i64 %84, %24
br i1 %85, label %86, label %76
86: ; preds = %73, %76, %16
%87 = phi i64 [ 0, %16 ], [ %20, %76 ], [ %20, %73 ]
br label %88
88: ; preds = %86, %88
%89 = phi i64 [ %91, %88 ], [ %87, %86 ]
%90 = getelementptr inbounds double, double* %11, i64 %89
store double 1.000000e+20, double* %90
%91 = add nuw nsw i64 %89, 1
%92 = icmp eq i64 %91, %17
br i1 %92, label %93, label %88
93: ; preds = %88
%94 = tail call i64 @malloc(i32 %9)
%95 = inttoptr i64 %94 to double*
br i1 %12, label %96, label %168
96: ; preds = %93
%97 = zext i32 %8 to i64
%98 = icmp ult i32 %8, 4
br i1 %98, label %112, label %114
99: ; preds = %123, %114
%100 = phi i64 [ 0, %114 ], [ %165, %123 ]
%101 = icmp eq i64 %119, 0
br i1 %101, label %112, label %102
102: ; preds = %99, %102
%103 = phi i64 [ %109, %102 ], [ %100, %99 ]
%104 = phi i64 [ %110, %102 ], [ 0, %99 ]
%105 = getelementptr inbounds double, double* %95, i64 %103
%106 = bitcast double* %105 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %106
%107 = getelementptr inbounds double, double* %105, i64 2
%108 = bitcast double* %107 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %108
%109 = add nuw i64 %103, 4
%110 = add i64 %104, 1
%111 = icmp eq i64 %110, %119
br i1 %111, label %112, label %102
112: ; preds = %99, %102, %96
%113 = phi i64 [ 0, %96 ], [ %115, %102 ], [ %115, %99 ]
br label %180
114: ; preds = %96
%115 = and i64 %17, 4294967292
%116 = add nsw i64 %115, -4
%117 = lshr exact i64 %116, 2
%118 = add nuw nsw i64 %117, 1
%119 = and i64 %118, 7
%120 = icmp ult i64 %116, 28
br i1 %120, label %99, label %121
121: ; preds = %114
%122 = and i64 %118, 9223372036854775800
br label %123
123: ; preds = %123, %121
%124 = phi i64 [ 0, %121 ], [ %165, %123 ]
%125 = phi i64 [ 0, %121 ], [ %166, %123 ]
%126 = getelementptr inbounds double, double* %95, i64 %124
%127 = bitcast double* %126 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %127
%128 = getelementptr inbounds double, double* %126, i64 2
%129 = bitcast double* %128 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %129
%130 = or i64 %124, 4
%131 = getelementptr inbounds double, double* %95, i64 %130
%132 = bitcast double* %131 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %132
%133 = getelementptr inbounds double, double* %131, i64 2
%134 = bitcast double* %133 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %134
%135 = or i64 %124, 8
%136 = getelementptr inbounds double, double* %95, i64 %135
%137 = bitcast double* %136 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %137
%138 = getelementptr inbounds double, double* %136, i64 2
%139 = bitcast double* %138 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %139
%140 = or i64 %124, 12
%141 = getelementptr inbounds double, double* %95, i64 %140
%142 = bitcast double* %141 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %142
%143 = getelementptr inbounds double, double* %141, i64 2
%144 = bitcast double* %143 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %144
%145 = or i64 %124, 16
%146 = getelementptr inbounds double, double* %95, i64 %145
%147 = bitcast double* %146 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %147
%148 = getelementptr inbounds double, double* %146, i64 2
%149 = bitcast double* %148 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %149
%150 = or i64 %124, 20
%151 = getelementptr inbounds double, double* %95, i64 %150
%152 = bitcast double* %151 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %152
%153 = getelementptr inbounds double, double* %151, i64 2
%154 = bitcast double* %153 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %154
%155 = or i64 %124, 24
%156 = getelementptr inbounds double, double* %95, i64 %155
%157 = bitcast double* %156 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %157
%158 = getelementptr inbounds double, double* %156, i64 2
%159 = bitcast double* %158 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %159
%160 = or i64 %124, 28
%161 = getelementptr inbounds double, double* %95, i64 %160
%162 = bitcast double* %161 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %162
%163 = getelementptr inbounds double, double* %161, i64 2
%164 = bitcast double* %163 to <2 x double>*
store <2 x double> <double 1.000000e+20, double 1.000000e+20>, <2 x double>* %164
%165 = add nuw i64 %124, 32
%166 = add i64 %125, 8
%167 = icmp eq i64 %166, %122
br i1 %167, label %99, label %123
168: ; preds = %180, %13, %93
%169 = phi double* [ %95, %93 ], [ %15, %13 ], [ %95, %180 ]
%170 = phi i32 [ 0, %93 ], [ 0, %13 ], [ %8, %180 ]
%171 = icmp sgt i32 %3, 0
br i1 %171, label %172, label %288
172: ; preds = %168
%173 = add nsw i32 %3, -1
%174 = sext i32 %7 to i64
%175 = sub i32 0, %4
%176 = sext i32 %4 to i64
%177 = zext i32 %3 to i64
%178 = zext i32 %173 to i64
%179 = zext i32 %3 to i64
br label %185
180: ; preds = %112, %180
%181 = phi i64 [ %183, %180 ], [ %113, %112 ]
%182 = getelementptr inbounds double, double* %95, i64 %181
store double 1.000000e+20, double* %182
%183 = add nuw nsw i64 %181, 1
%184 = icmp eq i64 %183, %97
br i1 %184, label %168, label %180
185: ; preds = %172, %281
%186 = phi i64 [ 0, %172 ], [ %282, %281 ]
%187 = phi i32 [ %175, %172 ], [ %284, %281 ]
%188 = phi i32 [ %4, %172 ], [ %283, %281 ]
%189 = phi double* [ %11, %172 ], [ %190, %281 ]
%190 = phi double* [ %169, %172 ], [ %189, %281 ]
%191 = sub nsw i64 %176, %186
%192 = icmp sgt i64 %191, 0
%193 = select i1 %192, i64 %191, i64 0
%194 = sub nsw i64 %186, %176
%195 = icmp sgt i64 %194, 0
%196 = select i1 %195, i64 %194, i64 0
%197 = trunc i64 %196 to i32
%198 = add nsw i64 %186, %176
%199 = icmp slt i64 %198, %177
%200 = trunc i64 %198 to i32
%201 = select i1 %199, i32 %200, i32 %173
%202 = icmp slt i32 %201, %197
br i1 %202, label %265, label %203
203: ; preds = %185
%204 = call i32 @llvm.smax.i32(i32 %187, i32 0)
%205 = zext i32 %204 to i64
%206 = call i32 @llvm.smax.i32(i32 %188, i32 0)
%207 = zext i32 %206 to i64
%208 = icmp eq i64 %186, 0
%209 = xor i1 %208, true
%210 = getelementptr inbounds double, double* %0, i64 %186
%211 = sext i32 %201 to i64
br label %212
212: ; preds = %203, %260
%213 = phi i64 [ %205, %203 ], [ %262, %260 ]
%214 = phi i64 [ %207, %203 ], [ %263, %260 ]
%215 = phi double [ 1.000000e+20, %203 ], [ %261, %260 ]
%216 = icmp eq i64 %213, 0
%217 = select i1 %208, i1 %216, i1 false
br i1 %217, label %218, label %224
218: ; preds = %212
%219 = load double, double* %0
%220 = load double, double* %1
%221 = fsub double %219, %220
%222 = fmul double %221, %221
%223 = getelementptr inbounds double, double* %189, i64 %214
store double %222, double* %223
br label %260
224: ; preds = %212
%225 = icmp eq i64 %214, 0
%226 = select i1 %216, i1 true, i1 %225
br i1 %226, label %231, label %227
227: ; preds = %224
%228 = add nsw i64 %214, -1
%229 = getelementptr inbounds double, double* %189, i64 %228
%230 = load double, double* %229
br label %231
231: ; preds = %224, %227
%232 = phi double [ %230, %227 ], [ 1.000000e+20, %224 ]
%233 = icmp slt i64 %214, %174
%234 = select i1 %209, i1 %233, i1 false
br i1 %234, label %235, label %240
235: ; preds = %231
%236 = add nuw nsw i64 %214, 1
%237 = and i64 %236, 4294967295
%238 = getelementptr inbounds double, double* %190, i64 %237
%239 = load double, double* %238
br label %240
240: ; preds = %231, %235
%241 = phi double [ %239, %235 ], [ 1.000000e+20, %231 ]
%242 = select i1 %208, i1 true, i1 %216
br i1 %242, label %246, label %243
243: ; preds = %240
%244 = getelementptr inbounds double, double* %190, i64 %214
%245 = load double, double* %244
br label %246
246: ; preds = %240, %243
%247 = phi double [ %245, %243 ], [ 1.000000e+20, %240 ]
%248 = fcmp olt double %241, %232
%249 = select i1 %248, double %241, double %232
%250 = fcmp olt double %249, %247
%251 = select i1 %250, double %249, double %247
%252 = load double, double* %210
%253 = getelementptr inbounds double, double* %1, i64 %213
%254 = load double, double* %253
%255 = fsub double %252, %254
%256 = tail call double @llvm.fmuladd.f64(double %255, double %255, double %251)
%257 = getelementptr inbounds double, double* %189, i64 %214
store double %256, double* %257
%258 = fcmp olt double %256, %215
br i1 %258, label %259, label %260
259: ; preds = %246
br label %260
260: ; preds = %246, %259, %218
%261 = phi double [ %222, %218 ], [ %256, %259 ], [ %215, %246 ]
%262 = add nuw nsw i64 %213, 1
%263 = add nuw nsw i64 %214, 1
%264 = icmp slt i64 %213, %211
br i1 %264, label %212, label %265
265: ; preds = %260, %185
%266 = phi i64 [ %193, %185 ], [ %263, %260 ]
%267 = phi double [ 1.000000e+20, %185 ], [ %261, %260 ]
%268 = icmp slt i64 %198, %178
br i1 %268, label %269, label %281
269: ; preds = %265
%270 = add nsw i64 %198, 1
%271 = getelementptr inbounds double, double* %2, i64 %270
%272 = load double, double* %271
%273 = fadd double %267, %272
%274 = fcmp ult double %273, %5
br i1 %274, label %281, label %275
275: ; preds = %269
%276 = getelementptr inbounds double, double* %2, i64 %270
%277 = tail call i32 @free(double* %189)
%278 = tail call i32 @free(double* %190)
%279 = load double, double* %276
%280 = fadd double %267, %279
br label %298
281: ; preds = %269, %265
%282 = add nuw nsw i64 %186, 1
%283 = add i32 %188, -1
%284 = add i32 %187, 1
%285 = icmp eq i64 %282, %179
br i1 %285, label %286, label %185
286: ; preds = %281
%287 = trunc i64 %266 to i32
br label %288
288: ; preds = %286, %168
%289 = phi double* [ %169, %168 ], [ %189, %286 ]
%290 = phi double* [ %11, %168 ], [ %190, %286 ]
%291 = phi i32 [ %170, %168 ], [ %287, %286 ]
%292 = add nsw i32 %291, -1
%293 = sext i32 %292 to i64
%294 = getelementptr inbounds double, double* %289, i64 %293
%295 = load double, double* %294
%296 = tail call i32 @free(double* %290)
%297 = tail call i32 @free(double* %289)
br label %298
298: ; preds = %288, %275
%299 = phi double [ %280, %275 ], [ %295, %288 ]
ret double %299
}