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

```asm
<mvvm_sampler_gibbs>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %edi,0x28(%rsp)
  mov    %esi,%r12d
  mov    %rdx,0x8(%rsp)
  mov    %rcx,0x10(%rsp)
  mov    %r8,%r13
  mov    %r9d,0x1c(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  lea    0x0(,%rsi,8),%eax
  mov    %eax,0x2c(%rsp)
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %r12d,%r12d
  jle    L121
  mov    %r12d,%edx
  lea    (%rax,%rdx,8),%rdx
  movsd  D1(%rip),%xmm0
L50:
  movsd  %xmm0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L50
L121:
  mov    0x28(%rsp),%edi
  imul   %r12d,%edi
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    %rax,0x20(%rsp)
  movl   $0x0,0x18(%rsp)
  lea    0x40(%rsp),%r15
  cmpl   $0x0,0x1c(%rsp)
  jns    L32
L99:
  mov    0x28(%rsp),%eax
  imul   0x90(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  movl   $0x0,0x18(%rsp)
  lea    0x40(%rsp),%r15
  test   %eax,%eax
  jns    L140
L146:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L36
  mov    0x20(%rsp),%rax
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L45:
  push   %r15
  lea    0x40(%rsp),%rax
  push   %rax
  mov    %r13,%r9
  mov    0x20(%rsp),%r8
  mov    0x18(%rsp),%rcx
  mov    %rbp,%rdx
  mov    %ebx,%esi
  mov    %r12d,%edi
  call   <condKappaMu@plt>
  movsd  0x50(%rsp),%xmm1
  movsd  0x48(%rsp),%xmm0
  call   <rvm_s@plt>
  movsd  %xmm0,0x0(%rbp,%rbx,8)
  add    $0x1,%rbx
  add    $0x10,%rsp
  cmp    %rbx,%r14
  jne    L45
L73:
  addl   $0x1,0x18(%rsp)
  mov    0x18(%rsp),%eax
  cmp    %eax,0x1c(%rsp)
  jl     L99
L32:
  mov    %r12d,%r14d
  mov    $0x0,%ebx
  test   %r12d,%r12d
  jg     L45
  jmp    L73
L118:
  addl   $0x1,0x18(%rsp)
  mov    0x18(%rsp),%eax
  cmp    0x1c(%rsp),%eax
  jg     L146
L140:
  mov    %r12d,%r14d
  mov    $0x0,%ebx
  test   %r12d,%r12d
  jle    L96
L61:
  push   %r15
  lea    0x40(%rsp),%rax
  push   %rax
  mov    %r13,%r9
  mov    0x20(%rsp),%r8
  mov    0x18(%rsp),%rcx
  mov    %rbp,%rdx
  mov    %ebx,%esi
  mov    %r12d,%edi
  call   <condKappaMu@plt>
  movsd  0x50(%rsp),%xmm1
  movsd  0x48(%rsp),%xmm0
  call   <rvm_s@plt>
  movsd  %xmm0,0x0(%rbp,%rbx,8)
  add    $0x1,%rbx
  add    $0x10,%rsp
  cmp    %rbx,%r14
  jne    L61
L96:
  mov    0x18(%rsp),%eax
  test   %eax,%eax
  je     L118
  cltd
  idivl  0x90(%rsp)
  test   %edx,%edx
  jne    L118
  mov    0x18(%rsp),%eax
  cltd
  idivl  0x90(%rsp)
  sub    $0x1,%eax
  imul   %r12d,%eax
  cltq
  mov    0x20(%rsp),%rcx
  lea    (%rcx,%rax,8),%rdi
  mov    0x2c(%rsp),%edx
  mov    %rbp,%rsi
  call   <memcpy@plt>
  jmp    L118
L36:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D1
data_type: byte[8]

tool: {"D1": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
double *mvvm_sampler_gibbs(int n, int p, double *mu, double *kappa, double *lambda, int initk, int k) {
  double *theta;
  double *ret;
  double mu_c, kappa_c;
  int i, j;
  theta = malloc(sizeof(double) * p);
  for (i = 0; i < p; i++)
    theta[i] = 1;
  ret = malloc(sizeof(double) * n * p);
  for (i = 0; i <= initk; i++) {
    for (j = 0; j < p; j++) {
      condKappaMu(p, j, theta, mu, kappa, lambda, &mu_c, &kappa_c);
      theta[j] = rvm_s(mu_c, kappa_c);
    }
  }
  for (i = 0; i <= (k * n); i++) {
    for (j = 0; j < p; j++) {
      condKappaMu(p, j, theta, mu, kappa, lambda, &mu_c, &kappa_c);
      theta[j] = rvm_s(mu_c, kappa_c);
    }
    if (i != 0 && i % k == 0)
      memcpy(ret + ((i / k) - 1) * p, theta, sizeof(double) * p);
  }
  free(theta);
  return ret;
}
```