user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<Hessian_BFGS>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    -0x24(%rbp),%eax
  mov    $0x8,%esi
  mov    %eax,%edi
  call   <calloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L75
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L75:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L0
L146:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x18(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  addl   $0x1,-0x20(%rbp)
L0:
  mov    -0x20(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L146
  movl   $0x0,-0x20(%rbp)
  jmp    L3
L82:
  movl   $0x0,-0x1c(%rbp)
  jmp    L91
L90:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x20(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x1c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x1c(%rbp)
L91:
  mov    -0x1c(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L90
  addl   $0x1,-0x20(%rbp)
L3:
  mov    -0x20(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L82
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L2
L98:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x10(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  addl   $0x1,-0x20(%rbp)
L2:
  mov    -0x20(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L98
  pxor   %xmm0,%xmm0
  ucomisd -0x18(%rbp),%xmm0
  jp     L142
  pxor   %xmm0,%xmm0
  ucomisd -0x18(%rbp),%xmm0
  jne    L142
  lea    D29(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L142:
  pxor   %xmm0,%xmm0
  ucomisd -0x10(%rbp),%xmm0
  jp     L119
  pxor   %xmm0,%xmm0
  ucomisd -0x10(%rbp),%xmm0
  jne    L119
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L119:
  movl   $0x0,-0x20(%rbp)
  jmp    L123
L28:
  movl   $0x0,-0x1c(%rbp)
  jmp    L52
L138:
  mov    -0x20(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x1c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  divsd  -0x18(%rbp),%xmm0
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm3
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mulsd  %xmm3,%xmm1
  divsd  -0x10(%rbp),%xmm1
  subsd  %xmm1,%xmm0
  mov    -0x20(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x1c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm2,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x1c(%rbp)
L52:
  mov    -0x1c(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L138
  addl   $0x1,-0x20(%rbp)
L123:
  mov    -0x20(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L28
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D0
type: string
name: unpack_data
arguments: label: D29
type: string
name: unpack_data
arguments: label: D6
type: string

tool: D0: Hessian_BFGS: error cannnot allocate memory


tool: D29: Hessian_BFGS: error dR perpendicular to dGrad


tool: D6: Hessian_BFGS: error dR perpendicular to HdR


assistant: ```c
void Hessian_BFGS(int nDim, const double *dR, const double *dGrad, double *H) {
  int i, j;
  double alpha;
  double beta;
  double *HdR;
  HdR = calloc(nDim, sizeof(double));
  if (HdR == NULL) {
    printf("Hessian_BFGS: error cannnot allocate memory\n");
    exit(-1);
  }
  alpha = 0.0;
  for (i = 0; i < nDim; i++)
    alpha += dGrad[i] * dR[i];
  for (i = 0; i < nDim; i++)
    for (j = 0; j < nDim; j++)
      HdR[i] += H[i * nDim + j] * dR[j];
  beta = 0.0;
  for (i = 0; i < nDim; i++)
    beta += HdR[i] * dR[i];
  if (alpha == 0.0) {
    printf("Hessian_BFGS: error dR perpendicular to dGrad\n");
    exit(-1);
  }
  if (beta == 0.0) {
    printf("Hessian_BFGS: error dR perpendicular to HdR\n");
    exit(-1);
  }
  for (i = 0; i < nDim; i++)
    for (j = 0; j < nDim; j++)
      H[i * nDim + j] += dGrad[i] * dGrad[j] / alpha - HdR[i] * HdR[j] / beta;
  free(HdR);
}
```