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

```asm
<EVP_BytesToKey>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r12
  push   %rbx
  add    $0xffffffffffffff80,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %rsi,-0x70(%rbp)
  mov    %rdx,-0x78(%rbp)
  mov    %rcx,-0x80(%rbp)
  mov    %r8d,-0x84(%rbp)
  mov    %r9d,-0x88(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x90(%rbp)
  mov    0x18(%rbp),%rax
  mov    %rax,-0x98(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x28(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%r12
  mov    D25(%rip),%rax
  mov    (%rax),%ebx
  movslq %ebx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x40(%rbp)
  movslq %ebx,%rax
  mov    %rax,%r14
  mov    $0x0,%r15d
  movslq %ebx,%rax
  mov    %rax,%r10
  mov    $0x0,%r11d
  movslq %ebx,%rax
  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
L134:
  cmp    %rdx,%rsp
  je     L401
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L134
L401:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L322
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L322:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x38(%rbp)
  movl   $0x0,-0x4c(%rbp)
  movl   $0x0,-0x58(%rbp)
  movl   $0x0,-0x44(%rbp)
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_CIPHER_key_length@plt>
  mov    %eax,-0x50(%rbp)
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_CIPHER_iv_length@plt>
  mov    %eax,-0x54(%rbp)
  mov    D30(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x50(%rbp)
  setle  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <OPENSSL_assert@plt>
  mov    D28(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x54(%rbp)
  setle  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <OPENSSL_assert@plt>
  cmpq   $0x0,-0x80(%rbp)
  jne    L339
  mov    -0x50(%rbp),%eax
  jmp    L400
L339:
  mov    $0x0,%eax
  call   <EVP_MD_CTX_new@plt>
  mov    %rax,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  je     L199
L205:
  mov    -0x70(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestInit_ex@plt>
  test   %eax,%eax
  je     L278
  mov    -0x4c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4c(%rbp)
  test   %eax,%eax
  je     L151
  mov    -0x58(%rbp),%edx
  mov    -0x38(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestUpdate@plt>
  test   %eax,%eax
  je     L334
L151:
  mov    -0x84(%rbp),%edx
  mov    -0x80(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestUpdate@plt>
  test   %eax,%eax
  je     L336
  cmpq   $0x0,-0x78(%rbp)
  je     L363
  mov    D0(%rip),%rax
  mov    (%rax),%edx
  mov    -0x78(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestUpdate@plt>
  test   %eax,%eax
  je     L171
L363:
  mov    -0x38(%rbp),%rcx
  lea    -0x58(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestFinal_ex@plt>
  test   %eax,%eax
  je     L378
  movl   $0x1,-0x48(%rbp)
  jmp    L397
L286:
  mov    -0x70(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestInit_ex@plt>
  test   %eax,%eax
  je     L275
  mov    -0x58(%rbp),%edx
  mov    -0x38(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestUpdate@plt>
  test   %eax,%eax
  je     L324
  mov    -0x38(%rbp),%rcx
  lea    -0x58(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <EVP_DigestFinal_ex@plt>
  test   %eax,%eax
  je     L137
  addl   $0x1,-0x48(%rbp)
L397:
  mov    -0x88(%rbp),%eax
  cmp    %eax,-0x48(%rbp)
  jb     L286
  movl   $0x0,-0x48(%rbp)
  cmpl   $0x0,-0x50(%rbp)
  je     L352
L391:
  cmpl   $0x0,-0x50(%rbp)
  je     L169
  mov    -0x58(%rbp),%eax
  cmp    %eax,-0x48(%rbp)
  je     L393
  cmpq   $0x0,-0x90(%rbp)
  je     L167
  mov    -0x90(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x90(%rbp)
  mov    -0x38(%rbp),%rcx
  mov    -0x48(%rbp),%edx
  movzbl (%rcx,%rdx,1),%edx
  mov    %dl,(%rax)
L167:
  subl   $0x1,-0x50(%rbp)
  addl   $0x1,-0x48(%rbp)
  jmp    L391
L169:
  nop
  jmp    L352
L393:
  nop
L352:
  cmpl   $0x0,-0x54(%rbp)
  je     L239
  mov    -0x58(%rbp),%eax
  cmp    %eax,-0x48(%rbp)
  je     L239
L192:
  cmpl   $0x0,-0x54(%rbp)
  je     L432
  mov    -0x58(%rbp),%eax
  cmp    %eax,-0x48(%rbp)
  je     L147
  cmpq   $0x0,-0x98(%rbp)
  je     L9
  mov    -0x98(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x98(%rbp)
  mov    -0x38(%rbp),%rcx
  mov    -0x48(%rbp),%edx
  movzbl (%rcx,%rdx,1),%edx
  mov    %dl,(%rax)
L9:
  subl   $0x1,-0x54(%rbp)
  addl   $0x1,-0x48(%rbp)
  jmp    L192
L432:
  nop
  jmp    L239
L147:
  nop
L239:
  cmpl   $0x0,-0x50(%rbp)
  jne    L205
  cmpl   $0x0,-0x54(%rbp)
  je     L237
  jmp    L205
L237:
  nop
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_CIPHER_key_length@plt>
  mov    %eax,-0x44(%rbp)
  jmp    L161
L199:
  nop
  jmp    L161
L278:
  nop
  jmp    L161
L334:
  nop
  jmp    L161
L336:
  nop
  jmp    L161
L171:
  nop
  jmp    L161
L378:
  nop
  jmp    L161
L275:
  nop
  jmp    L161
L324:
  nop
  jmp    L161
L137:
  nop
L161:
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_MD_CTX_free@plt>
  mov    -0x38(%rbp),%rax
  mov    %ebx,%esi
  mov    %rax,%rdi
  call   <OPENSSL_cleanse@plt>
  mov    -0x44(%rbp),%eax
L400:
  mov    %r12,%rsp
  mov    -0x28(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L283
  call   <__stack_chk_fail@plt>
L283:
  lea    -0x20(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, const unsigned char *salt, const unsigned char *data, int datal, int count, unsigned char *key, unsigned char *iv) {
  EVP_MD_CTX *c;
  unsigned char md_buf[EVP_MAX_MD_SIZE];
  int niv, nkey, addmd = 0;
  unsigned int mds = 0, i;
  int rv = 0;
  nkey = EVP_CIPHER_key_length(type);
  niv = EVP_CIPHER_iv_length(type);
  OPENSSL_assert(nkey <= EVP_MAX_KEY_LENGTH);
  OPENSSL_assert(niv <= EVP_MAX_IV_LENGTH);
  if (data == NULL)
    return nkey;
  c = EVP_MD_CTX_new();
  if (c == NULL)
    goto err;
  for (;;) {
    if (!EVP_DigestInit_ex(c, md, NULL))
      goto err;
    if (addmd++)
      if (!EVP_DigestUpdate(c, &(md_buf[0]), mds))
        goto err;
    if (!EVP_DigestUpdate(c, data, datal))
      goto err;
    if (salt != NULL)
      if (!EVP_DigestUpdate(c, salt, PKCS5_SALT_LEN))
        goto err;
    if (!EVP_DigestFinal_ex(c, &(md_buf[0]), &mds))
      goto err;
    for (i = 1; i < (unsigned int)count; i++) {
      if (!EVP_DigestInit_ex(c, md, NULL))
        goto err;
      if (!EVP_DigestUpdate(c, &(md_buf[0]), mds))
        goto err;
      if (!EVP_DigestFinal_ex(c, &(md_buf[0]), &mds))
        goto err;
    }
    i = 0;
    if (nkey) {
      for (;;) {
        if (nkey == 0)
          break;
        if (i == mds)
          break;
        if (key != NULL)
          *(key++) = md_buf[i];
        nkey--;
        i++;
      }
    }
    if (niv && (i != mds)) {
      for (;;) {
        if (niv == 0)
          break;
        if (i == mds)
          break;
        if (iv != NULL)
          *(iv++) = md_buf[i];
        niv--;
        i++;
      }
    }
    if ((nkey == 0) && (niv == 0))
      break;
  }
  rv = EVP_CIPHER_key_length(type);
err:
  EVP_MD_CTX_free(c);
  OPENSSL_cleanse(md_buf, sizeof(md_buf));
  return rv;
}
```