// File: /workspace/github_c_makefile_star2_O2/thegenemyers[P]DASCRUBBER/DB.c
// Function: Load_All_Arrows
int Load_All_Arrows(DAZZ_DB *db, int ascii)
{ int        nreads = db->nreads;
  DAZZ_READ *reads = db->reads;
  FILE      *afile;
  int64     *aoff;

  char  *seq;
  int64  o, off;
  int    i, len, clen;

  if (db != Arrow_DB)
    { if (db->tracks == NULL || db->tracks->name != atrack_name)
        { EPRINTF(EPLACE,"%s: Arrow data is not available (Load_All_Arrows)\n",Prog_Name);
          EXIT(1);
        }
      Arrow_Ptr = (DAZZ_ARROW *) db->tracks;
      Arrow_DB  = db;
    }

  if (Arrow_Ptr->loaded)
    return (0);

  afile = (FILE *) Arrow_Ptr->arrow;
  aoff  = Arrow_Ptr->aoff;

  seq = (char *) Malloc(db->totlen+nreads+4,"Allocating All Arrows");
  if (seq == NULL)
    EXIT(1);

  *seq++ = 4;
  o = 0;
  for (i = 0; i < nreads; i++)
    { len = reads[i].rlen;
      off = aoff[i];
      if (ftello(afile) != off)
        fseeko(afile,off,SEEK_SET);
      clen = COMPRESSED_LEN(len);
      if (clen > 0)
        { if (fread(seq+o,clen,1,afile) != 1)
            { EPRINTF(EPLACE,"%s: Read of .bps file failed (Load_All_Sequences)\n",Prog_Name);
              free(seq-1);
              EXIT(1);
            }
        }
      Uncompress_Read(len,seq+o);
      if (ascii)
        Letter_Arrow(seq+o);
      aoff[i] = o;
      o += (len+1);
    }
  aoff[nreads] = o;

  fclose(afile);

  Arrow_Ptr->arrow  = (void *) seq;
  Arrow_Ptr->loaded = 1;

  return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, 0x14(%rsp)
movslq 0x30(%rdi), %r12
movq 0x60(%rdi), %r14
cmpq %rdi, 0xc4d8(%rip)      # 0x10900
je 0x4458
movq 0x68(%rdi), %rax
testq %rax, %rax
je 0x45c9
leaq 0x5a18(%rip), %rcx      # 0x9e56
cmpq %rcx, 0x8(%rax)
jne 0x45c9
movq %rax, 0xc4b9(%rip)      # 0x10908
movq %rdi, 0xc4aa(%rip)      # 0x10900
jmp 0x445f
movq 0xc4a9(%rip), %rax      # 0x10908
cmpl $0x0, 0x20(%rax)
jne 0x4587
movq 0x10(%rax), %rbp
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x28(%rdi), %rax
leaq (%r12,%rax), %rdi
addq $0x4, %rdi
leaq 0x53c4(%rip), %rsi      # 0x984d
callq 0x1bad
testq %rax, %rax
je 0x45c1
movq %rax, %rcx
incq %rcx
movq %rcx, 0x18(%rsp)
xorl %ebx, %ebx
testl %r12d, %r12d
movl $0x0, %edx
movq %r12, 0x28(%rsp)
cmovgl %r12d, %edx
movq %rdx, 0x30(%rsp)
movq %rax, 0x20(%rsp)
movb $0x4, (%rax)
addq $0x4, %r14
xorl %r12d, %r12d
cmpq %rbx, 0x30(%rsp)
je 0x455c
movslq (%r14), %r13
movq %rbp, %r15
movq (%rbp,%rbx,8), %rbp
movq 0x8(%rsp), %rdi
callq 0x1080
cmpq %rbp, %rax
je 0x44fd
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x1230
leal 0x3(%r13), %eax
sarl $0x2, %eax
testl %eax, %eax
movq 0x18(%rsp), %rbp
jle 0x4526
leaq (%r12,%rbp), %rdi
movl %eax, %esi
pushq $0x1
popq %rdx
movq 0x8(%rsp), %rcx
callq 0x10b0
cmpq $0x1, %rax
jne 0x4598
addq %r12, %rbp
movl %r13d, %edi
movq %rbp, %rsi
callq 0x2337
cmpl $0x0, 0x14(%rsp)
je 0x4543
movq %rbp, %rdi
callq 0x23d3
movq %r15, %rbp
movq %r12, (%r15,%rbx,8)
addq %r13, %r12
incq %r12
incq %rbx
addq $0x28, %r14
jmp 0x44c9
movq 0x28(%rsp), %rax
movq %r12, (%rbp,%rax,8)
movq 0x8(%rsp), %rdi
callq 0x10c0
movq 0xc391(%rip), %rax      # 0x10908
movq 0x18(%rsp), %rcx
movq %rcx, 0x18(%rax)
movl $0x1, 0x20(%rax)
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x9a59(%rip), %rax      # 0xdff8
movq (%rax), %rdi
movq 0xc33f(%rip), %rdx      # 0x108e8
leaq 0x510f(%rip), %rsi      # 0x96bf
xorl %eax, %eax
callq 0x11a0
movq 0x20(%rsp), %rdi
callq 0x1030
pushq $0x1
popq %rdi
callq 0x1270
movq 0x9a28(%rip), %rax      # 0xdff8
movq (%rax), %rdi
movq 0xc30e(%rip), %rdx      # 0x108e8
leaq 0x5239(%rip), %rsi      # 0x981a
xorl %eax, %eax
callq 0x11a0
jmp 0x45c1