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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x378,%rsp
  mov    %edi,-0x1a4(%rbp)
  mov    %rsi,-0x1b0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,-0x398(%rbp)
  movl   $0x3e8,-0x17c(%rbp)
  mov    -0x17c(%rbp),%edx
  movslq %edx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x158(%rbp)
  movslq %edx,%rax
  mov    %rax,%rcx
  mov    $0x0,%ebx
  movslq %edx,%rax
  mov    %rax,%r8
  mov    $0x0,%r9d
  movslq %edx,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L351:
  cmp    %rcx,%rsp
  je     L586
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L351
L586:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L141
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L141:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x150(%rbp)
  mov    -0x1b0(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rdx
  mov    -0x150(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x17c(%rbp),%edx
  movslq %edx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x148(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x1c0(%rbp)
  movq   $0x0,-0x1b8(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x230(%rbp)
  movq   $0x0,-0x228(%rbp)
  movslq %edx,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L324:
  cmp    %rcx,%rsp
  je     L475
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L324
L475:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L234
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L234:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x140(%rbp)
  mov    -0x1b0(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rdx
  mov    -0x140(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x17c(%rbp),%edx
  movslq %edx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x138(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x240(%rbp)
  movq   $0x0,-0x238(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x250(%rbp)
  movq   $0x0,-0x248(%rbp)
  movslq %edx,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L210:
  cmp    %rcx,%rsp
  je     L363
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L210
L363:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L315
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L315:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x130(%rbp)
  mov    -0x1b0(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rdx
  mov    -0x130(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x17c(%rbp),%edx
  movslq %edx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x128(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x260(%rbp)
  movq   $0x0,-0x258(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x270(%rbp)
  movq   $0x0,-0x268(%rbp)
  movslq %edx,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L87:
  cmp    %rcx,%rsp
  je     L95
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L87
L95:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L714
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L714:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x120(%rbp)
  mov    -0x1b0(%rbp),%rax
  add    $0x20,%rax
  mov    (%rax),%rdx
  mov    -0x120(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x17c(%rbp),%edx
  movslq %edx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x118(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x280(%rbp)
  movq   $0x0,-0x278(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x290(%rbp)
  movq   $0x0,-0x288(%rbp)
  movslq %edx,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L571:
  cmp    %rcx,%rsp
  je     L530
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L571
L530:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L585
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L585:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x110(%rbp)
  mov    -0x130(%rbp),%rdx
  mov    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x110(%rbp),%rdx
  lea    D276(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x110(%rbp),%rdx
  lea    D163(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <fopen@plt>
  mov    %rax,-0x108(%rbp)
  mov    -0x17c(%rbp),%edx
  movslq %edx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x100(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x2a0(%rbp)
  movq   $0x0,-0x298(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x2b0(%rbp)
  movq   $0x0,-0x2a8(%rbp)
  movslq %edx,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L175:
  cmp    %rcx,%rsp
  je     L345
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L175
L345:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L122
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L122:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0xf8(%rbp)
  mov    -0x130(%rbp),%rdx
  mov    -0xf8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0xf8(%rbp),%rdx
  lea    D17(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x140(%rbp),%rdx
  mov    -0xf8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0xf8(%rbp),%rdx
  lea    D172(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x150(%rbp),%rdx
  mov    -0xf8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0xf8(%rbp),%rdx
  lea    D221(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x140(%rbp),%rdx
  mov    -0xf8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0xf8(%rbp),%rdx
  lea    D172(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x150(%rbp),%rdx
  mov    -0xf8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0xf8(%rbp),%rdx
  lea    D14(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x120(%rbp),%rdx
  mov    -0xf8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0xf8(%rbp),%rdx
  lea    D198(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0xf8(%rbp),%rdx
  lea    D34(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <fopen@plt>
  mov    %rax,-0xf0(%rbp)
  mov    -0xf0(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x2a,%edx
  mov    $0x1,%esi
  lea    D278(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x17c(%rbp),%edx
  movslq %edx,%rax
  sub    $0x1,%rax
  mov    %rax,-0xe8(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x2c0(%rbp)
  movq   $0x0,-0x2b8(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x2d0(%rbp)
  movq   $0x0,-0x2c8(%rbp)
  movslq %edx,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L495:
  cmp    %rcx,%rsp
  je     L507
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L495
L507:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L348
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L348:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0xe0(%rbp)
  mov    -0x130(%rbp),%rdx
  mov    -0xe0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0xe0(%rbp),%rdx
  lea    D77(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x150(%rbp),%rdx
  mov    -0xe0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0xe0(%rbp),%rdx
  lea    D72(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x150(%rbp),%rdx
  mov    -0xe0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0xe0(%rbp),%rdx
  lea    D154(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x17c(%rbp),%ebx
  movslq %ebx,%rax
  sub    $0x1,%rax
  mov    %rax,-0xd8(%rbp)
  movslq %ebx,%rax
  mov    %rax,-0x2e0(%rbp)
  movq   $0x0,-0x2d8(%rbp)
  movslq %ebx,%rax
  mov    %rax,-0x2f0(%rbp)
  movq   $0x0,-0x2e8(%rbp)
  movslq %ebx,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L52:
  cmp    %rcx,%rsp
  je     L233
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L52
L233:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L309
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L309:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0xd0(%rbp)
  movl   $0x0,-0x198(%rbp)
  mov    -0xe0(%rbp),%rdx
  lea    D5(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <fopen@plt>
  mov    %rax,-0xc8(%rbp)
  cmpq   $0x0,-0xc8(%rbp)
  je     L245
  jmp    L668
L661:
  addl   $0x1,-0x198(%rbp)
L668:
  mov    -0xc8(%rbp),%rax
  mov    -0xd0(%rbp),%rcx
  mov    %rax,%rdx
  mov    %ebx,%esi
  mov    %rcx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L661
  mov    -0xc8(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  jmp    L698
L245:
  mov    -0xe0(%rbp),%rax
  mov    %rax,%rdi
  call   <perror@plt>
L698:
  mov    -0x17c(%rbp),%esi
  mov    -0x198(%rbp),%edi
  movslq %esi,%rax
  sub    $0x1,%rax
  mov    %rax,-0xc0(%rbp)
  movslq %esi,%rax
  mov    %rax,-0x300(%rbp)
  movq   $0x0,-0x2f8(%rbp)
  movslq %esi,%rax
  mov    %rax,-0x1c0(%rbp)
  movslq %edi,%rax
  sub    $0x1,%rax
  mov    %rax,-0xb8(%rbp)
  movslq %esi,%rax
  mov    %rax,%r14
  mov    $0x0,%r15d
  movslq %edi,%rax
  mov    %rax,%r12
  mov    $0x0,%r13d
  mov    %r15,%rdx
  imul   %r12,%rdx
  mov    %r13,%rax
  imul   %r14,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    %r14,%rax
  mul    %r12
  add    %rdx,%rcx
  mov    %rcx,%rdx
  movslq %esi,%rax
  mov    %rax,-0x1d0(%rbp)
  movq   $0x0,-0x1c8(%rbp)
  movslq %edi,%rax
  mov    %rax,-0x1e0(%rbp)
  movq   $0x0,-0x1d8(%rbp)
  mov    -0x1d0(%rbp),%r11
  mov    -0x1c8(%rbp),%r12
  mov    %r12,%rdx
  mov    -0x1e0(%rbp),%r9
  mov    -0x1d8(%rbp),%r10
  imul   %r9,%rdx
  mov    %r10,%rax
  imul   %r11,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    %r11,%rax
  mul    %r9
  add    %rdx,%rcx
  mov    %rcx,%rdx
  movslq %esi,%rdx
  movslq %edi,%rax
  imul   %rax,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L572:
  cmp    %rcx,%rsp
  je     L36
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L572
L36:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L601
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L601:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0xb0(%rbp)
  mov    -0x17c(%rbp),%esi
  mov    -0x198(%rbp),%edi
  movslq %esi,%rax
  sub    $0x1,%rax
  mov    %rax,-0xa8(%rbp)
  movslq %esi,%rax
  mov    %rax,-0x310(%rbp)
  movq   $0x0,-0x308(%rbp)
  movslq %esi,%r12
  movslq %edi,%rax
  sub    $0x1,%rax
  mov    %rax,-0xa0(%rbp)
  movslq %esi,%rax
  mov    %rax,-0x1f0(%rbp)
  movq   $0x0,-0x1e8(%rbp)
  movslq %edi,%rax
  mov    %rax,-0x200(%rbp)
  movq   $0x0,-0x1f8(%rbp)
  mov    -0x1f0(%rbp),%r10
  mov    -0x1e8(%rbp),%r11
  mov    %r11,%rdx
  mov    -0x200(%rbp),%r8
  mov    -0x1f8(%rbp),%r9
  imul   %r8,%rdx
  mov    %r9,%rax
  imul   %r10,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    %r10,%rax
  mul    %r8
  add    %rdx,%rcx
  mov    %rcx,%rdx
  movslq %esi,%rax
  mov    %rax,-0x210(%rbp)
  movq   $0x0,-0x208(%rbp)
  movslq %edi,%rax
  mov    %rax,-0x220(%rbp)
  movq   $0x0,-0x218(%rbp)
  mov    -0x210(%rbp),%r8
  mov    -0x208(%rbp),%r9
  mov    %r9,%rdx
  mov    -0x220(%rbp),%r14
  mov    -0x218(%rbp),%r15
  imul   %r14,%rdx
  mov    %r15,%rax
  imul   %r8,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    %r8,%rax
  mul    %r14
  add    %rdx,%rcx
  mov    %rcx,%rdx
  movslq %esi,%rdx
  movslq %edi,%rax
  imul   %rax,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L547:
  cmp    %rcx,%rsp
  je     L427
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L547
L427:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L102
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L102:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x98(%rbp)
  movl   $0x0,-0x198(%rbp)
  mov    -0xe0(%rbp),%rdx
  lea    D5(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <fopen@plt>
  mov    %rax,-0x90(%rbp)
  cmpq   $0x0,-0x90(%rbp)
  je     L742
  jmp    L727
L77:
  mov    -0xd0(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x178(%rbp)
  mov    -0x178(%rbp),%eax
  sub    $0x1,%eax
  mov    -0xd0(%rbp),%rdx
  cltq
  movzbl (%rdx,%rax,1),%eax
  cmp    $0xa,%al
  jne    L519
  mov    -0x178(%rbp),%eax
  sub    $0x1,%eax
  mov    -0xd0(%rbp),%rdx
  cltq
  movb   $0x0,(%rdx,%rax,1)
L519:
  mov    -0x198(%rbp),%eax
  cltq
  imul   -0x1c0(%rbp),%rax
  mov    %rax,%rdx
  mov    -0xb0(%rbp),%rax
  add    %rax,%rdx
  mov    -0xd0(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcpy@plt>
  mov    -0x198(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  mov    -0x130(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcpy@plt>
  mov    -0x198(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  lea    D17(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x198(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  mov    -0x140(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x198(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  lea    D172(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x198(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  mov    -0x150(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x198(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  lea    D221(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x198(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  mov    -0x140(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x198(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  lea    D51(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x198(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  mov    -0x120(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x198(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  lea    D172(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x198(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  mov    -0xd0(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  mov    -0x198(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rax,%rdx
  lea    D273(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcat@plt>
  addl   $0x1,-0x198(%rbp)
L727:
  mov    -0x90(%rbp),%rax
  mov    -0xd0(%rbp),%rcx
  mov    %rax,%rdx
  mov    %ebx,%esi
  mov    %rcx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L77
  mov    -0x90(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  jmp    L486
L742:
  mov    -0xe0(%rbp),%rax
  mov    %rax,%rdi
  call   <perror@plt>
L486:
  movl   $0xf4240,-0x174(%rbp)
  mov    -0x174(%rbp),%edx
  movslq %edx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x88(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x320(%rbp)
  movq   $0x0,-0x318(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x330(%rbp)
  movq   $0x0,-0x328(%rbp)
  movslq %edx,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L376:
  cmp    %rcx,%rsp
  je     L489
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L376
L489:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L42
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L42:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x80(%rbp)
  mov    -0x174(%rbp),%edx
  movslq %edx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x78(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x340(%rbp)
  movq   $0x0,-0x338(%rbp)
  movslq %edx,%rax
  mov    %rax,-0x350(%rbp)
  movq   $0x0,-0x348(%rbp)
  movslq %edx,%rax
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L453:
  cmp    %rdx,%rsp
  je     L220
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L453
L220:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L262
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L262:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x70(%rbp)
  movl   $0x0,-0x188(%rbp)
  movl   $0x0,-0x194(%rbp)
  jmp    L171
L145:
  mov    -0x194(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  lea    D5(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x68(%rbp)
  cmpq   $0x0,-0x68(%rbp)
  je     L372
  mov    %rsp,%rax
  mov    %rax,%r13
  mov    -0x174(%rbp),%ebx
  movslq %ebx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x60(%rbp)
  movslq %ebx,%rax
  mov    %rax,-0x360(%rbp)
  movq   $0x0,-0x358(%rbp)
  movslq %ebx,%rax
  mov    %rax,-0x370(%rbp)
  movq   $0x0,-0x368(%rbp)
  movslq %ebx,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L413:
  cmp    %rcx,%rsp
  je     L338
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L413
L338:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L385
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L385:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x58(%rbp)
  jmp    L644
L721:
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x3e,%al
  je     L644
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x170(%rbp)
  subl   $0x1,-0x170(%rbp)
  mov    -0x58(%rbp),%rdx
  mov    -0x170(%rbp),%eax
  cltq
  movzbl (%rdx,%rax,1),%eax
  cmp    $0xa,%al
  jne    L98
  mov    -0x58(%rbp),%rdx
  mov    -0x170(%rbp),%eax
  cltq
  movb   $0x0,(%rdx,%rax,1)
L98:
  mov    -0x58(%rbp),%rax
  mov    -0x80(%rbp),%rdx
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcpy@plt>
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
L644:
  mov    -0x68(%rbp),%rax
  mov    -0x58(%rbp),%rcx
  mov    %rax,%rdx
  mov    %ebx,%esi
  mov    %rcx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L721
  mov    %r13,%rsp
  jmp    L690
L372:
  mov    -0x194(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <perror@plt>
L690:
  movl   $0x0,-0x190(%rbp)
  jmp    L522
L142:
  mov    -0x194(%rbp),%eax
  cmp    -0x190(%rbp),%eax
  jle    L747
  mov    -0x190(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  lea    D5(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x50(%rbp)
  cmpq   $0x0,-0x50(%rbp)
  je     L26
  mov    %rsp,%rax
  mov    %rax,%r13
  mov    -0x174(%rbp),%ebx
  movslq %ebx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x48(%rbp)
  movslq %ebx,%rax
  mov    %rax,-0x380(%rbp)
  movq   $0x0,-0x378(%rbp)
  movslq %ebx,%rax
  mov    %rax,-0x390(%rbp)
  movq   $0x0,-0x388(%rbp)
  movslq %ebx,%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rdx
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L478:
  cmp    %rcx,%rsp
  je     L183
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L478
L183:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  mov    %rdx,%rax
  and    $0xfff,%eax
  test   %rax,%rax
  je     L128
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L128:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x40(%rbp)
  jmp    L677
L84:
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x3e,%al
  je     L677
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x16c(%rbp)
  subl   $0x1,-0x16c(%rbp)
  mov    -0x40(%rbp),%rdx
  mov    -0x16c(%rbp),%eax
  cltq
  movzbl (%rdx,%rax,1),%eax
  cmp    $0xa,%al
  jne    L67
  mov    -0x40(%rbp),%rdx
  mov    -0x16c(%rbp),%eax
  cltq
  movb   $0x0,(%rdx,%rax,1)
L67:
  mov    -0x40(%rbp),%rax
  mov    -0x70(%rbp),%rdx
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcpy@plt>
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
L677:
  mov    -0x50(%rbp),%rax
  mov    -0x40(%rbp),%rcx
  mov    %rax,%rdx
  mov    %ebx,%esi
  mov    %rcx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L84
  mov    %r13,%rsp
  jmp    L40
L26:
  mov    -0x190(%rbp),%eax
  cltq
  imul   %r12,%rax
  mov    %rax,%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <perror@plt>
L40:
  mov    -0x80(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x168(%rbp)
  movl   $0x0,-0x184(%rbp)
  movl   $0x0,-0x180(%rbp)
  movl   $0x0,-0x18c(%rbp)
  jmp    L97
L508:
  mov    -0x80(%rbp),%rdx
  mov    -0x18c(%rbp),%eax
  cltq
  movzbl (%rdx,%rax,1),%eax
  cmp    $0x4e,%al
  je     L334
  mov    -0x70(%rbp),%rdx
  mov    -0x18c(%rbp),%eax
  cltq
  movzbl (%rdx,%rax,1),%eax
  cmp    $0x4e,%al
  jne    L339
L334:
  addl   $0x1,-0x180(%rbp)
  jmp    L206
L339:
  mov    -0x80(%rbp),%rdx
  mov    -0x18c(%rbp),%eax
  cltq
  movzbl (%rdx,%rax,1),%ecx
  mov    -0x70(%rbp),%rdx
  mov    -0x18c(%rbp),%eax
  cltq
  movzbl (%rdx,%rax,1),%eax
  cmp    %al,%cl
  je     L206
  addl   $0x1,-0x184(%rbp)
L206:
  addl   $0x1,-0x18c(%rbp)
L97:
  mov    -0x18c(%rbp),%eax
  cmp    -0x168(%rbp),%eax
  jl     L508
  mov    -0x168(%rbp),%eax
  sub    -0x180(%rbp),%eax
  mov    %eax,-0x164(%rbp)
  pxor   %xmm0,%xmm0
  cvtsi2ssl -0x184(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ssl -0x164(%rbp),%xmm1
  divss  %xmm1,%xmm0
  movss  %xmm0,-0x160(%rbp)
  movss  -0x160(%rbp),%xmm1
  movss  D270(%rip),%xmm0
  mulss  %xmm0,%xmm1
  movss  D94(%rip),%xmm0
  subss  %xmm1,%xmm0
  cvttss2si %xmm0,%eax
  mov    %eax,%edi
  call   <log@plt>
  movss  D245(%rip),%xmm1
  mulss  %xmm1,%xmm0
  movss  %xmm0,-0x15c(%rbp)
  pxor   %xmm2,%xmm2
  cvtss2sd -0x15c(%rbp),%xmm2
  movq   %xmm2,%rcx
  mov    -0x190(%rbp),%eax
  cltq
  mov    -0x1c0(%rbp),%rbx
  imul   %rbx,%rax
  mov    %rax,%rdx
  mov    -0xb0(%rbp),%rax
  lea    (%rdx,%rax,1),%rdi
  mov    -0x194(%rbp),%eax
  cltq
  imul   %rbx,%rax
  mov    %rax,%rdx
  mov    -0xb0(%rbp),%rax
  lea    (%rdx,%rax,1),%rsi
  mov    -0x164(%rbp),%edx
  mov    -0x184(%rbp),%eax
  mov    -0xf0(%rbp),%r10
  movq   %rcx,%xmm0
  mov    %edx,%r9d
  mov    %eax,%r8d
  mov    %rdi,%rcx
  mov    %rsi,%rdx
  lea    D33(%rip),%rax
  mov    %rax,%rsi
  mov    %r10,%rdi
  mov    $0x1,%eax
  call   <fprintf@plt>
  addl   $0x1,-0x188(%rbp)
L747:
  addl   $0x1,-0x190(%rbp)
L522:
  mov    -0x190(%rbp),%eax
  cmp    -0x198(%rbp),%eax
  jl     L142
  addl   $0x1,-0x194(%rbp)
L171:
  mov    -0x194(%rbp),%eax
  cmp    -0x198(%rbp),%eax
  jl     L145
  mov    -0x120(%rbp),%rdx
  mov    -0x150(%rbp),%rax
  mov    %rax,%rsi
  lea    D116(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x120(%rbp),%rcx
  mov    -0x150(%rbp),%rdx
  mov    -0x108(%rbp),%rax
  lea    D116(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0x0,%eax
  mov    -0x398(%rbp),%rsp
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L618
  call   <__stack_chk_fail@plt>
L618:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: unpack_data
arguments: label: D276
data_type: string
name: unpack_data
arguments: label: D163
data_type: string
name: unpack_data
arguments: label: D17
data_type: string
name: unpack_data
arguments: label: D172
data_type: string
name: unpack_data
arguments: label: D221
data_type: string
name: unpack_data
arguments: label: D14
data_type: string
name: unpack_data
arguments: label: D198
data_type: string
name: unpack_data
arguments: label: D34
data_type: string
name: unpack_data
arguments: label: D278
data_type: string
name: unpack_data
arguments: label: D77
data_type: string
name: unpack_data
arguments: label: D72
data_type: string
name: unpack_data
arguments: label: D154
data_type: string
name: unpack_data
arguments: label: D5
data_type: string
name: unpack_data
arguments: label: D51
data_type: string
name: unpack_data
arguments: label: D273
data_type: string
name: unpack_data
arguments: label: D270
data_type: byte[4]
name: unpack_data
arguments: label: D94
data_type: byte[4]
name: unpack_data
arguments: label: D245
data_type: byte[4]
name: unpack_data
arguments: label: D33
data_type: string
name: unpack_data
arguments: label: D116
data_type: string

tool: D276: /Analysis/log.txt

tool: D163: a

tool: D17: /Analysis/

tool: D172: /

tool: D221: _

tool: D14: _di_upstream_

tool: D198: .csv

tool: D34: w

tool: D278: Isolate_1,Isolate_2,SNPs,Sites,Divergence


tool: D77: /Analysis/Core_genome_alignment/

tool: D72: _Core_genome_alignment/

tool: D154: _isolates.txt

tool: D5: r

tool: D51: /Intergenic_files_upstream_

tool: D273: .fasta

tool: {"D270": [0xab,0xaa,0xaa,0x3f]}

tool: {"D94": [0x00,0x00,0x80,0x3f]}

tool: {"D245": [0x00,0x00,0x40,0xbf]}

tool: D33: %s,%s,%i,%i,%0.6f


tool: D116: %s di upstream %s calculated.


assistant: ```c
int main(int argc, char *argv[]) {
  int arg_len = 1000;
  char species[arg_len];
  strcpy(species, argv[1]);
  char analysis[arg_len];
  strcpy(analysis, argv[2]);
  char base_dir[arg_len];
  strcpy(base_dir, argv[3]);
  char upstream_len[arg_len];
  strcpy(upstream_len, argv[4]);
  char log_file_name[arg_len];
  strcpy(log_file_name, base_dir);
  strcat(log_file_name, "/Analysis/log.txt");
  FILE *log_file = fopen(log_file_name, "a");
  char output_file_name[arg_len];
  strcpy(output_file_name, base_dir);
  strcat(output_file_name, "/Analysis/");
  strcat(output_file_name, analysis);
  strcat(output_file_name, "/");
  strcat(output_file_name, species);
  strcat(output_file_name, "_");
  strcat(output_file_name, analysis);
  strcat(output_file_name, "/");
  strcat(output_file_name, species);
  strcat(output_file_name, "_di_upstream_");
  strcat(output_file_name, upstream_len);
  strcat(output_file_name, ".csv");
  FILE *output = fopen(output_file_name, "w");
  fprintf(output, "Isolate_1,Isolate_2,SNPs,Sites,Divergence\n");
  char isolates_file_name[arg_len];
  strcpy(isolates_file_name, base_dir);
  strcat(isolates_file_name, "/Analysis/Core_genome_alignment/");
  strcat(isolates_file_name, species);
  strcat(isolates_file_name, "_Core_genome_alignment/");
  strcat(isolates_file_name, species);
  strcat(isolates_file_name, "_isolates.txt");
  char isolate_name[arg_len];
  int isolate_count;
  isolate_count = 0;
  FILE *isolates_file = fopen(isolates_file_name, "r");
  if (isolates_file != NULL) {
    while (fgets(isolate_name, sizeof isolate_name, isolates_file) != NULL) {
      isolate_count++;
    }
    fclose(isolates_file);
  } else {
    perror(isolates_file_name);
  }
  char isolate_name_array[isolate_count][arg_len];
  char isolate_file_name_array[isolate_count][arg_len];
  isolate_count = 0;
  FILE *isolates_file_2 = fopen(isolates_file_name, "r");
  if (isolates_file_2 != NULL) {
    while (fgets(isolate_name, sizeof isolate_name, isolates_file_2) != NULL) {
      int isolate_name_len;
      isolate_name_len = strlen(isolate_name);
      if (isolate_name[(isolate_name_len - 1)] == '\n') {
        isolate_name[(isolate_name_len - 1)] = '\0';
      }
      strcpy(isolate_name_array[isolate_count], isolate_name);
      strcpy(isolate_file_name_array[isolate_count], base_dir);
      strcat(isolate_file_name_array[isolate_count], "/Analysis/");
      strcat(isolate_file_name_array[isolate_count], analysis);
      strcat(isolate_file_name_array[isolate_count], "/");
      strcat(isolate_file_name_array[isolate_count], species);
      strcat(isolate_file_name_array[isolate_count], "_");
      strcat(isolate_file_name_array[isolate_count], analysis);
      strcat(isolate_file_name_array[isolate_count], "/Intergenic_files_upstream_");
      strcat(isolate_file_name_array[isolate_count], upstream_len);
      strcat(isolate_file_name_array[isolate_count], "/");
      strcat(isolate_file_name_array[isolate_count], isolate_name);
      strcat(isolate_file_name_array[isolate_count], ".fasta");
      isolate_count++;
    }
    fclose(isolates_file_2);
  } else {
    perror(isolates_file_name);
  }
  int a;
  int b;
  int i;
  int genome_max = 1000000;
  char genome1[genome_max];
  char genome2[genome_max];
  int count;
  count = 0;
  for (a = 0; a < isolate_count; a++) {
    FILE *file1 = fopen(isolate_file_name_array[a], "r");
    if (file1 != NULL) {
      char line1[genome_max];
      while (fgets(line1, sizeof line1, file1) != NULL) {
        if (line1[0] != '>') {
          int line1_len = strlen(line1);
          line1_len = (line1_len - 1);
          if (line1[line1_len] == '\n') {
            line1[line1_len] = '\0';
          }
          strcpy(genome1, line1);
          fclose(file1);
        }
      }
    } else {
      perror(isolate_file_name_array[a]);
    }
    for (b = 0; b < isolate_count; b++) {
      if (a > b) {
        FILE *file2 = fopen(isolate_file_name_array[b], "r");
        if (file2 != NULL) {
          char line2[genome_max];
          while (fgets(line2, sizeof line2, file2) != NULL) {
            if (line2[0] != '>') {
              int line2_len = strlen(line2);
              line2_len = (line2_len - 1);
              if (line2[line2_len] == '\n') {
                line2[line2_len] = '\0';
              }
              strcpy(genome2, line2);
              fclose(file2);
            }
          }
        } else {
          perror(isolate_file_name_array[b]);
        }
        int genome_len;
        genome_len = strlen(genome1);
        int snp;
        snp = 0;
        int n;
        n = 0;
        for (i = 0; i < genome_len; i++) {
          if (genome1[i] == 'N' || genome2[i] == 'N') {
            n++;
          } else {
            if (genome1[i] != genome2[i]) {
              snp++;
            }
          }
        }
        int sites;
        sites = (genome_len - n);
        float div;
        div = ((float)snp / sites);
        float JC_div;
        JC_div = (((float)-3 / 4) * (log(1 - (((float)4 / 3) * div))));
        fprintf(output, "%s,%s,%i,%i,%0.6f\n", isolate_name_array[a], isolate_name_array[b], snp, sites, JC_div);
        count++;
      }
    }
  }
  printf("%s di upstream %s calculated.\n", species, upstream_len);
  fprintf(log_file, "%s di upstream %s calculated.\n", species, upstream_len);
  return 0;
}
```