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
  mov    %rsi,%rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  cmp    $0x3,%edi
  je     L92
  lea    D40(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L92:
  mov    0x8(%rbx),%r12
  lea    D27(%rip),%rsi
  mov    0x10(%rbx),%r14
  mov    %r12,%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L56
L71:
  lea    D25(%rip),%rsi
  mov    %r14,%rdi
  call   <fopen@plt>
  mov    %rax,(%rsp)
  test   %rax,%rax
  je     L73
L89:
  mov    (%rsp),%rcx
  mov    $0x2b,%edx
  mov    $0x1,%esi
  lea    D50(%rip),%rdi
  lea    0x20(%rsp),%r12
  lea    0x18(%rsp),%rbx
  call   <fwrite@plt>
  movl   $0x0,0xc(%rsp)
  lea    D26(%rip),%r13
  nopw   0x0(%rax,%rax,1)
L0:
  mov    %rbx,%rsi
  mov    %r12,%rdx
  mov    %rbp,%rdi
  call   <get_line@plt>
  mov    0x18(%rsp),%rsi
  test   %rsi,%rsi
  je     L41
  mov    0x20(%rsp),%rdx
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x20(%rsp),%r15
  mov    %r15,%rdi
  call   <strlen@plt>
  cltq
  movsbl -0x1(%r15,%rax,1),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L39
  mov    0x18(%rsp),%rax
  cmpb   $0x49,(%rax)
  jne    L0
L104:
  cmpb   $0x44,0x1(%rax)
  jne    L0
  cmpb   $0x0,0x2(%rax)
  jne    L0
  mov    0x20(%rsp),%rdi
  call   <new_unique_id@plt>
  test   %eax,%eax
  je     L98
L118:
  mov    0xc(%rsp),%r15d
  mov    0x20(%rsp),%rdx
  lea    D56(%rip),%rsi
  xor    %eax,%eax
  mov    (%rsp),%rdi
  mov    %r15d,%ecx
  call   <fprintf@plt>
  mov    %r15d,%eax
  add    $0x1,%eax
  mov    %eax,0xc(%rsp)
  jmp    L0
  nopl   0x0(%rax,%rax,1)
L39:
  mov    0x20(%rsp),%rsi
  lea    D29(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r14,%rdi
  call   <unlink@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  mov    0x18(%rsp),%rax
  cmpb   $0x49,(%rax)
  jne    L0
  jmp    L104
  nopl   0x0(%rax,%rax,1)
L41:
  mov    (%rsp),%rbx
  mov    0xc(%rsp),%edx
  lea    D6(%rip),%rsi
  xor    %eax,%eax
  mov    %rbx,%rdi
  call   <fprintf@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L24
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L98:
  mov    %r14,%rdi
  call   <unlink@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L118
L73:
  mov    %r14,%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L89
L56:
  mov    %r12,%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L71
L24:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D40
type_guessed: string
name: unpack_data
arguments: data_label: D27
type_guessed: string
name: unpack_data
arguments: data_label: D25
type_guessed: string
name: unpack_data
arguments: data_label: D50
type_guessed: string
name: unpack_data
arguments: data_label: D26
type_guessed: string
name: unpack_data
arguments: data_label: D56
type_guessed: string
name: unpack_data
arguments: data_label: D29
type_guessed: string
name: unpack_data
arguments: data_label: D6
type_guessed: string

tool: D40: gimme <source> <dest>

tool: D27: r

tool: D25: w

tool: D50: /* generated file, do not edit by hand */



tool: D26: name '%s' value '%s'


tool: D56: #define T_%s T_ID(%d)


tool: D29: bad value '%s' (no space at the end please!)


tool: D6: #define T_NUMBER_OF_IDS %d


assistant: ```c
int main(int n, char **v) {
  FILE *in;
  FILE *out;
  char *name;
  char *value;
  char *in_name;
  char *out_name;
  if (n != 3) {
    printf("gimme <source> <dest>\n");
    exit(1);
  }
  n = 0;
  in_name = v[1];
  out_name = v[2];
  in = fopen(in_name, "r");
  if (in == NULL) {
    perror(in_name);
    exit(1);
  }
  out = fopen(out_name, "w");
  if (out == NULL) {
    perror(out_name);
    exit(1);
  }
  fprintf(out, "/* generated file, do not edit by hand */\n\n");
  while (1) {
    get_line(in, &name, &value);
    if (name == NULL)
      break;
    printf("name '%s' value '%s'\n", name, value);
    if (isspace(value[strlen(value) - 1])) {
      printf("bad value '%s' (no space at the end please!)\n", value);
      unlink(out_name);
      exit(1);
    }
    if (!strcmp(name, "ID")) {
      if (!new_unique_id(value)) {
        unlink(out_name);
        exit(1);
      }
      fprintf(out, "#define T_%s T_ID(%d)\n", value, n);
      n++;
    }
  }
  fprintf(out, "#define T_NUMBER_OF_IDS %d\n", n);
  fclose(in);
  fclose(out);
  return 0;
}
```