// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/DB.c
// Function: Load_All_Reads
int Load_All_Reads(DAZZ_DB *db, int ascii)
{ FILE      *bases = (FILE *) db->bases;
  int        nreads = db->nreads;
  DAZZ_READ *reads = db->reads;
  void     (*translate)(char *s);

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

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

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

  *seq++ = 4;

  if (ascii == 1)
    translate = Lower_Read;
  else
    translate = Upper_Read;

  o = 0;
  for (i = 0; i < nreads; i++)
    { len = reads[i].rlen;
      off = reads[i].boff;
      if (ftello(bases) != off)
        fseeko(bases,off,SEEK_SET);
      clen = COMPRESSED_LEN(len);
      if (clen > 0)
        { if (fread(seq+o,clen,1,bases) != 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)
        translate(seq+o);
      reads[i].boff = o;
      o += (len+1);
    }
  reads[nreads].boff = o;

  fclose(bases);

  db->bases  = (void *) seq;
  db->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
movq 0x58(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x50(%rax)
je 0x5cd7
movl $0x0, -0x4(%rbp)
jmp 0x5ea1
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq 0x89b3(%rip), %rsi      # 0xe6a4
callq 0x22c0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x5d0b
movl $0x1, %edi
callq 0x1260
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb $0x4, (%rax)
cmpl $0x1, -0x14(%rbp)
jne 0x5d30
leaq -0x2d1a(%rip), %rax     # 0x3010
movq %rax, -0x38(%rbp)
jmp 0x5d3b
leaq -0x2cd7(%rip), %rax     # 0x3060
movq %rax, -0x38(%rbp)
movq $0x0, -0x48(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x5e63
movq -0x30(%rbp), %rax
movslq -0x54(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x30(%rbp), %rax
movslq -0x54(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1070
cmpq -0x50(%rbp), %rax
je 0x5da0
movq -0x20(%rbp), %rdi
movq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x1220
movl -0x58(%rbp), %eax
addl $0x3, %eax
sarl $0x2, %eax
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
jle 0x5e0a
movq -0x40(%rbp), %rdi
addq -0x48(%rbp), %rdi
movslq -0x5c(%rbp), %rsi
movq -0x20(%rbp), %rcx
movl $0x1, %edx
callq 0x10a0
cmpq $0x1, %rax
je 0x5e08
movq 0xc21f(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xeca5(%rip), %rdx      # 0x14a88
leaq 0x88d8(%rip), %rsi      # 0xe6c2
movb $0x0, %al
callq 0x1180
movq -0x40(%rbp), %rdi
addq $-0x1, %rdi
callq 0x1030
movl $0x1, %edi
callq 0x1260
jmp 0x5e0a
movl -0x58(%rbp), %edi
movq -0x40(%rbp), %rsi
addq -0x48(%rbp), %rsi
callq 0x2f20
cmpl $0x0, -0x14(%rbp)
je 0x5e2e
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rdi
addq -0x48(%rbp), %rdi
callq *%rax
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %rax
movslq -0x54(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movl -0x58(%rbp), %eax
addl $0x1, %eax
cltq
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x5d4a
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rdi
callq 0x10b0
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x50(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)