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

```asm
<vm_loglikelihood_kappa_partial_naive>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %edi,0x4c(%rsp)
  mov    %esi,0x1c(%rsp)
  mov    %edx,%ebx
  mov    %r8,0x28(%rsp)
  mov    0xa0(%rsp),%r14
  test   %edi,%edi
  jle    L59
  mov    %rcx,%rbp
  mov    %r9,%r12
  mov    %esi,%edi
  imul   %edx,%esi
  mov    %esi,0x18(%rsp)
  movslq %edi,%rax
  shl    $0x3,%rax
  mov    %rax,0x50(%rsp)
  movslq %edx,%rax
  lea    (%r14,%rax,8),%rdx
  mov    %rdx,0x20(%rsp)
  neg    %rax
  shl    $0x3,%rax
  mov    %rax,0x58(%rsp)
  movl   $0x0,0xc(%rsp)
  movl   $0x0,0x48(%rsp)
  pxor   %xmm3,%xmm3
  movsd  %xmm3,(%rsp)
  mov    %edi,%r15d
  jmp    L46
L34:
  add    $0x1,%r13
  cmp    %r15,%r13
  je     L38
L55:
  cmp    %r13d,%ebx
  je     L34
  mov    0xc(%rsp),%eax
  add    %r13d,%eax
  cltq
  movsd  (%r14,%rax,8),%xmm0
  subsd  0x0(%rbp,%r13,8),%xmm0
  call   <sin@plt>
  mov    0x18(%rsp),%eax
  add    %r13d,%eax
  cltq
  mulsd  (%r12,%rax,8),%xmm0
  addsd  (%rsp),%xmm0
  movsd  %xmm0,(%rsp)
  jmp    L34
L22:
  pxor   %xmm6,%xmm6
  movsd  %xmm6,(%rsp)
L38:
  mov    0x40(%rsp),%rax
  movsd  (%rax),%xmm0
  subsd  0x38(%rsp),%xmm0
  call   <sin@plt>
  mulsd  (%rsp),%xmm0
  divsd  0x10(%rsp),%xmm0
  addsd  0x30(%rsp),%xmm0
  movsd  %xmm0,(%rsp)
  addl   $0x1,0x48(%rsp)
  mov    0x48(%rsp),%eax
  mov    0x50(%rsp),%rsi
  add    %rsi,0x20(%rsp)
  mov    0x1c(%rsp),%edi
  add    %edi,0xc(%rsp)
  cmp    %eax,0x4c(%rsp)
  je     L54
L46:
  mov    0x20(%rsp),%r13
  add    0x58(%rsp),%r13
  mov    %r13,%r9
  mov    %r12,%r8
  mov    0x28(%rsp),%rcx
  mov    %rbp,%rdx
  mov    %ebx,%esi
  mov    0x1c(%rsp),%edi
  call   <marginal_j_concentration@plt>
  movsd  %xmm0,0x10(%rsp)
  mov    %r13,%r9
  mov    %r12,%r8
  mov    0x28(%rsp),%rcx
  mov    %rbp,%rdx
  mov    %ebx,%esi
  mov    0x1c(%rsp),%edi
  call   <marginal_j_mean@plt>
  movapd %xmm0,%xmm4
  movsd  %xmm0,0x38(%rsp)
  mov    0x20(%rsp),%rax
  mov    %rax,0x40(%rsp)
  movsd  (%rax),%xmm0
  subsd  %xmm4,%xmm0
  call   <cos@plt>
  movsd  %xmm0,0x30(%rsp)
  movsd  0x10(%rsp),%xmm0
  call   <bessi1_spd@plt>
  movq   %xmm0,%r13
  movsd  0x10(%rsp),%xmm0
  call   <bessi0_spd@plt>
  movq   %r13,%xmm1
  divsd  %xmm0,%xmm1
  movsd  0x30(%rsp),%xmm5
  subsd  %xmm1,%xmm5
  movapd %xmm5,%xmm0
  divsd  0x10(%rsp),%xmm0
  addsd  (%rsp),%xmm0
  movsd  %xmm0,0x30(%rsp)
  cmpl   $0x0,0x1c(%rsp)
  jle    L22
  mov    $0x0,%r13d
  pxor   %xmm5,%xmm5
  movsd  %xmm5,(%rsp)
  jmp    L55
L59:
  pxor   %xmm7,%xmm7
  movsd  %xmm7,(%rsp)
L54:
  movslq %ebx,%rbx
  movsd  (%rsp),%xmm0
  xorpd  D6(%rip),%xmm0
  mov    0x28(%rsp),%rax
  mulsd  (%rax,%rbx,8),%xmm0
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D6
data_type: f32[4]

tool: {"D6": [0.0,-0.0,0.0,0.0]}

assistant: ```c
double vm_loglikelihood_kappa_partial_naive(int n, int p, int R, double *mu, double *kappa, double *lambda, double *theta) {
  double k_rest, m_rest;
  double acum = 0., acum_scnd;
  int i, l;
  for (i = 0; i < n; i++) {
    k_rest = marginal_j_concentration(p, R, mu, kappa, lambda, theta + i * p);
    m_rest = marginal_j_mean(p, R, mu, kappa, lambda, theta + i * p);
    acum += (cos(theta[i * p + R] - m_rest) - (bessi1_spd(k_rest) / bessi0_spd(k_rest))) / k_rest;
    acum_scnd = 0.;
    for (l = 0; l < p; l++) {
      if (l != R) {
        acum_scnd += lambda[R * p + l] * sin(theta[i * p + l] - mu[l]);
      }
    }
    acum += (sin(theta[i * p + R] - m_rest) * acum_scnd) / k_rest;
  }
  return -acum * kappa[R];
}
```