user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edi,0x4(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x18(%rsp)
  movq   $0x0,0x20(%rsp)
  cmp    $0x1,%edi
  je     L78
  mov    %rsi,%r14
  jle    L166
L185:
  mov    $0x1,%r13d
  lea    0x20(%rsp),%r12
  nopl   (%rax)
L48:
  mov    (%r14,%r13,8),%rdi
  lea    D15(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L213
  nopl   0x0(%rax)
L118:
  mov    %rbp,%rdi
  call   <feof@plt>
  test   %eax,%eax
  jne    L6
  lea    0x18(%rsp),%rdi
  mov    %rbp,%rdx
  mov    %r12,%rsi
  call   <getline@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L6
  mov    0x18(%rsp),%r15
  jmp    L87
  nopl   0x0(%rax,%rax,1)
L116:
  add    $0x1,%r15
  call   <putchar@plt>
L47:
  mov    0x18(%rsp),%rax
  add    %rbx,%rax
  cmp    %rax,%r15
  jae    L118
L87:
  movsbl (%r15),%edi
  cmp    $0x3c,%dil
  jne    L116
  cmpb   $0x55,0x1(%r15)
  jne    L116
  movsbl 0x2(%r15),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  jne    L65
L131:
  movsbl (%r15),%edi
  jmp    L116
  nopl   0x0(%rax)
L65:
  movsbl 0x3(%r15),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L131
  movsbl 0x4(%r15),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L131
  movsbl 0x5(%r15),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L131
  cmpb   $0x3e,0x6(%r15)
  jne    L131
  lea    0x2(%r15),%rdi
  mov    $0x10,%edx
  xor    %esi,%esi
  call   <strtoul@plt>
  mov    %eax,%edi
  cmp    $0x7f,%eax
  jbe    L28
  mov    %eax,%r8d
  mov    %eax,%edx
  and    $0x3f,%r8d
  shr    $0x6,%edx
  or     $0x80,%r8b
  cmp    $0x7ff,%eax
  ja     L84
  or     $0xc0,%dl
  mov    %r8d,0x8(%rsp)
  mov    %edx,%edi
  call   <putchar@plt>
  mov    0x8(%rsp),%edi
  call   <putchar@plt>
  jmp    L210
L6:
  mov    %rbp,%rdi
  call   <fclose@plt>
L213:
  add    $0x1,%r13
  cmp    %r13d,0x4(%rsp)
  jg     L48
L166:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L74
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L78:
  movl   $0x2,0x4(%rsp)
  lea    D9(%rip),%r14
  jmp    L185
L84:
  shr    $0xc,%edi
  mov    %r8d,0xc(%rsp)
  or     $0xe0,%dil
  mov    %edx,0x8(%rsp)
  call   <putchar@plt>
  mov    0x8(%rsp),%edx
  and    $0x3f,%edx
  or     $0x80,%dl
  mov    %edx,%edi
  call   <putchar@plt>
  mov    0xc(%rsp),%edi
L28:
  call   <putchar@plt>
L210:
  add    $0x7,%r15
  jmp    L47
L74:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D15
type_guessed: string

tool: D15: r

assistant: ```c
int main(int argc, char *argv[]) {
  int n;
  char *line = NULL;
  size_t len = 0;
  if (argc == 1) {
    static char *new_argv[] = {NULL, (char *)"/dev/stdin", NULL};
    argv = new_argv;
    argc = 2;
  }
  for (n = 1; n < argc; ++n) {
    FILE *fp = fopen(argv[n], "r");
    if (fp == NULL)
      continue;
    while (!feof(fp)) {
      ssize_t cnt = getline(&line, &len, fp);
      char *runp;
      if (cnt <= 0)
        break;
      runp = line;
      do {
        if (runp[0] == '<' && runp[1] == 'U' && isxdigit(runp[2]) && isxdigit(runp[3]) && isxdigit(runp[4]) && isxdigit(runp[5]) && runp[6] == '>') {
          unsigned int val = strtoul(runp + 2, NULL, 16);
          if (val < 128)
            putchar(val);
          else if (val < 0x800) {
            putchar(0xc0 | (val >> 6));
            putchar(0x80 | (val & 0x3f));
          } else {
            putchar(0xe0 | (val >> 12));
            putchar(0x80 | ((val >> 6) & 0x3f));
            putchar(0x80 | (val & 0x3f));
          }
          runp += 7;
        } else
          putchar(*runp++);
      } while (runp < &line[cnt]);
    }
    fclose(fp);
  }
  return 0;
}
```