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    $0x278,%rsp
  mov    %rsi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x268(%rsp)
  xor    %eax,%eax
  cmp    $0x2,%edi
  jne    L42
L2:
  mov    0x8(%rbx),%rdi
  lea    D53(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L6
L123:
  movb   $0x0,0xf(%rsp)
  lea    D75(%rip),%r12
  lea    D76(%rip),%r14
  lea    D30(%rip),%r15
  lea    D42(%rip),%r13
L34:
  mov    %rbp,%rdi
  call   <feof@plt>
  test   %eax,%eax
  jne    L83
  lea    0x160(%rsp),%rbx
  mov    %rbp,%rdx
  mov    $0x100,%esi
  mov    %rbx,%rdi
  call   <fgets@plt>
  lea    0x1c(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x60(%rsp),%r8
  mov    %r12,%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  test   %rax,%rax
  je     L34
  lea    0x60(%rsp),%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L86
L125:
  lea    0x60(%rsp),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L67
L48:
  lea    0x60(%rsp),%rsi
  lea    D48(%rip),%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L34
  lea    0x1c(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x160(%rsp),%rdi
  lea    0x50(%rsp),%rax
  push   %rax
  lea    0x54(%rsp),%rax
  push   %rax
  lea    0x58(%rsp),%r9
  lea    0x70(%rsp),%r8
  mov    %r15,%rsi
  mov    $0x0,%eax
  call   <sscanf@plt>
  add    $0x10,%rsp
  cmpb   $0x0,0xf(%rsp)
  je     L34
  mov    0x30(%rsp),%eax
  mov    $0x64,%esi
  cltd
  idiv   %esi
  mov    %eax,%ecx
  mov    0x28(%rsp),%eax
  cltd
  idiv   %esi
  sub    0x58(%rsp),%eax
  mov    %eax,%edi
  mov    0x24(%rsp),%eax
  cltd
  idiv   %esi
  sub    0x54(%rsp),%eax
  mov    %eax,%esi
  mov    0x48(%rsp),%r8d
  mov    %edi,%edx
  lea    D49(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L34
L42:
  lea    D65(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L2
L6:
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L123
L86:
  lea    0x1c(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  mov    %rbx,%rdi
  lea    0x5c(%rsp),%rax
  push   %rax
  lea    0x60(%rsp),%rax
  push   %rax
  lea    0x64(%rsp),%r9
  lea    0x70(%rsp),%r8
  mov    %r15,%rsi
  mov    $0x0,%eax
  call   <sscanf@plt>
  add    $0x10,%rsp
  movb   $0x1,0xf(%rsp)
  jmp    L125
L67:
  lea    0x1c(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x160(%rsp),%rdi
  sub    $0x8,%rsp
  lea    0x4c(%rsp),%rax
  push   %rax
  lea    0x50(%rsp),%rax
  push   %rax
  lea    0x54(%rsp),%rax
  push   %rax
  lea    0x58(%rsp),%rax
  push   %rax
  lea    0x5c(%rsp),%rax
  push   %rax
  lea    0x60(%rsp),%rax
  push   %rax
  lea    0x64(%rsp),%rax
  push   %rax
  lea    0x68(%rsp),%rax
  push   %rax
  lea    0x6c(%rsp),%rax
  push   %rax
  lea    0x70(%rsp),%r9
  lea    0xb0(%rsp),%r8
  lea    D52(%rip),%rsi
  mov    $0x0,%eax
  call   <sscanf@plt>
  add    $0x50,%rsp
  jmp    L48
L83:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x268(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L106
  mov    $0x0,%eax
  add    $0x278,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L106:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D53
data_type: string
name: read_data
arguments: data_label: D75
data_type: string
name: read_data
arguments: data_label: D76
data_type: string
name: read_data
arguments: data_label: D30
data_type: string
name: read_data
arguments: data_label: D42
data_type: string
name: read_data
arguments: data_label: D48
data_type: string
name: read_data
arguments: data_label: D49
data_type: string
name: read_data
arguments: data_label: D65
data_type: string
name: read_data
arguments: data_label: D52
data_type: string

tool: D53: r

tool: D75: %e %i %s

tool: D76: NAVIGATION_REF

tool: D30: %e %i %s %i %i %i


tool: D42: GPS

tool: D48: ATTITUDE

tool: D49: %i %i %i %i



tool: D65: plot3dparse 'flight_file.data' > output.dat

tool: D52: %e %i %s %i %i %i %i %i %i %i %i %i %i


assistant: ```c
int main(int argc, char *argv[]) {
  char line_in[256];
  float rtime;
  char id_name[255];
  unsigned int ac_id;
  unsigned int byte_mask;
  int utm_east;
  int utm_north;
  int course;
  int alt;
  int speed;
  int climb;
  unsigned int itow;
  unsigned int utm_zone;
  unsigned int gps_nb_err;
  unsigned int phi;
  unsigned int psi;
  unsigned int theta;
  unsigned int nr_utm_east;
  unsigned int nr_utm_north;
  unsigned int nr_utm_zone;
  unsigned int humid;
  unsigned int temp;
  char got_navref = 0;
  FILE *fd;
  if (argc != 2) {
    printf("plot3dparse 'flight_file.data' > output.dat\n");
    exit(0);
  }
  fd = fopen(argv[1], "r");
  if (!fd)
    exit(0);
  while (!feof(fd)) {
    fgets(line_in, 256, fd);
    if (sscanf(line_in, "%e %i %s", &rtime, &ac_id, id_name)) {
      if (!strcmp("NAVIGATION_REF", id_name)) {
        sscanf(line_in, "%e %i %s %i %i %i\n", &rtime, &ac_id, id_name, &nr_utm_east, &nr_utm_north, &nr_utm_zone);
        got_navref = 1;
      }
      if (!strcmp("GPS", id_name)) {
        sscanf(line_in, "%e %i %s %i %i %i %i %i %i %i %i %i %i\n", &rtime, &ac_id, id_name, &byte_mask, &utm_east, &utm_north, &course, &alt, &speed, &climb, &itow, &utm_zone, &gps_nb_err);
      }
      if (!strcmp("ATTITUDE", id_name)) {
        sscanf(line_in, "%e %i %s %i %i %i\n", &rtime, &ac_id, id_name, &phi, &psi, &theta);
        if (got_navref)
          printf("%i %i %i %i\n\n", utm_east / 100 - nr_utm_east, utm_north / 100 - nr_utm_north, alt / 100, phi);
      }
    }
  }
  fclose(fd);
  return (0);
}
```