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

```asm
<resample_post_theta>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,%r12d
  mov    %edi,0x4(%rsp)
  mov    %esi,%r14d
  mov    %esi,(%rsp)
  mov    %rdx,%r13
  mov    %rcx,%r15
  mov    %r8,0x10(%rsp)
  mov    %r9,0x18(%rsp)
  lea    0x1(%rsi),%eax
  movslq %eax,%rbx
  lea    0x0(,%rax,8),%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %r12d,%r12d
  jle    L39
  lea    -0x8(%rax,%rbx,8),%rbx
  mov    0x70(%rsp),%r12
  lea    -0x1(%r14),%eax
  lea    0x8(%rbp,%rax,8),%rax
  mov    %rax,0x8(%rsp)
  mov    $0x1,%r14d
  jmp    L108
L97:
  movsd  (%rbx),%xmm0
  addsd  D17(%rip),%xmm0
  movsd  %xmm0,(%rbx)
  mov    (%r12),%rcx
  mov    (%rcx,%rdi,1),%rcx
  movslq (%rcx,%rdx,1),%rcx
  lea    -0x8(%rbp,%rcx,8),%rcx
  movsd  (%rcx),%xmm0
  addsd  D17(%rip),%xmm0
  movsd  %xmm0,(%rcx)
  add    $0x1,%eax
  add    $0x4,%rdx
  mov    (%r8),%rcx
  cmp    %eax,(%rcx,%rsi,1)
  jge    L97
L11:
  add    $0x1,%r9d
  add    $0x4,%rsi
  cmp    %r9d,-0x4(%r15,%r14,4)
  jl     L135
L25:
  mov    %r13,%r8
  mov    0x0(%r13),%rcx
  lea    (%rsi,%rsi,1),%rdi
  mov    $0x0,%edx
  mov    $0x1,%eax
  cmpl   $0x0,(%rcx,%rsi,1)
  jg     L97
  jmp    L11
L135:
  cmpq   $0x0,0x68(%rsp)
  je     L2
  mov    0x68(%rsp),%rax
  mov    -0x4(%rax,%r14,4),%eax
  cmp    $0xffffffff,%eax
  je     L123
  cltq
  mov    0x18(%rsp),%rdi
  mov    (%rdi,%rax,8),%rdi
  mov    (%rsp),%edx
  mov    %rbp,%rsi
  call   <add_dst@plt>
L117:
  add    $0x1,%r14
  add    $0x8,%r13
  add    $0x8,%r12
  cmp    %r14d,0x4(%rsp)
  jl     L39
L108:
  mov    %rbp,%rax
  mov    0x8(%rsp),%rdx
  cmpl   $0x0,(%rsp)
  jle    L81
L84:
  movq   $0x0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L84
L81:
  pxor   %xmm0,%xmm0
  cvtsi2sdl (%rsp),%xmm0
  pxor   %xmm1,%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  mov    $0x0,%esi
  mov    $0x1,%r9d
  cmpl   $0x0,-0x4(%r15,%r14,4)
  jg     L25
  jmp    L135
L2:
  mov    0x10(%rsp),%rax
  mov    -0x8(%rax,%r14,8),%rdi
  mov    (%rsp),%edx
  mov    %rbp,%rsi
  call   <sample_Delta@plt>
  jmp    L117
L123:
  mov    0x10(%rsp),%rax
  mov    -0x8(%rax,%r14,8),%rdi
  mov    (%rsp),%edx
  mov    %rbp,%rsi
  call   <sample_Delta@plt>
  mov    0x10(%rsp),%rax
  mov    -0x8(%rax,%r14,8),%rdi
  mov    (%rsp),%edx
  mov    0x60(%rsp),%rsi
  call   <add_dst@plt>
  jmp    L117
L39:
  mov    %rbp,%rdi
  call   <free@plt>
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: label: D17
type_infered: f64

tool: D17: 1

assistant: ```c
void resample_post_theta(int D, int K, int **M, int *N, double **post_theta, double **post_theta_train, double *global_topic_counts, int *entity_map, int ***z) {
  int d_9;
  double *tmpSP7;
  int n_3;
  int m_75;
  int dvv_loop_var_1;
  int i;
  tmpSP7 = (double *)malloc(sizeof(double) * (1 + ((K) + (1)) - (1)));
  for (d_9 = 1; d_9 <= D; d_9++) {
    for (dvv_loop_var_1 = 1; dvv_loop_var_1 <= K; dvv_loop_var_1++) {
      tmpSP7[dvv_loop_var_1 - 1] = 0.0;
    }
    tmpSP7[(K) + (1) - 1] = (0.0) * (((1) + (K)) - (1));
    for (n_3 = 1; n_3 <= N[d_9 - 1]; n_3++) {
      for (m_75 = 1; m_75 <= M[d_9 - 1][n_3 - 1]; m_75++) {
        tmpSP7[(K) + (1) - 1] += 1.0;
        tmpSP7[z[d_9 - 1][n_3 - 1][m_75 - 1] - 1] += 1.0;
      }
    }
    if (entity_map == NULL) {
      sample_Delta(post_theta[d_9 - 1], tmpSP7, K);
    } else if (entity_map[d_9 - 1] == -1) {
      sample_Delta(post_theta[d_9 - 1], tmpSP7, K);
      add_dst(post_theta[d_9 - 1], global_topic_counts, K);
    } else {
      add_dst(post_theta_train[entity_map[d_9 - 1]], tmpSP7, K);
    }
  }
  free(tmpSP7);
}
```