void fast_s_with_memory(double **x, double *y, int *nn, int *pp, int *NN,
                        int *K, int *bbest_r, double *bb, double *rrhoc,
                        double **best_betas, double *best_scales) {
  void refine_fast_s(double **x, double *y, double *weights, int n, int p,
                     double *res, double *tmp, double *tmp2, double **tmp_mat,
                     double **tmp_mat2, double *beta_cand, int kk, int conv,
                     double b, double rhoc, double *is, double *beta_ref,
                     double *scale);
  int find_max(double *a, int n);
  double find_scale(double *r, double b, double rhoc, double initial_scale,
                    int n, int p);
  double loss_rho(double *r, double s, int n, int p, double rhoc);
  double vecprime_vec(double *a, double *b, int n);
  void sample_n_outof_N(int n, int N, int *x);
  int lu(double **a, int *P, double *x);
  register int i, j, k, no_resamples;
  int n = *nn, p = *pp, Nres = *NN, kk = *K;
  int *b_i, flag, conv;
  double **x_samp, *beta_cand, *beta_ref, *res, aux;
  double b = *bb, rhoc = *rrhoc, sc, worst_sc = 1e+20;
  double *weights;
  int best_r = *bbest_r, pos_worst_scale;
  double *tmp, *tmp2, **tmp_mat2, **tmp_mat;
  for (i = 0; i < best_r; i++) {
    best_scales[i] = 1e+20;
  };
  pos_worst_scale = 0;
  res = (double *)malloc(n * sizeof(double));
  tmp = (double *)malloc(n * sizeof(double));
  tmp2 = (double *)malloc(n * sizeof(double));
  weights = (double *)malloc(n * sizeof(double));
  beta_cand = (double *)malloc(p * sizeof(double));
  beta_ref = (double *)malloc(p * sizeof(double));
  b_i = (int *)malloc(n * sizeof(int));
  x_samp = (double **)malloc(n * sizeof(double *));
  tmp_mat = (double **)malloc(p * sizeof(double *));
  tmp_mat2 = (double **)malloc(p * sizeof(double *));
  for (i = 0; i < n; i++) {
    x_samp[i] = (double *)malloc((p + 1) * sizeof(double));
  }
  for (i = 0; i < p; i++) {
    tmp_mat[i] = (double *)malloc(p * sizeof(double));
    tmp_mat2[i] = (double *)malloc((p + 1) * sizeof(double));
  };
  conv = 0;
  aux = -1.0;
  for (i = 0; i < Nres; i++) {
    flag = 1;
    no_resamples = 0;
    while (flag == 1) {
      if ((++no_resamples) > 500) {
        return;
      };
      sample_n_outof_N(p, n - 1, b_i);
      for (j = 0; j < p; j++) {
        for (k = 0; k < p; k++)
          x_samp[j][k] = x[b_i[j]][k];
        x_samp[j][p] = y[b_i[j]];
      };
      flag = lu(x_samp, pp, beta_cand);
    };
    refine_fast_s(x, y, weights, n, p, res, tmp, tmp2, tmp_mat, tmp_mat2,
                  beta_cand, kk, conv, b, rhoc, &aux, beta_ref, &sc);
    if (loss_rho(res, worst_sc, n, p, rhoc) < b) {
      sc = find_scale(res, b, rhoc, sc, n, p);
      k = pos_worst_scale;
      best_scales[k] = sc;
      for (j = 0; j < p; j++)
        best_betas[k][j] = beta_ref[j];
      pos_worst_scale = find_max(best_scales, best_r);
      worst_sc = best_scales[pos_worst_scale];
    };
  };
  free(tmp);
  free(tmp2);
  free(res);
  free(weights);
  free(beta_cand);
  free(beta_ref);
  free(b_i);
  for (i = 0; i < n; i++) {
    free(x_samp[i]);
  };
  for (i = 0; i < p; i++) {
    free(tmp_mat[i]);
    free(tmp_mat2[i]);
  };
  free(x_samp);
  free(tmp_mat);
  free(tmp_mat2);
}


x86 assembly (clang, -O0):
<fast_s_with_memory>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
mov    %r9,-0x58(%rbp)
mov    -0x40(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x48(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    -0x50(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    -0x58(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x78(%rbp)
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  0xdf4(%rip),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xdc(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0xdc(%rbp),%eax
jge    1259 <fast_s_with_memory+0xd9>
mov    0x30(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  0xdba(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1227 <fast_s_with_memory+0xa7>
movl   $0x0,-0xe0(%rbp)
movslq -0x6c(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xa8(%rbp)
movslq -0x6c(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xe8(%rbp)
movslq -0x6c(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xf0(%rbp)
movslq -0x6c(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xd8(%rbp)
movslq -0x70(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x98(%rbp)
movslq -0x70(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xa0(%rbp)
movslq -0x6c(%rbp),%rdi
shl    $0x2,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x80(%rbp)
movslq -0x6c(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x90(%rbp)
movslq -0x70(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x100(%rbp)
movslq -0x70(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xf8(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jge    136d <fast_s_with_memory+0x1ed>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0x90(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    132f <fast_s_with_memory+0x1af>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    13d1 <fast_s_with_memory+0x251>
movslq -0x70(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0x100(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x70(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0xf8(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1374 <fast_s_with_memory+0x1f4>
movl   $0x0,-0x88(%rbp)
movsd  0xc25(%rip),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    16e8 <fast_s_with_memory+0x568>
movl   $0x1,-0x84(%rbp)
movl   $0x0,-0x68(%rbp)
cmpl   $0x1,-0x84(%rbp)
jne    150d <fast_s_with_memory+0x38d>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
cmp    $0x1f4,%eax
jle    1435 <fast_s_with_memory+0x2b5>
jmp    17db <fast_s_with_memory+0x65b>
mov    -0x70(%rbp),%edi
mov    -0x6c(%rbp),%esi
sub    $0x1,%esi
mov    -0x80(%rbp),%rdx
call   1040 <sample_n_outof_N@plt>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    14eb <fast_s_with_memory+0x36b>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    14b0 <fast_s_with_memory+0x330>
mov    -0x30(%rbp),%rax
mov    -0x80(%rbp),%rcx
movslq -0x60(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x90(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1461 <fast_s_with_memory+0x2e1>
mov    -0x38(%rbp),%rax
mov    -0x80(%rbp),%rcx
movslq -0x60(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x90(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x70(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    144e <fast_s_with_memory+0x2ce>
mov    -0x90(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x98(%rbp),%rdx
call   1050 <lu@plt>
mov    %eax,-0x84(%rbp)
jmp    140f <fast_s_with_memory+0x28f>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0xd8(%rbp),%rdx
mov    -0x6c(%rbp),%ecx
mov    -0x70(%rbp),%r8d
mov    -0xa8(%rbp),%r9
mov    -0xe8(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    -0xf0(%rbp),%rax
mov    %rax,-0x110(%rbp)
mov    -0x100(%rbp),%r13
mov    -0xf8(%rbp),%r12
mov    -0x98(%rbp),%r15
mov    -0x78(%rbp),%r14d
mov    -0x88(%rbp),%ebx
movsd  -0xb8(%rbp),%xmm0
ff
movsd  -0xc0(%rbp),%xmm1
ff
mov    -0xa0(%rbp),%r10
lea    -0xb0(%rbp),%r11
lea    -0xc8(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    -0x118(%rbp),%rax
mov    %rax,(%rsp)
mov    -0x110(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x108(%rbp),%rax
mov    %r13,0x10(%rsp)
mov    %r12,0x18(%rsp)
mov    %r15,0x20(%rsp)
mov    %r14d,0x28(%rsp)
mov    %ebx,0x30(%rsp)
mov    %r11,0x38(%rsp)
mov    %r10,0x40(%rsp)
mov    %rax,0x48(%rsp)
call   1060 <refine_fast_s@plt>
mov    -0xa8(%rbp),%rdi
movsd  -0xd0(%rbp),%xmm0
ff
mov    -0x6c(%rbp),%esi
mov    -0x70(%rbp),%edx
movsd  -0xc0(%rbp),%xmm1
ff
call   1080 <loss_rho@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    16d5 <fast_s_with_memory+0x555>
mov    -0xa8(%rbp),%rdi
movsd  -0xb8(%rbp),%xmm0
ff
movsd  -0xc0(%rbp),%xmm1
ff
movsd  -0xc8(%rbp),%xmm2
ff
mov    -0x6c(%rbp),%esi
mov    -0x70(%rbp),%edx
call   10a0 <find_scale@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0xe0(%rbp),%eax
mov    %eax,-0x64(%rbp)
movsd  -0xc8(%rbp),%xmm0
ff
mov    0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    16a8 <fast_s_with_memory+0x528>
mov    -0xa0(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x28(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x60(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1669 <fast_s_with_memory+0x4e9>
mov    0x30(%rbp),%rdi
mov    -0xdc(%rbp),%esi
call   1090 <find_max@plt>
mov    %eax,-0xe0(%rbp)
mov    0x30(%rbp),%rax
movslq -0xe0(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
jmp    16da <fast_s_with_memory+0x55a>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    13f2 <fast_s_with_memory+0x272>
mov    -0xe8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xf0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xd8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jge    176e <fast_s_with_memory+0x5ee>
mov    -0x90(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1740 <fast_s_with_memory+0x5c0>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    17b7 <fast_s_with_memory+0x637>
mov    -0x100(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xf8(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1775 <fast_s_with_memory+0x5f5>
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
mov    -0x100(%rbp),%rdi
call   1030 <free@plt>
mov    -0xf8(%rbp),%rdi
call   1030 <free@plt>
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<fast_s_with_memory>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rsi,0xa8(%rsp)
mov    0x160(%rsp),%rbp
mov    0x140(%rsp),%r10
mov    0x150(%rsp),%rax
mov    0x148(%rsp),%rsi
movslq (%rdx),%rdx
mov    %rdx,0x20(%rsp)
mov    %edx,%ebx
mov    %rcx,0xf0(%rsp)
movslq (%rcx),%r14
mov    %r14d,%r13d
mov    (%r8),%ecx
mov    %ecx,0x14(%rsp)
mov    (%r9),%ecx
mov    %rcx,0xe0(%rsp)
movsd  (%rsi),%xmm1
movsd  (%rax),%xmm0
movsd  %xmm0,0x30(%rsp)
mov    (%r10),%r8d
test   %r8d,%r8d
jle    132e <fast_s_with_memory+0x1ae>
cmp    $0x4,%r8d
jae    120a <fast_s_with_memory+0x8a>
xor    %eax,%eax
jmp    1309 <fast_s_with_memory+0x189>
mov    %r8d,%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
jae    1231 <fast_s_with_memory+0xb1>
xor    %esi,%esi
jmp    12c6 <fast_s_with_memory+0x146>
and    $0xfffffffffffffff8,%rdx
xor    %esi,%esi
movapd 0xdc1(%rip),%xmm0
nop
movupd %xmm0,0x0(%rbp,%rsi,8)
movupd %xmm0,0x10(%rbp,%rsi,8)
movupd %xmm0,0x20(%rbp,%rsi,8)
movupd %xmm0,0x30(%rbp,%rsi,8)
movupd %xmm0,0x40(%rbp,%rsi,8)
movupd %xmm0,0x50(%rbp,%rsi,8)
movupd %xmm0,0x60(%rbp,%rsi,8)
movupd %xmm0,0x70(%rbp,%rsi,8)
movupd %xmm0,0x80(%rbp,%rsi,8)
movupd %xmm0,0x90(%rbp,%rsi,8)
movupd %xmm0,0xa0(%rbp,%rsi,8)
movupd %xmm0,0xb0(%rbp,%rsi,8)
movupd %xmm0,0xc0(%rbp,%rsi,8)
movupd %xmm0,0xd0(%rbp,%rsi,8)
movupd %xmm0,0xe0(%rbp,%rsi,8)
movupd %xmm0,0xf0(%rbp,%rsi,8)
add    $0x20,%rsi
add    $0xfffffffffffffff8,%rdx
jne    1240 <fast_s_with_memory+0xc0>
test   %rcx,%rcx
je     1304 <fast_s_with_memory+0x184>
lea    0x10(,%rsi,8),%rdx
add    %rbp,%rdx
shl    $0x5,%rcx
xor    %esi,%esi
movapd 0xd1c(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movupd %xmm0,-0x10(%rdx,%rsi,1)
movupd %xmm0,(%rdx,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%rcx
jne    12f0 <fast_s_with_memory+0x170>
cmp    %r8,%rax
je     132e <fast_s_with_memory+0x1ae>
movabs $0x4415af1d78b58c40,%rcx
af 15 44
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rcx,0x0(%rbp,%rax,8)
add    $0x1,%rax
cmp    %rax,%r8
jne    1320 <fast_s_with_memory+0x1a0>
mov    %r8,0xd8(%rsp)
movsd  %xmm1,0x98(%rsp)
mov    %rdi,0xa0(%rsp)
mov    0x20(%rsp),%r15
lea    0x0(,%r15,8),%r12
mov    %r12,%rdi
call   1070 <malloc@plt>
mov    %rax,0x50(%rsp)
mov    %r12,%rdi
call   1070 <malloc@plt>
mov    %rax,0x70(%rsp)
mov    %r12,%rdi
call   1070 <malloc@plt>
mov    %rax,0x68(%rsp)
mov    %r12,%rdi
call   1070 <malloc@plt>
mov    %rax,0x78(%rsp)
lea    0x0(,%r14,8),%rbp
mov    %rbp,%rdi
call   1070 <malloc@plt>
mov    %rax,0x48(%rsp)
mov    %rbp,%rdi
call   1070 <malloc@plt>
mov    %rax,0x18(%rsp)
lea    0x0(,%r15,4),%rdi
call   1070 <malloc@plt>
mov    %rax,0x90(%rsp)
mov    %r12,%rdi
call   1070 <malloc@plt>
mov    %rax,%r12
mov    %rbp,%rdi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    %rbp,0x28(%rsp)
mov    %rbp,%rdi
call   1070 <malloc@plt>
mov    %rax,0x38(%rsp)
test   %ebx,%ebx
jle    1417 <fast_s_with_memory+0x297>
lea    0x8(,%r14,8),%rax
mov    %rax,0x8(%rsp)
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rdi
call   1070 <malloc@plt>
mov    %rax,(%r12,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1400 <fast_s_with_memory+0x280>
mov    %r12,0x40(%rsp)
mov    %rbx,0x88(%rsp)
test   %r13d,%r13d
mov    0x38(%rsp),%r12
mov    0x28(%rsp),%rbx
jle    1473 <fast_s_with_memory+0x2f3>
lea    0x8(,%r13,8),%rax
mov    %rax,0x8(%rsp)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,(%r15,%rbp,8)
mov    0x8(%rsp),%rdi
call   1070 <malloc@plt>
mov    %rax,(%r12,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1450 <fast_s_with_memory+0x2d0>
mov    %r15,0x80(%rsp)
movabs $0xbff0000000000000,%rax
mov    %rax,0x100(%rsp)
cmpl   $0x0,0x14(%rsp)
mov    0x50(%rsp),%rbx
jle    1a0c <fast_s_with_memory+0x88c>
mov    0x20(%rsp),%rax
add    $0xffffffff,%eax
mov    %eax,0x58(%rsp)
mov    0x18(%rsp),%rax
lea    (%rax,%r13,8),%rcx
mov    %rcx,0xd0(%rsp)
mov    %r13d,%ecx
and    $0xfffffffc,%ecx
mov    %rcx,0x8(%rsp)
add    $0xfffffffffffffffc,%rcx
mov    %rcx,0x28(%rsp)
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
mov    %edx,%r12d
and    $0x3,%r12d
movabs $0x7ffffffffffffff8,%rsi
ff ff 7f
or     $0x4,%rsi
mov    %rdx,%rcx
mov    %rdx,0xc8(%rsp)
and    %rdx,%rsi
mov    %rsi,0xb0(%rsp)
mov    %r13d,%r15d
and    $0x3,%r15d
mov    %r12,0xf8(%rsp)
shl    $0x5,%r12
add    $0x10,%rax
mov    %rax,0xc0(%rsp)
movsd  0xae5(%rip),%xmm0
movsd  %xmm0,0x60(%rsp)
xor    %eax,%eax
movl   $0x0,0x10(%rsp)
mov    %rax,0xe8(%rsp)
xor    %eax,%eax
jmp    1592 <fast_s_with_memory+0x412>
nopw   0x0(%rax,%rax,1)
mov    0x5c(%rsp),%ebx
add    $0x1,%ebx
mov    0xf0(%rsp),%rsi
mov    0x48(%rsp),%rdx
call   1050 <lu@plt>
mov    0xa0(%rsp),%rdi
mov    0xa8(%rsp),%rsi
cmp    $0x1,%eax
mov    %ebx,%eax
movsd  0x98(%rsp),%xmm0
mov    0x50(%rsp),%rbx
jne    1780 <fast_s_with_memory+0x600>
cmp    $0x1f4,%eax
je     1ad5 <fast_s_with_memory+0x955>
mov    %eax,0x5c(%rsp)
mov    %r13d,%edi
mov    0x58(%rsp),%esi
mov    0x90(%rsp),%rbx
mov    %rbx,%rdx
call   1040 <sample_n_outof_N@plt>
mov    0xa0(%rsp),%r10
mov    0xa8(%rsp),%r9
test   %r13d,%r13d
mov    0x40(%rsp),%rdi
jle    1550 <fast_s_with_memory+0x3d0>
mov    %rbx,%r11
xor    %eax,%eax
jmp    15f9 <fast_s_with_memory+0x479>
nopl   (%rax)
movsd  (%r9,%r8,8),%xmm0
movsd  %xmm0,(%rdx,%r14,8)
add    $0x1,%rax
cmp    %r13,%rax
je     1550 <fast_s_with_memory+0x3d0>
movslq (%r11,%rax,4),%r8
mov    (%r10,%r8,8),%rsi
mov    (%rdi,%rax,8),%rdx
cmp    $0x4,%r14d
jb     1621 <fast_s_with_memory+0x4a1>
lea    (%rsi,%r13,8),%rcx
cmp    %rcx,%rdx
jae    16a0 <fast_s_with_memory+0x520>
lea    (%rdx,%r13,8),%rcx
cmp    %rcx,%rsi
jae    16a0 <fast_s_with_memory+0x520>
xor    %ebp,%ebp
mov    %rbp,%rbx
not    %rbx
add    %r13,%rbx
test   %r15,%r15
je     1654 <fast_s_with_memory+0x4d4>
mov    %r15,%rcx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rsi,%rbp,8),%xmm0
movsd  %xmm0,(%rdx,%rbp,8)
add    $0x1,%rbp
add    $0xffffffffffffffff,%rcx
jne    1640 <fast_s_with_memory+0x4c0>
cmp    $0x3,%rbx
jb     15e0 <fast_s_with_memory+0x460>
nopw   0x0(%rax,%rax,1)
movsd  (%rsi,%rbp,8),%xmm0
movsd  %xmm0,(%rdx,%rbp,8)
movsd  0x8(%rsi,%rbp,8),%xmm0
movsd  %xmm0,0x8(%rdx,%rbp,8)
movsd  0x10(%rsi,%rbp,8),%xmm0
movsd  %xmm0,0x10(%rdx,%rbp,8)
movsd  0x18(%rsi,%rbp,8),%xmm0
movsd  %xmm0,0x18(%rdx,%rbp,8)
add    $0x4,%rbp
cmp    %rbp,%r13
jne    1660 <fast_s_with_memory+0x4e0>
jmp    15e0 <fast_s_with_memory+0x460>
nopl   0x0(%rax)
cmpq   $0xc,0x28(%rsp)
jae    16ac <fast_s_with_memory+0x52c>
xor    %ecx,%ecx
jmp    171c <fast_s_with_memory+0x59c>
mov    0xb0(%rsp),%rbp
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
movups (%rsi,%rcx,8),%xmm0
movups 0x10(%rsi,%rcx,8),%xmm1
movups %xmm0,(%rdx,%rcx,8)
movups %xmm1,0x10(%rdx,%rcx,8)
movups 0x20(%rsi,%rcx,8),%xmm0
movups 0x30(%rsi,%rcx,8),%xmm1
movups %xmm0,0x20(%rdx,%rcx,8)
movups %xmm1,0x30(%rdx,%rcx,8)
movups 0x40(%rsi,%rcx,8),%xmm0
movups 0x50(%rsi,%rcx,8),%xmm1
movups %xmm0,0x40(%rdx,%rcx,8)
movups %xmm1,0x50(%rdx,%rcx,8)
movupd 0x60(%rsi,%rcx,8),%xmm0
movupd 0x70(%rsi,%rcx,8),%xmm1
movupd %xmm0,0x60(%rdx,%rcx,8)
movupd %xmm1,0x70(%rdx,%rcx,8)
add    $0x10,%rcx
add    $0xfffffffffffffffc,%rbp
jne    16c0 <fast_s_with_memory+0x540>
cmpq   $0x0,0xf8(%rsp)
je     1760 <fast_s_with_memory+0x5e0>
lea    (%rdx,%rcx,8),%rbp
add    $0x10,%rbp
lea    (%rsi,%rcx,8),%rcx
add    $0x10,%rcx
xor    %ebx,%ebx
nopl   0x0(%rax)
movupd -0x10(%rcx,%rbx,1),%xmm0
movupd (%rcx,%rbx,1),%xmm1
movupd %xmm0,-0x10(%rbp,%rbx,1)
movupd %xmm1,0x0(%rbp,%rbx,1)
add    $0x20,%rbx
cmp    %rbx,%r12
jne    1740 <fast_s_with_memory+0x5c0>
mov    0x8(%rsp),%rcx
mov    %rcx,%rbp
cmp    %r13,%rcx
je     15e0 <fast_s_with_memory+0x460>
jmp    1623 <fast_s_with_memory+0x4a3>
cs nopw 0x0(%rax,%rax,1)
mov    0x78(%rsp),%rdx
mov    0x88(%rsp),%rbp
mov    %ebp,%ecx
mov    %r13d,%r8d
mov    %rbx,%r9
movsd  0x30(%rsp),%xmm1
lea    0xb8(%rsp),%rax
push   %rax
push   0x20(%rsp)
lea    0x110(%rsp),%rax
push   %rax
push   $0x0
push   0x100(%rsp)
push   0x70(%rsp)
push   0x68(%rsp)
push   0xb8(%rsp)
push   0xa8(%rsp)
push   0xb8(%rsp)
call   1060 <refine_fast_s@plt>
add    $0x50,%rsp
mov    %rbx,%rdi
movsd  0x60(%rsp),%xmm0
mov    0x20(%rsp),%rsi
mov    %r13d,%edx
movsd  0x30(%rsp),%xmm1
call   1080 <loss_rho@plt>
movsd  0x98(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    19f7 <fast_s_with_memory+0x877>
movsd  0xb8(%rsp),%xmm2
mov    %rbx,%rdi
movapd %xmm1,%xmm0
movsd  0x30(%rsp),%xmm1
mov    %ebp,%esi
mov    %r13d,%edx
call   10a0 <find_scale@plt>
movsd  %xmm0,0xb8(%rsp)
movslq 0x10(%rsp),%rax
mov    0x160(%rsp),%rcx
movsd  %xmm0,(%rcx,%rax,8)
test   %r13d,%r13d
mov    0xd8(%rsp),%rsi
mov    0x18(%rsp),%rbp
jle    19d0 <fast_s_with_memory+0x850>
mov    0x158(%rsp),%rcx
mov    (%rcx,%rax,8),%rax
cmp    $0x4,%r14d
jb     1889 <fast_s_with_memory+0x709>
cmp    %rax,0xd0(%rsp)
jbe    18fd <fast_s_with_memory+0x77d>
lea    (%rax,%r13,8),%rcx
cmp    %rcx,%rbp
jae    18fd <fast_s_with_memory+0x77d>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
add    %r13,%rdx
test   $0x3,%r13b
je     18b5 <fast_s_with_memory+0x735>
mov    %r15,%rdi
nopl   (%rax)
movsd  0x0(%rbp,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rdi
jne    18a0 <fast_s_with_memory+0x720>
cmp    $0x3,%rdx
jb     19d0 <fast_s_with_memory+0x850>
nop
movsd  0x0(%rbp,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  0x8(%rbp,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rax,%rcx,8)
movsd  0x10(%rbp,%rcx,8),%xmm0
movsd  %xmm0,0x10(%rax,%rcx,8)
movsd  0x18(%rbp,%rcx,8),%xmm0
movsd  %xmm0,0x18(%rax,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%r13
jne    18c0 <fast_s_with_memory+0x740>
jmp    19d0 <fast_s_with_memory+0x850>
cmpq   $0xc,0x28(%rsp)
jae    1909 <fast_s_with_memory+0x789>
xor    %ecx,%ecx
jmp    197d <fast_s_with_memory+0x7fd>
mov    0xb0(%rsp),%rdx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups 0x0(%rbp,%rcx,8),%xmm0
movups 0x10(%rbp,%rcx,8),%xmm1
movups %xmm0,(%rax,%rcx,8)
movups %xmm1,0x10(%rax,%rcx,8)
movups 0x20(%rbp,%rcx,8),%xmm0
movups 0x30(%rbp,%rcx,8),%xmm1
movups %xmm0,0x20(%rax,%rcx,8)
movups %xmm1,0x30(%rax,%rcx,8)
movups 0x40(%rbp,%rcx,8),%xmm0
movups 0x50(%rbp,%rcx,8),%xmm1
movups %xmm0,0x40(%rax,%rcx,8)
movups %xmm1,0x50(%rax,%rcx,8)
movupd 0x60(%rbp,%rcx,8),%xmm0
movupd 0x70(%rbp,%rcx,8),%xmm1
movupd %xmm0,0x60(%rax,%rcx,8)
movupd %xmm1,0x70(%rax,%rcx,8)
add    $0x10,%rcx
add    $0xfffffffffffffffc,%rdx
jne    1920 <fast_s_with_memory+0x7a0>
testb  $0x3,0xc8(%rsp)
03
je     19bf <fast_s_with_memory+0x83f>
lea    (%rax,%rcx,8),%rdx
add    $0x10,%rdx
mov    0xc0(%rsp),%rdi
lea    (%rdi,%rcx,8),%rcx
xor    %edi,%edi
nopl   (%rax)
movupd -0x10(%rcx,%rdi,1),%xmm0
movupd (%rcx,%rdi,1),%xmm1
movupd %xmm0,-0x10(%rdx,%rdi,1)
movupd %xmm1,(%rdx,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%r12
jne    19a0 <fast_s_with_memory+0x820>
mov    0x8(%rsp),%rdx
mov    %rdx,%rcx
cmp    %r13,%rdx
jne    188b <fast_s_with_memory+0x70b>
mov    0x160(%rsp),%rbp
mov    %rbp,%rdi
call   1090 <find_max@plt>
mov    %eax,0x10(%rsp)
cltq
movsd  0x0(%rbp,%rax,8),%xmm0
movsd  %xmm0,0x60(%rsp)
mov    0x50(%rsp),%rbx
mov    0xe8(%rsp),%rax
add    $0x1,%eax
cmp    0x14(%rsp),%eax
jne    153b <fast_s_with_memory+0x3bb>
mov    0x70(%rsp),%rdi
call   1030 <free@plt>
mov    0x68(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x78(%rsp),%rdi
call   1030 <free@plt>
mov    0x48(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x90(%rsp),%rdi
call   1030 <free@plt>
cmpl   $0x0,0x88(%rsp)
mov    0x40(%rsp),%rbx
jle    1a82 <fast_s_with_memory+0x902>
mov    0x20(%rsp),%r14d
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%rbx,%rbp,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1a70 <fast_s_with_memory+0x8f0>
test   %r13d,%r13d
mov    0x80(%rsp),%rbx
mov    0x38(%rsp),%r14
jle    1abb <fast_s_with_memory+0x93b>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    (%rbx,%rbp,8),%rdi
call   1030 <free@plt>
mov    (%r14,%rbp,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1aa0 <fast_s_with_memory+0x920>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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