void tf_dp(int n, double *y, double lam, double *beta) {
  int i;
  int k;
  int l;
  int r;
  int lo;
  int hi;
  double afirst;
  double alast;
  double bfirst;
  double blast;
  double alo;
  double blo;
  double ahi;
  double bhi;
  double *x;
  double *a;
  double *b;
  double *tm;
  double *tp;
  if (n == 0)
    return;
  if (n == 1 || lam == 0) {
    for (i = 0; i < n; i++)
      beta[i] = y[i];
    return;
  }
  x = (double *)malloc(2 * n * sizeof(double));
  a = (double *)malloc(2 * n * sizeof(double));
  b = (double *)malloc(2 * n * sizeof(double));
  tm = (double *)malloc((n - 1) * sizeof(double));
  tp = (double *)malloc((n - 1) * sizeof(double));
  tm[0] = -lam + y[0];
  tp[0] = lam + y[0];
  l = n - 1;
  r = n;
  x[l] = tm[0];
  x[r] = tp[0];
  a[l] = 1;
  b[l] = -y[0] + lam;
  a[r] = -1;
  b[r] = y[0] + lam;
  afirst = 1;
  bfirst = -y[1] - lam;
  alast = -1;
  blast = y[1] - lam;
  for (k = 1; k < n - 1; k++) {
    alo = afirst;
    blo = bfirst;
    for (lo = l; lo <= r; lo++) {
      if (alo * x[lo] + blo > -lam)
        break;
      alo += a[lo];
      blo += b[lo];
    }
    ahi = alast;
    bhi = blast;
    for (hi = r; hi >= lo; hi--) {
      if (-ahi * x[hi] - bhi < lam)
        break;
      ahi += a[hi];
      bhi += b[hi];
    }
    tm[k] = (-lam - blo) / alo;
    l = lo - 1;
    x[l] = tm[k];
    tp[k] = (lam + bhi) / (-ahi);
    r = hi + 1;
    x[r] = tp[k];
    a[l] = alo;
    b[l] = blo + lam;
    a[r] = ahi;
    b[r] = bhi + lam;
    afirst = 1;
    bfirst = -y[k + 1] - lam;
    alast = -1;
    blast = y[k + 1] - lam;
  }
  alo = afirst;
  blo = bfirst;
  for (lo = l; lo <= r; lo++) {
    if (alo * x[lo] + blo > 0)
      break;
    alo += a[lo];
    blo += b[lo];
  }
  beta[n - 1] = -blo / alo;
  for (k = n - 2; k >= 0; k--) {
    if (beta[k + 1] > tp[k])
      beta[k] = tp[k];
    else if (beta[k + 1] < tm[k])
      beta[k] = tm[k];
    else
      beta[k] = beta[k + 1];
  }
  free(x);
  free(a);
  free(b);
  free(tm);
  free(tp);
}


x86 assembly (clang, -O0):
<tf_dp>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    114a <tf_dp+0x2a>
jmp    188f <tf_dp+0x76f>
cmpl   $0x1,-0x4(%rbp)
je     116c <tf_dp+0x4c>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11ac <tf_dp+0x8c>
jp     11ac <tf_dp+0x8c>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a7 <tf_dp+0x87>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1173 <tf_dp+0x53>
jmp    188f <tf_dp+0x76f>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x80(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x88(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x90(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x98(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0xa0(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x98(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0xa0(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x98(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x80(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xa0(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x80(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x88(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  0xd49(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  -0x18(%rbp),%xmm0
mov    -0x90(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x88(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  0xcf5(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x18(%rbp),%xmm0
mov    -0x90(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xcd3(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xc94(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    16a8 <tf_dp+0x588>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jg     144e <tf_dp+0x32e>
movsd  -0x60(%rbp),%xmm0
mov    -0x80(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
ucomisd %xmm1,%xmm0
jbe    140c <tf_dp+0x2ec>
jmp    144e <tf_dp+0x32e>
mov    -0x88(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x90(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13b6 <tf_dp+0x296>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jl     1517 <tf_dp+0x3f7>
movsd  -0x70(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mov    -0x80(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x78(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    14d5 <tf_dp+0x3b5>
jmp    1517 <tf_dp+0x3f7>
mov    -0x88(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x90(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
jmp    1468 <tf_dp+0x348>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
subsd  -0x68(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
mov    -0x98(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x98(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x80(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x18(%rbp),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
divsd  %xmm1,%xmm0
mov    -0xa0(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0xa0(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x80(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x88(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x68(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
mov    -0x90(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x70(%rbp),%xmm0
mov    -0x88(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x78(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
mov    -0x90(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0x9cf(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0x987(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    138b <tf_dp+0x26b>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jg     1741 <tf_dp+0x621>
movsd  -0x60(%rbp),%xmm0
mov    -0x80(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    16ff <tf_dp+0x5df>
jmp    1741 <tf_dp+0x621>
mov    -0x88(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x90(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    16c2 <tf_dp+0x5a2>
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x60(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     1856 <tf_dp+0x736>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0xa0(%rbp),%rax
movslq -0x28(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    17d1 <tf_dp+0x6b1>
mov    -0xa0(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1843 <tf_dp+0x723>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x98(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    181f <tf_dp+0x6ff>
mov    -0x98(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    183e <tf_dp+0x71e>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1843 <tf_dp+0x723>
jmp    1848 <tf_dp+0x728>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    177d <tf_dp+0x65d>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tf_dp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
test   %edi,%edi
je     1668 <tf_dp+0x548>
mov    %edi,%r12d
cmp    $0x1,%edi
je     13ce <tf_dp+0x2ae>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1152 <tf_dp+0x32>
jnp    13ce <tf_dp+0x2ae>
mov    %rdx,0x10(%rsp)
lea    (%r12,%r12,1),%eax
movslq %eax,%rbp
shl    $0x3,%rbp
mov    %rbp,%rdi
mov    %rsi,0x28(%rsp)
movapd %xmm0,0x30(%rsp)
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1040 <malloc@plt>
mov    %rax,%r13
mov    %rbp,%rdi
call   1040 <malloc@plt>
mov    %rax,%r15
lea    -0x1(%r12),%r14d
movslq %r12d,%rbp
lea    -0x1(%rbp),%rax
mov    %rax,0x8(%rsp)
lea    -0x8(,%rbp,8),%rdi
ff
mov    %rdi,0x20(%rsp)
call   1040 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    0x20(%rsp),%rdi
call   1040 <malloc@plt>
movapd 0x30(%rsp),%xmm3
mov    0x28(%rsp),%r10
mov    0x18(%rsp),%r9
movapd 0xe27(%rip),%xmm10
movsd  (%r10),%xmm0
movapd %xmm0,%xmm2
subsd  %xmm3,%xmm2
movsd  %xmm2,(%r9)
movapd %xmm3,%xmm1
subsd  %xmm0,%xmm1
addsd  %xmm3,%xmm0
movsd  %xmm0,(%rax)
movsd  %xmm2,-0x8(%rbx,%rbp,8)
movsd  %xmm0,(%rbx,%rbp,8)
movabs $0x3ff0000000000000,%rcx
mov    %rcx,-0x8(%r13,%rbp,8)
movsd  %xmm1,-0x8(%r15,%rbp,8)
movabs $0xbff0000000000000,%rcx
mov    %rcx,0x0(%r13,%rbp,8)
movsd  %xmm0,(%r15,%rbp,8)
movsd  0x8(%r10),%xmm2
movapd %xmm2,%xmm0
xorpd  %xmm10,%xmm0
subsd  %xmm3,%xmm0
cmp    $0x3,%r12d
jl     146c <tf_dp+0x34c>
movapd %xmm3,%xmm1
xorpd  %xmm10,%xmm1
mov    %r14d,%r8d
mov    $0x1,%edx
movsd  0xda8(%rip),%xmm8
movsd  0xda7(%rip),%xmm9
movapd 0xd87(%rip),%xmm6
mov    %r12d,%ebp
jmp    1315 <tf_dp+0x1f5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%r14d
movapd %xmm9,%xmm4
movapd %xmm1,%xmm5
subsd  %xmm0,%xmm5
divsd  %xmm7,%xmm5
movsd  %xmm5,(%r9,%rdx,8)
movslq %r14d,%rcx
movsd  %xmm5,(%rbx,%rcx,8)
addsd  %xmm3,%xmm2
movapd %xmm4,%xmm5
xorpd  %xmm10,%xmm5
movslq %ebp,%rsi
addsd  %xmm3,%xmm0
movsd  %xmm0,(%r15,%rcx,8)
movsd  %xmm2,0x8(%r15,%rsi,8)
divsd  %xmm5,%xmm2
movsd  %xmm2,(%rax,%rdx,8)
add    $0x1,%ebp
movsd  %xmm2,0x8(%rbx,%rsi,8)
movsd  %xmm7,0x0(%r13,%rcx,8)
movsd  %xmm4,0x8(%r13,%rsi,8)
movsd  0x8(%r10,%rdx,8),%xmm2
add    $0x1,%rdx
movapd %xmm2,%xmm0
xorpd  %xmm10,%xmm0
subsd  %xmm3,%xmm0
cmp    %r8,%rdx
je     1471 <tf_dp+0x351>
movslq %ebp,%rsi
cmp    %ebp,%r14d
jle    1330 <tf_dp+0x210>
movapd %xmm8,%xmm7
jmp    1372 <tf_dp+0x252>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %r14d,%rcx
lea    0x1(%rbp),%edi
add    $0xffffffffffffffff,%rcx
movapd %xmm8,%xmm7
nop
movsd  0x8(%rbx,%rcx,8),%xmm5
mulsd  %xmm7,%xmm5
addsd  %xmm0,%xmm5
ucomisd %xmm1,%xmm5
ja     1372 <tf_dp+0x252>
addsd  0x8(%r13,%rcx,8),%xmm7
addsd  0x8(%r15,%rcx,8),%xmm0
add    $0x1,%r14d
add    $0x1,%rcx
cmp    %rsi,%rcx
jl     1340 <tf_dp+0x220>
mov    %edi,%r14d
subsd  %xmm3,%xmm2
cmp    %r14d,%ebp
jl     1290 <tf_dp+0x170>
movslq %r14d,%rdi
add    $0xffffffff,%r14d
add    $0x1,%rsi
movapd %xmm9,%xmm4
nop
movapd %xmm4,%xmm5
xorpd  %xmm6,%xmm5
mulsd  -0x8(%rbx,%rsi,8),%xmm5
subsd  %xmm2,%xmm5
ucomisd %xmm5,%xmm3
ja     1299 <tf_dp+0x179>
addsd  -0x8(%r13,%rsi,8),%xmm4
addsd  -0x8(%r15,%rsi,8),%xmm2
add    $0xffffffff,%ebp
add    $0xffffffffffffffff,%rsi
cmp    %rdi,%rsi
jg     1390 <tf_dp+0x270>
mov    %r14d,%ebp
jmp    1299 <tf_dp+0x179>
test   %r12d,%r12d
jle    1668 <tf_dp+0x548>
mov    %r12d,%r9d
cmp    $0x4,%r12d
jb     13fa <tf_dp+0x2da>
lea    (%rsi,%r9,8),%rcx
cmp    %rdx,%rcx
jbe    1586 <tf_dp+0x466>
lea    (%rdx,%r9,8),%rcx
cmp    %rsi,%rcx
jbe    1586 <tf_dp+0x466>
xor    %ecx,%ecx
mov    %rcx,%rdi
not    %rdi
add    %r9,%rdi
mov    %r9,%rax
and    $0x3,%rax
je     1424 <tf_dp+0x304>
xchg   %ax,%ax
movsd  (%rsi,%rcx,8),%xmm0
movsd  %xmm0,(%rdx,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rax
jne    1410 <tf_dp+0x2f0>
cmp    $0x3,%rdi
jb     1668 <tf_dp+0x548>
xchg   %ax,%ax
movsd  (%rsi,%rcx,8),%xmm0
movsd  %xmm0,(%rdx,%rcx,8)
movsd  0x8(%rsi,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rdx,%rcx,8)
movsd  0x10(%rsi,%rcx,8),%xmm0
movsd  %xmm0,0x10(%rdx,%rcx,8)
movsd  0x18(%rsi,%rcx,8),%xmm0
movsd  %xmm0,0x18(%rdx,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%r9
jne    1430 <tf_dp+0x310>
jmp    1668 <tf_dp+0x548>
mov    %r12d,%ebp
jmp    148a <tf_dp+0x36a>
cmp    %ebp,%r14d
jle    148a <tf_dp+0x36a>
movsd  0xb92(%rip),%xmm1
mov    0x10(%rsp),%rdx
mov    0x8(%rsp),%r10
jmp    14e6 <tf_dp+0x3c6>
movslq %r14d,%rdi
lea    (%rbx,%rdi,8),%rcx
lea    0x0(,%rdi,8),%r8
add    %r13,%r8
lea    (%r15,%rdi,8),%rsi
sub    %edi,%ebp
add    $0x1,%ebp
movsd  0xb63(%rip),%xmm1
xor    %edi,%edi
xorpd  %xmm2,%xmm2
mov    0x10(%rsp),%rdx
mov    0x8(%rsp),%r10
nopl   (%rax)
movsd  (%rcx,%rdi,8),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm0,%xmm3
ucomisd %xmm2,%xmm3
ja     14e6 <tf_dp+0x3c6>
addsd  (%r8,%rdi,8),%xmm1
addsd  (%rsi,%rdi,8),%xmm0
add    $0x1,%rdi
cmp    %edi,%ebp
jne    14c0 <tf_dp+0x3a0>
xorpd  0xb12(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rdx,%r10,8)
cmp    $0x2,%r12d
jl     154a <tf_dp+0x42a>
add    $0xfffffffe,%r12d
add    $0x1,%r12
jmp    151d <tf_dp+0x3fd>
nopl   0x0(%rax,%rax,1)
movsd  %xmm1,-0x8(%rdx,%r12,8)
add    $0xffffffffffffffff,%r12
jle    154a <tf_dp+0x42a>
movsd  (%rdx,%r12,8),%xmm0
movsd  -0x8(%rax,%r12,8),%xmm1
ucomisd %xmm1,%xmm0
ja     1510 <tf_dp+0x3f0>
movsd  -0x8(%r9,%r12,8),%xmm1
ucomisd %xmm0,%xmm1
ja     1510 <tf_dp+0x3f0>
movsd  %xmm0,-0x8(%rdx,%r12,8)
add    $0xffffffffffffffff,%r12
jg     151d <tf_dp+0x3fd>
mov    %rbx,%rdi
mov    %r9,%rbx
mov    %rax,%rbp
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
mov    %r9d,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdi
mov    %rdi,%rbx
shr    $0x2,%rbx
add    $0x1,%rbx
mov    %ebx,%r8d
and    $0x3,%r8d
cmp    $0xc,%rdi
jae    15ac <tf_dp+0x48c>
xor    %edi,%edi
jmp    161c <tf_dp+0x4fc>
and    $0xfffffffffffffffc,%rbx
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movups (%rsi,%rdi,8),%xmm0
movups 0x10(%rsi,%rdi,8),%xmm1
movups %xmm0,(%rdx,%rdi,8)
movups %xmm1,0x10(%rdx,%rdi,8)
movups 0x20(%rsi,%rdi,8),%xmm0
movups 0x30(%rsi,%rdi,8),%xmm1
movups %xmm0,0x20(%rdx,%rdi,8)
movups %xmm1,0x30(%rdx,%rdi,8)
movups 0x40(%rsi,%rdi,8),%xmm0
movups 0x50(%rsi,%rdi,8),%xmm1
movups %xmm0,0x40(%rdx,%rdi,8)
movups %xmm1,0x50(%rdx,%rdi,8)
movupd 0x60(%rsi,%rdi,8),%xmm0
movupd 0x70(%rsi,%rdi,8),%xmm1
movupd %xmm0,0x60(%rdx,%rdi,8)
movupd %xmm1,0x70(%rdx,%rdi,8)
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rbx
jne    15c0 <tf_dp+0x4a0>
test   %r8,%r8
je     165f <tf_dp+0x53f>
lea    (%rdx,%rdi,8),%rax
add    $0x10,%rax
lea    (%rsi,%rdi,8),%rdi
add    $0x10,%rdi
shl    $0x5,%r8
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movupd -0x10(%rdi,%rbp,1),%xmm0
movupd (%rdi,%rbp,1),%xmm1
movupd %xmm0,-0x10(%rax,%rbp,1)
movupd %xmm1,(%rax,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%r8
jne    1640 <tf_dp+0x520>
cmp    %r9,%rcx
jne    13fc <tf_dp+0x2dc>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @tf_dp(i32 %0, double* %1, double %2, double* %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double*
%24 = alloca double*
%25 = alloca double*
%26 = alloca double*
%27 = alloca double*
store i32 %0, i32* %5
store double* %1, double** %6
store double %2, double* %7
store double* %3, double** %8
%28 = load i32, i32* %5
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %4
br label %453
31: ; preds = %4
%32 = load i32, i32* %5
%33 = icmp eq i32 %32, 1
br i1 %33, label %37, label %34
34: ; preds = %31
%35 = load double, double* %7
%36 = fcmp oeq double %35, 0.000000e+00
br i1 %36, label %37, label %56
37: ; preds = %34, %31
store i32 0, i32* %9
br label %38
38: ; preds = %52, %37
%39 = load i32, i32* %9
%40 = load i32, i32* %5
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %55
42: ; preds = %38
%43 = load double*, double** %6
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
%47 = load double, double* %46
%48 = load double*, double** %8
%49 = load i32, i32* %9
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
store double %47, double* %51
br label %52
52: ; preds = %42
%53 = load i32, i32* %9
%54 = add nsw i32 %53, 1
store i32 %54, i32* %9
br label %38
55: ; preds = %38
br label %453
56: ; preds = %34
%57 = load i32, i32* %5
%58 = mul nsw i32 2, %57
%59 = sext i32 %58 to i64
%60 = mul i64 %59, 8
%61 = call i8* @malloc(i64 %60)
%62 = bitcast i8* %61 to double*
store double* %62, double** %23
%63 = load i32, i32* %5
%64 = mul nsw i32 2, %63
%65 = sext i32 %64 to i64
%66 = mul i64 %65, 8
%67 = call i8* @malloc(i64 %66)
%68 = bitcast i8* %67 to double*
store double* %68, double** %24
%69 = load i32, i32* %5
%70 = mul nsw i32 2, %69
%71 = sext i32 %70 to i64
%72 = mul i64 %71, 8
%73 = call i8* @malloc(i64 %72)
%74 = bitcast i8* %73 to double*
store double* %74, double** %25
%75 = load i32, i32* %5
%76 = sub nsw i32 %75, 1
%77 = sext i32 %76 to i64
%78 = mul i64 %77, 8
%79 = call i8* @malloc(i64 %78)
%80 = bitcast i8* %79 to double*
store double* %80, double** %26
%81 = load i32, i32* %5
%82 = sub nsw i32 %81, 1
%83 = sext i32 %82 to i64
%84 = mul i64 %83, 8
%85 = call i8* @malloc(i64 %84)
%86 = bitcast i8* %85 to double*
store double* %86, double** %27
%87 = load double, double* %7
%88 = fneg double %87
%89 = load double*, double** %6
%90 = getelementptr inbounds double, double* %89, i64 0
%91 = load double, double* %90
%92 = fadd double %88, %91
%93 = load double*, double** %26
%94 = getelementptr inbounds double, double* %93, i64 0
store double %92, double* %94
%95 = load double, double* %7
%96 = load double*, double** %6
%97 = getelementptr inbounds double, double* %96, i64 0
%98 = load double, double* %97
%99 = fadd double %95, %98
%100 = load double*, double** %27
%101 = getelementptr inbounds double, double* %100, i64 0
store double %99, double* %101
%102 = load i32, i32* %5
%103 = sub nsw i32 %102, 1
store i32 %103, i32* %11
%104 = load i32, i32* %5
store i32 %104, i32* %12
%105 = load double*, double** %26
%106 = getelementptr inbounds double, double* %105, i64 0
%107 = load double, double* %106
%108 = load double*, double** %23
%109 = load i32, i32* %11
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double, double* %108, i64 %110
store double %107, double* %111
%112 = load double*, double** %27
%113 = getelementptr inbounds double, double* %112, i64 0
%114 = load double, double* %113
%115 = load double*, double** %23
%116 = load i32, i32* %12
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %115, i64 %117
store double %114, double* %118
%119 = load double*, double** %24
%120 = load i32, i32* %11
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %119, i64 %121
store double 1.000000e+00, double* %122
%123 = load double*, double** %6
%124 = getelementptr inbounds double, double* %123, i64 0
%125 = load double, double* %124
%126 = fneg double %125
%127 = load double, double* %7
%128 = fadd double %126, %127
%129 = load double*, double** %25
%130 = load i32, i32* %11
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds double, double* %129, i64 %131
store double %128, double* %132
%133 = load double*, double** %24
%134 = load i32, i32* %12
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds double, double* %133, i64 %135
store double -1.000000e+00, double* %136
%137 = load double*, double** %6
%138 = getelementptr inbounds double, double* %137, i64 0
%139 = load double, double* %138
%140 = load double, double* %7
%141 = fadd double %139, %140
%142 = load double*, double** %25
%143 = load i32, i32* %12
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds double, double* %142, i64 %144
store double %141, double* %145
store double 1.000000e+00, double* %15
%146 = load double*, double** %6
%147 = getelementptr inbounds double, double* %146, i64 1
%148 = load double, double* %147
%149 = fneg double %148
%150 = load double, double* %7
%151 = fsub double %149, %150
store double %151, double* %17
store double -1.000000e+00, double* %16
%152 = load double*, double** %6
%153 = getelementptr inbounds double, double* %152, i64 1
%154 = load double, double* %153
%155 = load double, double* %7
%156 = fsub double %154, %155
store double %156, double* %18
store i32 1, i32* %10
br label %157
157: ; preds = %325, %56
%158 = load i32, i32* %10
%159 = load i32, i32* %5
%160 = sub nsw i32 %159, 1
%161 = icmp slt i32 %158, %160
br i1 %161, label %162, label %328
162: ; preds = %157
%163 = load double, double* %15
store double %163, double* %19
%164 = load double, double* %17
store double %164, double* %20
%165 = load i32, i32* %11
store i32 %165, i32* %13
br label %166
166: ; preds = %198, %162
%167 = load i32, i32* %13
%168 = load i32, i32* %12
%169 = icmp sle i32 %167, %168
br i1 %169, label %170, label %201
170: ; preds = %166
%171 = load double, double* %19
%172 = load double*, double** %23
%173 = load i32, i32* %13
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
%176 = load double, double* %175
%177 = load double, double* %20
%178 = call double @llvm.fmuladd.f64(double %171, double %176, double %177)
%179 = load double, double* %7
%180 = fneg double %179
%181 = fcmp ogt double %178, %180
br i1 %181, label %182, label %183
182: ; preds = %170
br label %201
183: ; preds = %170
%184 = load double*, double** %24
%185 = load i32, i32* %13
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds double, double* %184, i64 %186
%188 = load double, double* %187
%189 = load double, double* %19
%190 = fadd double %189, %188
store double %190, double* %19
%191 = load double*, double** %25
%192 = load i32, i32* %13
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds double, double* %191, i64 %193
%195 = load double, double* %194
%196 = load double, double* %20
%197 = fadd double %196, %195
store double %197, double* %20
br label %198
198: ; preds = %183
%199 = load i32, i32* %13
%200 = add nsw i32 %199, 1
store i32 %200, i32* %13
br label %166
201: ; preds = %182, %166
%202 = load double, double* %16
store double %202, double* %21
%203 = load double, double* %18
store double %203, double* %22
%204 = load i32, i32* %12
store i32 %204, i32* %14
br label %205
205: ; preds = %238, %201
%206 = load i32, i32* %14
%207 = load i32, i32* %13
%208 = icmp sge i32 %206, %207
br i1 %208, label %209, label %241
209: ; preds = %205
%210 = load double, double* %21
%211 = fneg double %210
%212 = load double*, double** %23
%213 = load i32, i32* %14
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds double, double* %212, i64 %214
%216 = load double, double* %215
%217 = load double, double* %22
%218 = fneg double %217
%219 = call double @llvm.fmuladd.f64(double %211, double %216, double %218)
%220 = load double, double* %7
%221 = fcmp olt double %219, %220
br i1 %221, label %222, label %223
222: ; preds = %209
br label %241
223: ; preds = %209
%224 = load double*, double** %24
%225 = load i32, i32* %14
%226 = sext i32 %225 to i64
%227 = getelementptr inbounds double, double* %224, i64 %226
%228 = load double, double* %227
%229 = load double, double* %21
%230 = fadd double %229, %228
store double %230, double* %21
%231 = load double*, double** %25
%232 = load i32, i32* %14
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds double, double* %231, i64 %233
%235 = load double, double* %234
%236 = load double, double* %22
%237 = fadd double %236, %235
store double %237, double* %22
br label %238
238: ; preds = %223
%239 = load i32, i32* %14
%240 = add nsw i32 %239, -1
store i32 %240, i32* %14
br label %205
241: ; preds = %222, %205
%242 = load double, double* %7
%243 = fneg double %242
%244 = load double, double* %20
%245 = fsub double %243, %244
%246 = load double, double* %19
%247 = fdiv double %245, %246
%248 = load double*, double** %26
%249 = load i32, i32* %10
%250 = sext i32 %249 to i64
%251 = getelementptr inbounds double, double* %248, i64 %250
store double %247, double* %251
%252 = load i32, i32* %13
%253 = sub nsw i32 %252, 1
store i32 %253, i32* %11
%254 = load double*, double** %26
%255 = load i32, i32* %10
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds double, double* %254, i64 %256
%258 = load double, double* %257
%259 = load double*, double** %23
%260 = load i32, i32* %11
%261 = sext i32 %260 to i64
%262 = getelementptr inbounds double, double* %259, i64 %261
store double %258, double* %262
%263 = load double, double* %7
%264 = load double, double* %22
%265 = fadd double %263, %264
%266 = load double, double* %21
%267 = fneg double %266
%268 = fdiv double %265, %267
%269 = load double*, double** %27
%270 = load i32, i32* %10
%271 = sext i32 %270 to i64
%272 = getelementptr inbounds double, double* %269, i64 %271
store double %268, double* %272
%273 = load i32, i32* %14
%274 = add nsw i32 %273, 1
store i32 %274, i32* %12
%275 = load double*, double** %27
%276 = load i32, i32* %10
%277 = sext i32 %276 to i64
%278 = getelementptr inbounds double, double* %275, i64 %277
%279 = load double, double* %278
%280 = load double*, double** %23
%281 = load i32, i32* %12
%282 = sext i32 %281 to i64
%283 = getelementptr inbounds double, double* %280, i64 %282
store double %279, double* %283
%284 = load double, double* %19
%285 = load double*, double** %24
%286 = load i32, i32* %11
%287 = sext i32 %286 to i64
%288 = getelementptr inbounds double, double* %285, i64 %287
store double %284, double* %288
%289 = load double, double* %20
%290 = load double, double* %7
%291 = fadd double %289, %290
%292 = load double*, double** %25
%293 = load i32, i32* %11
%294 = sext i32 %293 to i64
%295 = getelementptr inbounds double, double* %292, i64 %294
store double %291, double* %295
%296 = load double, double* %21
%297 = load double*, double** %24
%298 = load i32, i32* %12
%299 = sext i32 %298 to i64
%300 = getelementptr inbounds double, double* %297, i64 %299
store double %296, double* %300
%301 = load double, double* %22
%302 = load double, double* %7
%303 = fadd double %301, %302
%304 = load double*, double** %25
%305 = load i32, i32* %12
%306 = sext i32 %305 to i64
%307 = getelementptr inbounds double, double* %304, i64 %306
store double %303, double* %307
store double 1.000000e+00, double* %15
%308 = load double*, double** %6
%309 = load i32, i32* %10
%310 = add nsw i32 %309, 1
%311 = sext i32 %310 to i64
%312 = getelementptr inbounds double, double* %308, i64 %311
%313 = load double, double* %312
%314 = fneg double %313
%315 = load double, double* %7
%316 = fsub double %314, %315
store double %316, double* %17
store double -1.000000e+00, double* %16
%317 = load double*, double** %6
%318 = load i32, i32* %10
%319 = add nsw i32 %318, 1
%320 = sext i32 %319 to i64
%321 = getelementptr inbounds double, double* %317, i64 %320
%322 = load double, double* %321
%323 = load double, double* %7
%324 = fsub double %322, %323
store double %324, double* %18
br label %325
325: ; preds = %241
%326 = load i32, i32* %10
%327 = add nsw i32 %326, 1
store i32 %327, i32* %10
br label %157
328: ; preds = %157
%329 = load double, double* %15
store double %329, double* %19
%330 = load double, double* %17
store double %330, double* %20
%331 = load i32, i32* %11
store i32 %331, i32* %13
br label %332
332: ; preds = %362, %328
%333 = load i32, i32* %13
%334 = load i32, i32* %12
%335 = icmp sle i32 %333, %334
br i1 %335, label %336, label %365
336: ; preds = %332
%337 = load double, double* %19
%338 = load double*, double** %23
%339 = load i32, i32* %13
%340 = sext i32 %339 to i64
%341 = getelementptr inbounds double, double* %338, i64 %340
%342 = load double, double* %341
%343 = load double, double* %20
%344 = call double @llvm.fmuladd.f64(double %337, double %342, double %343)
%345 = fcmp ogt double %344, 0.000000e+00
br i1 %345, label %346, label %347
346: ; preds = %336
br label %365
347: ; preds = %336
%348 = load double*, double** %24
%349 = load i32, i32* %13
%350 = sext i32 %349 to i64
%351 = getelementptr inbounds double, double* %348, i64 %350
%352 = load double, double* %351
%353 = load double, double* %19
%354 = fadd double %353, %352
store double %354, double* %19
%355 = load double*, double** %25
%356 = load i32, i32* %13
%357 = sext i32 %356 to i64
%358 = getelementptr inbounds double, double* %355, i64 %357
%359 = load double, double* %358
%360 = load double, double* %20
%361 = fadd double %360, %359
store double %361, double* %20
br label %362
362: ; preds = %347
%363 = load i32, i32* %13
%364 = add nsw i32 %363, 1
store i32 %364, i32* %13
br label %332
365: ; preds = %346, %332
%366 = load double, double* %20
%367 = fneg double %366
%368 = load double, double* %19
%369 = fdiv double %367, %368
%370 = load double*, double** %8
%371 = load i32, i32* %5
%372 = sub nsw i32 %371, 1
%373 = sext i32 %372 to i64
%374 = getelementptr inbounds double, double* %370, i64 %373
store double %369, double* %374
%375 = load i32, i32* %5
%376 = sub nsw i32 %375, 2
store i32 %376, i32* %10
br label %377
377: ; preds = %439, %365
%378 = load i32, i32* %10
%379 = icmp sge i32 %378, 0
br i1 %379, label %380, label %442
380: ; preds = %377
%381 = load double*, double** %8
%382 = load i32, i32* %10
%383 = add nsw i32 %382, 1
%384 = sext i32 %383 to i64
%385 = getelementptr inbounds double, double* %381, i64 %384
%386 = load double, double* %385
%387 = load double*, double** %27
%388 = load i32, i32* %10
%389 = sext i32 %388 to i64
%390 = getelementptr inbounds double, double* %387, i64 %389
%391 = load double, double* %390
%392 = fcmp ogt double %386, %391
br i1 %392, label %393, label %403
393: ; preds = %380
%394 = load double*, double** %27
%395 = load i32, i32* %10
%396 = sext i32 %395 to i64
%397 = getelementptr inbounds double, double* %394, i64 %396
%398 = load double, double* %397
%399 = load double*, double** %8
%400 = load i32, i32* %10
%401 = sext i32 %400 to i64
%402 = getelementptr inbounds double, double* %399, i64 %401
store double %398, double* %402
br label %438
403: ; preds = %380
%404 = load double*, double** %8
%405 = load i32, i32* %10
%406 = add nsw i32 %405, 1
%407 = sext i32 %406 to i64
%408 = getelementptr inbounds double, double* %404, i64 %407
%409 = load double, double* %408
%410 = load double*, double** %26
%411 = load i32, i32* %10
%412 = sext i32 %411 to i64
%413 = getelementptr inbounds double, double* %410, i64 %412
%414 = load double, double* %413
%415 = fcmp olt double %409, %414
br i1 %415, label %416, label %426
416: ; preds = %403
%417 = load double*, double** %26
%418 = load i32, i32* %10
%419 = sext i32 %418 to i64
%420 = getelementptr inbounds double, double* %417, i64 %419
%421 = load double, double* %420
%422 = load double*, double** %8
%423 = load i32, i32* %10
%424 = sext i32 %423 to i64
%425 = getelementptr inbounds double, double* %422, i64 %424
store double %421, double* %425
br label %437
426: ; preds = %403
%427 = load double*, double** %8
%428 = load i32, i32* %10
%429 = add nsw i32 %428, 1
%430 = sext i32 %429 to i64
%431 = getelementptr inbounds double, double* %427, i64 %430
%432 = load double, double* %431
%433 = load double*, double** %8
%434 = load i32, i32* %10
%435 = sext i32 %434 to i64
%436 = getelementptr inbounds double, double* %433, i64 %435
store double %432, double* %436
br label %437
437: ; preds = %426, %416
br label %438
438: ; preds = %437, %393
br label %439
439: ; preds = %438
%440 = load i32, i32* %10
%441 = add nsw i32 %440, -1
store i32 %441, i32* %10
br label %377
442: ; preds = %377
%443 = load double*, double** %23
%444 = bitcast double* %443 to i8*
%445 = load double*, double** %24
%446 = bitcast double* %445 to i8*
%447 = load double*, double** %25
%448 = bitcast double* %447 to i8*
%449 = load double*, double** %26
%450 = bitcast double* %449 to i8*
%451 = load double*, double** %27
%452 = bitcast double* %451 to i8*
br label %453
453: ; preds = %442, %55, %30
ret void
}

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