user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x268,%rsp
  mov    %rsi,%r15
  mov    %fs:0x28,%rax
  mov    %rax,0x258(%rsp)
  xor    %eax,%eax
  movq   $0x499602d2,0x30(%rsp)
  movq   $0x12aa0131,0x38(%rsp)
  cmp    $0x2,%edi
  je     L642
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    (%r15),%rsi
  lea    D363(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D333(%rip),%rdi
  call   <puts@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D811(%rip),%r15
  mov    %r15,%rdi
  call   <puts@plt>
  lea    D618(%rip),%r14
  mov    %r14,%rdi
  call   <puts@plt>
  lea    D721(%rip),%r13
  mov    %r13,%rdi
  call   <puts@plt>
  lea    D663(%rip),%r12
  mov    %r12,%rdi
  call   <puts@plt>
  lea    D392(%rip),%rbp
  mov    %rbp,%rdi
  call   <puts@plt>
  lea    D75(%rip),%rbx
  mov    %rbx,%rdi
  call   <puts@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D9(%rip),%rdi
  call   <puts@plt>
  lea    D625(%rip),%rdi
  call   <puts@plt>
  lea    D539(%rip),%rdi
  call   <puts@plt>
  lea    D743(%rip),%rdi
  call   <puts@plt>
  lea    D352(%rip),%rdi
  call   <puts@plt>
  lea    D820(%rip),%rdi
  call   <puts@plt>
  lea    D700(%rip),%rdi
  call   <puts@plt>
  lea    D679(%rip),%rdi
  call   <puts@plt>
  lea    D267(%rip),%rdi
  call   <puts@plt>
  lea    D107(%rip),%rdi
  call   <puts@plt>
  lea    D356(%rip),%rdi
  call   <puts@plt>
  lea    D216(%rip),%rdi
  call   <puts@plt>
  lea    D443(%rip),%rdi
  call   <puts@plt>
  lea    D658(%rip),%rdi
  call   <puts@plt>
  lea    D383(%rip),%rdi
  call   <puts@plt>
  lea    D491(%rip),%rdi
  call   <puts@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D372(%rip),%rdi
  call   <puts@plt>
  lea    D510(%rip),%rdi
  call   <puts@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    %r15,%rdi
  call   <puts@plt>
  mov    %r14,%rdi
  call   <puts@plt>
  mov    %r13,%rdi
  call   <puts@plt>
  mov    %r12,%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <puts@plt>
  mov    %rbx,%rdi
  call   <puts@plt>
  lea    D475(%rip),%rdi
  call   <puts@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D9(%rip),%rdi
  call   <puts@plt>
  lea    D625(%rip),%rdi
  call   <puts@plt>
  lea    D539(%rip),%rdi
  call   <puts@plt>
  lea    D839(%rip),%rdi
  call   <puts@plt>
  lea    D599(%rip),%rdi
  call   <puts@plt>
  lea    D820(%rip),%rdi
  call   <puts@plt>
  lea    D499(%rip),%rdi
  call   <puts@plt>
  lea    D593(%rip),%rdi
  call   <puts@plt>
  lea    D782(%rip),%rdi
  call   <puts@plt>
  lea    D107(%rip),%rdi
  call   <puts@plt>
  lea    D356(%rip),%rdi
  call   <puts@plt>
  lea    D810(%rip),%rdi
  call   <puts@plt>
  lea    D443(%rip),%rdi
  call   <puts@plt>
  lea    D658(%rip),%rdi
  call   <puts@plt>
  lea    D726(%rip),%rdi
  call   <puts@plt>
  lea    D491(%rip),%rdi
  call   <puts@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D367(%rip),%rdi
  call   <puts@plt>
  lea    D282(%rip),%rdi
  call   <puts@plt>
  lea    D643(%rip),%rdi
  call   <puts@plt>
  lea    D685(%rip),%rdi
  call   <puts@plt>
  lea    D73(%rip),%rdi
  call   <puts@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D194(%rip),%rdi
  call   <puts@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0x1,%eax
L599:
  mov    0x258(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L87
  add    $0x268,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L642:
  mov    %edi,%ebx
  mov    0x8(%rsi),%rdi
  lea    D335(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  lea    0x50(%rsp),%r12
  lea    D339(%rip),%r13
  lea    D792(%rip),%r14
  test   %rax,%rax
  je     L151
L553:
  mov    %rbp,%rdx
  mov    $0x1fe,%esi
  mov    %r12,%rdi
  call   <fgets@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L45
  mov    %r13,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L537
  mov    %rbx,%rsi
  mov    %r14,%rdi
  call   <printf@plt>
  jmp    L553
L151:
  mov    0x8(%r15),%rsi
  lea    D819(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D474(%rip),%rdi
  call   <puts@plt>
  mov    %ebx,%eax
  jmp    L599
L45:
  mov    %rbp,%rsi
  lea    D801(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D474(%rip),%rdi
  call   <puts@plt>
  mov    $0x3,%eax
  jmp    L599
L537:
  mov    %rbx,%rsi
  lea    D792(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%r12d
L674:
  mov    %r12d,%r13d
  movsbl (%rbx,%r12,1),%edi
  call   <isdigit@plt>
  add    $0x1,%r12
  test   %rax,%rax
  je     L674
  cmp    $0x14,%r13d
  jne    L94
  mov    $0x14,%r12d
  mov    $0x0,%r14d
L513:
  mov    %r14d,%r15d
  movsbl (%rbx,%r12,1),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L161
  movzbl (%rbx,%r12,1),%eax
  mov    %al,0x4a(%rsp,%r14,1)
  add    $0x1,%r14
  add    $0x1,%r12
  cmp    $0x6,%r14
  jne    L513
  lea    0x1(%r15),%esi
  lea    D465(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D474(%rip),%rdi
  call   <puts@plt>
  mov    $0x5,%eax
  jmp    L599
L94:
  mov    %r13d,%esi
  lea    D262(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D474(%rip),%rdi
  call   <puts@plt>
  mov    $0x4,%eax
  jmp    L599
L161:
  movslq %r14d,%r15
  movb   $0x0,0x4a(%rsp,%r15,1)
  lea    0x4a(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,(%rsp)
  movslq %r12d,%r13
L457:
  mov    %r13d,%r15d
  sub    %r12d,%r15d
  movsbl (%rbx,%r13,1),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L95
  add    $0x1,%r13
  jmp    L457
L95:
  lea    -0x6(%r15),%eax
  cmp    $0x1,%eax
  jbe    L611
  mov    %r15d,%esi
  lea    D397(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D474(%rip),%rdi
  call   <puts@plt>
  mov    $0x6,%eax
  jmp    L599
L611:
  movslq %r13d,%r14
  mov    $0x0,%r12d
L332:
  mov    %r12d,%r13d
  movsbl (%rbx,%r14,1),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L337
  movzbl (%rbx,%r14,1),%eax
  mov    %al,0x41(%rsp,%r12,1)
  add    $0x1,%r12
  add    $0x1,%r14
  cmp    $0x3,%r12
  jne    L332
  lea    0x1(%r13),%esi
  lea    D263(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D474(%rip),%rdi
  call   <puts@plt>
  mov    $0x7,%eax
  jmp    L599
L337:
  movslq %r12d,%r13
  movb   $0x0,0x41(%rsp,%r13,1)
  lea    0x41(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0xc(%rsp)
  movslq %r14d,%r15
  jmp    L567
L249:
  add    $0x1,%r15
L567:
  mov    %r15d,%r12d
  sub    %r14d,%r12d
  movsbl (%rbx,%r15,1),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L249
  lea    -0x7(%r12),%eax
  cmp    $0x1,%eax
  jbe    L91
  mov    %r12d,%esi
  lea    D125(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D474(%rip),%rdi
  call   <puts@plt>
  mov    $0x8,%eax
  jmp    L599
L91:
  movslq %r15d,%r13
  mov    $0x0,%r14d
L579:
  mov    %r14d,%r12d
  movsbl (%rbx,%r13,1),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L352
  movzbl (%rbx,%r13,1),%eax
  mov    %al,0x44(%rsp,%r14,1)
  add    $0x1,%r14
  add    $0x1,%r13
  cmp    $0x3,%r14
  jne    L579
  lea    0x1(%r12),%esi
  lea    D549(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D474(%rip),%rdi
  call   <puts@plt>
  mov    $0x9,%eax
  jmp    L599
L352:
  movslq %r14d,%r12
  movb   $0x0,0x44(%rsp,%r12,1)
  lea    0x44(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x10(%rsp)
  movslq %r13d,%r15
  jmp    L194
L48:
  add    $0x1,%r15
L194:
  mov    %r15d,%r12d
  sub    %r13d,%r12d
  movsbl (%rbx,%r15,1),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L48
  lea    -0x9(%r12),%eax
  cmp    $0x1,%eax
  jbe    L493
  mov    %r12d,%esi
  lea    D245(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D474(%rip),%rdi
  call   <puts@plt>
  mov    $0xa,%eax
  jmp    L599
L493:
  movslq %r15d,%r14
  add    %r14,%rbx
  mov    $0x0,%r12d
L184:
  mov    %r12d,%r13d
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L110
  movzbl (%rbx),%eax
  mov    %al,0x47(%rsp,%r12,1)
  add    $0x1,%r12
  add    $0x1,%rbx
  cmp    $0x3,%r12
  jne    L184
  lea    0x1(%r13),%esi
  lea    D226(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D474(%rip),%rdi
  call   <puts@plt>
  mov    $0xb,%eax
  jmp    L599
L110:
  movslq %r12d,%rax
  movb   $0x0,0x47(%rsp,%rax,1)
  lea    0x47(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,%ebx
  lea    0x50(%rsp),%rdi
  mov    %rbp,%rdx
  mov    $0x1fe,%esi
  call   <fgets@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L166
  mov    %rax,%rsi
  lea    D792(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x2c(%rsp),%rdx
  lea    D548(%rip),%rsi
  mov    %r12,%rdi
  call   <strptime@plt>
  test   %eax,%eax
  je     L527
  movl   $0xffffffff,0x2c(%rsp)
  lea    0x2c(%rsp),%rdi
  call   <mktime@plt>
  cmp    $0xffffffff,%eax
  je     L689
  cltq
  movslq %ebx,%rbx
  add    %rbx,%rax
  imul   $0x3c,0x10(%rsp),%edx
  movslq %edx,%rdx
  add    %rdx,%rax
  imul   $0xe10,0xc(%rsp),%edx
  movslq %edx,%rdx
  add    %rdx,%rax
  imul   $0x15180,(%rsp),%edx
  movslq %edx,%rdx
  add    %rdx,%rax
  mov    %rax,0x30(%rsp)
  lea    0x30(%rsp),%rdi
  call   <gmtime@plt>
  mov    %eax,%edi
  call   <asctime@plt>
  mov    %rax,%rsi
  lea    D320(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x50(%rsp),%rax
  mov    %rax,0x18(%rsp)
  lea    0x4a(%rsp),%r15
L328:
  mov    %rbp,%rdx
  mov    $0x1fe,%esi
  mov    0x18(%rsp),%rdi
  call   <fgets@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L477
  lea    D813(%rip),%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L89
  mov    %rbx,%rsi
  lea    D792(%rip),%rdi
  call   <printf@plt>
  jmp    L328
L527:
  lea    D4(%rip),%rdi
  call   <puts@plt>
  mov    $0xd,%eax
  jmp    L599
L689:
  lea    D324(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xe,%eax
  jmp    L599
L89:
  mov    %rbx,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  cltq
L467:
  mov    %eax,%edx
  cmp    $0xffffffff,%eax
  jl     L302
  je     L173
  movzbl (%rbx,%rax,1),%ecx
  sub    $0x1,%rax
  cmp    $0x20,%cl
  je     L467
  cmp    $0xa,%cl
  je     L467
  movslq %edx,%rax
L534:
  mov    %eax,%edx
  cmp    $0xffffffff,%eax
  jl     L302
  je     L645
  sub    $0x1,%rax
  cmpb   $0x20,0x1(%rbx,%rax,1)
  jne    L534
  lea    0x1(%rdx),%r13d
L302:
  movslq %r13d,%r13
  mov    $0x0,%r12d
  jmp    L592
L173:
  mov    %rbx,%rsi
  lea    D731(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D474(%rip),%rdi
  call   <puts@plt>
  mov    $0x10,%eax
  jmp    L599
L645:
  mov    %rbx,%rsi
  lea    D654(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D474(%rip),%rdi
  call   <puts@plt>
  mov    $0x10,%eax
  jmp    L599
L384:
  movzbl (%rbx,%r13,1),%eax
  mov    %al,(%r12,%r15,1)
  add    $0x1,%r12
  add    $0x1,%r13
L592:
  mov    %r13d,(%rsp)
  movsbl (%rbx,%r13,1),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L384
  movslq %r12d,%r14
  movb   $0x0,0x4a(%rsp,%r14,1)
  mov    %r15,%rdi
  call   <atoi@plt>
  mov    %eax,0xc(%rsp)
  movslq (%rsp),%r13
L451:
  mov    %r13d,%r12d
  movsbl (%rbx,%r13,1),%edi
  call   <isdigit@plt>
  add    $0x1,%r13
  test   %rax,%rax
  je     L451
  movslq %r12d,%r12
  mov    $0x0,%r13d
  jmp    L651
L671:
  movzbl (%rbx,%r12,1),%eax
  mov    %al,0x41(%rsp,%r13,1)
  add    $0x1,%r13
  add    $0x1,%r12
L651:
  mov    %r12d,(%rsp)
  movsbl (%rbx,%r12,1),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L671
  movslq %r13d,%r14
  movb   $0x0,0x41(%rsp,%r14,1)
  lea    0x41(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x10(%rsp)
  movslq (%rsp),%r13
L502:
  mov    %r13d,%r12d
  movsbl (%rbx,%r13,1),%edi
  call   <isdigit@plt>
  add    $0x1,%r13
  test   %rax,%rax
  je     L502
  movslq %r12d,%r12
  mov    $0x0,%r13d
  jmp    L116
L297:
  movzbl (%rbx,%r12,1),%eax
  mov    %al,0x44(%rsp,%r13,1)
  add    $0x1,%r13
  add    $0x1,%r12
L116:
  mov    %r12d,(%rsp)
  movsbl (%rbx,%r12,1),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L297
  movslq %r13d,%r14
  movb   $0x0,0x44(%rsp,%r14,1)
  lea    0x44(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x14(%rsp)
  movslq (%rsp),%r13
L656:
  mov    %r13d,%r12d
  movsbl (%rbx,%r13,1),%edi
  call   <isdigit@plt>
  add    $0x1,%r13
  test   %rax,%rax
  je     L656
  movslq %r12d,%r12
  mov    $0x0,%r13d
  jmp    L357
L149:
  movzbl (%rbx,%r12,1),%eax
  mov    %al,0x47(%rsp,%r13,1)
  add    $0x1,%r13
  add    $0x1,%r12
L357:
  mov    %r12d,(%rsp)
  movsbl (%rbx,%r12,1),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L149
  movslq %r13d,%r14
  movb   $0x0,0x47(%rsp,%r14,1)
  lea    0x47(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,%r12d
  movslq (%rsp),%r13
L38:
  movsbl (%rbx,%r13,1),%edi
  call   <isdigit@plt>
  add    $0x1,%r13
  test   %rax,%rax
  je     L38
  movslq %r12d,%r12
  mov    0x30(%rsp),%rax
  sub    %r12,%rax
  imul   $0x3c,0x14(%rsp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  imul   $0xe10,0x10(%rsp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  imul   $0x15180,0xc(%rsp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  mov    %rax,0x38(%rsp)
  mov    %rbx,%rdi
  call   <strlen@plt>
  lea    -0x1(%rax),%edx
  movslq %edx,%rdx
  movb   $0x20,(%rbx,%rdx,1)
  movslq %eax,%rdx
  movb   $0x73,(%rbx,%rdx,1)
  lea    0x1(%rax),%edx
  movslq %edx,%rdx
  movb   $0x69,(%rbx,%rdx,1)
  lea    0x2(%rax),%edx
  movslq %edx,%rdx
  movb   $0x6e,(%rbx,%rdx,1)
  lea    0x3(%rax),%edx
  movslq %edx,%rdx
  movb   $0x63,(%rbx,%rdx,1)
  lea    0x4(%rax),%edx
  movslq %edx,%rdx
  movb   $0x65,(%rbx,%rdx,1)
  lea    0x5(%rax),%edx
  movslq %edx,%rdx
  movb   $0x20,(%rbx,%rdx,1)
  add    $0x6,%eax
  movslq %eax,%r12
  mov    $0x0,%r14d
  lea    0x38(%rsp),%rax
  mov    %rax,(%rsp)
  jmp    L382
L231:
  mov    (%rsp),%rdi
  call   <gmtime@plt>
  mov    %eax,%edi
  call   <asctime@plt>
  movzbl (%rax,%r14,1),%eax
  mov    %al,(%rbx,%r12,1)
  add    $0x1,%r14
  add    $0x1,%r12
L382:
  mov    %r12d,%r13d
  mov    (%rsp),%rdi
  call   <gmtime@plt>
  mov    %eax,%edi
  call   <asctime@plt>
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %r14d,%eax
  jg     L231
  movslq %r12d,%rax
  movb   $0x0,(%rbx,%rax,1)
  mov    %rbx,%rsi
  lea    D792(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L328
L166:
  mov    $0xc,%eax
  jmp    L599
L477:
  mov    $0x0,%eax
  jmp    L599
L87:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D363
datatype: string
name: parse_data
arguments: data_tag: D333
datatype: string
name: parse_data
arguments: data_tag: D811
datatype: string
name: parse_data
arguments: data_tag: D618
datatype: string
name: parse_data
arguments: data_tag: D721
datatype: string
name: parse_data
arguments: data_tag: D663
datatype: string
name: parse_data
arguments: data_tag: D392
datatype: string
name: parse_data
arguments: data_tag: D75
datatype: string
name: parse_data
arguments: data_tag: D9
datatype: string
name: parse_data
arguments: data_tag: D625
datatype: string
name: parse_data
arguments: data_tag: D539
datatype: string
name: parse_data
arguments: data_tag: D743
datatype: string
name: parse_data
arguments: data_tag: D352
datatype: string
name: parse_data
arguments: data_tag: D820
datatype: string
name: parse_data
arguments: data_tag: D700
datatype: string
name: parse_data
arguments: data_tag: D679
datatype: string
name: parse_data
arguments: data_tag: D267
datatype: string
name: parse_data
arguments: data_tag: D107
datatype: string
name: parse_data
arguments: data_tag: D356
datatype: string
name: parse_data
arguments: data_tag: D216
datatype: string
name: parse_data
arguments: data_tag: D443
datatype: string
name: parse_data
arguments: data_tag: D658
datatype: string
name: parse_data
arguments: data_tag: D383
datatype: string
name: parse_data
arguments: data_tag: D491
datatype: string
name: parse_data
arguments: data_tag: D372
datatype: string
name: parse_data
arguments: data_tag: D510
datatype: string
name: parse_data
arguments: data_tag: D475
datatype: string
name: parse_data
arguments: data_tag: D839
datatype: string
name: parse_data
arguments: data_tag: D599
datatype: string
name: parse_data
arguments: data_tag: D499
datatype: string
name: parse_data
arguments: data_tag: D593
datatype: string
name: parse_data
arguments: data_tag: D782
datatype: string
name: parse_data
arguments: data_tag: D810
datatype: string
name: parse_data
arguments: data_tag: D726
datatype: string
name: parse_data
arguments: data_tag: D367
datatype: string
name: parse_data
arguments: data_tag: D282
datatype: string
name: parse_data
arguments: data_tag: D643
datatype: string
name: parse_data
arguments: data_tag: D685
datatype: string
name: parse_data
arguments: data_tag: D73
datatype: string
name: parse_data
arguments: data_tag: D194
datatype: string
name: parse_data
arguments: data_tag: D335
datatype: string
name: parse_data
arguments: data_tag: D339
datatype: string
name: parse_data
arguments: data_tag: D792
datatype: string
name: parse_data
arguments: data_tag: D819
datatype: string
name: parse_data
arguments: data_tag: D474
datatype: string
name: parse_data
arguments: data_tag: D801
datatype: string
name: parse_data
arguments: data_tag: D465
datatype: string
name: parse_data
arguments: data_tag: D262
datatype: string
name: parse_data
arguments: data_tag: D397
datatype: string
name: parse_data
arguments: data_tag: D263
datatype: string
name: parse_data
arguments: data_tag: D125
datatype: string
name: parse_data
arguments: data_tag: D549
datatype: string
name: parse_data
arguments: data_tag: D245
datatype: string
name: parse_data
arguments: data_tag: D226
datatype: string
name: parse_data
arguments: data_tag: D548
datatype: string
name: parse_data
arguments: data_tag: D320
datatype: string
name: parse_data
arguments: data_tag: D813
datatype: string
name: parse_data
arguments: data_tag: D4
datatype: string
name: parse_data
arguments: data_tag: D324
datatype: string
name: parse_data
arguments: data_tag: D731
datatype: string
name: parse_data
arguments: data_tag: D654
datatype: string

tool: D363:     Usage: %s <input text file 1>


tool: D333: This C program takes as INPUT(in a file) the output from an eSeries "show version" CLI command, for example:

tool: D811: Juniper Edge Routing Switch ERX-1400

tool: D618: Copyright (c) 1999-2008 Juniper Networks, Inc.  All rights reserved.

tool: D721: System Release: 8-2-3p0-5-1.rel

tool: D663:         Version: 8.2.3 patch-0.5.1 [BuildId 10739]   (March 24, 2009  10:50)

tool: D392: System running for: 553 days, 16 hours, 13 minutes, 20 seconds

tool: D75:         (since TUE SEP 01 2009 05:21:30 UTC)

tool: D9: slot  state        type        admin  spare running release   slot uptime  

tool: D625: ---- ------- ---------------- ------- ----- --------------- ---------------

tool: D539: 0    standby OC3/OC12/DS3-ATM enabled spare 8-2-3p0-5-1.rel       ---      

tool: D743: 1    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:15s

tool: D352: 2    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:14s

tool: D820: 3      ---         ---          ---    ---        ---             ---      

tool: D700: 4    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:12s

tool: D679: 5    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:10s

tool: D267: 6    online  SRP-10Ge         enabled  ---  8-2-3p0-5-1.rel 553d16h:10m:27s

tool: D107: 7    standby SRP-10Ge         enabled  ---  8-2-3p0-5-1.rel       ---      

tool: D356: 8      ---         ---          ---    ---        ---             ---      

tool: D216: 9    online  GE               enabled  ---  8-2-3p0-5-1.rel 553d16h:02m:33s

tool: D443: 10     ---         ---          ---    ---        ---             ---      

tool: D658: 11     ---         ---          ---    ---        ---             ---      

tool: D383: 12   online  GE               enabled  ---  8-2-3p0-5-1.rel 553d16h:02m:36s

tool: D491: 13     ---         ---          ---    ---        ---             ---      

tool: D372: --and provides as OUTPUT(to the monitor) the time that this eSeries "show version" CLI command was executed;

tool: D510: ALSO, it converts the slot uptimes to the actual times the slots came up, in this example it would be:

tool: D475: Time this "show version" CLI command was executed:                          Tue Mar  8 21:34:50 2011

tool: D839: 1    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:15s Tue Sep  1 05:33:35 2009

tool: D599: 2    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:14s Tue Sep  1 05:33:36 2009

tool: D499: 4    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:12s Tue Sep  1 05:33:38 2009

tool: D593: 5    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:10s Tue Sep  1 05:33:40 2009

tool: D782: 6    online  SRP-10Ge         enabled  ---  8-2-3p0-5-1.rel 553d16h:10m:27s Tue Sep  1 05:24:23 2009

tool: D810: 9    online  GE               enabled  ---  8-2-3p0-5-1.rel 553d16h:02m:33s Tue Sep  1 05:32:17 2009

tool: D726: 12   online  GE               enabled  ---  8-2-3p0-5-1.rel 553d16h:02m:36s Tue Sep  1 05:32:14 2009

tool: D367: Caveats:

tool: D282: 0 - input format must be exact

tool: D643: 1 - output is in local time, ASSUMED to be UTC (at least, that is what I like)

tool: D685: 2 - the eSeries may add trailing spaces, which breaks this code.  An example workaround is:

tool: D73:         cat inputFile | sed 's/ *$//' > inputFileCleaned

tool: D194: Written by Jonathan Natale for Juniper Networks on 11-Mar-2011.

tool: D335: r

tool: D339: System running for: 

tool: D792: %s

tool: D819: Sorry, unable to open %s file.


tool: D474: Please try again.  Exiting ...

tool: D801: Sorry, unexpected NULL line read in %s file.


tool: D465: Sorry, wrong number of digits in the number of days, in first line (got %d, expected between 1 and 5).


tool: D262: Sorry, wrong number of non-numeric characters before a number, in first line (got %d, expected 20).


tool: D397: Sorry, wrong number of characters after the number of days and before the number of hours, in first line (got %d, expected 6 or 7).


tool: D263: Sorry, wrong number of digits in the number of hours, in first line (got %d, expected between 1 and 2).


tool: D125: Sorry, wrong number of characters after the number of hours and before the number of minutes, in first line (got %d, expected 7 or 8).


tool: D549: Sorry, wrong number of digits in the number of minutes, in first line (got %d, expected between 1 and 2).


tool: D245: Sorry, wrong number of characters after the number of minutes and before the number of seconds, in first line (got %d, expected 9 or 10).


tool: D226: Sorry, wrong number of digits in the number of seconds, in first line (got %d, expected between 1 and 2).


tool: D548:          (since %a %b %d %Y %T UTC)

tool: D320: Time this "show version" CLI command was executed:                                   %s

tool: D813: m:

tool: D4: strptime() failed!

tool: D324: mktime failed!

tool: D731: Sorry, unexpectedly, a nonspace was not found in the input line: <%s>.


tool: D654: Sorry, unexpectedly, a space was not found in the input line: <%s>.


assistant: ```c
int main(int argc, char **argv) {
  FILE *inputFile_ptr;
  int i, j, k;
  time_t t;
  struct tm time_str;
  char *line;
  char lineBuf[512];
  long int currentTimeInSecondsSinceEpoch = 1234567890;
  long int slotBootTimeInSecondsSinceEpoch = 313131313;
  int daysDiffInt = 0;
  int hoursDiffInt = 0;
  int minutesDiffInt = 0;
  int secondsDiffInt = 0;
  char daysDiffString[6];
  char hoursDiffString[3];
  char minutesDiffString[3];
  char secondsDiffString[3];
  if (argc != 2) {
    printf("\n");
    printf("\n");
    printf("    Usage: %s <input text file 1>\n", argv[0]);
    printf("\n");
    printf("This C program takes as INPUT(in a file) the output from an eSeries \"show version\" CLI command, for example:\n");
    printf("\n");
    printf("Juniper Edge Routing Switch ERX-1400\n");
    printf("Copyright (c) 1999-2008 Juniper Networks, Inc.  All rights reserved.\n");
    printf("System Release: 8-2-3p0-5-1.rel\n");
    printf("        Version: 8.2.3 patch-0.5.1 [BuildId 10739]   (March 24, 2009  10:50)\n");
    printf("System running for: 553 days, 16 hours, 13 minutes, 20 seconds\n");
    printf("        (since TUE SEP 01 2009 05:21:30 UTC)\n");
    printf("\n");
    printf("slot  state        type        admin  spare running release   slot uptime  \n");
    printf("---- ------- ---------------- ------- ----- --------------- ---------------\n");
    printf("0    standby OC3/OC12/DS3-ATM enabled spare 8-2-3p0-5-1.rel       ---      \n");
    printf("1    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:15s\n");
    printf("2    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:14s\n");
    printf("3      ---         ---          ---    ---        ---             ---      \n");
    printf("4    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:12s\n");
    printf("5    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:10s\n");
    printf("6    online  SRP-10Ge         enabled  ---  8-2-3p0-5-1.rel 553d16h:10m:27s\n");
    printf("7    standby SRP-10Ge         enabled  ---  8-2-3p0-5-1.rel       ---      \n");
    printf("8      ---         ---          ---    ---        ---             ---      \n");
    printf("9    online  GE               enabled  ---  8-2-3p0-5-1.rel 553d16h:02m:33s\n");
    printf("10     ---         ---          ---    ---        ---             ---      \n");
    printf("11     ---         ---          ---    ---        ---             ---      \n");
    printf("12   online  GE               enabled  ---  8-2-3p0-5-1.rel 553d16h:02m:36s\n");
    printf("13     ---         ---          ---    ---        ---             ---      \n");
    printf("\n");
    printf("\n");
    printf("--and provides as OUTPUT(to the monitor) the time that this eSeries \"show version\" CLI command was executed;\n");
    printf("ALSO, it converts the slot uptimes to the actual times the slots came up, in this example it would be:\n");
    printf("\n");
    printf("Juniper Edge Routing Switch ERX-1400\n");
    printf("Copyright (c) 1999-2008 Juniper Networks, Inc.  All rights reserved.\n");
    printf("System Release: 8-2-3p0-5-1.rel\n");
    printf("        Version: 8.2.3 patch-0.5.1 [BuildId 10739]   (March 24, 2009  10:50)\n");
    printf("System running for: 553 days, 16 hours, 13 minutes, 20 seconds\n");
    printf("        (since TUE SEP 01 2009 05:21:30 UTC)\n");
    printf("Time this \"show version\" CLI command was executed:                          Tue Mar  8 21:34:50 2011\n");
    printf("\n");
    printf("slot  state        type        admin  spare running release   slot uptime  \n");
    printf("---- ------- ---------------- ------- ----- --------------- ---------------\n");
    printf("0    standby OC3/OC12/DS3-ATM enabled spare 8-2-3p0-5-1.rel       ---      \n");
    printf("1    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:15s Tue Sep  1 05:33:35 2009\n");
    printf("2    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:14s Tue Sep  1 05:33:36 2009\n");
    printf("3      ---         ---          ---    ---        ---             ---      \n");
    printf("4    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:12s Tue Sep  1 05:33:38 2009\n");
    printf("5    online  OC3-4A           enabled  ---  8-2-3p0-5-1.rel 553d16h:01m:10s Tue Sep  1 05:33:40 2009\n");
    printf("6    online  SRP-10Ge         enabled  ---  8-2-3p0-5-1.rel 553d16h:10m:27s Tue Sep  1 05:24:23 2009\n");
    printf("7    standby SRP-10Ge         enabled  ---  8-2-3p0-5-1.rel       ---      \n");
    printf("8      ---         ---          ---    ---        ---             ---      \n");
    printf("9    online  GE               enabled  ---  8-2-3p0-5-1.rel 553d16h:02m:33s Tue Sep  1 05:32:17 2009\n");
    printf("10     ---         ---          ---    ---        ---             ---      \n");
    printf("11     ---         ---          ---    ---        ---             ---      \n");
    printf("12   online  GE               enabled  ---  8-2-3p0-5-1.rel 553d16h:02m:36s Tue Sep  1 05:32:14 2009\n");
    printf("13     ---         ---          ---    ---        ---             ---      \n");
    printf("\n");
    printf("\n");
    printf("Caveats:\n");
    printf("0 - input format must be exact\n");
    printf("1 - output is in local time, ASSUMED to be UTC (at least, that is what I like)\n");
    printf("2 - the eSeries may add trailing spaces, which breaks this code.  An example workaround is:\n");
    printf("        cat inputFile | sed 's/ *$//' > inputFileCleaned\n");
    printf("\n");
    printf("Written by Jonathan Natale for Juniper Networks on 11-Mar-2011.\n");
    printf("\n");
    return (1);
  }
  if ((inputFile_ptr = fopen(argv[1], "r")) == NULL) {
    printf("Sorry, unable to open %s file.\n", argv[1]);
    printf("Please try again.  Exiting ...\n");
    return (2);
  }
  while (1) {
    if ((line = fgets(lineBuf, 512 - 2, inputFile_ptr)) == NULL) {
      printf("Sorry, unexpected NULL line read in %s file.\n", inputFile_ptr);
      printf("Please try again.  Exiting ...\n");
      return (3);
    }
    if (strstr(line, "System running for: ") == NULL) {
      printf("%s", line);
    } else {
      break;
    }
  }
  printf("%s", line);
  i = 0;
  j = 0;
  while (!isdigit(line[i])) {
    i++;
    j++;
  }
  if (j != 20) {
    printf("Sorry, wrong number of non-numeric characters before a number, in first line (got %d, expected 20).\n", j);
    printf("Please try again.  Exiting ...\n");
    return (4);
  }
  j = 0;
  while (isdigit(line[i])) {
    daysDiffString[j] = line[i];
    if (j >= 5) {
      printf("Sorry, wrong number of digits in the number of days, in first line (got %d, expected between 1 and 5).\n", j + 1);
      printf("Please try again.  Exiting ...\n");
      return (5);
    }
    i++;
    j++;
  }
  daysDiffString[j] = '\0';
  daysDiffInt = atoi(daysDiffString);
  j = 0;
  while (!isdigit(line[i])) {
    i++;
    j++;
  }
  if ((j != 6) && (j != 7)) {
    printf("Sorry, wrong number of characters after the number of days and before the number of hours, in first line (got %d, expected 6 or 7).\n", j);
    printf("Please try again.  Exiting ...\n");
    return (6);
  }
  j = 0;
  while (isdigit(line[i])) {
    hoursDiffString[j] = line[i];
    if (j >= 2) {
      printf("Sorry, wrong number of digits in the number of hours, in first line (got %d, expected between 1 and 2).\n", j + 1);
      printf("Please try again.  Exiting ...\n");
      return (7);
    }
    i++;
    j++;
  }
  hoursDiffString[j] = '\0';
  hoursDiffInt = atoi(hoursDiffString);
  j = 0;
  while (!isdigit(line[i])) {
    i++;
    j++;
  }
  if ((j != 7) && (j != 8)) {
    printf("Sorry, wrong number of characters after the number of hours and before the number of minutes, in first line (got %d, expected 7 or 8).\n", j);
    printf("Please try again.  Exiting ...\n");
    return (8);
  }
  j = 0;
  while (isdigit(line[i])) {
    minutesDiffString[j] = line[i];
    if (j >= 2) {
      printf("Sorry, wrong number of digits in the number of minutes, in first line (got %d, expected between 1 and 2).\n", j + 1);
      printf("Please try again.  Exiting ...\n");
      return (9);
    }
    i++;
    j++;
  }
  minutesDiffString[j] = '\0';
  minutesDiffInt = atoi(minutesDiffString);
  j = 0;
  while (!isdigit(line[i])) {
    i++;
    j++;
  }
  if ((j != 9) && (j != 10)) {
    printf("Sorry, wrong number of characters after the number of minutes and before the number of seconds, in first line (got %d, expected 9 or 10).\n", j);
    printf("Please try again.  Exiting ...\n");
    return (10);
  }
  j = 0;
  while (isdigit(line[i])) {
    secondsDiffString[j] = line[i];
    if (j >= 2) {
      printf("Sorry, wrong number of digits in the number of seconds, in first line (got %d, expected between 1 and 2).\n", j + 1);
      printf("Please try again.  Exiting ...\n");
      return (11);
    }
    i++;
    j++;
  }
  secondsDiffString[j] = '\0';
  secondsDiffInt = atoi(secondsDiffString);
  if ((line = fgets(lineBuf, 512 - 2, inputFile_ptr)) == NULL) {
    return (12);
  }
  printf("%s", line);
  if (strptime(line, "         (since %a %b %d %Y %T UTC)", &time_str) == (int)NULL) {
    printf("strptime() failed!\n");
    return (13);
  }
  time_str.tm_isdst = -1;
  t = mktime(&time_str);
  if (t == -1) {
    printf("mktime failed!");
    return (14);
  } else {
    currentTimeInSecondsSinceEpoch = (long)t + secondsDiffInt + minutesDiffInt * 60 + hoursDiffInt * 3600 + daysDiffInt * 86400;
  }
  printf("Time this \"show version\" CLI command was executed:                                   %s", asctime(gmtime(&currentTimeInSecondsSinceEpoch)));
  while (1) {
    while (1) {
      if ((line = fgets(lineBuf, 512 - 2, inputFile_ptr)) == NULL) {
        return (0);
      }
      if (strstr(line, "m:") == NULL) {
        printf("%s", line);
      } else {
        break;
      }
    }
    for (k = strlen(line) - 1; k >= -1; k--) {
      if (k == -1) {
        printf("Sorry, unexpectedly, a nonspace was not found in the input line: <%s>.\n", line);
        printf("Please try again.  Exiting ...\n");
        return (16);
      }
      if ((line[k] != ' ') && (line[k] != '\n')) {
        break;
      }
    }
    for (i = k; i >= -1; i--) {
      if (i == -1) {
        printf("Sorry, unexpectedly, a space was not found in the input line: <%s>.\n", line);
        printf("Please try again.  Exiting ...\n");
        return (16);
      }
      if (line[i] == ' ') {
        j = i + 1;
        break;
      }
    }
    i = 0;
    while (isdigit(line[j])) {
      daysDiffString[i++] = line[j++];
    }
    daysDiffString[i] = '\0';
    daysDiffInt = atoi(daysDiffString);
    while (!isdigit(line[j++]))
      ;
    j--;
    i = 0;
    while (isdigit(line[j])) {
      hoursDiffString[i++] = line[j++];
    }
    hoursDiffString[i] = '\0';
    hoursDiffInt = atoi(hoursDiffString);
    while (!isdigit(line[j++]))
      ;
    j--;
    i = 0;
    while (isdigit(line[j])) {
      minutesDiffString[i++] = line[j++];
    }
    minutesDiffString[i] = '\0';
    minutesDiffInt = atoi(minutesDiffString);
    while (!isdigit(line[j++]))
      ;
    j--;
    i = 0;
    while (isdigit(line[j])) {
      secondsDiffString[i++] = line[j++];
    }
    secondsDiffString[i] = '\0';
    secondsDiffInt = atoi(secondsDiffString);
    while (!isdigit(line[j++])) {
    }
    j--;
    slotBootTimeInSecondsSinceEpoch = currentTimeInSecondsSinceEpoch - secondsDiffInt - minutesDiffInt * 60 - hoursDiffInt * 3600 - daysDiffInt * 86400;
    j = strlen(line) - 1;
    line[j++] = ' ';
    line[j++] = 's';
    line[j++] = 'i';
    line[j++] = 'n';
    line[j++] = 'c';
    line[j++] = 'e';
    line[j++] = ' ';
    for (i = 0; i < strlen(asctime(gmtime(&slotBootTimeInSecondsSinceEpoch))); i++) {
      line[j++] = asctime(gmtime(&slotBootTimeInSecondsSinceEpoch))[i];
    }
    line[j] = '\0';
    printf("%s", line);
  }
  printf("Sorry, unexpected program exit point, something might be broken!\n");
  printf("Please try again and/or contact the program author, Jonathan Natale.  Exiting ...\n");
  return (0);
}
```