#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef size_t V;
typedef int K;

/* Variables and functions */
int /*<<< orphan*/ free(double *);
double ldf_Mult_smooth(int /*<<< orphan*/, double, int, double *, int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ normalizeLog(double *, int, int);
int sample_Mult(double *, int, int);
void resample_z(int D, int **M, int *N, double alpha, double eta,
                double **post_beta, double **post_theta, int ***w, int ***z,
                int K, int V) {
  int d_10;
  int n_16;
  int m_22;
  double *tmp_post_z_3;
  int tmp_idx_z_3;
  int dvv_loop_var_1;
  tmp_post_z_3 = (double *)malloc(sizeof(double) * (1 + ((K) + (1)) - (1)));
  for (d_10 = 1; d_10 <= D; d_10++) {
    for (n_16 = 1; n_16 <= N[d_10 - 1]; n_16++) {
      for (m_22 = 1; m_22 <= M[d_10 - 1][n_16 - 1]; m_22++) {
        post_theta[d_10 - 1][(K) + (1) - 1] += (0.0) - (1.0);
        post_theta[d_10 - 1][z[d_10 - 1][n_16 - 1][m_22 - 1] - 1] +=
            (0.0) - (1.0);
        post_beta[z[d_10 - 1][n_16 - 1][m_22 - 1] - 1][(V) + (1) - 1] +=
            (0.0) - ((1.0) * ((((z[d_10 - 1][n_16 - 1][m_22 - 1]) ==
                                (z[d_10 - 1][n_16 - 1][m_22 - 1]))
                                   ? 1
                                   : 0)));
        post_beta[z[d_10 - 1][n_16 - 1][m_22 - 1] - 1]
                 [w[d_10 - 1][n_16 - 1][m_22 - 1] - 1] +=
            (0.0) - ((1.0) * ((((z[d_10 - 1][n_16 - 1][m_22 - 1]) ==
                                (z[d_10 - 1][n_16 - 1][m_22 - 1]))
                                   ? 1
                                   : 0)));
        for (dvv_loop_var_1 = 1; dvv_loop_var_1 <= K; dvv_loop_var_1++) {
          tmp_post_z_3[dvv_loop_var_1 - 1] = 0.0;
        }
        tmp_post_z_3[(K) + (1) - 1] = (0.0) * (((1) + (K)) - (1));
        for (tmp_idx_z_3 = 1; tmp_idx_z_3 <= K; tmp_idx_z_3++) {
          tmp_post_z_3[tmp_idx_z_3 - 1] =
              (ldf_Mult_smooth(0, eta, w[d_10 - 1][n_16 - 1][m_22 - 1],
                               post_beta[tmp_idx_z_3 - 1], 1, V)) +
              (ldf_Mult_smooth(0, alpha, tmp_idx_z_3, post_theta[d_10 - 1], 1,
                               K));
        }
        normalizeLog(tmp_post_z_3, 1, K);
        z[d_10 - 1][n_16 - 1][m_22 - 1] = sample_Mult(tmp_post_z_3, 1, K);
        post_beta[z[d_10 - 1][n_16 - 1][m_22 - 1] - 1][(V) + (1) - 1] +=
            (1.0) * ((((z[d_10 - 1][n_16 - 1][m_22 - 1]) ==
                       (z[d_10 - 1][n_16 - 1][m_22 - 1]))
                          ? 1
                          : 0));
        post_beta[z[d_10 - 1][n_16 - 1][m_22 - 1] - 1]
                 [w[d_10 - 1][n_16 - 1][m_22 - 1] - 1] +=
            (1.0) * ((((z[d_10 - 1][n_16 - 1][m_22 - 1]) ==
                       (z[d_10 - 1][n_16 - 1][m_22 - 1]))
                          ? 1
                          : 0));
        post_theta[d_10 - 1][(K) + (1) - 1] += 1.0;
        post_theta[d_10 - 1][z[d_10 - 1][n_16 - 1][m_22 - 1] - 1] += 1.0;
      }
    }
  }
  free(tmp_post_z_3);
}


x86 assembly (clang, -O0):
<resample_z>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
mov    0x18(%rbp),%eax
add    $0x1,%eax
add    $0x1,%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x58(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     17c8 <resample_z+0x678>
movl   $0x1,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    -0x44(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jg     17b5 <resample_z+0x665>
movl   $0x1,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    -0x44(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x48(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jg     17a2 <resample_z+0x652>
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    0x18(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xddb(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    0x10(%rbp),%rcx
mov    -0x44(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x48(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x4c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xd88(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
cvtsi2sd %eax,%xmm1
xorps  %xmm0,%xmm0
subsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
mov    0x10(%rbp),%rcx
mov    -0x44(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x48(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x4c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    0x20(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
cvtsi2sd %eax,%xmm1
xorps  %xmm0,%xmm0
subsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
mov    0x10(%rbp),%rcx
mov    -0x44(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x48(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x4c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x40(%rbp),%rcx
mov    -0x44(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x48(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x4c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    0x18(%rbp),%eax
jg     144e <resample_z+0x2fe>
mov    -0x58(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    141f <resample_z+0x2cf>
mov    0x18(%rbp),%eax
add    $0x1,%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
xorps  %xmm0,%xmm0
mulsd  %xmm1,%xmm0
mov    -0x58(%rbp),%rax
mov    0x18(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    0x18(%rbp),%eax
jg     1534 <resample_z+0x3e4>
movsd  -0x28(%rbp),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x30(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    0x20(%rbp),%r8d
xor    %edi,%edi
mov    $0x1,%ecx
call   1070 <ldf_Mult_smooth@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x5c(%rbp),%esi
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    0x18(%rbp),%r8d
xor    %edi,%edi
mov    $0x1,%ecx
call   1070 <ldf_Mult_smooth@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
addsd  %xmm1,%xmm0
mov    -0x58(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    147e <resample_z+0x32e>
mov    -0x58(%rbp),%rdi
mov    0x18(%rbp),%edx
mov    $0x1,%esi
call   1040 <normalizeLog@plt>
mov    -0x58(%rbp),%rdi
mov    0x18(%rbp),%edx
mov    $0x1,%esi
call   1050 <sample_Mult@plt>
mov    %eax,%edx
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
cvtsi2sd %eax,%xmm0
mov    -0x30(%rbp),%rax
mov    0x10(%rbp),%rcx
mov    -0x44(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x48(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x4c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    0x20(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
cvtsi2sd %eax,%xmm0
mov    -0x30(%rbp),%rax
mov    0x10(%rbp),%rcx
mov    -0x44(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x48(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x4c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x40(%rbp),%rcx
mov    -0x44(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x48(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x4c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    0x18(%rbp),%ecx
add    $0x1,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0x8d1(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    0x10(%rbp),%rcx
mov    -0x44(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x48(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
mov    -0x4c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0x87e(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11da <resample_z+0x8a>
jmp    17a7 <resample_z+0x657>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11ba <resample_z+0x6a>
jmp    17ba <resample_z+0x66a>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11a7 <resample_z+0x57>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resample_z>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9,0x18(%rsp)
mov    %r8,0x20(%rsp)
mov    %rcx,%r14
movsd  %xmm1,0x78(%rsp)
movsd  %xmm0,0x70(%rsp)
mov    %rdx,0x28(%rsp)
mov    %rsi,0x38(%rsp)
mov    %edi,%ebx
mov    0xd0(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0xc8(%rsp),%r12d
mov    0xc0(%rsp),%rax
mov    %rax,0x40(%rsp)
lea    0x8(,%r12,8),%edi
call   1070 <malloc@plt>
mov    %rax,(%rsp)
mov    %rbx,0x10(%rsp)
test   %ebx,%ebx
jle    14cb <resample_z+0x36b>
movslq %r12d,%r8
movslq 0xc(%rsp),%r9
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
xorpd  %xmm1,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x30(%rsp)
mov    %r12d,%eax
shl    $0x3,%rax
mov    %rax,0x58(%rsp)
lea    0x1(%r12),%ecx
mov    0x10(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x10(%rsp)
add    $0xfffffffffffffffe,%rcx
mov    %rcx,0x68(%rsp)
mov    $0x1,%r15d
mov    %r14,0x50(%rsp)
mov    %r12,%r13
mov    %r8,0x48(%rsp)
mov    %r9,0x60(%rsp)
jmp    124f <resample_z+0xef>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r15
cmp    0x10(%rsp),%r15
je     14cb <resample_z+0x36b>
mov    0x28(%rsp),%rax
mov    -0x4(%rax,%r15,4),%eax
test   %eax,%eax
jle    1240 <resample_z+0xe0>
mov    0x38(%rsp),%rcx
mov    -0x8(%rcx,%r15,8),%rsi
mov    $0x1,%ebx
jmp    1289 <resample_z+0x129>
xchg   %ax,%ax
mov    0x28(%rsp),%rax
mov    -0x4(%rax,%r15,4),%eax
lea    0x1(%rbx),%rcx
movslq %eax,%rdx
cmp    %rdx,%rbx
mov    %rcx,%rbx
jge    1240 <resample_z+0xe0>
cmpl   $0x0,-0x4(%rsi,%rbx,4)
jle    127a <resample_z+0x11a>
mov    0x20(%rsp),%rax
mov    -0x8(%rax,%r15,8),%rdx
mov    0x40(%rsp),%rax
mov    -0x8(%rax,%r15,8),%rax
mov    -0x8(%rax,%rbx,8),%rcx
mov    0x18(%rsp),%rax
mov    -0x8(%rax,%r15,8),%rax
mov    -0x8(%rax,%rbx,8),%rax
mov    $0x1,%ebp
jmp    13b3 <resample_z+0x253>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rsp),%rax
movsd  0x30(%rsp),%xmm0
movsd  %xmm0,(%rax,%r8,8)
mov    (%rsp),%r14
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r13,%r12
mov    %r12d,%edx
call   1040 <normalizeLog@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r12d,%edx
call   1060 <sample_Mult@plt>
mov    0x40(%rsp),%rcx
mov    -0x8(%rcx,%r15,8),%rcx
mov    -0x8(%rcx,%rbx,8),%rcx
mov    %eax,-0x4(%rcx,%rbp,4)
movslq %eax,%rsi
mov    0x50(%rsp),%r14
mov    -0x8(%r14,%rsi,8),%rdx
mov    0x60(%rsp),%r9
movsd  (%rdx,%r9,8),%xmm0
movsd  0xcce(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rdx,%r9,8)
mov    0x18(%rsp),%rax
mov    -0x8(%rax,%r15,8),%rax
mov    -0x8(%rax,%rbx,8),%rax
movslq -0x4(%rax,%rbp,4),%rdi
movsd  -0x8(%rdx,%rdi,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rdx,%rdi,8)
mov    0x20(%rsp),%rdx
mov    -0x8(%rdx,%r15,8),%rdx
mov    0x48(%rsp),%r8
movsd  (%rdx,%r8,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rdx,%r8,8)
movsd  -0x8(%rdx,%rsi,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rdx,%rsi,8)
mov    0x38(%rsp),%rsi
mov    -0x8(%rsi,%r15,8),%rsi
movslq -0x4(%rsi,%rbx,4),%rdi
cmp    %rdi,%rbp
lea    0x1(%rbp),%rbp
jge    1270 <resample_z+0x110>
movsd  (%rdx,%r8,8),%xmm0
movsd  0xc3f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rdx,%r8,8)
movslq -0x4(%rcx,%rbp,4),%rcx
movsd  -0x8(%rdx,%rcx,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rdx,%rcx,8)
mov    -0x8(%r14,%rcx,8),%rcx
movsd  (%rcx,%r9,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rcx,%r9,8)
movslq -0x4(%rax,%rbp,4),%r14
movsd  -0x8(%rcx,%r14,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rcx,%r14,8)
test   %r12d,%r12d
jle    12d0 <resample_z+0x170>
mov    (%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    0x58(%rsp),%rdx
call   1050 <memset@plt>
movsd  0x30(%rsp),%xmm0
mov    0x48(%rsp),%rax
movsd  %xmm0,(%r12,%rax,8)
xor    %r12d,%r12d
nopl   0x0(%rax)
mov    0x50(%rsp),%rax
mov    (%rax,%r12,8),%rdx
xor    %edi,%edi
movsd  0x78(%rsp),%xmm0
mov    %r14d,%esi
mov    $0x1,%ecx
mov    0xc(%rsp),%r8d
call   1080 <ldf_Mult_smooth@plt>
movsd  %xmm0,0x80(%rsp)
mov    0x20(%rsp),%rax
mov    -0x8(%rax,%r15,8),%rdx
lea    0x1(%r12),%esi
xor    %edi,%edi
movsd  0x70(%rsp),%xmm0
mov    $0x1,%ecx
mov    %r13d,%r8d
call   1080 <ldf_Mult_smooth@plt>
addsd  0x80(%rsp),%xmm0
mov    (%rsp),%rax
movsd  %xmm0,(%rax,%r12,8)
cmp    %r12,0x68(%rsp)
je     12e0 <resample_z+0x180>
mov    0x18(%rsp),%rax
mov    -0x8(%rax,%r15,8),%rax
mov    -0x8(%rax,%rbx,8),%rax
mov    -0x4(%rax,%rbp,4),%r14d
add    $0x1,%r12
jmp    1440 <resample_z+0x2e0>
mov    (%rsp),%rdi
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @resample_z(i32 %0, i32** nocapture %1, i32* nocapture %2, double %3, double %4, double** nocapture %5, double** nocapture %6, i32*** nocapture %7, i32*** nocapture %8, i32 %9, i32 %10) {
%12 = shl i32 %9, 3
%13 = add i32 %12, 8
%14 = tail call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to double*
%16 = inttoptr i64 %14 to i8*
%17 = icmp slt i32 %0, 1
br i1 %17, label %157, label %18
18: ; preds = %11
%19 = sext i32 %9 to i64
%20 = sext i32 %10 to i64
%21 = icmp slt i32 %9, 1
%22 = sitofp i32 %9 to double
%23 = fmul double %22, 0.000000e+00
%24 = getelementptr inbounds double, double* %15, i64 %19
%25 = zext i32 %9 to i64
%26 = shl nuw nsw i64 %25, 3
%27 = add i32 %9, 1
%28 = add nuw i32 %0, 1
%29 = zext i32 %28 to i64
%30 = zext i32 %27 to i64
br label %31
31: ; preds = %18, %154
%32 = phi i64 [ 1, %18 ], [ %155, %154 ]
%33 = add nsw i64 %32, -1
%34 = getelementptr inbounds i32, i32* %2, i64 %33
%35 = load i32, i32* %34
%36 = icmp slt i32 %35, 1
br i1 %36, label %154, label %37
37: ; preds = %31
%38 = getelementptr inbounds i32*, i32** %1, i64 %33
%39 = getelementptr inbounds double*, double** %6, i64 %33
%40 = getelementptr inbounds i32**, i32*** %8, i64 %33
%41 = getelementptr inbounds i32**, i32*** %7, i64 %33
%42 = load i32*, i32** %38
br label %43
43: ; preds = %37, %148
%44 = phi i32 [ %35, %37 ], [ %149, %148 ]
%45 = phi i32* [ %42, %37 ], [ %150, %148 ]
%46 = phi i64 [ 1, %37 ], [ %151, %148 ]
%47 = add nsw i64 %46, -1
%48 = getelementptr inbounds i32, i32* %45, i64 %47
%49 = load i32, i32* %48
%50 = icmp slt i32 %49, 1
br i1 %50, label %148, label %51
51: ; preds = %43
%52 = load double*, double** %39
%53 = load i32**, i32*** %40
%54 = getelementptr inbounds i32*, i32** %53, i64 %47
%55 = load i32*, i32** %54
%56 = load i32**, i32*** %41
%57 = getelementptr inbounds i32*, i32** %56, i64 %47
%58 = load i32*, i32** %57
br label %59
59: ; preds = %51, %109
%60 = phi i32* [ %58, %51 ], [ %125, %109 ]
%61 = phi i32* [ %55, %51 ], [ %114, %109 ]
%62 = phi double* [ %52, %51 ], [ %133, %109 ]
%63 = phi i64 [ 1, %51 ], [ %140, %109 ]
%64 = getelementptr inbounds double, double* %62, i64 %19
%65 = load double, double* %64
%66 = fadd double %65, -1.000000e+00
store double %66, double* %64
%67 = add nsw i64 %63, -1
%68 = getelementptr inbounds i32, i32* %61, i64 %67
%69 = load i32, i32* %68
%70 = add nsw i32 %69, -1
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %62, i64 %71
%73 = load double, double* %72
%74 = fadd double %73, -1.000000e+00
store double %74, double* %72
%75 = getelementptr inbounds double*, double** %5, i64 %71
%76 = load double*, double** %75
%77 = getelementptr inbounds double, double* %76, i64 %20
%78 = load double, double* %77
%79 = fadd double %78, -1.000000e+00
store double %79, double* %77
%80 = getelementptr inbounds i32, i32* %60, i64 %67
%81 = load i32, i32* %80
%82 = add nsw i32 %81, -1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %76, i64 %83
%85 = load double, double* %84
%86 = fadd double %85, -1.000000e+00
store double %86, double* %84
br i1 %21, label %87, label %88
87: ; preds = %59
store double %23, double* %24
br label %109
88: ; preds = %59
store double %23, double* %24
br label %89
89: ; preds = %103, %88
%90 = phi i32 [ %81, %88 ], [ %108, %103 ]
%91 = phi i64 [ 1, %88 ], [ %101, %103 ]
%92 = add nsw i64 %91, -1
%93 = getelementptr inbounds double*, double** %5, i64 %92
%94 = load double*, double** %93
%95 = tail call double @ldf_Mult_smooth(i32 0, double %4, i32 %90, double* %94, i32 1, i32 %10)
%96 = load double*, double** %39
%97 = trunc i64 %91 to i32
%98 = tail call double @ldf_Mult_smooth(i32 0, double %3, i32 %97, double* %96, i32 1, i32 %9)
%99 = fadd double %95, %98
%100 = getelementptr inbounds double, double* %15, i64 %92
store double %99, double* %100
%101 = add nuw nsw i64 %91, 1
%102 = icmp eq i64 %101, %30
br i1 %102, label %109, label %103
103: ; preds = %89
%104 = load i32**, i32*** %41
%105 = getelementptr inbounds i32*, i32** %104, i64 %47
%106 = load i32*, i32** %105
%107 = getelementptr inbounds i32, i32* %106, i64 %67
%108 = load i32, i32* %107
br label %89
109: ; preds = %89, %87
%110 = tail call i32 @normalizeLog(double* %15, i32 1, i32 %9)
%111 = tail call i32 @sample_Mult(double* %15, i32 1, i32 %9)
%112 = load i32**, i32*** %40
%113 = getelementptr inbounds i32*, i32** %112, i64 %47
%114 = load i32*, i32** %113
%115 = getelementptr inbounds i32, i32* %114, i64 %67
store i32 %111, i32* %115
%116 = add nsw i32 %111, -1
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double*, double** %5, i64 %117
%119 = load double*, double** %118
%120 = getelementptr inbounds double, double* %119, i64 %20
%121 = load double, double* %120
%122 = fadd double %121, 1.000000e+00
store double %122, double* %120
%123 = load i32**, i32*** %41
%124 = getelementptr inbounds i32*, i32** %123, i64 %47
%125 = load i32*, i32** %124
%126 = getelementptr inbounds i32, i32* %125, i64 %67
%127 = load i32, i32* %126
%128 = add nsw i32 %127, -1
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds double, double* %119, i64 %129
%131 = load double, double* %130
%132 = fadd double %131, 1.000000e+00
store double %132, double* %130
%133 = load double*, double** %39
%134 = getelementptr inbounds double, double* %133, i64 %19
%135 = load double, double* %134
%136 = fadd double %135, 1.000000e+00
store double %136, double* %134
%137 = getelementptr inbounds double, double* %133, i64 %117
%138 = load double, double* %137
%139 = fadd double %138, 1.000000e+00
store double %139, double* %137
%140 = add nuw nsw i64 %63, 1
%141 = load i32*, i32** %38
%142 = getelementptr inbounds i32, i32* %141, i64 %47
%143 = load i32, i32* %142
%144 = sext i32 %143 to i64
%145 = icmp slt i64 %63, %144
br i1 %145, label %59, label %146
146: ; preds = %109
%147 = load i32, i32* %34
br label %148
148: ; preds = %146, %43
%149 = phi i32 [ %147, %146 ], [ %44, %43 ]
%150 = phi i32* [ %141, %146 ], [ %45, %43 ]
%151 = add nuw nsw i64 %46, 1
%152 = sext i32 %149 to i64
%153 = icmp slt i64 %46, %152
br i1 %153, label %43, label %154
154: ; preds = %148, %31
%155 = add nuw nsw i64 %32, 1
%156 = icmp eq i64 %155, %29
br i1 %156, label %157, label %31
157: ; preds = %154, %11
%158 = tail call i32 @free(double* %15)
ret void
}