// File: /workspace/github_c_makefile_star2_O1/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), %r14
movq 0x60(%rdi), %rax
movq %rax, 0x30(%rsp)
cmpq %rdi, 0xd306(%rip)      # 0x12900
je 0x5628
movq 0x68(%rdi), %rax
testq %rax, %rax
je 0x5793
leaq 0x6846(%rip), %rcx      # 0xbe56
cmpq %rcx, 0x8(%rax)
jne 0x5793
movq %rax, 0xd2e7(%rip)      # 0x12908
movq %rdi, 0xd2d8(%rip)      # 0x12900
movq 0xd2d9(%rip), %rax      # 0x12908
cmpl $0x0, 0x20(%rax)
jne 0x5778
movq 0x10(%rax), %r13
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x28(%rdi), %rax
leaq (%r14,%rax), %rdi
addq $0x4, %rdi
leaq 0x61f4(%rip), %rsi      # 0xb84d
callq 0x2b85
testq %rax, %rax
je 0x5798
movq %rax, %rcx
incq %rcx
movq %rcx, 0x18(%rsp)
movb $0x4, (%rax)
testl %r14d, %r14d
jle 0x5750
movq %rax, 0x20(%rsp)
xorl %r15d, %r15d
leaq 0x6905(%rip), %rbx      # 0xbf92
xorl %ebp, %ebp
movq %r14, 0x28(%rsp)
leaq (%r15,%r15,4), %rax
movq 0x30(%rsp), %rcx
movslq 0x4(%rcx,%rax,8), %r12
movq %r13, %r14
movq (%r13,%r15,8), %r13
movq 0x8(%rsp), %rdi
callq 0x1080
cmpq %r13, %rax
je 0x56c8
movq 0x8(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x1230
leal 0x3(%r12), %eax
sarl $0x2, %eax
testl %eax, %eax
movq 0x18(%rsp), %r13
jle 0x56fa
movq %r13, %rdi
addq %rbp, %rdi
movl %eax, %esi
movl $0x1, %edx
movq 0x8(%rsp), %rcx
callq 0x10b0
cmpq $0x1, %rax
jne 0x5789
addq %rbp, %r13
movl %r12d, %edi
movq %r13, %rsi
callq 0x3400
cmpl $0x0, 0x14(%rsp)
je 0x5730
movb (%r13), %al
cmpb $0x4, %al
je 0x572b
movsbq %al, %rax
movb (%rax,%rbx), %al
movb %al, (%r13)
movb 0x1(%r13), %al
incq %r13
jmp 0x5713
movb $0x0, (%r13)
movq %r14, %r13
movq %rbp, (%r14,%r15,8)
addq %r12, %rbp
incq %rbp
incq %r15
movq 0x28(%rsp), %r14
cmpq %r14, %r15
jne 0x5694
jmp 0x5752
xorl %ebp, %ebp
movq %rbp, (%r13,%r14,8)
movq 0x8(%rsp), %rdi
callq 0x10c0
movq 0xd1a0(%rip), %rax      # 0x12908
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 0x20(%rsp), %rdi
callq 0x17e1
callq 0x17b9
movl $0x1, %edi
callq 0x1270