user: Demonstrate the C code that generates the assembly output below:

```asm
<pbkdf2_check>:
  endbr64
  push   %r15
  lea    D37(%rip),%r8
  lea    D26(%rip),%rcx
  push   %r14
  push   %r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  mov    %rsi,%rdi
  lea    D135(%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     L64
L57:
  mov    0x98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L265
  add    $0xa8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L64:
  mov    D26(%rip),%rdi
  call   <strlen@plt>
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <EVP_sha256@plt>
  mov    D135(%rip),%rdi
  lea    D132(%rip),%rsi
  mov    %rax,%r12
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L12
  call   <EVP_sha1@plt>
  mov    %rax,%r12
L23:
  lea    0x10(%rsp),%r14
  mov    %rbp,%rdi
  mov    0x4(%rsp),%ebx
  mov    D26(%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>
  mov    %eax,%ebp
  pop    %rax
  pop    %rdx
  test   %ebp,%ebp
  jg     L228
L115:
  mov    D135(%rip),%rdi
  call   <free@plt>
  mov    D26(%rip),%rdi
  call   <free@plt>
  mov    D37(%rip),%rdi
  call   <free@plt>
  jmp    L57
  nopl   (%rax)
L12:
  mov    D135(%rip),%rdi
  lea    D67(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L23
  call   <EVP_sha512@plt>
  mov    %rax,%r12
  jmp    L23
  nopl   0x0(%rax)
L228:
  mov    D37(%rip),%rdi
  call   <strlen@plt>
  cmp    %eax,%ebp
  mov    %eax,%ecx
  mov    %eax,%r8d
  cmovle %ebp,%ecx
  test   %ecx,%ecx
  jle    L41
  lea    -0x1(%rcx),%eax
  mov    D37(%rip),%rdx
  mov    0x8(%rsp),%rdi
  cmp    $0xe,%eax
  jbe    L251
  mov    %ecx,%esi
  pxor   %xmm2,%xmm2
  pxor   %xmm6,%xmm6
  xor    %eax,%eax
  shr    $0x4,%esi
  pxor   %xmm4,%xmm4
  shl    $0x4,%rsi
  nopl   (%rax)
L188:
  movdqu (%rdx,%rax,1),%xmm0
  movdqu (%rdi,%rax,1),%xmm7
  movdqa %xmm6,%xmm3
  add    $0x10,%rax
  pxor   %xmm7,%xmm0
  pcmpgtb %xmm0,%xmm3
  movdqa %xmm0,%xmm1
  punpcklbw %xmm3,%xmm1
  punpckhbw %xmm3,%xmm0
  movdqa %xmm4,%xmm3
  pcmpgtw %xmm0,%xmm3
  movdqa %xmm0,%xmm5
  punpcklwd %xmm3,%xmm5
  punpckhwd %xmm3,%xmm0
  movdqa %xmm4,%xmm3
  pcmpgtw %xmm1,%xmm3
  por    %xmm5,%xmm0
  movdqa %xmm1,%xmm5
  punpcklwd %xmm3,%xmm5
  punpckhwd %xmm3,%xmm1
  por    %xmm5,%xmm1
  por    %xmm1,%xmm0
  por    %xmm0,%xmm2
  cmp    %rsi,%rax
  jne    L188
  movdqa %xmm2,%xmm0
  mov    %ecx,%esi
  psrldq $0x8,%xmm0
  and    $0xfffffff0,%esi
  por    %xmm0,%xmm2
  movdqa %xmm2,%xmm0
  psrldq $0x4,%xmm0
  por    %xmm0,%xmm2
  movd   %xmm2,%eax
  test   $0xf,%cl
  je     L211
L218:
  movslq %esi,%r10
  movzbl (%rdx,%r10,1),%r9d
  xor    (%rdi,%r10,1),%r9b
  movsbl %r9b,%r9d
  or     %r9d,%eax
  lea    0x1(%rsi),%r9d
  cmp    %ecx,%r9d
  jge    L211
  movslq %r9d,%r9
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  lea    0x2(%rsi),%r9d
  cmp    %r9d,%ecx
  jle    L211
  movslq %r9d,%r9
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  lea    0x3(%rsi),%r9d
  cmp    %r9d,%ecx
  jle    L211
  movslq %r9d,%r9
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  lea    0x4(%rsi),%r9d
  cmp    %r9d,%ecx
  jle    L211
  movslq %r9d,%r9
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  lea    0x5(%rsi),%r9d
  cmp    %r9d,%ecx
  jle    L211
  movslq %r9d,%r9
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  lea    0x6(%rsi),%r9d
  cmp    %r9d,%ecx
  jle    L211
  movslq %r9d,%r9
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  lea    0x7(%rsi),%r9d
  cmp    %r9d,%ecx
  jle    L211
  movslq %r9d,%r9
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  lea    0x8(%rsi),%r9d
  cmp    %r9d,%ecx
  jle    L211
  movslq %r9d,%r9
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  lea    0x9(%rsi),%r9d
  cmp    %r9d,%ecx
  jle    L211
  movslq %r9d,%r9
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  lea    0xa(%rsi),%r9d
  cmp    %r9d,%ecx
  jle    L211
  movslq %r9d,%r9
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  lea    0xb(%rsi),%r9d
  cmp    %r9d,%ecx
  jle    L211
  movslq %r9d,%r9
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  lea    0xc(%rsi),%r9d
  cmp    %r9d,%ecx
  jle    L211
  movslq %r9d,%r9
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  lea    0xd(%rsi),%r9d
  cmp    %r9d,%ecx
  jle    L211
  movslq %r9d,%r9
  add    $0xe,%esi
  movzbl (%rdx,%r9,1),%r10d
  xor    (%rdi,%r9,1),%r10b
  movsbl %r10b,%r9d
  or     %r9d,%eax
  cmp    %esi,%ecx
  jle    L211
  movslq %esi,%rsi
  movzbl (%rdi,%rsi,1),%ecx
  xor    (%rdx,%rsi,1),%cl
  movsbl %cl,%edx
  or     %edx,%eax
  nopl   0x0(%rax)
L211:
  xor    %r12d,%r12d
  test   %eax,%eax
  sete   %r12b
L186:
  xor    %eax,%eax
  cmp    %r8d,%ebp
  cmovne %eax,%r12d
  call   <free@plt>
  jmp    L115
  nopl   0x0(%rax)
L41:
  mov    0x8(%rsp),%rdi
  mov    $0x1,%r12d
  jmp    L186
L251:
  xor    %eax,%eax
  xor    %esi,%esi
  jmp    L218
L265:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D132
type: string
name: disassemble_data
arguments: data_tag: D67
type: string

tool: D132: sha1

tool: D67: 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;
}
```