user: 请从给定的汇编指令推导出C源代码:

```asm
<resample_z>:
  endbr64
  push   %r15
  push   %r14
  mov    %r9,%r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %r8,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x98,%rsp
  mov    %edi,0x8c(%rsp)
  movslq 0xe8(%rsp),%rdi
  mov    %rdx,0x78(%rsp)
  mov    0xf0(%rsp),%edx
  mov    %edi,0x54(%rsp)
  shl    $0x2,%rdi
  mov    0xd0(%rsp),%r12
  mov    %rcx,(%rsp)
  mov    0xd8(%rsp),%r13
  mov    %edx,0x88(%rsp)
  mov    0xe0(%rsp),%r15
  movsd  %xmm0,0x58(%rsp)
  movsd  %xmm1,0x8(%rsp)
  call   <malloc@plt>
  mov    %rax,0x40(%rsp)
  mov    0x54(%rsp),%eax
  add    $0x1,%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  mov    %rax,0x80(%rsp)
  call   <malloc@plt>
  mov    0x8c(%rsp),%edi
  mov    %rax,0x48(%rsp)
  test   %edi,%edi
  jle    L68
  mov    0x88(%rsp),%edx
  mov    %rbx,0x30(%rsp)
  mov    %r12,%r11
  mov    %r14,%r10
  mov    %rbp,0x20(%rsp)
  movsd  D17(%rip),%xmm2
  lea    0x1(%rdx),%eax
  movsd  0x8(%rsp),%xmm1
  mov    (%rsp),%rdx
  movq   $0x1,0x70(%rsp)
  cltq
  mov    %r15,0x38(%rsp)
  mov    %r13,%r15
  lea    -0x8(,%rax,8),%rax
  mov    %rax,0x60(%rsp)
  nopw   0x0(%rax,%rax,1)
L4:
  mov    0x78(%rsp),%rax
  mov    0x70(%rsp),%rsi
  mov    -0x4(%rax,%rsi,4),%ecx
  test   %ecx,%ecx
  jle    L31
  mov    0x30(%rsp),%rax
  mov    %r10,%rbx
  mov    %r15,%r10
  movq   $0x0,0x68(%rsp)
  mov    %rbx,%r15
  mov    (%rax),%rax
L52:
  mov    0x68(%rsp),%rbx
  lea    0x0(,%rbx,4),%rsi
  mov    %rsi,0x28(%rsp)
  mov    (%rax,%rbx,4),%esi
  test   %esi,%esi
  jle    L62
  mov    (%r10),%rax
  lea    0x0(,%rbx,8),%r13
  mov    (%rax,%rbx,8),%rsi
  mov    (%r11),%rax
  mov    (%rax,%rbx,8),%rbp
  mov    0x80(%rsp),%rax
  xor    %ebx,%ebx
  lea    -0x8(%rax),%r14
  mov    0x20(%rsp),%rax
  mov    (%rax),%rcx
  jmp    L76
  nopl   0x0(%rax,%rax,1)
L13:
  movslq 0x0(%rbp,%r12,1),%rax
  lea    -0x8(,%rax,8),%rax
L92:
  mov    0x20(%rsp),%rcx
  mov    0x28(%rsp),%r9
  add    $0x1,%rbx
  mov    (%rcx),%rcx
  lea    (%rcx,%r14,1),%rdi
  add    %rcx,%rax
  movsd  (%rdi),%xmm0
  addsd  %xmm2,%xmm0
  movsd  %xmm0,(%rdi)
  movsd  (%rax),%xmm0
  lea    0x1(%rbx),%edi
  addsd  %xmm2,%xmm0
  movsd  %xmm0,(%rax)
  mov    0x30(%rsp),%rax
  mov    (%rax),%rax
  cmp    %edi,(%rax,%r9,1)
  jl     L20
L76:
  lea    0x0(,%rbx,4),%r12
  mov    (%r15),%rdi
  mov    (%rsi,%rbx,4),%esi
  add    %r12,%rbp
  movslq 0x0(%rbp),%r8
  mov    (%rdi,%r13,1),%rdi
  shl    $0x3,%r8
  mov    (%rdi,%rbx,4),%edi
  lea    -0x8(%r8),%rax
  cmp    $0x1,%esi
  jne    L57
  mov    -0x8(%rdx,%r8,1),%r8
  mov    0x60(%rsp),%r9
  add    %r8,%r9
  movsd  (%r9),%xmm0
  subsd  %xmm2,%xmm0
  movsd  %xmm0,(%r9)
  movslq %edi,%r9
  lea    -0x8(%r8,%r9,8),%r8
  movsd  (%r8),%xmm0
  subsd  %xmm2,%xmm0
  movsd  %xmm0,(%r8)
L57:
  lea    (%rcx,%r14,1),%r8
  add    %rcx,%rax
  mov    %r11,0x18(%rsp)
  sub    $0x8,%rsp
  movsd  (%r8),%xmm0
  mov    %r10,0x18(%rsp)
  subsd  %xmm2,%xmm0
  movsd  %xmm0,(%r8)
  movsd  (%rax),%xmm0
  subsd  %xmm2,%xmm0
  movsd  %xmm0,(%rax)
  push   0x50(%rsp)
  push   0x50(%rsp)
  mov    0x50(%rsp),%rax
  push   (%rax)
  movsd  0x78(%rsp),%xmm0
  mov    $0x2,%eax
  mov    0x74(%rsp),%r9d
  mov    0xa8(%rsp),%r8d
  mov    %rdx,0x20(%rsp)
  movsd  %xmm1,0x28(%rsp)
  call   <sample_Mult_labeled_stop@plt>
  mov    0x30(%rsp),%r10
  mov    0x38(%rsp),%r11
  add    $0x20,%rsp
  mov    (%rsp),%rdx
  movsd  0x8(%rsp),%xmm1
  mov    %eax,0x0(%rbp)
  mov    (%r10),%rax
  mov    (%rax,%r13,1),%rsi
  mov    D17(%rip),%rax
  movq   %rax,%xmm2
  mov    (%r11),%rax
  cmpl   $0x1,(%rsi,%r12,1)
  mov    (%rax,%r13,1),%rbp
  jne    L13
  movslq 0x0(%rbp,%r12,1),%rcx
  mov    0x60(%rsp),%rdi
  shl    $0x3,%rcx
  lea    -0x8(%rcx),%rax
  mov    -0x8(%rdx,%rcx,1),%rcx
  add    %rcx,%rdi
  movsd  (%rdi),%xmm0
  addsd  %xmm2,%xmm0
  movsd  %xmm0,(%rdi)
  mov    (%r15),%rdi
  mov    (%rdi,%r13,1),%rdi
  movslq (%rdi,%r12,1),%rdi
  lea    -0x8(%rcx,%rdi,8),%rcx
  movsd  (%rcx),%xmm0
  addsd  %xmm2,%xmm0
  movsd  %xmm0,(%rcx)
  jmp    L92
  nopl   0x0(%rax)
L20:
  mov    0x78(%rsp),%rsi
  mov    0x70(%rsp),%rbx
  mov    -0x4(%rsi,%rbx,4),%ecx
L62:
  addq   $0x1,0x68(%rsp)
  mov    0x68(%rsp),%rbx
  mov    %ebx,%esi
  add    $0x1,%esi
  cmp    %ecx,%esi
  jle    L52
  mov    %r15,%rax
  mov    %r10,%r15
  mov    %rax,%r10
L31:
  addq   $0x1,0x70(%rsp)
  add    $0x8,%r11
  mov    0x70(%rsp),%rax
  add    $0x8,%r10
  addq   $0x8,0x30(%rsp)
  add    $0x8,%r15
  addq   $0x8,0x20(%rsp)
  addq   $0x8,0x38(%rsp)
  cmp    %eax,0x8c(%rsp)
  jge    L4
L68:
  mov    0x40(%rsp),%rdi
  call   <free@plt>
  mov    0x48(%rsp),%rdi
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <free@plt>
```

tool_calls: name: parse_data
arguments: data_label: D17
type: f64

tool: D17: 1

assistant: ```c
void resample_z(int D, int **M, int *N, double alpha, double eta, double psi, double **post_beta, double **post_theta, int ***w, int ***z, int ***s, int **labels, 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;
  int *labelIdx = (int *)malloc(K * sizeof(int));
  double *post_z = (double *)malloc((K + 1) * sizeof(double));
  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++) {
        if (s[d_10 - 1][n_16 - 1][m_22 - 1] == 1) {
          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)));
        }
        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);
        z[d_10 - 1][n_16 - 1][m_22 - 1] = sample_Mult_labeled_stop(w[d_10 - 1][n_16 - 1][m_22 - 1], s[d_10 - 1][n_16 - 1][m_22 - 1], post_beta, post_theta[d_10 - 1], V, K, alpha, eta, labels[d_10 - 1], labelIdx, post_z);
        if (s[d_10 - 1][n_16 - 1][m_22 - 1] == 1) {
          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(labelIdx);
  free(post_z);
}
```