user: Please show me the C implementation that matches the assembly code listed below:

```asm
<pbkdf2>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %esi,%r12d
  mov    %edx,%esi
  push   %rbp
  push   %rbx
  sub    $0xc8,%rsp
  mov    %edx,0x5c(%rsp)
  movabs $0x13ffffffec,%rdx
  mov    %rcx,0x50(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xb8(%rsp)
  xor    %eax,%eax
  mov    $0x1,%eax
  cmp    %rdx,%r8
  ja     L108
  mov    %r8,%rax
  mov    %rdi,%rbp
  mov    %r8,%rdi
  mov    %rcx,%rbx
  movabs $0xcccccccccccccccd,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x4,%rax
  mov    %rax,0x30(%rsp)
  lea    (%rax,%rax,4),%rax
  shl    $0x2,%rax
  sub    %rax,%rdi
  mov    %rdi,0x48(%rsp)
  cmp    $0x13,%r8
  jbe    L39
  mov    %esi,%eax
  mov    %rbx,0x20(%rsp)
  mov    %rax,0x8(%rsp)
  lea    0x6c(%rsp),%rax
  mov    %rax,0x38(%rsp)
  lea    0x90(%rsp),%rax
  mov    %rax,0x28(%rsp)
  lea    0x68(%rsp),%rax
  mov    %rax,(%rsp)
  lea    0xa4(%rsp),%rax
  movq   $0x1,0x18(%rsp)
  mov    %rax,0x40(%rsp)
L118:
  mov    0x38(%rsp),%rbx
  mov    0x18(%rsp),%edx
  lea    D12(%rip),%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  xor    %eax,%eax
  call   <EVP_sha1@plt>
  sub    $0x8,%rsp
  mov    %rbx,%rcx
  mov    %r12d,%edx
  push   0x8(%rsp)
  mov    0x38(%rsp),%r9
  mov    %eax,%edi
  mov    %rbp,%rsi
  mov    $0x4,%r8d
  call   <HMAC@plt>
  mov    0xb0(%rsp),%eax
  movdqa 0xa0(%rsp),%xmm0
  mov    %eax,0x90(%rsp)
  movaps %xmm0,0x80(%rsp)
  pop    %r11
  pop    %rbx
  cmpq   $0x1,0x8(%rsp)
  jbe    L142
  mov    0x40(%rsp),%r14
  lea    0x70(%rsp),%rax
  mov    0x28(%rsp),%rbx
  lea    0x84(%rsp),%r13
  mov    $0x1,%r15d
  mov    %rax,0x10(%rsp)
  mov    %r13,%rax
  mov    %r15,%r13
  mov    %r14,%r15
  mov    %rax,%r14
  nopl   (%rax)
L153:
  xor    %eax,%eax
  call   <EVP_sha1@plt>
  sub    $0x8,%rsp
  mov    %r15,%r9
  mov    %r12d,%edx
  push   0x8(%rsp)
  mov    %eax,%edi
  mov    $0x14,%r8d
  mov    %rbx,%rcx
  mov    %rbp,%rsi
  call   <HMAC@plt>
  mov    0x20(%rsp),%rax
  mov    %r15,%rdx
  pop    %r9
  pop    %r10
  nopl   0x0(%rax)
L59:
  movzbl (%rdx),%ecx
  xor    %cl,(%rax)
  add    $0x1,%rax
  add    $0x1,%rdx
  cmp    %rax,%r14
  jne    L59
  mov    %r15,%rax
  add    $0x1,%r13
  mov    %rbx,%r15
  cmp    %r13,0x8(%rsp)
  je     L142
  mov    %rax,%rbx
  jmp    L153
L142:
  mov    0x20(%rsp),%rsi
  mov    0x80(%rsp),%eax
  movdqa 0x70(%rsp),%xmm1
  addq   $0x1,0x18(%rsp)
  mov    %eax,0x10(%rsi)
  add    $0x14,%rsi
  mov    0x18(%rsp),%rax
  movups %xmm1,-0x14(%rsi)
  mov    %rsi,0x20(%rsp)
  cmp    %rax,0x30(%rsp)
  jae    L118
  mov    0x30(%rsp),%rdi
  mov    $0x2,%eax
  lea    0x1(%rdi),%rcx
  lea    (%rdi,%rdi,4),%rdx
  cmp    %rax,%rcx
  cmovae %rcx,%rax
  shl    $0x2,%rdx
  cmp    $0x1,%rcx
  mov    $0x14,%ecx
  cmovbe %rcx,%rdx
  add    %rdx,0x50(%rsp)
L128:
  cmpq   $0x0,0x48(%rsp)
  jne    L94
L109:
  xor    %eax,%eax
L108:
  mov    0xb8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L31
  add    $0xc8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L94:
  lea    0x6c(%rsp),%r15
  mov    %eax,%edx
  lea    D12(%rip),%rsi
  mov    %r15,%rdi
  lea    0x90(%rsp),%r14
  call   <sprintf@plt>
  xor    %eax,%eax
  call   <EVP_sha1@plt>
  sub    $0x8,%rsp
  mov    %r14,%r9
  mov    %r15,%rcx
  mov    %eax,%edi
  lea    0x70(%rsp),%rax
  mov    $0x4,%r8d
  mov    %r12d,%edx
  mov    %rax,0x8(%rsp)
  mov    %rbp,%rsi
  push   %rax
  call   <HMAC@plt>
  mov    0xb0(%rsp),%eax
  mov    0x6c(%rsp),%edi
  movdqa 0xa0(%rsp),%xmm2
  mov    %eax,0x90(%rsp)
  mov    %rdi,%rax
  mov    %rdi,0x18(%rsp)
  movaps %xmm2,0x80(%rsp)
  pop    %rdi
  pop    %r8
  cmp    $0x1,%eax
  jbe    L112
  lea    0x70(%rsp),%r13
  mov    $0x1,%r10d
  lea    0xa4(%rsp),%rbx
  mov    %r13,%rax
  lea    0x84(%rsp),%r15
  mov    %r10,%r13
  mov    %rax,%r10
L86:
  xor    %eax,%eax
  mov    %r10,0x10(%rsp)
  call   <EVP_sha1@plt>
  sub    $0x8,%rsp
  mov    %r14,%rcx
  mov    %r12d,%edx
  push   0x8(%rsp)
  mov    %rbp,%rsi
  mov    %eax,%edi
  mov    %rbx,%r9
  mov    $0x14,%r8d
  call   <HMAC@plt>
  mov    0x20(%rsp),%r10
  mov    %rbx,%rdx
  pop    %rcx
  pop    %rsi
  mov    %r10,%rax
  nopl   0x0(%rax)
L147:
  movzbl (%rdx),%ecx
  xor    %cl,(%rax)
  add    $0x1,%rax
  add    $0x1,%rdx
  cmp    %rax,%r15
  jne    L147
  mov    %rbx,%rax
  add    $0x1,%r13
  mov    %r14,%rbx
  cmp    %r13,0x8(%rsp)
  je     L112
  mov    %rax,%r14
  jmp    L86
L112:
  mov    0x50(%rsp),%rdx
  xor    %eax,%eax
L67:
  movzwl %ax,%ecx
  add    $0x1,%eax
  add    $0x1,%rdx
  movzbl 0x70(%rsp,%rcx,1),%ecx
  mov    %cl,-0x1(%rdx)
  movzwl %ax,%ecx
  cmp    0x48(%rsp),%rcx
  jb     L67
  jmp    L109
L39:
  mov    $0x1,%eax
  jmp    L128
L31:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D12
type_infered: string

tool: D12: %04u

assistant: ```c
int pbkdf2(const unsigned char *pw, unsigned int pwlen, unsigned int ic, unsigned char *dk, unsigned long long dklen) {
  unsigned long l, r, i, j;
  unsigned char txt[4], hash[(20) * 2], tmp[(20)], *p = dk, *lhix, *hix, *swap;
  unsigned short k;
  unsigned int outlen;
  if (dklen > ((((unsigned long long)1) << 32) - 1) * (20)) {
    return 1;
  }
  l = dklen / (20);
  r = dklen % (20);
  for (i = 1; i <= l; i++) {
    sprintf((char *)txt, "%04u", (unsigned int)i);
    HMAC(EVP_sha1(), pw, pwlen, txt, 4, hash, &outlen);
    lhix = hash;
    hix = hash + (20);
    for (k = 0; k < (20); k++) {
      tmp[k] = hash[k];
    }
    for (j = 1; j < ic; j++) {
      HMAC(EVP_sha1(), pw, pwlen, lhix, (20), hix, &outlen);
      for (k = 0; k < (20); k++) {
        tmp[k] ^= hix[k];
      }
      swap = hix;
      hix = lhix;
      lhix = swap;
    }
    for (k = 0; k < (20); k++) {
      *p++ = tmp[k];
    }
  }
  if (r) {
    sprintf((char *)txt, "%04u", (unsigned int)i);
    HMAC(EVP_sha1(), pw, pwlen, txt, 4, hash, &outlen);
    lhix = hash;
    hix = hash + (20);
    for (k = 0; k < (20); k++) {
      tmp[k] = hash[k];
    }
    for (j = 1; j < ic; j++) {
      HMAC(EVP_sha1(), pw, pwlen, lhix, (20), hix, &outlen);
      for (k = 0; k < (20); k++) {
        tmp[k] ^= hix[k];
      }
      swap = hix;
      hix = lhix;
      lhix = swap;
    }
    for (k = 0; k < r; k++) {
      *p++ = tmp[k];
    }
  }
  return 0;
}
```