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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  cmpl   $0x4,-0x24(%rbp)
  jg     L124
  lea    D67(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L91
L124:
  mov    -0x30(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  lea    D179(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L120
  mov    -0x30(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D153(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L91
L120:
  mov    -0x30(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  lea    D137(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L76
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x30(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L91
L76:
  mov    -0x30(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  lea    D137(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L34
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x30(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D46(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L91
L34:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x30,%edx
  mov    $0x1,%esi
  lea    D103(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x27,%edx
  mov    $0x1,%esi
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x30(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%rdx
  mov    -0x8(%rbp),%rax
  lea    D135(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x30,%edx
  mov    $0x1,%esi
  lea    D103(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  cmpl   $0x6,-0x24(%rbp)
  jle    L49
  mov    -0x30(%rbp),%rax
  add    $0x30,%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%rax
  lea    D155(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
L49:
  mov    -0x30(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%rax
  lea    D141(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  cmpl   $0x5,-0x24(%rbp)
  jle    L78
  mov    -0x30(%rbp),%rax
  add    $0x28,%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%rax
  lea    D110(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
L78:
  mov    -0x30(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%rax
  lea    D14(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  movb   $0x0,-0x19(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  mov    %al,-0x1a(%rbp)
  jmp    L111
L22:
  movzbl -0x19(%rbp),%eax
  and    $0xf,%eax
  test   %al,%al
  jne    L90
  mov    -0x10(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x4,%edx
  mov    $0x1,%esi
  lea    D120(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  movb   $0x0,-0x19(%rbp)
L90:
  movzbl -0x1a(%rbp),%edx
  mov    -0x10(%rbp),%rax
  lea    D122(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  addb   $0x1,-0x19(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  mov    %al,-0x1a(%rbp)
L111:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %eax,%eax
  je     L22
  mov    -0x10(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x9,%edx
  mov    $0x1,%esi
  lea    D75(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x4,%edx
  mov    $0x1,%esi
  lea    D55(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
L91:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D67
type_guessed: string
name: disassemble_data
arguments: tag: D179
type_guessed: string
name: disassemble_data
arguments: tag: D153
type_guessed: string
name: disassemble_data
arguments: tag: D137
type_guessed: string
name: disassemble_data
arguments: tag: D4
type_guessed: string
name: disassemble_data
arguments: tag: D46
type_guessed: string
name: disassemble_data
arguments: tag: D103
type_guessed: string
name: disassemble_data
arguments: tag: D7
type_guessed: string
name: disassemble_data
arguments: tag: D135
type_guessed: string
name: disassemble_data
arguments: tag: D155
type_guessed: string
name: disassemble_data
arguments: tag: D141
type_guessed: string
name: disassemble_data
arguments: tag: D110
type_guessed: string
name: disassemble_data
arguments: tag: D14
type_guessed: string
name: disassemble_data
arguments: tag: D120
type_guessed: string
name: disassemble_data
arguments: tag: D122
type_guessed: string
name: disassemble_data
arguments: tag: D75
type_guessed: string
name: disassemble_data
arguments: tag: D55
type_guessed: string

tool: D67: Usage: bin2c infile.bin outfile.c outfile.h array_name [array_attribute [header_for_attribute]]

tool: D179: rb

tool: D153: ERROR: Couldn't open data file '%s'.


tool: D137: w

tool: D4: ERROR: Couldn't create output source file '%s'.


tool: D46: ERROR: Couldn't create output header file '%s'.


tool: D103: /* This file is autogenerated, do not edit. */



tool: D7: #ifndef CHAR
#define CHAR char
#endif



tool: D135: extern CHAR %s[];


tool: D155: #include "%s"


tool: D141: #include "%s"



tool: D110: %s 

tool: D14: CHAR %s[] =
{

tool: D120: 
   

tool: D122:  0x%02x,

tool: D75: 
    0x00

tool: D55: 
};


assistant: ```c
int main(int argc, char *argv[]) {
  FILE *inFile;
  FILE *outCFile;
  FILE *outHFile;
  unsigned char ch;
  unsigned char cnt;
  if (argc < 5) {
    printf("Usage: bin2c infile.bin outfile.c outfile.h array_name [array_attribute [header_for_attribute]]\n");
    return -1;
  }
  inFile = fopen(argv[1], "rb");
  if (!inFile) {
    printf("ERROR: Couldn't open data file '%s'.\n", argv[1]);
    return -1;
  }
  outCFile = fopen(argv[2], "w");
  if (!outCFile) {
    fclose(inFile);
    printf("ERROR: Couldn't create output source file '%s'.\n", argv[2]);
    return -1;
  }
  outHFile = fopen(argv[3], "w");
  if (!outHFile) {
    fclose(outCFile);
    fclose(inFile);
    printf("ERROR: Couldn't create output header file '%s'.\n", argv[3]);
    return -1;
  }
  fprintf(outHFile, "/* This file is autogenerated, do not edit. */\n\n");
  fprintf(outHFile, "#ifndef CHAR\n"
                    "#define CHAR char\n"
                    "#endif\n\n");
  fprintf(outHFile, "extern CHAR %s[];\n", argv[4]);
  fclose(outHFile);
  fprintf(outCFile, "/* This file is autogenerated, do not edit. */\n\n");
  if (argc >= 7) {
    fprintf(outCFile, "#include \"%s\"\n", argv[6]);
  }
  fprintf(outCFile, "#include \"%s\"\n\n", argv[3]);
  if (argc >= 6) {
    fprintf(outCFile, "%s ", argv[5]);
  }
  fprintf(outCFile, "CHAR %s[] =\n{", argv[4]);
  cnt = 0;
  ch = fgetc(inFile);
  while (!feof(inFile)) {
    if ((cnt % 16) == 0) {
      fprintf(outCFile, "\n   ");
      cnt = 0;
    }
    fprintf(outCFile, " 0x%02x,", (unsigned int)ch);
    ++cnt;
    ch = fgetc(inFile);
  }
  fprintf(outCFile, "\n    0x00");
  fprintf(outCFile, "\n};\n");
  fclose(outCFile);
  fclose(inFile);
  return 0;
}
```