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

```asm
<file_cvt>:
  endbr64
  push   %r15
  push   %r14
  lea    D32(%rip),%r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    $0x8,%ebp
  push   %rbx
  lea    0x1(%rdi),%rbx
  sub    $0x18,%rsp
  movzbl (%rdi),%r15d
  movl   $0x0,0xc(%rsp)
  test   %r15b,%r15b
  jne    L147
  jmp    L199
  nopl   0x0(%rax,%rax,1)
L2:
  test   %ebp,%ebp
  je     L183
  mov    %r15b,(%r12)
  sub    $0x1,%ebp
  add    $0x1,%r12
L183:
  movzbl (%rbx),%r15d
  add    $0x1,%rbx
  test   %r15b,%r15b
  je     L184
L147:
  lea    -0x1(%rbx),%rax
  mov    %rax,(%rsp)
  lea    -0x20(%r15),%eax
  cmp    $0x5e,%al
  ja     L82
  movzbl %r15b,%r13d
  mov    %r14,%rdi
  mov    %r13d,%esi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L82
  cmp    $0x2e,%r15b
  je     L103
  cmp    $0x5c,%r15b
  je     L0
  mov    %r13d,%edi
  call   <islower@plt>
  test   %rax,%rax
  je     L2
  mov    %r13d,%edi
  call   <toupper@plt>
  mov    %eax,%r15d
  jmp    L2
  cs nopw 0x0(%rax,%rax,1)
L103:
  mov    0xc(%rsp),%ecx
  test   %ecx,%ecx
  jne    L105
  lea    -0x1(%rbp),%eax
  test   %ebp,%ebp
  je     L169
  mov    %eax,%ebp
  mov    %r12,%rdi
  mov    $0x20,%esi
  add    $0x1,%rbp
  mov    %rbp,%rdx
  add    %rbp,%r12
  call   <memset@plt>
L169:
  movzbl (%rbx),%r15d
  movl   $0x1,0xc(%rsp)
  mov    $0x3,%ebp
  add    $0x1,%rbx
  test   %r15b,%r15b
  jne    L147
  nopw   0x0(%rax,%rax,1)
L184:
  cmp    $0x8,%ebp
  je     L199
  mov    0xc(%rsp),%edx
  lea    -0x1(%rbp),%eax
  test   %edx,%edx
  jne    L73
  test   %ebp,%ebp
  je     L43
  lea    0x1(%rax),%rbx
  mov    %r12,%rdi
  mov    $0x20,%esi
  mov    %rbx,%rdx
  add    %rbx,%r12
  call   <memset@plt>
L43:
  mov    $0x2,%eax
L60:
  lea    0x1(%rax),%rdx
  mov    $0x20,%esi
  mov    %r12,%rdi
  call   <memset@plt>
L172:
  add    $0x18,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L105:
  lea    D24(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
L68:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L82:
  lea    D16(%rip),%rdi
  call   <printf@plt>
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L0:
  add    $0x2,%rbx
L12:
  mov    (%rsp),%rax
  movzbl (%rax),%eax
  mov    %al,0xc(%rsp)
  sub    $0x30,%eax
  cmp    $0x7,%al
  ja     L89
  addq   $0x1,(%rsp)
  mov    (%rsp),%rax
  cmp    %rbx,%rax
  jne    L12
  lea    D12(%rip),%rdi
  call   <printf@plt>
L199:
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L73:
  test   %ebp,%ebp
  jne    L60
  jmp    L172
L89:
  lea    D4(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  jmp    L68
```

tool_calls: name: disassemble_data
arguments: data_label: D32
type_guessed: string
name: disassemble_data
arguments: data_label: D24
type_guessed: string
name: disassemble_data
arguments: data_label: D16
type_guessed: string
name: disassemble_data
arguments: data_label: D12
type_guessed: string
name: disassemble_data
arguments: data_label: D4
type_guessed: string

tool: D32: *?<>|"/

tool: D24: Duplicate dots in name.


tool: D16: Invalid character in name. Use \ooo for special characters.


tool: D12: Expected three octal digits.


tool: D4: Invalid octal character.


assistant: ```c
int file_cvt(unsigned char *name, unsigned char *fixed) {
  unsigned char c;
  int size, ext, cnt;
  size = 8;
  ext = 0;
  while (*name) {
    c = *name;
    if (c < ' ' || c > 0x7e || strchr("*?<>|\"/", c)) {
      printf("Invalid character in name. Use \\ooo for special "
             "characters.\n");
      return 0;
    }
    if (c == '.') {
      if (ext) {
        printf("Duplicate dots in name.\n");
        return 0;
      }
      while (size--)
        *fixed++ = ' ';
      size = 3;
      ext = 1;
      name++;
      continue;
    }
    if (c == '\\') {
      c = 0;
      for (cnt = 3; cnt; cnt--) {
        if (*name < '0' || *name > '7') {
          printf("Invalid octal character.\n");
          return 0;
        }
        c = c * 8 + *name++ - '0';
      }
      if (cnt < 4) {
        printf("Expected three octal digits.\n");
        return 0;
      }
      name += 3;
    }
    if (islower(c))
      c = toupper(c);
    if (size) {
      *fixed++ = c;
      size--;
    }
    name++;
  }
  if (*name || size == 8)
    return 0;
  if (!ext) {
    while (size--)
      *fixed++ = ' ';
    size = 3;
  }
  while (size--)
    *fixed++ = ' ';
  return 1;
}
```