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    $0x158,%rsp
  mov    %rsi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x148(%rsp)
  xor    %eax,%eax
  cmp    $0x3,%edi
  jne    L119
L124:
  mov    0x8(%rbx),%rdi
  lea    D149(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L74
L42:
  mov    0x10(%rbx),%rdi
  lea    D55(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L84
L19:
  mov    D5(%rip),%r15
  lea    D115(%rip),%rbp
L15:
  lea    0x40(%rsp),%rbx
  lea    D13(%rip),%r13
L103:
  mov    %r12,%rdx
  mov    $0x100,%esi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L108
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strtok@plt>
  lea    0x3(%rax),%rdi
  mov    $0x3,%edx
  mov    %r13,%rsi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L103
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rax,%rbx
  lea    0x38(%rsp),%r13
  mov    $0x2,%edx
  mov    %rax,%rsi
  mov    %r13,%rdi
  call   <strncpy@plt>
  movb   $0x0,0x3a(%rsp)
  mov    %r13,%rdi
  call   <atof@plt>
  movq   %xmm0,%r13
  lea    0x2(%rbx),%rdi
  call   <atof@plt>
  divsd  D62(%rip),%xmm0
  movq   %r13,%xmm5
  addsd  %xmm5,%xmm0
  movsd  %xmm0,(%rsp)
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  cmpb   $0x53,(%rax)
  je     L97
L46:
  movsd  (%rsp),%xmm0
  divsd  D61(%rip),%xmm0
  movsd  %xmm0,(%rsp)
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rax,%rbx
  lea    0x38(%rsp),%r13
  mov    $0x3,%edx
  mov    %rax,%rsi
  mov    %r13,%rdi
  call   <strncpy@plt>
  movb   $0x0,0x3b(%rsp)
  mov    %r13,%rdi
  call   <atof@plt>
  movq   %xmm0,%r13
  lea    0x3(%rbx),%rdi
  call   <atof@plt>
  divsd  D62(%rip),%xmm0
  movq   %r13,%xmm6
  addsd  %xmm6,%xmm0
  movsd  %xmm0,0x8(%rsp)
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  cmpb   $0x57,(%rax)
  je     L5
L99:
  movsd  0x8(%rsp),%xmm0
  divsd  D61(%rip),%xmm0
  movsd  %xmm0,0x8(%rsp)
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rax,%rdi
  call   <atof@plt>
  movsd  %xmm0,0x10(%rsp)
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rax,%rdi
  call   <atof@plt>
  addsd  0x10(%rsp),%xmm0
  movsd  %xmm0,0x10(%rsp)
  lea    0x20(%rsp),%rsi
  mov    %rsp,%rdi
  call   <llh2xyz@plt>
  movsd  0x30(%rsp),%xmm3
  movsd  0x28(%rsp),%xmm2
  movsd  0x20(%rsp),%xmm1
  movq   %r15,%xmm0
  lea    D123(%rip),%rsi
  mov    %r14,%rdi
  call   <fprintf@plt>
  movq   %r15,%xmm4
  addsd  D17(%rip),%xmm4
  movq   %xmm4,%r15
  jmp    L15
L119:
  lea    D90(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L124
L74:
  lea    D68(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L42
L84:
  lea    D136(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L19
L97:
  movsd  (%rsp),%xmm0
  xorpd  D131(%rip),%xmm0
  movsd  %xmm0,(%rsp)
  jmp    L46
L5:
  movsd  0x8(%rsp),%xmm0
  xorpd  D131(%rip),%xmm0
  movsd  %xmm0,0x8(%rsp)
  jmp    L99
L108:
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    %r14,%rdi
  call   <fclose@plt>
  mov    0x148(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  mov    $0x0,%eax
  add    $0x158,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L3:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D149
type_guessed: string
name: read_data
arguments: tag: D55
type_guessed: string
name: read_data
arguments: tag: D5
type_guessed: f64
name: read_data
arguments: tag: D115
type_guessed: string
name: read_data
arguments: tag: D13
type_guessed: string
name: read_data
arguments: tag: D62
type_guessed: f64
name: read_data
arguments: tag: D61
type_guessed: f64
name: read_data
arguments: tag: D123
type_guessed: string
name: read_data
arguments: tag: D17
type_guessed: f64
name: read_data
arguments: tag: D90
type_guessed: string
name: read_data
arguments: tag: D68
type_guessed: string
name: read_data
arguments: tag: D136
type_guessed: string
name: read_data
arguments: tag: D131
type_guessed: byte[16]

tool: D149: rt

tool: D55: wt

tool: D5: 0

tool: D115: ,

tool: D13: GGA

tool: D62: 60

tool: D61: 57.2957795131

tool: D123: %5.1f,%12.3f,%12.3f,%12.3f


tool: D17: 0.1

tool: D90: Usage: nmea2um <nmea_gga> <user_motion>


tool: D68: Failed to open NMEA file.


tool: D136: Failed to open user motion file.


tool: {"D131": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

assistant: ```c
int main(int argc, char *argv[]) {
  FILE *inp, *outp;
  char str[256];
  char *token;
  double llh[3], xyz[3], t = 0.0;
  char tmp[8];
  if (argc != 3) {
    printf("Usage: nmea2um <nmea_gga> <user_motion>\n");
    exit(1);
  }
  if ((inp = fopen(argv[1], "rt")) == NULL) {
    printf("Failed to open NMEA file.\n");
    exit(1);
  }
  if ((outp = fopen(argv[2], "wt")) == NULL) {
    printf("Failed to open user motion file.\n");
    exit(1);
  }
  while (1) {
    if (fgets(str, 256, inp) == NULL)
      break;
    token = strtok(str, ",");
    if (strncmp(token + 3, "GGA", 3) == 0) {
      token = strtok(NULL, ",");
      token = strtok(NULL, ",");
      strncpy(tmp, token, 2);
      tmp[2] = 0;
      llh[0] = atof(tmp) + atof(token + 2) / 60.0;
      token = strtok(NULL, ",");
      if (token[0] == 'S')
        llh[0] *= -1.0;
      llh[0] /= 57.2957795131;
      token = strtok(NULL, ",");
      strncpy(tmp, token, 3);
      tmp[3] = 0;
      llh[1] = atof(tmp) + atof(token + 3) / 60.0;
      token = strtok(NULL, ",");
      if (token[0] == 'W')
        llh[1] *= -1.0;
      llh[1] /= 57.2957795131;
      token = strtok(NULL, ",");
      token = strtok(NULL, ",");
      token = strtok(NULL, ",");
      token = strtok(NULL, ",");
      llh[2] = atof(token);
      token = strtok(NULL, ",");
      token = strtok(NULL, ",");
      llh[2] += atof(token);
      llh2xyz(llh, xyz);
      fprintf(outp, "%5.1f,%12.3f,%12.3f,%12.3f\n", t, xyz[0], xyz[1], xyz[2]);
      t += 0.1;
    }
  }
  fclose(inp);
  fclose(outp);
  return (0);
}
```