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

```asm
<extract_string>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0xffffffff,-0x4(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L144
L23:
  cmpl   $0xffffffff,-0x4(%rbp)
  jne    L21
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x22,%al
  jne    L21
  mov    -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  jmp    L143
L21:
  cmpl   $0x0,-0x4(%rbp)
  js     L143
  cmpl   $0x1,-0x8(%rbp)
  jne    L175
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x22,%eax
  je     L165
  cmp    $0x5c,%eax
  jne    L31
L165:
  addl   $0x1,-0x4(%rbp)
  nop
L31:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0xc(%rbp),%eax
  sub    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  movzbl (%rcx),%eax
  mov    %al,(%rdx)
  movl   $0x0,-0x8(%rbp)
  jmp    L143
L175:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x5c,%al
  jne    L22
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0xc(%rbp),%eax
  sub    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  movzbl (%rcx),%eax
  mov    %al,(%rdx)
  movl   $0x1,-0x8(%rbp)
  jmp    L143
L22:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x22,%al
  je     L111
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0xc(%rbp),%eax
  sub    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  movzbl (%rcx),%eax
  mov    %al,(%rdx)
  jmp    L143
L111:
  mov    -0xc(%rbp),%eax
  sub    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L70
L143:
  addl   $0x1,-0xc(%rbp)
L144:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %eax,-0xc(%rbp)
  jge    L70
  mov    -0xc(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L23
L70:
  cmpl   $0x0,-0x4(%rbp)
  js     L135
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  jmp    L161
L135:
  mov    $0xffffffff,%eax
L161:
  leave
  ret
```

assistant: ```c
int extract_string(const char *src, char *dest, int len) {
  int pos = 0;
  int esc = 0;
  int off = -1;
  for (pos = 0; (pos < strlen(src)) && (pos < len); pos++) {
    if ((off == -1) && (src[pos] == '"')) {
      off = pos + 1;
    } else if (off >= 0) {
      if (esc == 1) {
        switch (src[pos]) {
        case '"':
        case '\\':
          off++;
          break;
        }
        dest[pos - off] = src[pos];
        esc = 0;
      } else if (src[pos] == '\\') {
        dest[pos - off] = src[pos];
        esc = 1;
      } else if (src[pos] != '"') {
        dest[pos - off] = src[pos];
      } else {
        dest[pos - off] = '\0';
        break;
      }
    }
  }
  return (off > -1) ? strlen(dest) : -1;
}
```