user: 请将以下的汇编代码转换成C语言代码:

```asm
<resample_post_theta>:
  endbr64
  push   %r15
  lea    0x1(%rsi),%eax
  mov    %edi,%r15d
  push   %r14
  movslq %eax,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x48,%rsp
  mov    %edi,0x14(%rsp)
  lea    0x0(,%rax,8),%edi
  mov    0x80(%rsp),%rbp
  mov    %rdx,0x28(%rsp)
  mov    0x88(%rsp),%r13
  mov    %rcx,0x18(%rsp)
  mov    %r8,0x30(%rsp)
  mov    %r9,0x38(%rsp)
  call   <malloc@plt>
  mov    %rax,%r12
  test   %r15d,%r15d
  jle    L51
  pxor   %xmm0,%xmm0
  lea    -0x8(%rax,%r14,8),%r15
  lea    -0x1(%rbx),%eax
  mov    $0x1,%r14d
  cvtsi2sd %ebx,%xmm0
  mulsd  D4(%rip),%xmm0
  lea    0x8(,%rax,8),%rax
  mov    %rax,0x20(%rsp)
  mov    %r12,%rax
  mov    %r14,%r12
  mov    %rax,%r14
  movsd  %xmm0,0x8(%rsp)
  movsd  D10(%rip),%xmm0
  nop
L87:
  test   %ebx,%ebx
  jle    L74
  mov    0x20(%rsp),%rdx
  xor    %esi,%esi
  mov    %r14,%rdi
  call   <memset@plt>
  mov    D10(%rip),%rax
  movq   %rax,%xmm0
L74:
  mov    0x18(%rsp),%rax
  movsd  0x8(%rsp),%xmm2
  movslq -0x4(%rax,%r12,4),%r10
  movsd  %xmm2,(%r15)
  test   %r10d,%r10d
  jle    L64
  mov    0x28(%rsp),%rax
  xor    %edi,%edi
  mov    -0x8(%rax,%r12,8),%r11
  nopl   (%rax)
L41:
  mov    (%r11,%rdi,4),%edx
  test   %edx,%edx
  jle    L80
  mov    -0x8(%r13,%r12,8),%rax
  sub    $0x1,%edx
  mov    (%rax,%rdi,8),%rax
  lea    (%rax,%rdx,4),%rcx
L10:
  movsd  (%r15),%xmm1
  movslq (%rax),%rdx
  addsd  %xmm0,%xmm1
  lea    -0x8(%r14,%rdx,8),%rdx
  movsd  %xmm1,(%r15)
  movsd  (%rdx),%xmm1
  addsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdx)
  mov    %rax,%rdx
  add    $0x4,%rax
  cmp    %rdx,%rcx
  jne    L10
L80:
  add    $0x1,%rdi
  cmp    %rdi,%r10
  jne    L41
L64:
  test   %rbp,%rbp
  je     L56
  movslq -0x4(%rbp,%r12,4),%rax
  cmp    $0xffffffff,%eax
  je     L56
  mov    0x38(%rsp),%rsi
  mov    %ebx,%edx
  mov    (%rsi,%rax,8),%rdi
  mov    %r14,%rsi
  call   <add_dst@plt>
  mov    D10(%rip),%rax
  movq   %rax,%xmm0
L44:
  add    $0x1,%r12
  cmp    %r12d,0x14(%rsp)
  jge    L87
  mov    %r14,%r12
L51:
  add    $0x48,%rsp
  mov    %r12,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1090 <free@plt>
L56:
  mov    0x30(%rsp),%rax
  mov    %ebx,%edx
  mov    %r14,%rsi
  mov    -0x8(%rax,%r12,8),%rdi
  call   <sample_Delta@plt>
  mov    D10(%rip),%rax
  movq   %rax,%xmm0
  jmp    L44
```

tool_calls: name: unpack_data
arguments: data_label: D4
datatype: f64
name: unpack_data
arguments: data_label: D10
datatype: f64

tool: D4: 0

tool: D10: 1

assistant: ```c
void resample_post_theta(int D, int K, int **M, int *N, double **post_theta, double **post_theta_train, int *entity_map, int ***z) {
  int d_9;
  double *tmpSP7;
  int n_3;
  int m_75;
  int dvv_loop_var_1;
  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) || (entity_map[d_9 - 1] == -1)) {
      sample_Delta(post_theta[d_9 - 1], tmpSP7, K);
    } else {
      add_dst(post_theta_train[entity_map[d_9 - 1]], tmpSP7, K);
    }
  }
  free(tmpSP7);
}
```