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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x125000(%rsp),%r11
L300:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L300
  sub    $0x4e8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1254d8(%rsp)
  xor    %eax,%eax
  cmp    $0x1,%edi
  jle    L537
  movss  D212(%rip),%xmm5
  movss  D301(%rip),%xmm6
  mov    $0x1,%r12d
  movb   $0x0,0x124fd0(%rsp)
  movl   $0x0,0x8(%rsp)
  mov    %edi,%ebx
  mov    %rsi,%rbp
  mov    %r12d,%r14d
  movss  D90(%rip),%xmm7
  movss  D76(%rip),%xmm3
  movss  %xmm5,0x4c(%rsp)
  lea    D387(%rip),%r15
  movss  D15(%rip),%xmm5
  movss  D127(%rip),%xmm1
  movss  %xmm6,0x48(%rsp)
  movss  %xmm7,0x30(%rsp)
  movss  D414(%rip),%xmm6
  movss  D354(%rip),%xmm7
  movss  %xmm3,0x44(%rsp)
  movss  D407(%rip),%xmm3
  movl   $0x0,0x10(%rsp)
  movl   $0x0,0x18(%rsp)
  movl   $0x0,0x28(%rsp)
  movl   $0x3e8,0x24(%rsp)
  movss  %xmm5,0x40(%rsp)
  movss  %xmm6,0x3c(%rsp)
  movss  %xmm7,0x38(%rsp)
  movss  %xmm1,0x2c(%rsp)
  movss  %xmm3,0x34(%rsp)
  jmp    L964
  nopw   0x0(%rax,%rax,1)
L726:
  cmpb   $0x66,0x1(%r13)
  jne    L451
  cmpb   $0x0,0x2(%r13)
  jne    L451
L301:
  lea    0x8(%rbp,%r12,1),%r12
  add    $0x1,%r14d
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L397
L1122:
  cmpb   $0x2d,0x0(%r13)
  jne    L357
  cmpb   $0x6d,0x1(%r13)
  jne    L357
  cmpb   $0x0,0x2(%r13)
  jne    L357
L227:
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L615
L1067:
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L735
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L478
L735:
  cmpb   $0x2d,0x0(%r13)
  jne    L975
  cmpb   $0x30,0x1(%r13)
  jne    L975
  cmpb   $0x0,0x2(%r13)
  jne    L975
L1126:
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L528
L757:
  cmpb   $0x2d,0x0(%r13)
  jne    L273
  cmpb   $0x31,0x1(%r13)
  jne    L273
  cmpb   $0x0,0x2(%r13)
  jne    L273
L734:
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L695
L1124:
  cmpb   $0x2d,0x0(%r13)
  jne    L532
  cmpb   $0x69,0x1(%r13)
  jne    L532
  cmpb   $0x0,0x2(%r13)
  jne    L532
L465:
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L588
L1101:
  cmpb   $0x2d,0x0(%r13)
  jne    L730
  cmpb   $0x70,0x1(%r13)
  jne    L730
  cmpb   $0x0,0x2(%r13)
  jne    L730
L1208:
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L127
L75:
  lea    D240(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L1170
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L252
L1170:
  lea    D233(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L381
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L724
L381:
  lea    D322(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L1024
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L438
L1024:
  cmpb   $0x2d,0x0(%r13)
  jne    L37
  cmpb   $0x72,0x1(%r13)
  jne    L37
  cmpb   $0x0,0x2(%r13)
  jne    L37
L73:
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L251
L520:
  lea    D368(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L799
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L967
L799:
  lea    D124(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L186
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L783
L186:
  lea    D320(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L801
  add    $0x1,%r14d
  movslq %r14d,%rax
  lea    0x0(%rbp,%rax,8),%r12
  mov    (%r12),%r13
  cmp    %r14d,%ebx
  jg     L367
L801:
  cmpb   $0x2d,0x0(%r13)
  jne    L114
  cmpb   $0x74,0x1(%r13)
  jne    L114
  cmpb   $0x0,0x2(%r13)
  jne    L114
L1070:
  add    $0x1,%r14d
  movslq %r14d,%rax
  mov    0x0(%rbp,%rax,8),%r13
  cmp    %r14d,%ebx
  jle    L379
  lea    D143(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L425
  lea    D13(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  cmovne 0x8(%rsp),%eax
L425:
  movzbl 0x0(%r13),%ecx
  cmp    $0x6b,%ecx
  jne    L118
  cmpb   $0x32,0x1(%r13)
  jne    L118
  cmpb   $0x0,0x2(%r13)
  movl   $0x1,0x8(%rsp)
  jne    L118
  nopw   0x0(%rax,%rax,1)
L379:
  movzbl 0x0(%r13),%r12d
  cmp    $0x2d,%r12d
  jne    L331
  cmpb   $0x68,0x1(%r13)
  jne    L331
  cmpb   $0x0,0x2(%r13)
  je     L972
  nopl   (%rax)
L331:
  lea    D33(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L972
  cmp    $0x2d,%r12d
  jne    L167
  cmpb   $0x76,0x1(%r13)
  jne    L167
  cmpb   $0x0,0x2(%r13)
  je     L155
  nop
L167:
  lea    D367(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L155
  add    $0x1,%r14d
  cmp    %r14d,%ebx
  jle    L487
L964:
  movslq %r14d,%rax
  mov    0x0(%rbp,%rax,8),%r13
  lea    0x0(,%rax,8),%r12
  cmpb   $0x2d,0x0(%r13)
  je     L726
L451:
  lea    D101(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L1122
  jmp    L301
  nopl   0x0(%rax,%rax,1)
L37:
  lea    D370(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L520
  jmp    L73
  nopl   0x0(%rax)
L114:
  lea    D371(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L379
  jmp    L1070
  nopl   0x0(%rax)
L975:
  lea    D385(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L757
  jmp    L1126
  nopl   0x0(%rax)
L357:
  lea    D51(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L1067
  jmp    L227
  nopl   0x0(%rax)
L532:
  lea    D391(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L1101
  jmp    L465
  nopl   0x0(%rax)
L273:
  lea    D208(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L1124
  jmp    L734
  nopl   0x0(%rax)
L730:
  lea    D48(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L75
  jmp    L1208
  nopl   0x0(%rax)
L127:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atof@plt>
  pxor   %xmm7,%xmm7
  mov    (%r12),%r13
  cvtsi2ss %eax,%xmm7
  movss  %xmm7,0x10(%rsp)
  jmp    L75
  nopl   0x0(%rax)
L588:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atof@plt>
  pxor   %xmm6,%xmm6
  mov    (%r12),%r13
  cvtsi2ss %eax,%xmm6
  movss  %xmm6,0x2c(%rsp)
  jmp    L1101
  nopl   0x0(%rax)
L695:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atof@plt>
  pxor   %xmm5,%xmm5
  mov    (%r12),%r13
  cvtsi2ss %eax,%xmm5
  movss  %xmm5,0x18(%rsp)
  jmp    L1124
  nopl   0x0(%rax)
L251:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atof@plt>
  pxor   %xmm3,%xmm3
  mov    (%r12),%r13
  cvtsi2ss %eax,%xmm3
  movss  %xmm3,0x30(%rsp)
  jmp    L520
  nopl   0x0(%rax)
L528:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atof@plt>
  pxor   %xmm4,%xmm4
  mov    (%r12),%r13
  cvtsi2ss %eax,%xmm4
  movss  %xmm4,0x28(%rsp)
  jmp    L757
  nopl   0x0(%rax)
L397:
  mov    %r13,%rsi
  lea    0x124fd0(%rsp),%rdi
  call   <strcpy@plt>
  mov    (%r12),%r13
  jmp    L1122
  nopl   0x0(%rax)
L615:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atoi@plt>
  mov    (%r12),%r13
  mov    %eax,0x24(%rsp)
  jmp    L1067
  nop
L118:
  cmp    $0x4b,%ecx
  jne    L386
  cmpb   $0x32,0x1(%r13)
  jne    L386
  cmpb   $0x0,0x2(%r13)
  jne    L386
  movl   $0x1,0x8(%rsp)
  jmp    L379
L386:
  mov    %eax,0x8(%rsp)
  jmp    L379
  nopl   0x0(%rax)
L478:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atof@plt>
  pxor   %xmm1,%xmm1
  mov    (%r12),%r13
  cvtsi2ss %eax,%xmm1
  movss  %xmm1,0x34(%rsp)
  jmp    L735
  nopl   0x0(%rax)
L967:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atof@plt>
  pxor   %xmm2,%xmm2
  mov    (%r12),%r13
  cvtsi2ss %eax,%xmm2
  movss  %xmm2,0x44(%rsp)
  jmp    L799
  nopl   0x0(%rax)
L367:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atof@plt>
  pxor   %xmm4,%xmm4
  mov    (%r12),%r13
  cvtsi2ss %eax,%xmm4
  movss  %xmm4,0x4c(%rsp)
  jmp    L801
  nopl   0x0(%rax)
L783:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atof@plt>
  pxor   %xmm0,%xmm0
  mov    (%r12),%r13
  cvtsi2ss %eax,%xmm0
  movss  %xmm0,0x48(%rsp)
  jmp    L186
  nopl   0x0(%rax)
L252:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atof@plt>
  pxor   %xmm2,%xmm2
  mov    (%r12),%r13
  cvtsi2ss %eax,%xmm2
  movss  %xmm2,0x38(%rsp)
  jmp    L1170
  nopl   0x0(%rax)
L724:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atof@plt>
  pxor   %xmm0,%xmm0
  mov    (%r12),%r13
  cvtsi2ss %eax,%xmm0
  movss  %xmm0,0x3c(%rsp)
  jmp    L381
  nopl   0x0(%rax)
L438:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <atof@plt>
  pxor   %xmm1,%xmm1
  mov    (%r12),%r13
  cvtsi2ss %eax,%xmm1
  movss  %xmm1,0x40(%rsp)
  jmp    L1024
L972:
  xor    %eax,%eax
  call   <show_help@plt>
  xor    %eax,%eax
L385:
  mov    0x1254d8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L815
  add    $0x1254e8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L155:
  movsd  D302(%rip),%xmm0
  lea    D413(%rip),%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  xor    %eax,%eax
  jmp    L385
L487:
  cmpb   $0x0,0x124fd0(%rsp)
  je     L865
  movss  0x10(%rsp),%xmm2
  pxor   %xmm0,%xmm0
  ucomiss %xmm0,%xmm2
  jp     L434
  jne    L434
  movss  0x18(%rsp),%xmm4
  ucomiss %xmm0,%xmm4
  jp     L1198
  je     L311
L1198:
  movss  0x28(%rsp),%xmm0
  comiss 0x18(%rsp),%xmm0
  jae    L908
L434:
  lea    0x124fd0(%rsp),%r14
  xor    %eax,%eax
  lea    0x1250d0(%rsp),%r12
  mov    %r14,%rdi
  mov    %r12,%rsi
  lea    0x50(%rsp),%rbp
  call   <scan_name@plt>
  mov    %rbp,%rsi
  mov    %r14,%rdi
  xor    %r8d,%r8d
  lea    0x61ad0(%rsp),%r13
  mov    $0x3,%r9d
  mov    $0x186a0,%ecx
  xor    %eax,%eax
  sub    0x8(%rsp),%r9d
  mov    %r13,%rdx
  call   <logfile_load@plt>
  mov    %eax,%r14d
  mov    %eax,%esi
  cmp    %eax,0x24(%rsp)
  jg     L1014
  lea    D428(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  mov    %r14d,%esi
  mov    %rbp,%rdi
  lea    0xc3550(%rsp),%rdx
  call   <detect_endpoints@plt>
  test   %eax,%eax
  je     L755
  movss  0x10(%rsp),%xmm2
  pxor   %xmm0,%xmm0
  ucomiss %xmm0,%xmm2
  jp     L624
  je     L152
  pxor   %xmm2,%xmm2
  cvtss2sd 0x10(%rsp),%xmm2
L170:
  lea    0x1252d0(%rsp),%rbx
  mov    %r12,%rdx
  lea    D62(%rip),%rsi
  xor    %eax,%eax
  mov    %rbx,%rdi
  movsd  %xmm2,0x8(%rsp)
  lea    0x1251d0(%rsp),%r15
  call   <sprintf@plt>
  lea    0x1253d0(%rsp),%r8
  mov    %r12,%rdx
  xor    %eax,%eax
  mov    %r8,%rdi
  lea    D184(%rip),%rsi
  mov    %r8,0x18(%rsp)
  call   <sprintf@plt>
  mov    %r12,%rdx
  mov    %r15,%rdi
  xor    %eax,%eax
  lea    D162(%rip),%rsi
  lea    D181(%rip),%r12
  call   <sprintf@plt>
  pxor   %xmm3,%xmm3
  mov    %r14d,%ecx
  mov    %r13,%rdx
  cvtss2sd 0x34(%rsp),%xmm3
  push   %r12
  mov    %rbp,%rsi
  movsd  D140(%rip),%xmm1
  push   $0x280
  mov    0x28(%rsp),%r8
  mov    %r15,%rdi
  mov    $0x4,%eax
  movsd  0x18(%rsp),%xmm2
  movsd  D471(%rip),%xmm0
  mov    $0x400,%r9d
  movsd  %xmm3,0x20(%rsp)
  call   <gnuplot_light_curve_distribution@plt>
  push   %r12
  mov    $0x400,%r9d
  mov    %rbx,%r8
  mov    D140(%rip),%rax
  mov    %r14d,%ecx
  mov    %r13,%rdx
  mov    %rbp,%rsi
  push   $0x280
  movsd  0x30(%rsp),%xmm3
  mov    %r15,%rdi
  movq   %rax,%xmm1
  mov    D471(%rip),%rax
  movsd  0x28(%rsp),%xmm2
  movq   %rax,%xmm0
  mov    $0x4,%eax
  call   <gnuplot_light_curve@plt>
  add    $0x20,%rsp
  xor    %eax,%eax
  call   <gnuplot_tidy@plt>
  xor    %eax,%eax
  jmp    L385
L537:
  call   <show_help@plt>
  mov    $0x1,%eax
  jmp    L385
L1014:
  lea    D480(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L385
L152:
  pxor   %xmm0,%xmm0
  sub    $0x20,%rsp
  pxor   %xmm1,%xmm1
  mov    %r14d,%edx
  pxor   %xmm7,%xmm7
  pxor   %xmm6,%xmm6
  pxor   %xmm4,%xmm4
  mov    %r13,%rsi
  movss  0x4c(%rsp),%xmm2
  pxor   %xmm3,%xmm3
  mov    %rbp,%rdi
  mov    $0x8,%eax
  cvtss2sd 0x48(%rsp),%xmm0
  cvtss2sd 0x6c(%rsp),%xmm1
  movsd  %xmm1,0x10(%rsp)
  pxor   %xmm1,%xmm1
  cvtss2sd 0x58(%rsp),%xmm1
  movsd  D39(%rip),%xmm5
  movsd  %xmm1,0x8(%rsp)
  pxor   %xmm1,%xmm1
  cvtss2sd 0x68(%rsp),%xmm1
  movsd  %xmm1,(%rsp)
  pxor   %xmm1,%xmm1
  cvtss2sd 0x60(%rsp),%xmm4
  divss  D145(%rip),%xmm2
  cvtss2sd 0x50(%rsp),%xmm7
  cvtss2sd %xmm2,%xmm2
  cvtss2sd 0x64(%rsp),%xmm6
  cvtss2sd 0x5c(%rsp),%xmm3
  cvtss2sd 0x38(%rsp),%xmm1
  call   <detect_orbital_period@plt>
  pxor   %xmm4,%xmm4
  cvtsi2ss %eax,%xmm4
  pxor   %xmm0,%xmm0
  movss  %xmm4,0x30(%rsp)
  add    $0x20,%rsp
  ucomiss %xmm0,%xmm4
  jp     L1184
  je     L944
L1184:
  pxor   %xmm2,%xmm2
  lea    D89(%rip),%rdi
  mov    $0x1,%eax
  cvtss2sd 0x10(%rsp),%xmm2
  movapd %xmm2,%xmm0
  movsd  %xmm2,0x8(%rsp)
  call   <printf@plt>
  movsd  0x8(%rsp),%xmm2
  jmp    L170
L944:
  lea    D239(%rip),%rdi
  call   <puts@plt>
  mov    $0xfffffffb,%eax
  jmp    L385
L755:
  lea    D3(%rip),%rdi
  call   <puts@plt>
  mov    $0x2,%eax
  jmp    L385
L624:
  cvtss2sd %xmm2,%xmm2
  jmp    L170
L908:
  lea    D27(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D175(%rip),%rdi
  call   <puts@plt>
  mov    $0xfffffffd,%eax
  jmp    L385
L311:
  lea    D483(%rip),%rdi
  call   <puts@plt>
  mov    $0xfffffffe,%eax
  jmp    L385
L865:
  lea    D54(%rip),%rdi
  call   <puts@plt>
  or     $0xffffffff,%eax
  jmp    L385
L815:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D212
type: byte[4]
name: parse_data
arguments: tag: D301
type: byte[4]
name: parse_data
arguments: tag: D90
type: byte[4]
name: parse_data
arguments: tag: D76
type: byte[4]
name: parse_data
arguments: tag: D387
type: string
name: parse_data
arguments: tag: D15
type: byte[4]
name: parse_data
arguments: tag: D127
type: byte[4]
name: parse_data
arguments: tag: D414
type: byte[4]
name: parse_data
arguments: tag: D354
type: byte[4]
name: parse_data
arguments: tag: D407
type: f32
name: parse_data
arguments: tag: D240
type: string
name: parse_data
arguments: tag: D233
type: string
name: parse_data
arguments: tag: D322
type: string
name: parse_data
arguments: tag: D368
type: string
name: parse_data
arguments: tag: D124
type: string
name: parse_data
arguments: tag: D320
type: string
name: parse_data
arguments: tag: D143
type: string
name: parse_data
arguments: tag: D13
type: string
name: parse_data
arguments: tag: D33
type: string
name: parse_data
arguments: tag: D367
type: string
name: parse_data
arguments: tag: D101
type: string
name: parse_data
arguments: tag: D370
type: string
name: parse_data
arguments: tag: D371
type: string
name: parse_data
arguments: tag: D385
type: string
name: parse_data
arguments: tag: D51
type: string
name: parse_data
arguments: tag: D391
type: string
name: parse_data
arguments: tag: D208
type: string
name: parse_data
arguments: tag: D48
type: string
name: parse_data
arguments: tag: D302
type: f32[2]
name: parse_data
arguments: tag: D413
type: string
name: parse_data
arguments: tag: D428
type: string
name: parse_data
arguments: tag: D62
type: string
name: parse_data
arguments: tag: D184
type: string
name: parse_data
arguments: tag: D162
type: string
name: parse_data
arguments: tag: D181
type: string
name: parse_data
arguments: tag: D140
type: f64
name: parse_data
arguments: tag: D471
type: f64
name: parse_data
arguments: tag: D480
type: string
name: parse_data
arguments: tag: D39
type: f32[2]
name: parse_data
arguments: tag: D145
type: byte[4]
name: parse_data
arguments: tag: D89
type: string
name: parse_data
arguments: tag: D239
type: string
name: parse_data
arguments: tag: D3
type: string
name: parse_data
arguments: tag: D27
type: string
name: parse_data
arguments: tag: D175
type: string
name: parse_data
arguments: tag: D483
type: string
name: parse_data
arguments: tag: D54
type: string

tool: {"D212": [0xcd,0xcc,0x4c,0x3e]}

tool: {"D301": [0x9a,0x99,0x19,0x3f]}

tool: {"D90": [0x00,0x00,0x00,0x40]}

tool: {"D76": [0x00,0x00,0x20,0x41]}

tool: D387: --vscale

tool: {"D15": [0x00,0x00,0x70,0x41]}

tool: {"D127": [0x1b,0x2f,0x5d,0x3f]}

tool: {"D414": [0x9a,0x99,0x99,0x3e]}

tool: {"D354": [0x6f,0x12,0x03,0x3c]}

tool: D407: 1

tool: D240: --maxvac

tool: D233: --mindd

tool: D322: --maxd

tool: D368: --maxint

tool: D124: --peak

tool: D320: --dip

tool: D143: wasp

tool: D13: WASP

tool: D33: --help

tool: D367: --version

tool: D101: --filename

tool: D370: --diprad

tool: D371: --type

tool: D385: --min

tool: D51: --minsamples

tool: D391: --incr

tool: D208: --max

tool: D48: --period

tool: {"D302": [0.0,1.875]}

tool: D413: Version %.2f


tool: D428: %d values loaded


tool: D62: %s.png

tool: D184: %s_distr.png

tool: D162: SuperWASP Light Curve for %s

tool: D181: TAMUZ corrected processed flux (micro Vega)

tool: D140: 0.93

tool: D471: 0.44

tool: D480: Number of data samples too small: %d


tool: {"D39": [0.0,2.0]}

tool: {"D145": [0x00,0xc0,0xa8,0x47]}

tool: D89: orbital_period_days %.6f


tool: D239: No transits detected

tool: D3: No sections detected in the time series

tool: D27: Maximum orbital period must be greater 

tool: D175: than the minimum orbital period

tool: D483: No maximum orbital period specified

tool: D54: No log file specified

assistant: ```c
int main(int argc, char *argv[]) {
  int i, series_length;
  float timestamp[100000];
  float series[100000];
  int endpoints[100000];
  int no_of_sections;
  char log_filename[256];
  char name[256], title[256];
  float orbital_period_days;
  int minimum_data_samples = 1000;
  float minimum_period_days = 0;
  float maximum_period_days = 0;
  float known_period_days = 0;
  char light_curve_filename[256];
  char light_curve_distribution_filename[256];
  int table_type = 0;
  int time_field_index = 0, flux_field_index = 3;
  float vertical_scale = 1.0f;
  float search_increment_seconds = 0.864f;
  float max_vacancy_density = 0.008f;
  float min_dipped_density = 0.3f;
  float max_dipped_percent = 15.0f;
  float min_intermediate_percent = 2.0f;
  float max_intermediate_percent = 10.0f;
  float expected_dip_radius_percent = 2.0f;
  float peak_threshold = 0.6f;
  float dip_threshold = 0.2f;
  if (argc <= 1) {
    show_help();
    return 1;
  }
  log_filename[0] = 0;
  for (i = 1; i < argc; i++) {
    if ((strcmp(argv[i], "-f") == 0) || (strcmp(argv[i], "--filename") == 0)) {
      i++;
      if (i < argc) {
        sprintf(log_filename, "%s", argv[i]);
      }
    }
    if ((strcmp(argv[i], "-m") == 0) || (strcmp(argv[i], "--minsamples") == 0)) {
      i++;
      if (i < argc) {
        minimum_data_samples = atoi(argv[i]);
      }
    }
    if (strcmp(argv[i], "--vscale") == 0) {
      i++;
      if (i < argc) {
        vertical_scale = atof(argv[i]);
      }
    }
    if ((strcmp(argv[i], "-0") == 0) || (strcmp(argv[i], "--min") == 0)) {
      i++;
      if (i < argc) {
        minimum_period_days = atof(argv[i]);
      }
    }
    if ((strcmp(argv[i], "-1") == 0) || (strcmp(argv[i], "--max") == 0)) {
      i++;
      if (i < argc) {
        maximum_period_days = atof(argv[i]);
      }
    }
    if ((strcmp(argv[i], "-i") == 0) || (strcmp(argv[i], "--incr") == 0)) {
      i++;
      if (i < argc) {
        search_increment_seconds = atof(argv[i]);
      }
    }
    if ((strcmp(argv[i], "-p") == 0) || (strcmp(argv[i], "--period") == 0)) {
      i++;
      if (i < argc) {
        known_period_days = atof(argv[i]);
      }
    }
    if (strcmp(argv[i], "--maxvac") == 0) {
      i++;
      if (i < argc) {
        max_vacancy_density = atof(argv[i]);
      }
    }
    if (strcmp(argv[i], "--mindd") == 0) {
      i++;
      if (i < argc) {
        min_dipped_density = atof(argv[i]);
      }
    }
    if (strcmp(argv[i], "--maxd") == 0) {
      i++;
      if (i < argc) {
        max_dipped_percent = atof(argv[i]);
      }
    }
    if ((strcmp(argv[i], "-r") == 0) || (strcmp(argv[i], "--diprad") == 0)) {
      i++;
      if (i < argc) {
        expected_dip_radius_percent = atof(argv[i]);
      }
    }
    if (strcmp(argv[i], "--maxint") == 0) {
      i++;
      if (i < argc) {
        max_intermediate_percent = atof(argv[i]);
      }
    }
    if (strcmp(argv[i], "--peak") == 0) {
      i++;
      if (i < argc) {
        peak_threshold = atof(argv[i]);
      }
    }
    if (strcmp(argv[i], "--dip") == 0) {
      i++;
      if (i < argc) {
        dip_threshold = atof(argv[i]);
      }
    }
    if ((strcmp(argv[i], "-t") == 0) || (strcmp(argv[i], "--type") == 0)) {
      i++;
      if (i < argc) {
        if ((strcmp(argv[i], "wasp") == 0) || (strcmp(argv[i], "WASP") == 0)) {
          table_type = 0;
        }
        if ((strcmp(argv[i], "k2") == 0) || (strcmp(argv[i], "K2") == 0)) {
          table_type = 1;
        }
      }
    }
    if ((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "--help") == 0)) {
      show_help();
      return 0;
    }
    if ((strcmp(argv[i], "-v") == 0) || (strcmp(argv[i], "--version") == 0)) {
      printf("Version %.2f\n", 1.00);
      return 0;
    }
  }
  if (log_filename[0] == 0) {
    printf("No log file specified\n");
    return -1;
  }
  if (known_period_days == 0) {
    if (maximum_period_days == 0) {
      printf("No maximum orbital period specified\n");
      return -2;
    }
    if (maximum_period_days <= minimum_period_days) {
      printf("Maximum orbital period must be greater ");
      printf("than the minimum orbital period\n");
      return -3;
    }
  }
  scan_name(log_filename, name);
  switch (table_type) {
  case 0: {
    time_field_index = 0;
    flux_field_index = 3;
    break;
  }
  case 1: {
    time_field_index = 0;
    flux_field_index = 2;
    break;
  }
  }
  series_length = logfile_load(log_filename, timestamp, series, 100000, time_field_index, flux_field_index);
  if (series_length < minimum_data_samples) {
    printf("Number of data samples too small: %d\n", series_length);
    return 1;
  }
  printf("%d values loaded\n", series_length);
  no_of_sections = detect_endpoints(timestamp, series_length, endpoints);
  if (no_of_sections == 0) {
    printf("No sections detected in the time series\n");
    return 2;
  }
  if (known_period_days == 0) {
    orbital_period_days = detect_orbital_period(timestamp, series, series_length, minimum_period_days, maximum_period_days, search_increment_seconds / (60.0f * 60.0f * 24.0f), min_dipped_density, max_dipped_percent, min_intermediate_percent, max_intermediate_percent, expected_dip_radius_percent, peak_threshold, max_vacancy_density, dip_threshold);
    if (orbital_period_days == 0) {
      printf("No transits detected\n");
      return -5;
    }
    printf("orbital_period_days %.6f\n", orbital_period_days);
  } else {
    orbital_period_days = known_period_days;
  }
  sprintf(light_curve_filename, "%s.png", name);
  sprintf(light_curve_distribution_filename, "%s_distr.png", name);
  sprintf(title, "SuperWASP Light Curve for %s", name);
  gnuplot_light_curve_distribution(title, timestamp, series, series_length, light_curve_distribution_filename, 1024, 640, 0.44, 0.93, "TAMUZ corrected processed flux (micro Vega)", orbital_period_days, vertical_scale);
  gnuplot_light_curve(title, timestamp, series, series_length, light_curve_filename, 1024, 640, 0.44, 0.93, "TAMUZ corrected processed flux (micro Vega)", orbital_period_days, vertical_scale);
  gnuplot_tidy();
  return 0;
}
```