user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<extract>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x22,%al
  jne    L77
  addq   $0x1,-0x18(%rbp)
L77:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L12
  mov    $0x4,%esi
  lea    D19(%rip),%rax
  mov    %rax,%rdi
  call   <die@plt>
L12:
  movq   $0x0,-0x8(%rbp)
  jmp    L11
L5:
  mov    -0x8(%rbp),%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    %rax,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  cltq
  add    %rax,-0x8(%rbp)
L11:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L5
  mov    -0x20(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x22,%al
  jne    L59
  addq   $0x1,-0x18(%rbp)
L59:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  test   %al,%al
  jne    L56
  mov    $0x5,%esi
  lea    D27(%rip),%rax
  mov    %rax,%rdi
  call   <die@plt>
L56:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x22,%al
  jne    L2
  addq   $0x1,-0x18(%rbp)
L2:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L61
  mov    $0x6,%esi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <die@plt>
L61:
  movw   $0x0,-0xa(%rbp)
  jmp    L66
L76:
  movzwl -0xa(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %ax,-0xa(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  mov    %eax,%edx
  movzwl -0xa(%rbp),%eax
  add    %edx,%eax
  mov    %ax,-0xa(%rbp)
L66:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L76
  mov    -0x28(%rbp),%rax
  movzwl -0xa(%rbp),%edx
  mov    %dx,(%rax)
  mov    -0x28(%rbp),%rax
  movzwl (%rax),%eax
  cwtl
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D19
type_infered: string
name: disassemble_data
arguments: label: D27
type_infered: string
name: disassemble_data
arguments: label: D4
type_infered: string

tool: D19: expected number for ip address

tool: D27: expected comma after ip address

tool: D4: expected number for location index

assistant: ```c
int extract(char *buf, long *addr, short *ndx) {
  if ('"' == *buf)
    buf++;
  if (!isdigit(*buf))
    die("expected number for ip address", 4);
  long ip = 0;
  while (isdigit(*buf)) {
    ip *= 10;
    ip += (*buf++) - '0';
  }
  *addr = ip;
  if ('"' == *buf)
    buf++;
  if (!',' == *buf++)
    die("expected comma after ip address", 5);
  if ('"' == *buf)
    buf++;
  if (!isdigit(*buf))
    die("expected number for location index", 6);
  short nub = 0;
  while (isdigit(*buf)) {
    nub *= 10;
    nub += (*buf++) - '0';
  }
  return *ndx = nub;
}
```