user: Translate the below assembly code into C programming language:

```asm
<pbkdf2_check>:
  endbr64
  push   %r15
  lea    D78(%rip),%r8
  lea    D65(%rip),%rcx
  push   %r14
  push   %r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  mov    %rsi,%rdi
  lea    D5(%rip),%rsi
  push   %rbx
  sub    $0xa8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rdx
  call   <detoken@plt>
  test   %rax,%rax
  je     L25
L42:
  mov    0x98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0xa8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L25:
  mov    D65(%rip),%rdi
  call   <strlen@plt>
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <EVP_sha256@plt>
  mov    D5(%rip),%rdi
  lea    D16(%rip),%rsi
  mov    %rax,%r12
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L78
  call   <EVP_sha1@plt>
  mov    %rax,%r12
L105:
  lea    0x10(%rsp),%r14
  mov    %rbp,%rdi
  mov    0x4(%rsp),%ebx
  mov    D65(%rip),%r15
  call   <strlen@plt>
  push   %r14
  mov    %r12,%r9
  mov    %rbp,%rdi
  push   $0x18
  mov    %eax,%esi
  mov    %ebx,%r8d
  mov    %r13d,%ecx
  mov    %r15,%rdx
  xor    %r12d,%r12d
  call   <PKCS5_PBKDF2_HMAC@plt>
  lea    0x18(%rsp),%rdx
  mov    $0x18,%esi
  mov    %r14,%rdi
  call   <base64_encode@plt>
  movslq %eax,%rbp
  pop    %rax
  pop    %rdx
  test   %ebp,%ebp
  jg     L24
L6:
  mov    D5(%rip),%rdi
  call   <free@plt>
  mov    D65(%rip),%rdi
  call   <free@plt>
  mov    D78(%rip),%rdi
  call   <free@plt>
  jmp    L42
  xchg   %ax,%ax
L78:
  mov    D5(%rip),%rdi
  lea    D113(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L105
  call   <EVP_sha512@plt>
  mov    %rax,%r12
  jmp    L105
  nopl   0x0(%rax)
L24:
  mov    D78(%rip),%rdi
  call   <strlen@plt>
  cmp    %eax,%ebp
  movslq %eax,%rdi
  cmovle %rbp,%rdi
  test   %edi,%edi
  jle    L89
  mov    D78(%rip),%r9
  mov    0x8(%rsp),%r8
  xor    %ecx,%ecx
  xor    %esi,%esi
  nopl   0x0(%rax)
L19:
  movzbl (%r9,%rcx,1),%edx
  xor    (%r8,%rcx,1),%dl
  add    $0x1,%rcx
  movsbl %dl,%edx
  or     %edx,%esi
  cmp    %rcx,%rdi
  jne    L19
  xor    %r12d,%r12d
  test   %esi,%esi
  sete   %r12b
L27:
  cmp    %eax,%ebp
  mov    %r8,%rdi
  mov    $0x0,%eax
  cmovne %eax,%r12d
  call   <free@plt>
  jmp    L6
  nopl   0x0(%rax,%rax,1)
L89:
  mov    0x8(%rsp),%r8
  mov    $0x1,%r12d
  jmp    L27
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D16
data_type: string
name: unpack_data
arguments: data_tag: D113
data_type: string

tool: D16: sha1

tool: D113: sha512

assistant: ```c
int pbkdf2_check(char *password, char *hash) {
  static char *sha, *salt, *h_pw;
  int iterations, saltlen, blen;
  char *b64;
  unsigned char key[128];
  int match = (0);
  const EVP_MD *evpmd;
  if (detoken(hash, &sha, &iterations, &salt, &h_pw) != 0)
    return match;
  saltlen = strlen((char *)salt);
  evpmd = EVP_sha256();
  if (strcmp(sha, "sha1") == 0) {
    evpmd = EVP_sha1();
  } else if (strcmp(sha, "sha512") == 0) {
    evpmd = EVP_sha512();
  }
  PKCS5_PBKDF2_HMAC(password, strlen(password), (unsigned char *)salt, saltlen, iterations, evpmd, 24, key);
  blen = base64_encode(key, 24, &b64);
  if (blen > 0) {
    int i, diff = 0, hlen = strlen(h_pw);
    for (i = 0; (i < blen) && (i < hlen); i++) {
      diff |= h_pw[i] ^ b64[i];
    }
    match = diff == 0;
    if (hlen != blen)
      match = 0;
    free(b64);
  }
  free(sha);
  free(salt);
  free(h_pw);
  return match;
}
```