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    $0x38,%rsp
  mov    %edi,%r13d
  mov    %rsi,%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x24(%rsp)
  mov    %edi,%esi
  lea    D12(%rip),%rdi
  call   <printf@plt>
  cmp    $0x1,%r13d
  jle    L266
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  movq   $0x0,0x8(%rsp)
  mov    $0x1,%ebx
  lea    D20(%rip),%r15
  jmp    L55
L44:
  mov    $0x0,%eax
  call   <print_help@plt>
  mov    $0xffffffff,%eax
L262:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L226
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L40:
  mov    0x8(%r14,%rbp,1),%rax
  mov    %rax,0x8(%rsp)
L168:
  add    $0x1,%ebx
  cmp    %ebx,%r13d
  jle    L48
L55:
  movslq %ebx,%rbp
  shl    $0x3,%rbp
  lea    (%r14,%rbp,1),%r12
  mov    %r15,%rsi
  mov    (%r12),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L44
  lea    D151(%rip),%rsi
  mov    (%r12),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L44
  lea    D183(%rip),%rsi
  mov    (%r12),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L218
  add    $0x1,%ebx
  cmp    %r13d,%ebx
  jne    L40
  lea    D150(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L262
L218:
  lea    D103(%rip),%rsi
  mov    (%r12),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L162
  cmpq   $0x0,0x10(%rsp)
  jne    L265
  add    $0x1,%ebx
  cmp    %r13d,%ebx
  je     L100
  mov    0x8(%r14,%rbp,1),%rax
  mov    %rax,0x10(%rsp)
  jmp    L168
L265:
  lea    D147(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L262
L100:
  lea    D7(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L262
L162:
  cmpq   $0x0,0x18(%rsp)
  je     L231
  lea    D159(%rip),%rdi
  call   <puts@plt>
  jmp    L168
L231:
  mov    (%r12),%rax
  mov    %rax,0x18(%rsp)
  jmp    L168
L48:
  cmpq   $0x0,0x8(%rsp)
  je     L130
L251:
  cmpq   $0x0,0x10(%rsp)
  je     L242
L36:
  cmpq   $0x0,0x18(%rsp)
  je     L103
  mov    0x8(%rsp),%rbx
  mov    %rbx,%rsi
  lea    D161(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x10(%rsp),%r14
  mov    %r14,%rsi
  lea    D94(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x18(%rsp),%r15
  mov    %r15,%rsi
  lea    D142(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x24(%rsp),%rdx
  mov    %rbx,%rcx
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <parse_file@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  jmp    L262
L266:
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
L130:
  mov    $0x17,%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L68
  lea    D127(%rip),%rsi
  mov    0x8(%rsp),%rdi
  call   <strcpy@plt>
  jmp    L251
L68:
  mov    $0x4b,%edx
  lea    D93(%rip),%rsi
  lea    D31(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L262
L242:
  mov    $0x9,%edi
  call   <malloc@plt>
  mov    %rax,0x10(%rsp)
  test   %rax,%rax
  je     L94
  lea    D135(%rip),%rsi
  mov    0x10(%rsp),%rdi
  call   <strcpy@plt>
  jmp    L36
L94:
  mov    $0x53,%edx
  lea    D93(%rip),%rsi
  lea    D31(%rip),%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L262
L103:
  lea    D182(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L262
L226:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D12
data_type: string
name: read_data
arguments: data_tag: D20
data_type: string
name: read_data
arguments: data_tag: D151
data_type: string
name: read_data
arguments: data_tag: D183
data_type: string
name: read_data
arguments: data_tag: D150
data_type: string
name: read_data
arguments: data_tag: D103
data_type: string
name: read_data
arguments: data_tag: D147
data_type: string
name: read_data
arguments: data_tag: D7
data_type: string
name: read_data
arguments: data_tag: D159
data_type: string
name: read_data
arguments: data_tag: D161
data_type: string
name: read_data
arguments: data_tag: D94
data_type: string
name: read_data
arguments: data_tag: D142
data_type: string
name: read_data
arguments: data_tag: D127
data_type: string
name: read_data
arguments: data_tag: D93
data_type: string
name: read_data
arguments: data_tag: D31
data_type: string
name: read_data
arguments: data_tag: D135
data_type: string
name: read_data
arguments: data_tag: D182
data_type: string

tool: D12: %d


tool: D20: --help

tool: D151: -h

tool: D183: -p

tool: D150: no config file specified after -p

tool: D103: -o

tool: D147: multiple output files specified

tool: D7: no output file specified after --output

tool: D159: multiple log files not supported

tool: D161: config file: %s


tool: D94: output file: %s


tool: D142: log file: %s


tool: D127: %m [%p]: [%s %c-%l] %S

tool: D93: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/myYearbook/playr/refs/heads/master/src/parsr.c

tool: D31: %s:%d: Could not allocate memory

tool: D135: file.out

tool: D182: logfile not specified

assistant: ```c
int main(int argc, char **argv) {
  int i = 0;
  size_t length = 0;
  char *prefixstring = 0;
  char *logfile = 0;
  char *outputfile = 0;
  int count = 0;
  printf("%d\n", argc);
  for (i = 1; i < argc; i++) {
    if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) {
      print_help();
      return -1;
    }
    if (strcmp(argv[i], "-p") == 0) {
      if (i + 1 == argc) {
        printf("no config file specified after -p\n");
        return -1;
      }
      prefixstring = argv[i + 1];
      i++;
      continue;
    }
    if (strcmp(argv[i], "-o") == 0) {
      if (outputfile != 0) {
        printf("multiple output files specified");
        return -1;
      }
      if (i + 1 == argc) {
        printf("no output file specified after --output");
        return -1;
      }
      outputfile = argv[i + 1];
      i++;
      continue;
    }
    if (logfile == 0) {
      logfile = argv[i];
      continue;
    } else {
      printf("multiple log files not supported\n");
    }
  }
  if (prefixstring == 0) {
    length = strlen("%m [%p]: [%s %c-%l] %S");
    prefixstring = (char *)malloc(sizeof(char) * length + 1);
    if (prefixstring == 0) {
      printf("%s:%d: Could not allocate memory", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/myYearbook/playr/refs/heads/master/src/parsr.c", 75);
      return -1;
    }
    strcpy(prefixstring, "%m [%p]: [%s %c-%l] %S");
  }
  if (outputfile == 0) {
    outputfile = (char *)malloc(sizeof(char) * 9);
    if (outputfile == 0) {
      printf("%s:%d: Could not allocate memory", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/myYearbook/playr/refs/heads/master/src/parsr.c", 83);
      return -1;
    }
    strcpy(outputfile, "file.out");
  }
  if (logfile == 0) {
    printf("logfile not specified\n");
    return -1;
  }
  printf("config file: %s\n", prefixstring);
  printf("output file: %s\n", outputfile);
  printf("log file: %s\n", logfile);
  parse_file(logfile, outputfile, &count, prefixstring);
  free(prefixstring);
  return 0;
}
```