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

```asm
<cdb_seek>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xa0,%rsp
  mov    %edi,-0x84(%rbp)
  mov    %rsi,-0x90(%rbp)
  mov    %edx,-0x88(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x1,-0x74(%rbp)
  mov    -0x88(%rbp),%edx
  mov    -0x90(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <cdb_hash@plt>
  mov    %eax,-0x6c(%rbp)
  mov    -0x6c(%rbp),%eax
  shl    $0x3,%eax
  and    $0x7f8,%eax
  mov    %eax,-0x68(%rbp)
  mov    -0x68(%rbp),%ecx
  mov    -0x84(%rbp),%eax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <lseek@plt>
  test   %rax,%rax
  js     L40
  lea    -0x50(%rbp),%rcx
  mov    -0x84(%rbp),%eax
  mov    $0x8,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <cdb_bread@plt>
  test   %rax,%rax
  jns    L294
L40:
  mov    $0xffffffff,%eax
  jmp    L85
L294:
  lea    -0x50(%rbp),%rax
  add    $0x4,%rax
  mov    %rax,%rdi
  call   <cdb_unpack@plt>
  mov    %eax,-0x64(%rbp)
  cmpl   $0x0,-0x64(%rbp)
  jne    L52
  mov    $0x0,%eax
  jmp    L85
L52:
  mov    -0x6c(%rbp),%eax
  shr    $0x8,%eax
  mov    $0x0,%edx
  divl   -0x64(%rbp)
  mov    %edx,-0x78(%rbp)
  mov    -0x64(%rbp),%eax
  mov    %eax,-0x7c(%rbp)
  lea    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <cdb_unpack@plt>
  mov    %eax,-0x60(%rbp)
L184:
  cmpl   $0x0,-0x74(%rbp)
  je     L122
  mov    -0x78(%rbp),%eax
  lea    0x0(,%rax,8),%edx
  mov    -0x60(%rbp),%eax
  lea    (%rdx,%rax,1),%ecx
  mov    -0x84(%rbp),%eax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <lseek@plt>
  test   %rax,%rax
  jns    L122
  mov    $0xffffffff,%eax
  jmp    L85
L122:
  lea    -0x50(%rbp),%rcx
  mov    -0x84(%rbp),%eax
  mov    $0x8,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <cdb_bread@plt>
  test   %rax,%rax
  jns    L1
  mov    $0xffffffff,%eax
  jmp    L85
L1:
  lea    -0x50(%rbp),%rax
  add    $0x4,%rax
  mov    %rax,%rdi
  call   <cdb_unpack@plt>
  mov    %eax,-0x68(%rbp)
  cmpl   $0x0,-0x68(%rbp)
  jne    L255
  mov    $0x0,%eax
  jmp    L85
L255:
  lea    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <cdb_unpack@plt>
  cmp    %eax,-0x6c(%rbp)
  je     L190
  movl   $0x0,-0x74(%rbp)
  jmp    L224
L190:
  mov    -0x68(%rbp),%ecx
  mov    -0x84(%rbp),%eax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <lseek@plt>
  test   %rax,%rax
  js     L144
  lea    -0x50(%rbp),%rcx
  mov    -0x84(%rbp),%eax
  mov    $0x8,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <cdb_bread@plt>
  test   %rax,%rax
  jns    L226
L144:
  mov    $0xffffffff,%eax
  jmp    L85
L226:
  lea    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <cdb_unpack@plt>
  cmp    %eax,-0x88(%rbp)
  jne    L230
  mov    -0x88(%rbp),%eax
  mov    %eax,-0x70(%rbp)
  mov    -0x90(%rbp),%rax
  mov    %rax,-0x58(%rbp)
  cmpq   $0x0,-0x98(%rbp)
  je     L171
  lea    -0x50(%rbp),%rax
  add    $0x4,%rax
  mov    %rax,%rdi
  call   <cdb_unpack@plt>
  mov    -0x98(%rbp),%rdx
  mov    %eax,(%rdx)
L171:
  cmpl   $0x0,-0x70(%rbp)
  jne    L27
  mov    $0x1,%eax
  jmp    L85
L27:
  mov    -0x70(%rbp),%eax
  mov    $0x40,%edx
  cmp    %edx,%eax
  cmova  %edx,%eax
  mov    %eax,-0x5c(%rbp)
  mov    -0x5c(%rbp),%edx
  lea    -0x50(%rbp),%rcx
  mov    -0x84(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <cdb_bread@plt>
  test   %rax,%rax
  jns    L254
  mov    $0xffffffff,%eax
  jmp    L85
L254:
  mov    -0x5c(%rbp),%edx
  mov    -0x58(%rbp),%rcx
  lea    -0x50(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  jne    L280
  mov    -0x5c(%rbp),%eax
  add    %rax,-0x58(%rbp)
  mov    -0x5c(%rbp),%eax
  sub    %eax,-0x70(%rbp)
  jmp    L171
L280:
  nop
L230:
  movl   $0x1,-0x74(%rbp)
L224:
  subl   $0x1,-0x7c(%rbp)
  cmpl   $0x0,-0x7c(%rbp)
  jne    L231
  mov    $0x0,%eax
  jmp    L85
L231:
  addl   $0x1,-0x78(%rbp)
  mov    -0x78(%rbp),%eax
  cmp    -0x64(%rbp),%eax
  jne    L184
  movl   $0x0,-0x78(%rbp)
  movl   $0x1,-0x74(%rbp)
  jmp    L184
L85:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L86
  call   <__stack_chk_fail@plt>
L86:
  leave
  ret
```

assistant: ```c
int cdb_seek(int fd, const void *key, unsigned klen, unsigned *dlenp) {
  unsigned htstart;
  unsigned htsize;
  unsigned httodo;
  unsigned hti;
  unsigned pos;
  unsigned hval;
  unsigned char rbuf[64];
  int needseek = 1;
  hval = cdb_hash(key, klen);
  pos = (hval & 0xff) << 3;
  if (lseek(fd, pos, 0) < 0 || cdb_bread(fd, rbuf, 8) < 0)
    return -1;
  if ((htsize = cdb_unpack(rbuf + 4)) == 0)
    return 0;
  hti = (hval >> 8) % htsize;
  httodo = htsize;
  htstart = cdb_unpack(rbuf);
  for (;;) {
    if (needseek && lseek(fd, htstart + (hti << 3), 0) < 0)
      return -1;
    if (cdb_bread(fd, rbuf, 8) < 0)
      return -1;
    if ((pos = cdb_unpack(rbuf + 4)) == 0)
      return 0;
    if (cdb_unpack(rbuf) != hval)
      needseek = 0;
    else {
      if (lseek(fd, pos, 0) < 0 || cdb_bread(fd, rbuf, 8) < 0)
        return -1;
      if (cdb_unpack(rbuf) == klen) {
        unsigned l = klen, c;
        const char *k = (const char *)key;
        if (dlenp)
          *dlenp = cdb_unpack(rbuf + 4);
        for (;;) {
          if (!l)
            return 1;
          c = l > sizeof(rbuf) ? sizeof(rbuf) : l;
          if (cdb_bread(fd, rbuf, c) < 0)
            return -1;
          if (memcmp(rbuf, k, c) != 0)
            break;
          k += c;
          l -= c;
        }
      }
      needseek = 1;
    }
    if (!--httodo)
      return 0;
    if (++hti == htsize) {
      hti = 0;
      needseek = 1;
    }
  }
}
```