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

```asm
<scan_text>:
  endbr64
  push   %r12
  mov    %rdi,%rcx
  mov    %rsi,%r8
  push   %rbp
  sub    $0x118,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  movzbl (%rdi),%eax
  cmp    $0x9,%al
  je     L16
  cmp    $0x20,%al
  jne    L302
  nopw   0x0(%rax,%rax,1)
L16:
  movzbl 0x1(%rcx),%eax
  add    $0x1,%rcx
  cmp    $0x20,%al
  je     L16
  cmp    $0x9,%al
  je     L16
L302:
  cmp    $0x28,%al
  je     L8
  cmp    $0xa,%al
  je     L318
  test   %al,%al
  je     L318
  mov    %rsp,%rbp
  mov    %rbp,%rdi
  test   %edx,%edx
  jne    L81
  cmp    $0x9,%al
  je     L216
  nopw   0x0(%rax,%rax,1)
L382:
  cmp    $0x20,%al
  je     L216
  add    $0x1,%rcx
  mov    %al,(%rdi)
  add    $0x1,%rdi
  movzbl (%rcx),%eax
  cmp    $0xa,%al
  je     L216
  test   %al,%al
  je     L216
  cmp    $0x9,%al
  jne    L382
  nopl   (%rax)
L216:
  cmp    %rbp,%rdi
  je     L318
L257:
  movb   $0x0,(%rdi)
  test   %r8,%r8
  je     L52
  mov    %rcx,(%r8)
L52:
  sub    %rbp,%rdi
  add    $0x1,%edi
  call   <dsc_malloc@plt>
  mov    %rbp,%rsi
  mov    %rax,%rdi
  mov    %rax,%r12
  call   <strcpy@plt>
L71:
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L213
  add    $0x118,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L225:
  cmp    $0xa,%al
  je     L216
L81:
  add    $0x1,%rcx
  mov    %al,(%rdi)
  add    $0x1,%rdi
  movzbl (%rcx),%eax
  test   %al,%al
  jne    L225
  jmp    L216
  nopw   0x0(%rax,%rax,1)
L8:
  mov    %rsp,%rbp
  movzbl 0x1(%rcx),%eax
  lea    0x1(%rcx),%rdx
  mov    $0x1,%r9d
  mov    %rbp,%rdi
  lea    D6(%rip),%r10
  lea    0x1(%rdx),%rcx
  lea    0x1(%rdi),%rsi
  mov    %al,-0x1(%rsi)
  cmp    $0x29,%al
  je     L56
L3:
  jg     L46
  test   %al,%al
  je     L257
  cmp    $0x28,%al
  jne    L186
  movzbl 0x1(%rdx),%eax
  add    $0x1,%r9d
  mov    %rcx,%rdx
L40:
  mov    %rsi,%rdi
  lea    0x1(%rdx),%rcx
  lea    0x1(%rdi),%rsi
  mov    %al,-0x1(%rsi)
  cmp    $0x29,%al
  jne    L3
L56:
  sub    $0x1,%r9d
  je     L257
L186:
  movzbl 0x1(%rdx),%eax
  mov    %rcx,%rdx
  jmp    L40
  nopl   0x0(%rax,%rax,1)
L46:
  cmp    $0x5c,%al
  jne    L186
  movzbl 0x1(%rdx),%eax
  lea    0x2(%rdx),%r11
  cmp    $0x74,%al
  jg     L70
  cmp    $0x61,%al
  jle    L351
  lea    -0x62(%rax),%ecx
  cmp    $0x12,%cl
  ja     L70
  movzbl %cl,%ecx
  movslq (%r10,%rcx,4),%rcx
  add    %r10,%rcx
  notrack jmp *%rcx
  nopl   0x0(%rax)
L351:
  test   %al,%al
  je     L257
  lea    -0x30(%rax),%ecx
  cmp    $0x7,%cl
  ja     L70
  movsbl 0x2(%rdx),%edi
  movsbl %cl,%ecx
  lea    -0x30(%rdi),%r12d
  mov    %edi,%eax
  cmp    $0x7,%r12d
  ja     L150
  lea    -0x30(%rdi,%rcx,8),%ecx
  movsbl 0x3(%rdx),%edi
  lea    -0x30(%rdi),%r11d
  mov    %edi,%eax
  cmp    $0x7,%r11d
  jbe    L373
  lea    0x3(%rdx),%r11
  nop
L150:
  mov    %cl,-0x1(%rsi)
  mov    %r11,%rdx
  jmp    L40
L318:
  xor    %r12d,%r12d
  jmp    L71
  nopl   0x0(%rax,%rax,1)
L70:
  mov    %al,-0x1(%rsi)
  movzbl 0x2(%rdx),%eax
  mov    %r11,%rdx
  jmp    L40
  movzbl 0x2(%rdx),%eax
  movb   $0x8,-0x1(%rsi)
  mov    %r11,%rdx
  jmp    L40
  movzbl 0x2(%rdx),%eax
  movb   $0x9,-0x1(%rsi)
  mov    %r11,%rdx
  jmp    L40
  movzbl 0x2(%rdx),%eax
  movb   $0xd,-0x1(%rsi)
  mov    %r11,%rdx
  jmp    L40
  movzbl 0x2(%rdx),%eax
  movb   $0xa,-0x1(%rsi)
  mov    %r11,%rdx
  jmp    L40
  movzbl 0x2(%rdx),%eax
  movb   $0xc,-0x1(%rsi)
  mov    %r11,%rdx
  jmp    L40
L373:
  movzbl 0x4(%rdx),%eax
  lea    -0x30(%rdi,%rcx,8),%ecx
  lea    0x4(%rdx),%r11
  jmp    L150
L213:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
const char *scan_text(const char *line, const char **endp, int rest) {
  char buf[258];
  const char *lp = line;
  char *bp = buf;
  char *arg;
  while (*lp == ' ' || *lp == '\t')
    lp++;
  if (*lp == '(') {
    int level = 1;
    lp++;
    for (;;)
      switch (*bp++ = *lp++) {
      case '\\':
        switch (*lp++) {
        case 'n':
          bp[-1] = '\n';
          break;
        case 'r':
          bp[-1] = '\r';
          break;
        case 't':
          bp[-1] = '\t';
          break;
        case 'b':
          bp[-1] = '\b';
          break;
        case 'f':
          bp[-1] = '\f';
          break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7': {
          int c = lp[-1] - '0';
          int d = *lp;
          if (d >= '0' && d <= '7') {
            c = (c << 3) + d - '0';
            d = *++lp;
            if (d >= '0' && d <= '7') {
              c = (c << 3) + d - '0';
              lp++;
            }
          }
          bp[-1] = c;
          break;
        }
        case 0:
          lp--;
          goto out;
        default:
          bp[-1] = lp[-1];
        }
        break;
      case '(':
        ++level;
        break;
      case ')':
        if (--level)
          break;
      case 0:
        goto out;
      default:;
      }
  out:
    --bp;
  } else {
    while (!(*lp == 0 || *lp == '\n' || (!rest && (*lp == ' ' || *lp == '\t'))))
      *bp++ = *lp++;
    if (bp == buf)
      return NULL;
  }
  *bp = 0;
  if (endp)
    *endp = lp;
  arg = dsc_malloc(bp - buf + 1);
  strcpy(arg, buf);
  return arg;
}
```