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

```asm
<ECDH_KDF_X9_62>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x88,%rsp
  mov    %rdi,-0x78(%rbp)
  mov    %rsi,-0x80(%rbp)
  mov    %rdx,-0x88(%rbp)
  mov    %rcx,-0x90(%rbp)
  mov    %r8,-0x98(%rbp)
  mov    %r9,-0xa0(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0xa8(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x60(%rbp)
  movl   $0x0,-0x68(%rbp)
  cmpq   $0x40000000,-0xa0(%rbp)
  ja     L36
  cmpq   $0x40000000,-0x80(%rbp)
  ja     L36
  cmpq   $0x40000000,-0x90(%rbp)
  jbe    L125
L36:
  mov    $0x0,%eax
  jmp    L154
L125:
  mov    $0x0,%eax
  call   <EVP_MD_CTX_new@plt>
  mov    %rax,-0x60(%rbp)
  cmpq   $0x0,-0x60(%rbp)
  jne    L22
  mov    $0x0,%eax
  jmp    L154
L22:
  mov    -0xa8(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_MD_size@plt>
  mov    %rax,-0x58(%rbp)
  movl   $0x1,-0x64(%rbp)
L159:
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    D1(%rip),%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x50(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  movslq %eax,%rdx
  mov    %rdx,%r14
  mov    $0x0,%r15d
  cltq
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L79:
  cmp    %rdx,%rsp
  je     L12
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L79
L12:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L242
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L242:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x48(%rbp)
  mov    -0xa8(%rbp),%rcx
  mov    -0x60(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestInit_ex@plt>
  test   %eax,%eax
  je     L52
  mov    -0x64(%rbp),%eax
  mov    %al,-0x39(%rbp)
  mov    -0x64(%rbp),%eax
  shr    $0x8,%eax
  mov    %al,-0x3a(%rbp)
  mov    -0x64(%rbp),%eax
  shr    $0x10,%eax
  mov    %al,-0x3b(%rbp)
  mov    -0x64(%rbp),%eax
  shr    $0x18,%eax
  mov    %al,-0x3c(%rbp)
  mov    -0x90(%rbp),%rdx
  mov    -0x88(%rbp),%rcx
  mov    -0x60(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestUpdate@plt>
  test   %eax,%eax
  je     L219
  lea    -0x3c(%rbp),%rcx
  mov    -0x60(%rbp),%rax
  mov    $0x4,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestUpdate@plt>
  test   %eax,%eax
  je     L149
  mov    -0xa0(%rbp),%rdx
  mov    -0x98(%rbp),%rcx
  mov    -0x60(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestUpdate@plt>
  test   %eax,%eax
  je     L9
  mov    -0x80(%rbp),%rax
  cmp    -0x58(%rbp),%rax
  jb     L231
  mov    -0x78(%rbp),%rcx
  mov    -0x60(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestFinal@plt>
  test   %eax,%eax
  je     L184
  mov    -0x58(%rbp),%rax
  sub    %rax,-0x80(%rbp)
  cmpq   $0x0,-0x80(%rbp)
  je     L80
  mov    -0x58(%rbp),%rax
  add    %rax,-0x78(%rbp)
  mov    %rbx,%rsp
  addl   $0x1,-0x64(%rbp)
  jmp    L159
L231:
  mov    -0x48(%rbp),%rcx
  mov    -0x60(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestFinal@plt>
  test   %eax,%eax
  je     L100
  mov    -0x80(%rbp),%rdx
  mov    -0x48(%rbp),%rcx
  mov    -0x78(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x58(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <OPENSSL_cleanse@plt>
  jmp    L80
L219:
  nop
  jmp    L52
L149:
  nop
  jmp    L52
L9:
  nop
  jmp    L52
L184:
  nop
  jmp    L52
L100:
  nop
L52:
  mov    %rbx,%rsp
  jmp    L77
L80:
  mov    %rbx,%rsp
  movl   $0x1,-0x68(%rbp)
L77:
  mov    -0x60(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_MD_CTX_free@plt>
  mov    -0x68(%rbp),%eax
L154:
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L15
  call   <__stack_chk_fail@plt>
L15:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
int ECDH_KDF_X9_62(unsigned char *out, size_t outlen, const unsigned char *Z, size_t Zlen, const unsigned char *sinfo, size_t sinfolen, const EVP_MD *md) {
  EVP_MD_CTX *mctx = NULL;
  int rv = 0;
  unsigned int i;
  size_t mdlen;
  unsigned char ctr[4];
  if (sinfolen > (1 << 30) || outlen > (1 << 30) || Zlen > (1 << 30))
    return 0;
  mctx = EVP_MD_CTX_new();
  if (mctx == NULL)
    return 0;
  mdlen = EVP_MD_size(md);
  for (i = 1;; i++) {
    unsigned char mtmp[EVP_MAX_MD_SIZE];
    if (!EVP_DigestInit_ex(mctx, md, NULL))
      goto err;
    ctr[3] = i & 0xFF;
    ctr[2] = (i >> 8) & 0xFF;
    ctr[1] = (i >> 16) & 0xFF;
    ctr[0] = (i >> 24) & 0xFF;
    if (!EVP_DigestUpdate(mctx, Z, Zlen))
      goto err;
    if (!EVP_DigestUpdate(mctx, ctr, sizeof(ctr)))
      goto err;
    if (!EVP_DigestUpdate(mctx, sinfo, sinfolen))
      goto err;
    if (outlen >= mdlen) {
      if (!EVP_DigestFinal(mctx, out, NULL))
        goto err;
      outlen -= mdlen;
      if (outlen == 0)
        break;
      out += mdlen;
    } else {
      if (!EVP_DigestFinal(mctx, mtmp, NULL))
        goto err;
      memcpy(out, mtmp, outlen);
      OPENSSL_cleanse(mtmp, mdlen);
      break;
    }
  }
  rv = 1;
err:
  EVP_MD_CTX_free(mctx);
  return rv;
}
```