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

```asm
<tgoto>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movzbl (%rdi),%eax
  test   %al,%al
  je     L186
  mov    %rdi,%rcx
  mov    %esi,%r10d
  mov    %edx,%r9d
  lea    0x1(%rdi),%r8
  mov    %edx,%esi
  mov    $0x0,%ebp
  lea    D68(%rip),%rdi
  lea    0x14(%rdi),%r11
  lea    0x1(%rsp),%rbx
  mov    $0x1,%r12d
  jmp    L261
L126:
  lea    0x2(%rcx),%r8
  movzbl 0x1(%rcx),%eax
  cmp    $0x25,%al
  je     L75
  cmp    $0x69,%al
  je     L99
  jg     L159
  cmp    $0x33,%al
  jg     L158
  cmp    $0x31,%al
  jg     L17
L82:
  mov    D59(%rip),%rax
  mov    (%rax),%edx
  mov    D99(%rip),%rax
  mov    %edx,(%rax)
  mov    $0x0,%eax
  jmp    L220
L190:
  mov    D11(%rip),%rax
  mov    (%rax),%edx
  mov    D99(%rip),%rax
  mov    %edx,(%rax)
  mov    $0x0,%eax
L220:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L30
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L158:
  cmp    $0x64,%al
  jne    L82
  mov    $0x1,%ecx
L74:
  mov    %ecx,%r13d
  movslq %esi,%rdx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x22,%rdx
  mov    %esi,%r14d
  sar    $0x1f,%r14d
  sub    %r14d,%edx
  lea    (%rdx,%rdx,4),%r14d
  add    %r14d,%r14d
  sub    %r14d,%esi
  or     $0x30,%esi
  mov    %sil,(%rbx,%rcx,1)
  mov    %edx,%esi
  add    $0x1,%rcx
  test   %edx,%edx
  jne    L74
  cmp    $0x64,%al
  je     L272
  sub    $0x30,%eax
  movsbl %al,%ecx
  cmp    %r13d,%ecx
  jl     L162
  movslq %r13d,%rdx
  jle    L272
L165:
  movb   $0x30,0x2(%rsp,%rdx,1)
  add    $0x1,%rdx
  cmp    %edx,%ecx
  jg     L165
  movsbl %al,%r13d
L272:
  movslq %r13d,%rax
  lea    (%rdi,%rax,1),%rdx
  cmp    %r11,%rdx
  jae    L40
  mov    %rdi,%rdx
L212:
  add    $0x1,%rdx
  movzbl (%rbx,%rax,1),%ecx
  mov    %cl,-0x1(%rdx)
  sub    $0x1,%rax
  test   %eax,%eax
  jne    L212
  lea    -0x1(%r13),%eax
  lea    0x1(%rdi,%rax,1),%rdi
  mov    %r12d,%eax
  sub    %ebp,%eax
  mov    %eax,%ebp
  jne    L2
  mov    %r9d,%esi
  mov    %r8,%rcx
  jmp    L233
L159:
  cmp    $0x72,%al
  jne    L82
  mov    %r10d,%esi
  mov    %r8,%rcx
  mov    $0x1,%ebp
L233:
  lea    0x1(%rcx),%r8
  movzbl (%rcx),%eax
  test   %al,%al
  je     L70
L261:
  cmp    $0x25,%al
  je     L126
L75:
  lea    0x1(%rdi),%rdx
  mov    %al,(%rdi)
  cmp    %r11,%rdx
  jae    L190
  mov    %rdx,%rdi
  mov    %r8,%rcx
  jmp    L233
L17:
  mov    $0x1,%ecx
  jmp    L74
L162:
  mov    D59(%rip),%rax
  mov    (%rax),%edx
  mov    D99(%rip),%rax
  mov    %edx,(%rax)
  mov    $0x0,%eax
  jmp    L220
L40:
  mov    D11(%rip),%rax
  mov    (%rax),%edx
  mov    D99(%rip),%rax
  mov    %edx,(%rax)
  mov    $0x0,%eax
  jmp    L220
L2:
  mov    %r10d,%esi
  mov    %r8,%rcx
  jmp    L233
L99:
  add    $0x1,%r10d
  add    $0x1,%r9d
  add    $0x1,%esi
  mov    %r8,%rcx
  jmp    L233
L186:
  lea    D68(%rip),%rdi
L70:
  movb   $0x0,(%rdi)
  lea    D68(%rip),%rax
  jmp    L220
L30:
  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;
}
```