// File: /workspace/github_c_makefile_star2_O3/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, 0xd2c8(%rip)      # 0x12900
je 0x5668
movq 0x68(%rdi), %rax
testq %rax, %rax
je 0x57d3
leaq 0x6868(%rip), %rcx      # 0xbeb6
cmpq %rcx, 0x8(%rax)
jne 0x57d3
movq %rax, 0xd2a9(%rip)      # 0x12908
movq %rdi, 0xd29a(%rip)      # 0x12900
jmp 0x566f
movq 0xd299(%rip), %rax      # 0x12908
cmpl $0x0, 0x20(%rax)
jne 0x57b8
movq 0x10(%rax), %r13
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x28(%rdi), %rax
leaq (%r14,%rax), %rdi
addq $0x4, %rdi
leaq 0x6214(%rip), %rsi      # 0xb8ad
callq 0x2af5
testq %rax, %rax
je 0x57d8
movq %rax, %rcx
incq %rcx
movq %rcx, 0x18(%rsp)
movb $0x4, (%rax)
testl %r14d, %r14d
jle 0x5790
movq %rax, 0x20(%rsp)
xorl %r15d, %r15d
leaq 0x6925(%rip), %rbx      # 0xbff2
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 0x5708
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 0x573a
movq %r13, %rdi
addq %rbp, %rdi
movl %eax, %esi
movl $0x1, %edx
movq 0x8(%rsp), %rcx
callq 0x10b0
cmpq $0x1, %rax
jne 0x57c9
addq %rbp, %r13
movl %r12d, %edi
movq %r13, %rsi
callq 0x330c
cmpl $0x0, 0x14(%rsp)
je 0x5770
movb (%r13), %al
cmpb $0x4, %al
je 0x576b
movsbq %al, %rax
movb (%rax,%rbx), %al
movb %al, (%r13)
movb 0x1(%r13), %al
incq %r13
jmp 0x5753
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 0x56d4
jmp 0x5792
xorl %ebp, %ebp
movq %rbp, (%r13,%r14,8)
movq 0x8(%rsp), %rdi
callq 0x10c0
movq 0xd160(%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