// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpq 0xe820(%rip), %rax      # 0x14aa0
je 0x62e5
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x62a2
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movq 0x8(%rax), %rax
cmpq 0xc0a0(%rip), %rax      # 0x12340
je 0x62cb
movq 0xbd4f(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xe7d5(%rip), %rdx      # 0x14a88
leaq 0x8563(%rip), %rsi      # 0xe81d
movb $0x0, %al
callq 0x1180
movl $0x1, %edi
callq 0x1260
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, 0xe7ce(%rip)      # 0x14aa8
movq -0x10(%rbp), %rax
movq %rax, 0xe7bb(%rip)      # 0x14aa0
movq 0xe7bc(%rip), %rax      # 0x14aa8
cmpl $0x0, 0x20(%rax)
je 0x62fe
movl $0x0, -0x4(%rbp)
jmp 0x64b8
movq 0xe7a3(%rip), %rax      # 0x14aa8
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
movq 0xe794(%rip), %rax      # 0x14aa8
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movslq -0x18(%rbp), %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq 0x851a(%rip), %rsi      # 0xe850
callq 0x22c0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x6350
movl $0x1, %edi
callq 0x1260
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0x4, (%rax)
movq $0x0, -0x40(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x647b
movq -0x20(%rbp), %rax
movslq -0x4c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1070
cmpq -0x48(%rbp), %rax
je 0x63c0
movq -0x28(%rbp), %rdi
movq -0x48(%rbp), %rsi
xorl %edx, %edx
callq 0x1220
movl -0x50(%rbp), %eax
addl $0x3, %eax
sarl $0x2, %eax
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
jle 0x642a
movq -0x38(%rbp), %rdi
addq -0x40(%rbp), %rdi
movslq -0x54(%rbp), %rsi
movq -0x28(%rbp), %rcx
movl $0x1, %edx
callq 0x10a0
cmpq $0x1, %rax
je 0x6428
movq 0xbbff(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xe685(%rip), %rdx      # 0x14a88
leaq 0x82b8(%rip), %rsi      # 0xe6c2
movb $0x0, %al
callq 0x1180
movq -0x38(%rbp), %rdi
addq $-0x1, %rdi
callq 0x1030
movl $0x1, %edi
callq 0x1260
jmp 0x642a
movl -0x50(%rbp), %edi
movq -0x38(%rbp), %rsi
addq -0x40(%rbp), %rsi
callq 0x2f20
cmpl $0x0, -0x14(%rbp)
je 0x644d
movq -0x38(%rbp), %rdi
addq -0x40(%rbp), %rdi
callq 0x30b0
movq -0x40(%rbp), %rdx
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x50(%rbp), %eax
addl $0x1, %eax
cltq
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x6371
movq -0x40(%rbp), %rdx
movq -0x30(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rdi
callq 0x10b0
movq -0x38(%rbp), %rcx
movq 0xe609(%rip), %rax      # 0x14aa8
movq %rcx, 0x18(%rax)
movq 0xe5fe(%rip), %rax      # 0x14aa8
movl $0x1, 0x20(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)