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

```asm
<find_next_kv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %esi,%r12d
  mov    %rdx,%rbp
  mov    %rcx,%r14
  mov    %r8,0x8(%rsp)
  mov    %r9,%r15
  mov    $0x1,%r8d
  mov    $0x4,%ecx
  lea    D29(%rip),%rdx
  call   <ignore_chs@plt>
  test   %rax,%rax
  je     L109
  mov    %rax,%rbx
  mov    0x50(%rsp),%rax
  movq   $0x0,(%rax)
  mov    %rbx,0x0(%rbp)
  mov    %rbx,%rax
  sub    %r13,%rax
  mov    %r12d,%edx
  sub    %eax,%edx
  mov    $0x3d,%esi
  mov    %rbx,%rdi
  call   <memchr@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L79
  movb   $0x0,(%rax)
  mov    $0x4,%ecx
  lea    D27(%rip),%rdx
  mov    %eax,%esi
  sub    %ebx,%esi
  mov    %rbx,%rdi
  call   <find_delim@plt>
  test   %rax,%rax
  je     L5
  movb   $0x0,(%rax)
L5:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %eax,(%r14)
  lea    0x1(%rbp),%rdi
  mov    %rdi,%rax
  sub    %r13,%rax
  mov    %r12d,%esi
  sub    %eax,%esi
  mov    $0x1,%r8d
  mov    $0x4,%ecx
  lea    D27(%rip),%rdx
  call   <ignore_chs@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L101
  cmpb   $0x22,(%rax)
  je     L46
  mov    0x8(%rsp),%rax
  mov    %rbx,(%rax)
  mov    %rbx,%rax
  sub    %r13,%rax
  mov    %r12d,%esi
  sub    %eax,%esi
  mov    $0x5,%ecx
  lea    D25(%rip),%rdx
  mov    %rbx,%rdi
  call   <find_delim@plt>
  jmp    L94
L46:
  add    $0x1,%rbx
  mov    0x8(%rsp),%rax
  mov    %rbx,(%rax)
  mov    %rbx,%rax
  sub    %r13,%rax
  mov    %r12d,%esi
  sub    %eax,%esi
  mov    $0x3,%ecx
  lea    D1(%rip),%rdx
  mov    %rbx,%rdi
  call   <find_delim@plt>
L94:
  test   %rax,%rax
  je     L61
  mov    %rax,%rdx
  sub    %rbx,%rdx
  mov    %edx,(%r15)
  add    $0x1,%rax
  mov    0x50(%rsp),%rcx
  mov    %rax,(%rcx)
  sub    %r13,%rax
  sub    %eax,%r12d
  mov    0x58(%rsp),%rax
  mov    %r12d,(%rax)
  mov    $0x0,%eax
L47:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L61:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %eax,(%r15)
  mov    $0x0,%eax
  jmp    L47
L109:
  mov    $0xffffffff,%eax
  jmp    L47
L79:
  mov    $0xffffffff,%eax
  jmp    L47
L101:
  mov    $0xffffffff,%eax
  jmp    L47
```

tool_calls: name: read_data
arguments: label: D29
type: string
name: read_data
arguments: label: D27
type: string
name: read_data
arguments: label: D25
type: string
name: read_data
arguments: label: D1
type: string

tool: D29: ;	 


tool: D27: 	 


tool: D25: 	 ;


tool: D1: "


assistant: ```c
int find_next_kv(char *buf, int len, char **key, int *key_len, char **value, int *value_len, char **nbuf, int *nlen) {
  char *p = buf, *p1, *p2, *pe, *pn = 0;
  int find;
  p = ignore_chs(p, len, ";\t \r\n", 4, 1);
  if (!p) {
    return -1;
  }
  *nbuf = 0;
  *key = p;
  pe = memchr(p, '=', len - (p - buf));
  if (!pe) {
    return -1;
  }
  *pe = 0;
  p1 = find_delim(p, pe - p, "\t \r\n", 4);
  if (p1) {
    *p1 = 0;
  }
  *key_len = strlen(p);
  p = pe + 1;
  p = ignore_chs(p, len - (p - buf), "\t \r\n", 4, 1);
  if (!p) {
    return -1;
  }
  find = 0;
  if (*p == '"') {
    p++;
    find = 1;
  }
  *value = p;
  if (find) {
    p2 = find_delim(p, len - (p - buf), "\"\r\n", 3);
  } else {
    p2 = find_delim(p, len - (p - buf), "\t ;\r\n", 5);
  }
  if (p2) {
    *value_len = p2 - p;
    pn = p2 + 1;
  } else {
    *value_len = strlen(p);
  }
  if (pn) {
    *nbuf = pn;
    *nlen = len - (pn - buf);
  }
  return 0;
}
```