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    $0x1a8,%rsp
  mov    %edi,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x198(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x44(%rsp)
  movl   $0x0,0x48(%rsp)
  movl   $0x1,0x4c(%rsp)
  cmp    $0x1,%edi
  jle    L67
  lea    0x50(%rsp),%rax
  mov    %rsi,%r14
  mov    0x8(%rsi),%rsi
  lea    0x130(%rsp),%rbx
  mov    %rax,%rdi
  mov    %rax,0x28(%rsp)
  call   <strcpy@plt>
  lea    0xc0(%rsp),%rax
  mov    0x10(%r14),%rsi
  mov    %rax,%rdi
  mov    %rax,0x20(%rsp)
  call   <strcpy@plt>
  xor    %edx,%edx
  mov    $0x64,%esi
  mov    %rbx,%rdi
  call   <fill_string@plt>
  cmpl   $0x3,0x18(%rsp)
  movl   $0x0,0x10(%rsp)
  movl   $0x0,0xc(%rsp)
  movl   $0x42,0x1c(%rsp)
  jle    L172
  mov    0x18(%rsp),%eax
  movl   $0x0,0x14(%rsp)
  mov    $0x3,%ebp
  mov    $0x1,%r15d
  sub    $0x2,%eax
  mov    %eax,0x34(%rsp)
  lea    0x10(%r14),%rax
  mov    %rax,0x38(%rsp)
  jmp    L2
  nopw   0x0(%rax,%rax,1)
L190:
  mov    (%r12),%rdi
  lea    D138(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L133
L176:
  mov    (%r12),%rdi
  lea    D24(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L45
L55:
  add    $0x1,%ebp
  cmp    %ebp,0x18(%rsp)
  jle    L74
L2:
  movslq %ebp,%r13
  lea    D23(%rip),%rsi
  shl    $0x3,%r13
  lea    (%r14,%r13,1),%r12
  mov    (%r12),%rdi
  call   <strcmp@plt>
  mov    (%r12),%rdi
  lea    D15(%rip),%rsi
  test   %rax,%rax
  mov    0x14(%rsp),%eax
  cmove  %r15d,%eax
  mov    %eax,0x14(%rsp)
  call   <strcmp@plt>
  mov    (%r12),%rdi
  lea    D48(%rip),%rsi
  test   %rax,%rax
  mov    0xc(%rsp),%eax
  cmove  %r15d,%eax
  mov    %eax,0xc(%rsp)
  call   <strcmp@plt>
  mov    (%r12),%rdi
  lea    D16(%rip),%rsi
  test   %rax,%rax
  mov    0x10(%rsp),%eax
  cmove  %r15d,%eax
  mov    %eax,0x10(%rsp)
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L190
  lea    0x8(%r14,%r13,1),%r12
  add    $0x1,%ebp
  mov    (%r12),%rdi
  call   <atoi@plt>
  mov    %eax,0x1c(%rsp)
  jmp    L190
  nopw   0x0(%rax,%rax,1)
L133:
  add    $0x1,%ebp
  movslq %ebp,%rax
  lea    (%r14,%rax,8),%r12
  mov    (%r12),%rdi
  call   <atoi@plt>
  mov    %eax,0x4c(%rsp)
  jmp    L176
L67:
  mov    $0x42,%esi
  lea    D46(%rip),%rdi
  lea    0x130(%rsp),%rbx
  call   <printf@plt>
  lea    D10(%rip),%rsi
  lea    D44(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  lea    0x50(%rsp),%rax
  movl   $0x0,0x10(%rsp)
  mov    %rax,0x28(%rsp)
  lea    0xc0(%rsp),%rax
  movl   $0x0,0xc(%rsp)
  movl   $0x42,0x1c(%rsp)
  movl   $0x0,0x14(%rsp)
  mov    %rax,0x20(%rsp)
L74:
  mov    0x1c(%rsp),%edi
  mov    $0x1,%esi
  call   <lpp@plt>
  mov    0x28(%rsp),%rdi
  lea    D128(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L175
L182:
  mov    0x20(%rsp),%rdi
  lea    D14(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L177
L97:
  mov    0x10(%rsp),%r9d
  mov    0xc(%rsp),%r8d
  mov    %rbx,%rcx
  mov    %rbp,%rdi
  lea    0x4c(%rsp),%r14
  lea    0x48(%rsp),%r13
  mov    %r13,%rsi
  mov    %r14,%rdx
  lea    0x44(%rsp),%r15
  call   <print_report_header@plt>
  mov    0x44(%rsp),%esi
  test   %esi,%esi
  jne    L140
  nopl   (%rax)
L159:
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <read_a_record@plt>
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    %rbx,%r8
  mov    %rax,%rdi
  mov    0x14(%rsp),%eax
  mov    %rbp,%rsi
  push   %rax
  mov    0x18(%rsp),%eax
  push   %rax
  mov    0x1c(%rsp),%r9d
  call   <write_a_record@plt>
  pop    %rax
  pop    %rdx
  mov    0x44(%rsp),%ecx
  test   %ecx,%ecx
  je     L159
L140:
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x198(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L68
  add    $0x1a8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L45:
  lea    0x1(%rbp),%eax
  lea    D70(%rip),%rsi
  mov    %rbx,%rdi
  mov    %eax,%r13d
  mov    %eax,0x30(%rsp)
  call   <strcpy@plt>
  movslq %r13d,%rax
  cmp    %eax,0x18(%rsp)
  jle    L21
  lea    (%r14,%rax,8),%r13
  mov    0x34(%rsp),%eax
  movslq %ebp,%rcx
  sub    %ebp,%eax
  add    %rcx,%rax
  mov    0x38(%rsp),%rcx
  lea    (%rcx,%rax,8),%r12
  nopw   0x0(%rax,%rax,1)
L79:
  mov    0x0(%r13),%rsi
  mov    %rbx,%rdi
  add    $0x8,%r13
  call   <strcat@plt>
  lea    D70(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcat@plt>
  cmp    %r12,%r13
  jne    L79
  mov    0x30(%rsp),%eax
  mov    0x18(%rsp),%edx
  lea    -0x1(%rax,%rdx,1),%eax
  sub    %ebp,%eax
  mov    %eax,%ebp
  jmp    L55
L177:
  mov    0x20(%rsp),%rsi
  lea    D18(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x2,%edi
  call   <exit@plt>
  jmp    L97
L175:
  mov    0x28(%rsp),%rsi
  lea    D18(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x2,%edi
  call   <exit@plt>
  jmp    L182
L21:
  mov    0x30(%rsp),%ebp
  jmp    L55
L172:
  movl   $0x0,0x14(%rsp)
  jmp    L74
L68:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D138
type: string
name: parse_data
arguments: data_label: D24
type: string
name: parse_data
arguments: data_label: D23
type: string
name: parse_data
arguments: data_label: D15
type: string
name: parse_data
arguments: data_label: D48
type: string
name: parse_data
arguments: data_label: D16
type: string
name: parse_data
arguments: data_label: D46
type: string
name: parse_data
arguments: data_label: D10
type: string
name: parse_data
arguments: data_label: D44
type: string
name: parse_data
arguments: data_label: D128
type: string
name: parse_data
arguments: data_label: D14
type: string
name: parse_data
arguments: data_label: D70
type: string
name: parse_data
arguments: data_label: D18
type: string

tool: D138: -n

tool: D24: -t

tool: D23: -ds

tool: D15: -d

tool: D48: -p

tool: D16: -l

tool: D46: 

usage: kf in-file out-file -d -p -n # -l # -t ...
         -d     = put the date in the header
         -p     = put the page number in the header
         -l #   = there are # lines per page (%d default)
         -n #   = start numbering the pages with #
         -ds    = double space print the output
         -t ... = put the following title in the header

tool: D10: kf Version 1 - December 1999

tool: D44: 
%s


tool: D128: rt

tool: D14: wt

tool: D70:  

tool: D18: 
ERROR Could not open file %s

assistant: ```c
int main(int argc, char *argv[]) {
  char in_file_name[100], out_file_name[100], title[100];
  FILE *in_file, *out_file;
  int double_space = 0, file_done = 0, i, line_counter = 0, lines = 66, page_counter = 1, print_date = 0, print_page = 0, print_title = 0;
  struct word_list_struct *word_list, *temp;
  struct line_list_struct *line_list;
  if (argc < 2) {
    printf("\n\nusage: kf in-file out-file -d -p -n # -l # -t ..."
           "\n         -d     = put the date in the header"
           "\n         -p     = put the page number in the header"
           "\n         -l #   = there are # lines per page (%d default)"
           "\n         -n #   = start numbering the pages with #"
           "\n         -ds    = double space print the output"
           "\n         -t ... = put the following title in the header",
           66);
    printf("\n%s\n", "kf Version 1 - December 1999");
    exit(1);
  }
  if (argc > 1) {
    strcpy(in_file_name, argv[1]);
    strcpy(out_file_name, argv[2]);
    fill_string(title, 100, '\0');
    i = 3;
    while (i < argc) {
      if (strcmp(argv[i], "-ds") == 0)
        double_space = 1;
      if (strcmp(argv[i], "-d") == 0)
        print_date = 1;
      if (strcmp(argv[i], "-p") == 0)
        print_page = 1;
      if (strcmp(argv[i], "-l") == 0) {
        i++;
        lines = atoi(argv[i]);
      }
      if (strcmp(argv[i], "-n") == 0) {
        i++;
        page_counter = atoi(argv[i]);
      }
      if (strcmp(argv[i], "-t") == 0) {
        i++;
        strcpy(title, " ");
        while (i < argc) {
          strcat(title, argv[i]);
          strcat(title, " ");
          i++;
        }
      }
      i++;
    }
  }
  lpp(lines, 1);
  if ((in_file = fopen(in_file_name, "rt")) == NULL) {
    printf("\nERROR Could not open file %s", in_file_name);
    exit(2);
  }
  if ((out_file = fopen(out_file_name, "wt")) == NULL) {
    printf("\nERROR Could not open file %s", out_file_name);
    exit(2);
  }
  print_report_header(out_file, &line_counter, &page_counter, title, print_date, print_page);
  while (file_done == 0) {
    line_list = read_a_record(in_file, &file_done);
    write_a_record(line_list, out_file, &line_counter, &page_counter, title, print_date, print_page, double_space);
  }
  fclose(in_file);
  fclose(out_file);
}
```