user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x2,%edi
  jne    L104
  mov    0x8(%rsi),%rbp
  mov    %rsi,%rbx
  cmpb   $0x2d,0x0(%rbp)
  je     L104
  mov    %rbp,%rdi
  call   <filename2varname@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L118
  lea    D84(%rip),%rsi
  mov    %rbp,%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L139
  mov    %r15,%rsi
  lea    D70(%rip),%rdi
  xor    %eax,%eax
  xor    %r12d,%r12d
  call   <printf@plt>
  mov    $0x1,%ebx
  lea    D80(%rip),%r14
  jmp    L133
  nopl   (%rax)
L51:
  cmp    $0x10,%ebx
  je     L6
L140:
  mov    %ebp,%esi
  mov    %r14,%rdi
  xor    %eax,%eax
  add    $0x1,%ebx
  add    $0x1,%r12
  call   <printf@plt>
L133:
  mov    %r13,%rdi
  call   <getc@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  js     L4
  test   %r12,%r12
  je     L51
  mov    $0x2c,%edi
  call   <putchar@plt>
  cmp    $0x10,%ebx
  jne    L140
L6:
  mov    $0xa,%edi
  mov    $0x1,%ebx
  call   <putchar@plt>
  jmp    L140
L104:
  lea    D38(%rip),%rdi
  call   <puts@plt>
  lea    D17(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%eax
L39:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L4:
  test   %r12,%r12
  jne    L84
L123:
  lea    D64(%rip),%rdi
  call   <puts@plt>
  mov    %r12,%rdx
  mov    %r15,%rsi
  xor    %eax,%eax
  lea    D42(%rip),%rdi
  call   <printf@plt>
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    %r15,%rdi
  call   <free@plt>
  xor    %eax,%eax
  jmp    L39
L84:
  mov    $0x2c,%edi
  call   <putchar@plt>
  jmp    L123
L118:
  lea    D65(%rip),%rdi
  call   <puts@plt>
  mov    $0x2,%eax
  jmp    L39
L139:
  mov    0x8(%rbx),%rsi
  lea    D28(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x3,%eax
  jmp    L39
```

tool_calls: name: extract_symbolic_data
arguments: label: D84
type_infered: string
name: extract_symbolic_data
arguments: label: D70
type_infered: string
name: extract_symbolic_data
arguments: label: D80
type_infered: string
name: extract_symbolic_data
arguments: label: D38
type_infered: string
name: extract_symbolic_data
arguments: label: D17
type_infered: string
name: extract_symbolic_data
arguments: label: D64
type_infered: string
name: extract_symbolic_data
arguments: label: D42
type_infered: string
name: extract_symbolic_data
arguments: label: D65
type_infered: string
name: extract_symbolic_data
arguments: label: D28
type_infered: string

tool: D84: rb

tool: D70: unsigned char %s[] = {


tool: D80: 0x%02X

tool: D38: file2c transforms a data file into C code. Copyright (C) Mateusz Viste 2014

tool: D17: Usage: file2c file.dat

tool: D64: 0x00};

tool: D42: long %s_len = %ldl;


tool: D65: Error: unable to parse filename.

tool: D28: Error: failed to open '%s'.


assistant: ```c
int main(int argc, char **argv) {
  FILE *fd;
  int bytebuff, column = 1;
  long bytecount = 0;
  char *varname, *filename;
  if ((argc != 2) || (argv[1][0] == '-')) {
    puts("file2c transforms a data file into C code. Copyright (C) Mateusz Viste 2014");
    puts("Usage: file2c file.dat");
    return (1);
  }
  filename = argv[1];
  varname = filename2varname(filename);
  if (varname == NULL) {
    puts("Error: unable to parse filename.");
    return (2);
  }
  fd = fopen(filename, "rb");
  if (fd == NULL) {
    printf("Error: failed to open '%s'.\n", argv[1]);
    return (3);
  }
  printf("unsigned char %s[] = {\n", varname);
  for (;;) {
    bytebuff = getc(fd);
    if (bytebuff < 0)
      break;
    if (bytecount > 0)
      printf(",");
    if (column > 15) {
      column = 1;
      printf("\n");
    }
    column += 1;
    bytecount += 1;
    printf("0x%02X", bytebuff);
  }
  if (bytecount > 0)
    printf(",");
  printf("0x00};\n");
  printf("long %s_len = %ldl;\n", varname, bytecount);
  fclose(fd);
  free(varname);
  return (0);
}
```