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

```asm
<tgoto>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movzbl (%rdi),%eax
  test   %al,%al
  je     L6
  lea    D57(%rip),%rbp
  mov    %esi,%r13d
  mov    %edx,%r14d
  xor    %r15d,%r15d
  lea    0x1(%rdi),%rbx
  lea    0x14(%rbp),%r12
L144:
  cmp    $0x25,%al
  je     L215
L1:
  lea    0x1(%rbp),%rcx
  mov    %al,0x0(%rbp)
  cmp    %r12,%rcx
  jae    L113
  mov    %rcx,%rbp
  mov    %rbx,%rdi
L240:
  movzbl (%rdi),%eax
  add    $0x1,%rbx
  test   %al,%al
  jne    L144
L33:
  movb   $0x0,0x0(%rbp)
  lea    D57(%rip),%rax
  jmp    L61
  nopw   0x0(%rax,%rax,1)
L215:
  movzbl 0x1(%rdi),%eax
  lea    0x2(%rdi),%rbx
  cmp    $0x25,%al
  je     L1
  cmp    $0x69,%al
  je     L24
  jg     L40
  cmp    $0x33,%al
  jg     L36
  cmp    $0x31,%al
  jg     L97
L56:
  mov    D1(%rip),%rax
  mov    (%rax),%edx
  mov    D7(%rip),%rax
  mov    %edx,(%rax)
  xor    %eax,%eax
  jmp    L61
  nopw   0x0(%rax,%rax,1)
L40:
  cmp    $0x72,%al
  jne    L56
L27:
  mov    %r13d,%edx
  mov    %rbx,%rdi
  mov    $0x1,%r15d
  jmp    L240
  nopw   0x0(%rax,%rax,1)
L36:
  cmp    $0x64,%al
  jne    L56
L97:
  mov    $0x1,%esi
  lea    0x11(%rsp),%r8
L142:
  movslq %edx,%rcx
  mov    %edx,%r9d
  movslq %esi,%rdi
  imul   $0x66666667,%rcx,%rcx
  sar    $0x1f,%r9d
  sar    $0x22,%rcx
  sub    %r9d,%ecx
  lea    (%rcx,%rcx,4),%r9d
  add    %r9d,%r9d
  sub    %r9d,%edx
  or     $0x30,%edx
  mov    %dl,(%r8,%rsi,1)
  mov    %ecx,%edx
  add    $0x1,%rsi
  test   %ecx,%ecx
  jne    L142
  cmp    $0x64,%al
  je     L104
  sub    $0x30,%eax
  movzbl %al,%ecx
  cmp    %edi,%ecx
  jl     L56
  jle    L104
  lea    -0x1(%rcx),%edx
  mov    $0x30,%esi
  mov    %r8,0x8(%rsp)
  sub    %edi,%edx
  lea    0x12(%rsp,%rdi,1),%rdi
  mov    %ecx,0x4(%rsp)
  add    $0x1,%rdx
  call   <memset@plt>
  mov    0x4(%rsp),%ecx
  mov    0x8(%rsp),%r8
  movslq %ecx,%rdi
L104:
  lea    0x0(%rbp,%rdi,1),%rdx
  mov    %rdi,%rax
  cmp    %r12,%rdx
  jae    L113
  mov    %rbp,%rdx
  nopl   (%rax)
L7:
  movzbl (%r8,%rax,1),%ecx
  sub    $0x1,%rax
  add    $0x1,%rdx
  mov    %cl,-0x1(%rdx)
  test   %eax,%eax
  jne    L7
  add    %rdi,%rbp
  cmp    $0x1,%r15d
  jne    L27
  mov    %r14d,%edx
  xor    %r15d,%r15d
  mov    %rbx,%rdi
  jmp    L240
  nop
L113:
  mov    D67(%rip),%rax
  mov    (%rax),%edx
  mov    D7(%rip),%rax
  mov    %edx,(%rax)
  xor    %eax,%eax
L61:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L51
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L24:
  add    $0x1,%r13d
  add    $0x1,%r14d
  add    $0x1,%edx
  mov    %rbx,%rdi
  jmp    L240
L6:
  lea    D57(%rip),%rbp
  jmp    L33
L51:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *tgoto(const char *cap, int col, int line) {
  static char buf[20];
  char *p, *e, c, dbuf[6];
  int oncol = 0, which = line, i;
  p = buf;
  e = p + sizeof(buf);
  while ((c = *cap++)) {
    if (c != '%' || ((c = *cap++) == '%')) {
      *p++ = c;
      if (p >= e) {
        errno = E2BIG;
        return NULL;
      }
      continue;
    }
    switch (c) {
    case '3':
    case '2':
    case 'd':
      i = 0;
      do
        dbuf[i++] = which % 10 | '0';
      while ((which /= 10));
      if (c != 'd') {
        c -= '0';
        if (i > c) {
          errno = EINVAL;
          return NULL;
        }
        while (i < c)
          dbuf[i++] = '0';
      }
      if (p + i >= e) {
        errno = E2BIG;
        return NULL;
      }
      do
        *p++ = dbuf[--i];
      while (i);
      break;
    case 'r':
      oncol = 0;
      break;
    case 'i':
      col++;
      line++;
      which++;
      continue;
    default:
      errno = EINVAL;
      return NULL;
    }
    oncol = 1 - oncol;
    which = oncol ? col : line;
  }
  *p = '\0';
  return buf;
}
```