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     L203
  mov    %rsi,%r14
  jle    L49
L173:
  mov    $0x1,%r13d
  lea    0x20(%rsp),%r12
  nopl   (%rax)
L135:
  mov    (%r14,%r13,8),%rdi
  lea    D2(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L28
  nopl   0x0(%rax)
L20:
  mov    %rbp,%rdi
  call   <feof@plt>
  test   %eax,%eax
  jne    L88
  lea    0x18(%rsp),%rdi
  mov    %rbp,%rdx
  mov    %r12,%rsi
  call   <getline@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L88
  mov    0x18(%rsp),%r15
  jmp    L40
  nopl   0x0(%rax,%rax,1)
L172:
  add    $0x1,%r15
  call   <putchar@plt>
L11:
  mov    0x18(%rsp),%rax
  add    %rbx,%rax
  cmp    %rax,%r15
  jae    L20
L40:
  movsbl (%r15),%edi
  cmp    $0x3c,%dil
  jne    L172
  cmpb   $0x55,0x1(%r15)
  jne    L172
  movsbl 0x2(%r15),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  jne    L48
L120:
  movsbl (%r15),%edi
  jmp    L172
  nopl   0x0(%rax)
L48:
  movsbl 0x3(%r15),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L120
  movsbl 0x4(%r15),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L120
  movsbl 0x5(%r15),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L120
  cmpb   $0x3e,0x6(%r15)
  jne    L120
  lea    0x2(%r15),%rdi
  mov    $0x10,%edx
  xor    %esi,%esi
  call   <strtoul@plt>
  mov    %eax,%edi
  cmp    $0x7f,%eax
  jbe    L143
  mov    %eax,%r8d
  mov    %eax,%edx
  and    $0x3f,%r8d
  shr    $0x6,%edx
  or     $0x80,%r8b
  cmp    $0x7ff,%eax
  ja     L142
  or     $0xc0,%dl
  mov    %r8d,0x8(%rsp)
  mov    %edx,%edi
  call   <putchar@plt>
  mov    0x8(%rsp),%edi
  call   <putchar@plt>
  jmp    L210
L88:
  mov    %rbp,%rdi
  call   <fclose@plt>
L28:
  add    $0x1,%r13
  cmp    %r13d,0x4(%rsp)
  jg     L135
L49:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L29
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L203:
  movl   $0x2,0x4(%rsp)
  lea    D8(%rip),%r14
  jmp    L173
L142:
  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
L143:
  call   <putchar@plt>
L210:
  add    $0x7,%r15
  jmp    L11
L29:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D2
datatype: string

tool: D2: 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;
}
```