user: Converte this assembly snippet into its equivalent C code:

```asm
<get_next_tle_rev>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x280,%rsp
  mov    %rdi,-0x258(%rbp)
  mov    %rsi,-0x260(%rbp)
  mov    %rdx,-0x268(%rbp)
  mov    %rcx,-0x270(%rbp)
  mov    %r8,-0x278(%rbp)
  mov    %r9,-0x280(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x100,-0x23c(%rbp)
  movl   $0x0,-0x244(%rbp)
  movq   $0x5265c00,-0x228(%rbp)
  mov    -0x258(%rbp),%rdx
  mov    -0x23c(%rbp),%ecx
  lea    -0x210(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L46
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L46:
  movzbl -0x210(%rbp),%eax
  cmp    $0x31,%al
  je     L34
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L34:
  mov    -0x258(%rbp),%rdx
  mov    -0x23c(%rbp),%ecx
  lea    -0x110(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L13
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L13:
  movzbl -0x110(%rbp),%eax
  cmp    $0x32,%al
  je     L39
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L39:
  lea    -0x238(%rbp),%rdi
  lea    -0x217(%rbp),%rsi
  lea    -0x21e(%rbp),%rcx
  lea    -0x244(%rbp),%rdx
  lea    -0x210(%rbp),%rax
  mov    %rdi,%r9
  mov    %rsi,%r8
  lea    D25(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  lea    -0x230(%rbp),%r8
  lea    -0x230(%rbp),%rdi
  lea    -0x240(%rbp),%rcx
  lea    -0x244(%rbp),%rdx
  lea    -0x110(%rbp),%rax
  sub    $0x8,%rsp
  push   -0x278(%rbp)
  push   -0x280(%rbp)
  lea    -0x230(%rbp),%rsi
  push   %rsi
  lea    -0x230(%rbp),%rsi
  push   %rsi
  lea    -0x21e(%rbp),%rsi
  push   %rsi
  mov    %r8,%r9
  mov    %rdi,%r8
  lea    D3(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  add    $0x30,%rsp
  mov    -0x278(%rbp),%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x2,%edx
  sar    $0x1f,%eax
  sub    %eax,%edx
  mov    -0x278(%rbp),%rax
  mov    %edx,(%rax)
  movsd  -0x238(%rbp),%xmm0
  cvttsd2si %xmm0,%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  sub    %eax,%edx
  mov    -0x260(%rbp),%rax
  mov    %edx,(%rax)
  movsd  -0x238(%rbp),%xmm0
  mov    -0x260(%rbp),%rax
  mov    (%rax),%eax
  imul   $0x3e8,%eax,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  subsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%edx
  mov    -0x268(%rbp),%rax
  mov    %edx,(%rax)
  movsd  -0x238(%rbp),%xmm0
  mov    -0x260(%rbp),%rax
  mov    (%rax),%eax
  imul   $0x3e8,%eax,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  subsd  %xmm1,%xmm0
  mov    -0x268(%rbp),%rax
  mov    (%rax),%eax
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  movapd %xmm0,%xmm1
  subsd  %xmm2,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sdq -0x228(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%edx
  mov    -0x270(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x260(%rbp),%rax
  mov    (%rax),%eax
  lea    0x76c(%rax),%edx
  mov    -0x260(%rbp),%rax
  mov    %edx,(%rax)
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L48
  call   <__stack_chk_fail@plt>
L48:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D11
data_type: string
name: retrieve_data
arguments: data_label: D25
data_type: string
name: retrieve_data
arguments: data_label: D3
data_type: string

tool: D11: ERROR:bad get from tle file


tool: D25: %1i %s %s %lf

tool: D3: %1i %i %lf %lf %s %lf %lf %lf %i

assistant: ```c
void get_next_tle_rev(FILE *fpin, int *this_year, int *this_day, int *this_msec, int *this_rev, double *this_rev_per_day) {
  int max = 256;
  int line_no = 0;
  char tmp1[7];
  char tmp2[7];
  double full_time;
  long msec_per_day = 24 * 60 * 60 * 1000;
  int junk;
  double junkf;
  char line1[256];
  char line2[256];
  if (fgets(line1, max, fpin) == NULL) {
    printf("ERROR:bad get from tle file\n");
    exit(1);
  }
  if (line1[0] != '1') {
    printf("ERROR:bad get from tle file\n");
    exit(1);
  }
  if (fgets(line2, max, fpin) == NULL) {
    printf("ERROR:bad get from tle file\n");
    exit(1);
  }
  if (line2[0] != '2') {
    printf("ERROR:bad get from tle file\n");
    exit(1);
  }
  sscanf(line1, "%1i %s %s %lf", &line_no, tmp1, tmp2, &full_time);
  sscanf(line2, "%1i %i %lf %lf %s %lf %lf %lf %i", &line_no, &junk, &junkf, &junkf, tmp1, &junkf, &junkf, this_rev_per_day, this_rev);
  *this_rev /= 10;
  *this_year = (int)full_time / 1000;
  *this_day = (int)(full_time - (*this_year * 1000));
  *this_msec = (int)((full_time - (*this_year * 1000) - *this_day) * msec_per_day);
  *this_year = *this_year + 1900;
}
```