// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/DB.c
// Function: Load_Read
int Load_Read(DAZZ_DB *db, int i, char *read, int ascii)
{ FILE      *bases  = (FILE *) db->bases;
  int64      off;
  int        len, clen;
  DAZZ_READ *r = db->reads;

  if (i < 0 || i >= db->nreads)
    { EPRINTF(EPLACE,"%s: Index out of bounds (Load_Read)\n",Prog_Name);
      EXIT(1);
    }

  if (db->loaded)
    { len = r[i].rlen;
      strncpy(read,(char *) bases + r[i].boff,len);
      if (ascii == 0)
        { if (*read < 4)
            read[-1] = read[len] = 4;
          else
            { read[len] = '\0';
              Number_Read(read);
              read[-1] = 4;
            }
        }
      else
        { if (*read < 4)
            { read[len] = 4;
              if (ascii == 1)
                Lower_Read(read);
              else
                Upper_Read(read);
              read[-1] = '\0';
            }
          else
            { read[len] = '\0';
              if ((ascii == 1) != islower(*read))
                Change_Read(read);
            }
          read[-1] = '\0';
        }
      return (0);
    }

  off = r[i].boff;
  len = r[i].rlen;

  if (ftello(bases) != off)
    fseeko(bases,off,SEEK_SET);
  clen = COMPRESSED_LEN(len);
  if (clen > 0)
    { if (fread(read,clen,1,bases) != 1)
        { EPRINTF(EPLACE,"%s: Failed read of .bps file (Load_Read)\n",Prog_Name);
          EXIT(1);
        }
    }
  Uncompress_Read(len,read);
  if (ascii == 1)
    { Lower_Read(read);
      read[-1] = '\0';
    }
  else if (ascii == 2)
    { Upper_Read(read);
      read[-1] = '\0';
    }
  else
    read[-1] = 4;
  return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x5750
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jl 0x5779
movq 0xc8a1(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xf327(%rip), %rdx      # 0x14a88
leaq 0x8eed(%rip), %rsi      # 0xe655
movb $0x0, %al
callq 0x1180
movl $0x1, %edi
callq 0x1260
movq -0x10(%rbp), %rax
cmpl $0x0, 0x50(%rax)
je 0x58a6
movq -0x48(%rbp), %rax
movslq -0x14(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x48(%rbp), %rax
movslq -0x14(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
addq 0x10(%rax), %rsi
movslq -0x3c(%rbp), %rdx
callq 0x1050
cmpl $0x0, -0x24(%rbp)
jne 0x580a
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4, %eax
jge 0x57e8
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movb $0x4, (%rax,%rcx)
movq -0x20(%rbp), %rax
movb $0x4, -0x1(%rax)
jmp 0x5805
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x20(%rbp), %rdi
callq 0x3100
movq -0x20(%rbp), %rax
movb $0x4, -0x1(%rax)
jmp 0x589a
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4, %eax
jge 0x5846
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movb $0x4, (%rax,%rcx)
cmpl $0x1, -0x24(%rbp)
jne 0x5833
movq -0x20(%rbp), %rdi
callq 0x3010
jmp 0x583c
movq -0x20(%rbp), %rdi
callq 0x3060
movq -0x20(%rbp), %rax
movb $0x0, -0x1(%rax)
jmp 0x5892
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
cmpl $0x1, -0x24(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4c(%rbp)
callq 0x1290
movq %rax, %rcx
movl -0x4c(%rbp), %eax
movq (%rcx), %rcx
movq -0x20(%rbp), %rdx
movsbl (%rdx), %edx
movslq %edx, %rdx
movzwl (%rcx,%rdx,2), %ecx
andl $0x200, %ecx            # imm = 0x200
cmpl %ecx, %eax
je 0x5890
movq -0x20(%rbp), %rdi
callq 0x31a0
jmp 0x5892
movq -0x20(%rbp), %rax
movb $0x0, -0x1(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x5998
movq -0x48(%rbp), %rax
movslq -0x14(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movslq -0x14(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rdi
callq 0x1070
cmpq -0x38(%rbp), %rax
je 0x58f0
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
xorl %edx, %edx
callq 0x1220
movl -0x3c(%rbp), %eax
addl $0x3, %eax
sarl $0x2, %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
jle 0x5949
movq -0x20(%rbp), %rdi
movslq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rcx
movl $0x1, %edx
callq 0x10a0
cmpq $0x1, %rax
je 0x5947
movq 0xc6d3(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xf159(%rip), %rdx      # 0x14a88
leaq 0x8d44(%rip), %rsi      # 0xe67a
movb $0x0, %al
callq 0x1180
movl $0x1, %edi
callq 0x1260
jmp 0x5949
movl -0x3c(%rbp), %edi
movq -0x20(%rbp), %rsi
callq 0x2f20
cmpl $0x1, -0x24(%rbp)
jne 0x596e
movq -0x20(%rbp), %rdi
callq 0x3010
movq -0x20(%rbp), %rax
movb $0x0, -0x1(%rax)
jmp 0x5991
cmpl $0x2, -0x24(%rbp)
jne 0x5987
movq -0x20(%rbp), %rdi
callq 0x3060
movq -0x20(%rbp), %rax
movb $0x0, -0x1(%rax)
jmp 0x598f
movq -0x20(%rbp), %rax
movb $0x4, -0x1(%rax)
jmp 0x5991
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)