user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<multi_bin_bh>:
  endbr64
  push   %r15
  movsd  D4(%rip),%xmm3
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  movslq (%rcx),%rax
  lea    0x1(%rax),%ecx
  movslq %ecx,%r14
  mov    %rdi,-0x18(%rsp)
  lea    0x0(,%r14,8),%r15
  mov    %rsi,-0x10(%rsp)
  lea    (%r9,%r15,1),%r10
  mov    %rdx,-0x20(%rsp)
  mov    %eax,-0x38(%rsp)
  movsd  %xmm3,(%r10)
  cmp    $0x1,%ecx
  jle    L40
  lea    0x2(%r14,%rax,1),%rdx
  mov    %r8,%rdi
  mov    %r15,%rbx
  mov    %r15,-0x48(%rsp)
  lea    (%r9,%rdx,8),%r8
  lea    0xf(%r15),%rdx
  mov    $0x1,%r13d
  cmp    $0x1e,%rdx
  mov    $0x8,%edx
  seta   -0x31(%rsp)
  neg    %rax
  neg    %rbx
  sub    %r9,%rdx
  shl    $0x4,%rax
  mov    %rbx,-0x28(%rsp)
  shl    $0x4,%r14
  sub    $0x18,%rax
  mov    %rdx,-0x40(%rsp)
  mov    %rax,-0x30(%rsp)
  nopl   0x0(%rax)
L25:
  mov    -0x40(%rsp),%rax
  mov    %r13d,%esi
  add    $0x1,%r13d
  lea    (%rax,%r10,1),%rdx
  xor    %eax,%eax
  test   %ecx,%ecx
  cmovns %r15,%rax
  add    %rdx,%rax
  add    %r9,%rax
  cmp    %rax,%rdi
  seta   %r11b
  xor    %eax,%eax
  test   %ecx,%ecx
  cmovs  %r15,%rax
  add    %rdx,%rax
  add    %r9,%rax
  cmp    %rax,%rdi
  setb   %al
  or     %r11b,%al
  je     L106
  cmp    $0x16,%esi
  seta   %al
  test   %al,-0x31(%rsp)
  je     L106
  movsd  (%rdi),%xmm0
  movapd %xmm3,%xmm4
  mov    -0x30(%rsp),%rax
  mov    %r13d,%r12d
  shr    %r12d
  lea    0x8(%r10),%r11
  lea    -0x8(%r8),%rbx
  xor    %edx,%edx
  subsd  %xmm0,%xmm4
  movapd %xmm0,%xmm5
  lea    (%rax,%r8,1),%rbp
  xor    %eax,%eax
  unpcklpd %xmm5,%xmm5
  unpcklpd %xmm4,%xmm4
  nopl   (%rax)
L83:
  movsd  (%r10,%rax,1),%xmm2
  movsd  0x0(%rbp,%rax,1),%xmm1
  add    $0x1,%edx
  movapd %xmm2,%xmm0
  unpcklpd %xmm2,%xmm1
  mulpd  %xmm5,%xmm1
  movhpd (%rbx,%rax,1),%xmm0
  mulpd  %xmm4,%xmm0
  addpd  %xmm1,%xmm0
  movlpd %xmm0,(%r11,%rax,1)
  movhpd %xmm0,(%r8,%rax,1)
  add    %r14,%rax
  cmp    %edx,%r12d
  jne    L83
  mov    %r13d,%eax
  or     $0x1,%eax
  test   $0x1,%r13b
  je     L89
  imul   %ecx,%eax
  movsd  (%rdi),%xmm2
  movapd %xmm3,%xmm1
  subsd  %xmm2,%xmm1
  lea    (%rsi,%rax,1),%edx
  sub    %ecx,%eax
  add    %esi,%eax
  movslq %edx,%rdx
  mulsd  -0x8(%r9,%rdx,8),%xmm1
  cltq
  movsd  -0x8(%r9,%rax,8),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%r9,%rdx,8)
L89:
  add    -0x48(%rsp),%r15
  add    $0x8,%rdi
  mov    %r11,%r10
  add    $0x8,%r8
  cmp    %esi,-0x38(%rsp)
  jne    L25
  mov    -0x38(%rsp),%esi
  lea    (%rcx,%rcx,2),%eax
  mov    -0x48(%rsp),%r15
  mov    $0x2,%edx
  cltq
  mov    -0x28(%rsp),%rdi
  lea    -0x8(%r9,%rax,8),%rax
  add    $0x2,%esi
  nopl   0x0(%rax)
L44:
  movsd  (%rax),%xmm0
  addsd  (%rax,%rdi,1),%xmm0
  add    $0x1,%edx
  movsd  %xmm0,(%rax)
  add    %r15,%rax
  cmp    %esi,%edx
  jne    L44
L40:
  mov    -0x20(%rsp),%rax
  movslq (%rax),%rsi
  test   %esi,%esi
  jle    L22
  mov    -0x18(%rsp),%rdi
  mov    -0x10(%rsp),%r8
  xor    %edx,%edx
  nopw   0x0(%rax,%rax,1)
L73:
  mov    (%r8,%rdx,4),%eax
  add    $0x1,%eax
  imul   %ecx,%eax
  add    %ecx,%eax
  cltq
  movsd  -0x8(%r9,%rax,8),%xmm0
  movsd  %xmm0,(%rdi,%rdx,8)
  add    $0x1,%rdx
  cmp    %rsi,%rdx
  jne    L73
L22:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L106:
  mov    -0x48(%rsp),%rbx
  mov    -0x28(%rsp),%rbp
  mov    %r10,%rax
  lea    0x2(%rsi),%r11d
  mov    $0x1,%edx
  cs nopw 0x0(%rax,%rax,1)
L109:
  movsd  (%rdi),%xmm1
  movapd %xmm3,%xmm0
  add    $0x1,%edx
  subsd  %xmm1,%xmm0
  mulsd  (%rax,%rbp,1),%xmm1
  mulsd  (%rax),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,0x8(%rax)
  add    %rbx,%rax
  cmp    %r11d,%edx
  jne    L109
  lea    0x8(%r10),%r11
  jmp    L89
```

tool_calls: name: unpack_data
arguments: tag: D4
type: f64

tool: D4: 1

assistant: ```c
void multi_bin_bh(double *res, int *nvec, int *nn, int *n, double *pp, double *mat) {
  int i, j, m;
  int k, kk;
  double pj, tres;
  m = *n + 1;
  mat[m] = 1.0;
  for (j = 1; j < m; j++) {
    for (i = 1; i <= j + 1; i++) {
      pj = pp[j - 1];
      mat[i * m + j] = (1 - pj) * mat[i * m + j - 1] + pj * mat[(i - 1) * m + j - 1];
    }
  }
  for (i = 2; i <= m; i++) {
    tres = mat[i * m + m - 1];
    mat[i * m + m - 1] = tres + mat[(i - 1) * m + m - 1];
  }
  for (k = 0; k < *nn; k++) {
    kk = nvec[k];
    res[k] = mat[(kk + 1) * m + m - 1];
  }
  return;
}
```