user: Translate the below assembly code into C programming language:

```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    L73
  pxor   %xmm0,%xmm0
  lea    -0x8(%rax,%r14,8),%r15
  lea    -0x1(%rbx),%eax
  mov    $0x1,%r14d
  cvtsi2sd %ebx,%xmm0
  mulsd  D20(%rip),%xmm0
  lea    0x8(,%rax,8),%rax
  mov    %rax,0x20(%rsp)
  movsd  %xmm0,0x8(%rsp)
  movsd  D46(%rip),%xmm0
  cs nopw 0x0(%rax,%rax,1)
L62:
  test   %ebx,%ebx
  jle    L85
  mov    0x20(%rsp),%rdx
  xor    %esi,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    D46(%rip),%rax
  movq   %rax,%xmm0
L85:
  mov    0x18(%rsp),%rax
  movsd  0x8(%rsp),%xmm2
  movslq -0x4(%rax,%r14,4),%r10
  movsd  %xmm2,(%r15)
  test   %r10d,%r10d
  jle    L80
  mov    0x28(%rsp),%rax
  xor    %edi,%edi
  mov    -0x8(%rax,%r14,8),%r11
  nopl   (%rax)
L97:
  mov    (%r11,%rdi,4),%edx
  test   %edx,%edx
  jle    L32
  mov    -0x8(%r13,%r14,8),%rax
  sub    $0x1,%edx
  mov    (%rax,%rdi,8),%rax
  lea    (%rax,%rdx,4),%rcx
L64:
  movsd  (%r15),%xmm1
  movslq (%rax),%rdx
  addsd  %xmm0,%xmm1
  lea    -0x8(%r12,%rdx,8),%rdx
  movsd  %xmm1,(%r15)
  movsd  (%rdx),%xmm1
  addsd  %xmm0,%xmm1
  movsd  %xmm1,(%rdx)
  mov    %rax,%rdx
  add    $0x4,%rax
  cmp    %rcx,%rdx
  jne    L64
L32:
  add    $0x1,%rdi
  cmp    %rdi,%r10
  jne    L97
L80:
  test   %rbp,%rbp
  je     L17
  movslq -0x4(%rbp,%r14,4),%rax
  cmp    $0xffffffff,%eax
  je     L17
  mov    0x38(%rsp),%rsi
  mov    %ebx,%edx
  mov    (%rsi,%rax,8),%rdi
  mov    %r12,%rsi
  call   <add_dst@plt>
  mov    D46(%rip),%rax
  movq   %rax,%xmm0
L71:
  add    $0x1,%r14
  cmp    %r14d,0x14(%rsp)
  jge    L62
L73:
  add    $0x48,%rsp
  mov    %r12,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1090 <free@plt>
L17:
  mov    0x30(%rsp),%rax
  mov    %ebx,%edx
  mov    %r12,%rsi
  mov    -0x8(%rax,%r14,8),%rdi
  call   <sample_Delta@plt>
  mov    D46(%rip),%rax
  movq   %rax,%xmm0
  jmp    L71
```

tool_calls: name: retrieve_data
arguments: label: D20
type_infered: f64
name: retrieve_data
arguments: label: D46
type_infered: f64

tool: D20: 0

tool: D46: 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);
}
```