// File: /workspace/github_cpp_makefile_star2_O2/readmapping[P]alfalfa/src/sparseSA.cpp
// Function: sparseSA::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool sparseSA::load(const string &prefix){
    cerr << "atempting to load index " << prefix  << " ... "<< endl;
    string basic = prefix;
    string aux = basic + ".aux";
    string sa = basic + ".sa";
    string lcp = basic + ".lcp";
    string ref = basic + ".ref";
    ifstream aux_s (aux.c_str());
    if(!aux_s.is_open()){
        cerr << "unable to open " << prefix << endl;
        return false;
    }
    string line;
    getline(aux_s,line); N = atol(line.c_str());
    getline(aux_s,line); K = atol(line.c_str());
    getline(aux_s,line); logN = atol(line.c_str());
    getline(aux_s,line); NKm1 = atol(line.c_str());
    getline(aux_s,line); hasSufLink = atoi(line.c_str()) == 1 ? true : false;
    getline(aux_s,line); hasChild = atoi(line.c_str()) == 1 ? true : false;
    getline(aux_s,line); hasKmer = atoi(line.c_str()) == 1 ? true : false;
    getline(aux_s,line); 
    int chromNumber = atoi(line.c_str());
    for(int i = 0; i < chromNumber; i++){
        getline(aux_s,line); 
        startpos.push_back(atol(line.c_str()));
    }
    for(int i = 0; i < chromNumber; i++){
        getline(aux_s,line); 
        descr.push_back(line);
    }
    //read auxiliary information
    aux_s.close();
    //read ref
    ifstream ref_s (ref.c_str());
    getline(ref_s,S);
    ref_s.close();
    //read sa
    ifstream sa_s (sa.c_str(), ios::binary);
    unsigned int sizeSA;
    sa_s.read((char*)&sizeSA,sizeof(sizeSA));
    SA.resize(sizeSA);
    sa_s.read((char*)&SA[0],sizeSA*sizeof(unsigned int));
    sa_s.close();
    //read LCP
    ifstream lcp_s (lcp.c_str(), ios::binary);
    unsigned int sizeLCP;
    unsigned int sizeM;
    lcp_s.read((char*)&sizeLCP,sizeof(sizeLCP));
    lcp_s.read((char*)&sizeM,sizeof(sizeM));
    LCP.vec.resize(sizeLCP);
    LCP.M.resize(sizeM);
    lcp_s.read((char*)&LCP.vec[0],sizeLCP*sizeof(unsigned char));
    lcp_s.read((char*)&LCP.M[0],sizeM*sizeof(vec_uchar::item_t));
    lcp_s.close();
    //read ISA if nec
    if(hasSufLink){
        string isa = basic + ".isa";
        ifstream isa_s (isa.c_str(), ios::binary);
        unsigned int sizeISA;
        isa_s.read((char*)&sizeISA,sizeof(sizeISA));
        ISA.resize(sizeISA);
        isa_s.read((char*)&ISA[0],sizeISA*sizeof(int));
        isa_s.close();
    }
    //read child if nec
    if(hasChild){
        string child = basic + ".child";
        ifstream child_s (child.c_str(), ios::binary);
        unsigned int sizeCHILD;
        child_s.read((char*)&sizeCHILD,sizeof(sizeCHILD));
        CHILD.resize(sizeCHILD);
        child_s.read((char*)&CHILD[0],sizeCHILD*sizeof(int));
        child_s.close();
    }
    //read kmer table if nec
    if(hasKmer){
        string kmer = basic + ".kmer";
        ifstream kmer_s (kmer.c_str(), ios::binary);
        unsigned int sizeKMR;
        kmer_s.read((char*)&sizeKMR,sizeof(sizeKMR));
        KMR.resize(sizeKMR);
        kmer_s.read((char*)&KMR[0],sizeKMR*sizeof(saTuple_t));
        kmer_s.close();
    }
    cerr << "index loaded succesful" << endl;
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb28, %rsp            # imm = 0xB28
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
movq 0x3b976(%rip), %rdi     # 0x49fe8
leaq 0x27cc1(%rip), %rsi     # 0x3633a
callq 0x72b0
movq %rax, %rdi
movq %r15, %rsi
callq 0x7280
leaq 0x286fd(%rip), %rsi     # 0x36d8d
movq %rax, %rdi
callq 0x72b0
movq %rax, %rdi
callq 0x7160
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7440
leaq 0x27c4e(%rip), %rdx     # 0x36305
leaq 0xe0(%rsp), %rdi
movq %rbx, %rsi
callq 0x11081
leaq 0x27c3c(%rip), %rdx     # 0x3630a
leaq 0xc0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x11081
leaq 0x27c27(%rip), %rdx     # 0x3630e
leaq 0xa0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x11081
leaq 0x27c13(%rip), %rdx     # 0x36313
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x11081
movq 0xe0(%rsp), %rsi
leaq 0x308(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x7620
leaq 0x380(%rsp), %rdi
callq 0x70d0
movl %eax, %ebx
testb %al, %al
je 0xe8c5
movb %bl, 0x7(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x308(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x70a0
movq 0x8(%rsp), %rbx
leaq 0x20(%rsp), %r15
movq (%r15), %rdi
callq 0x7370
movq %rax, 0x38(%rbx)
leaq 0x308(%rsp), %rdi
movq %r15, %rsi
callq 0x70a0
leaq 0x20(%rsp), %r15
movq (%r15), %rdi
callq 0x7370
movq %rax, 0xe8(%rbx)
leaq 0x308(%rsp), %rdi
movq %r15, %rsi
callq 0x70a0
leaq 0x20(%rsp), %r15
movq (%r15), %rdi
callq 0x7370
movq %rax, 0x40(%rbx)
leaq 0x308(%rsp), %rdi
movq %r15, %rsi
callq 0x70a0
leaq 0x20(%rsp), %r15
movq (%r15), %rdi
callq 0x7370
movq %rax, 0x48(%rbx)
leaq 0x308(%rsp), %rdi
movq %r15, %rsi
callq 0x70a0
leaq 0x20(%rsp), %r15
movq (%r15), %rdi
callq 0x7520
cmpl $0x1, %eax
sete 0xf1(%rbx)
leaq 0x308(%rsp), %rdi
movq %r15, %rsi
callq 0x70a0
leaq 0x20(%rsp), %r15
movq (%r15), %rdi
callq 0x7520
cmpl $0x1, %eax
sete 0xf0(%rbx)
leaq 0x308(%rsp), %rdi
movq %r15, %rsi
callq 0x70a0
leaq 0x20(%rsp), %r15
movq (%r15), %rdi
callq 0x7520
cmpl $0x1, %eax
sete 0xf8(%rbx)
leaq 0x308(%rsp), %rdi
movq %r15, %rsi
callq 0x70a0
leaq 0x20(%rsp), %r15
movq (%r15), %rdi
callq 0x7520
xorl %r14d, %r14d
testl %eax, %eax
cmovgl %eax, %r14d
leaq 0x18(%rbx), %r12
leaq 0x308(%rsp), %r13
leaq 0x718(%rsp), %rbp
movl %r14d, %ebx
subl $0x1, %ebx
jb 0xe8f0
movq %r13, %rdi
movq %r15, %rsi
callq 0x70a0
movq 0x20(%rsp), %rdi
callq 0x7370
movq %rax, 0x718(%rsp)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x127d0
jmp 0xe896
movq 0x3b71c(%rip), %rdi     # 0x49fe8
leaq 0x27a80(%rip), %rsi     # 0x36353
callq 0x72b0
movq %rax, %rdi
movq %r15, %rsi
callq 0x7280
movq %rax, %rdi
callq 0x7160
jmp 0xecae
leaq 0x308(%rsp), %r15
leaq 0x20(%rsp), %r12
subl $0x1, %r14d
jb 0xe91d
movq %r15, %rdi
movq %r12, %rsi
callq 0x70a0
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x10e56
jmp 0xe8fd
leaq 0x308(%rsp), %rdi
callq 0x70b0
movq 0x80(%rsp), %rsi
leaq 0x718(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x7620
movq 0x8(%rsp), %rax
leaq 0x50(%rax), %rsi
leaq 0x718(%rsp), %rdi
callq 0x70a0
leaq 0x718(%rsp), %rdi
callq 0x70b0
movq 0xc0(%rsp), %rsi
leaq 0x920(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7620
leaq 0x920(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
pushq $0x4
popq %rdx
callq 0x73d0
movq 0x8(%rsp), %rax
leaq 0x70(%rax), %r15
movl 0x1c(%rsp), %esi
movq %r15, %rdi
callq 0x110ba
movq (%r15), %rsi
movl 0x1c(%rsp), %edx
shlq $0x2, %rdx
leaq 0x920(%rsp), %rdi
callq 0x73d0
leaq 0x920(%rsp), %rdi
callq 0x70b0
movq 0xa0(%rsp), %rsi
leaq 0x510(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7620
leaq 0x510(%rsp), %rdi
leaq 0x18(%rsp), %rsi
pushq $0x4
popq %rdx
callq 0x73d0
leaq 0x510(%rsp), %rdi
leaq 0x14(%rsp), %rsi
pushq $0x4
popq %rdx
callq 0x73d0
movq 0x8(%rsp), %rax
leaq 0xa0(%rax), %r12
movl 0x18(%rsp), %esi
movq %r12, %rdi
callq 0x110ec
movq 0x8(%rsp), %rax
leaq 0xb8(%rax), %r15
movl 0x14(%rsp), %esi
movq %r15, %rdi
callq 0x11118
movq (%r12), %rsi
movl 0x18(%rsp), %edx
leaq 0x510(%rsp), %rdi
callq 0x73d0
movq (%r15), %rsi
movl 0x14(%rsp), %edx
shlq $0x4, %rdx
leaq 0x510(%rsp), %rdi
callq 0x73d0
leaq 0x510(%rsp), %rdi
callq 0x70b0
movq 0x8(%rsp), %rax
cmpb $0x1, 0xf1(%rax)
jne 0xeb1a
leaq 0x27897(%rip), %rdx     # 0x36328
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x11081
movq 0x40(%rsp), %rsi
leaq 0x100(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7620
leaq 0x100(%rsp), %rdi
movq %rsp, %rsi
pushq $0x4
popq %rdx
callq 0x73d0
movq 0x8(%rsp), %rax
leaq 0x88(%rax), %r15
movl (%rsp), %esi
movq %r15, %rdi
callq 0x1114c
movq (%r15), %rsi
movl (%rsp), %edx
shlq $0x2, %rdx
leaq 0x100(%rsp), %rdi
callq 0x73d0
leaq 0x100(%rsp), %rdi
callq 0x70b0
leaq 0x100(%rsp), %rdi
callq 0x70e0
leaq 0x40(%rsp), %rdi
callq 0x76a8
movq 0x8(%rsp), %rax
cmpb $0x1, 0xf0(%rax)
jne 0xebbc
leaq 0x277fa(%rip), %rdx     # 0x3632d
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x11081
movq 0x40(%rsp), %rsi
leaq 0x100(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7620
leaq 0x100(%rsp), %rdi
movq %rsp, %rsi
pushq $0x4
popq %rdx
callq 0x73d0
movq 0x8(%rsp), %rax
leaq 0xd0(%rax), %r15
movl (%rsp), %esi
movq %r15, %rdi
callq 0x1114c
movq (%r15), %rsi
movl (%rsp), %edx
shlq $0x2, %rdx
leaq 0x100(%rsp), %rdi
callq 0x73d0
leaq 0x100(%rsp), %rdi
callq 0x70b0
leaq 0x100(%rsp), %rdi
callq 0x70e0
leaq 0x40(%rsp), %rdi
callq 0x76a8
movq 0x8(%rsp), %rax
cmpb $0x1, 0xf8(%rax)
jne 0xec5e
leaq 0x2775f(%rip), %rdx     # 0x36334
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x11081
movq 0x40(%rsp), %rsi
leaq 0x100(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7620
leaq 0x100(%rsp), %rdi
movq %rsp, %rsi
pushq $0x4
popq %rdx
callq 0x73d0
movq 0x8(%rsp), %rbx
addq $0x100, %rbx            # imm = 0x100
movl (%rsp), %esi
movq %rbx, %rdi
callq 0x1117e
movq (%rbx), %rsi
movl (%rsp), %edx
shlq $0x3, %rdx
leaq 0x100(%rsp), %rdi
callq 0x73d0
leaq 0x100(%rsp), %rdi
callq 0x70b0
leaq 0x100(%rsp), %rdi
callq 0x70e0
leaq 0x40(%rsp), %rdi
callq 0x76a8
movq 0x3b383(%rip), %rdi     # 0x49fe8
leaq 0x276f7(%rip), %rsi     # 0x36363
callq 0x72b0
movq %rax, %rdi
callq 0x7160
leaq 0x510(%rsp), %rdi
callq 0x70e0
leaq 0x920(%rsp), %rdi
callq 0x70e0
leaq 0x718(%rsp), %rdi
callq 0x70e0
leaq 0x20(%rsp), %rdi
callq 0x76a8
movb 0x7(%rsp), %bl
leaq 0x308(%rsp), %rdi
callq 0x70e0
leaq 0x80(%rsp), %rdi
callq 0x76a8
leaq 0xa0(%rsp), %rdi
callq 0x76a8
leaq 0xc0(%rsp), %rdi
callq 0x76a8
leaq 0xe0(%rsp), %rdi
callq 0x76a8
leaq 0x60(%rsp), %rdi
callq 0x76a8
movl %ebx, %eax
addq $0xb28, %rsp            # imm = 0xB28
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xed15
jmp 0xed7d
jmp 0xed15
jmp 0xed7d
movq %rax, %rbx
jmp 0xed3e
jmp 0xed7d
jmp 0xed76
jmp 0xed4a
jmp 0xedad
jmp 0xedad
jmp 0xed2e
jmp 0xed2e
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x70e0
leaq 0x40(%rsp), %rdi
callq 0x76a8
jmp 0xed80
movq %rax, %rbx
jmp 0xed9a
movq %rax, %rbx
jmp 0xedc7
movq %rax, %rbx
jmp 0xedd4
movq %rax, %rbx
jmp 0xede1
movq %rax, %rbx
jmp 0xedee
movq %rax, %rbx
jmp 0xedfb
movq %rax, %rbx
jmp 0xedba
movq %rax, %rbx
jmp 0xed8d
jmp 0xedad
movq %rax, %rbx
leaq 0x510(%rsp), %rdi
callq 0x70e0
leaq 0x920(%rsp), %rdi
callq 0x70e0
leaq 0x718(%rsp), %rdi
callq 0x70e0
jmp 0xedb0
jmp 0xedad
jmp 0xedad
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x76a8
leaq 0x308(%rsp), %rdi
callq 0x70e0
leaq 0x80(%rsp), %rdi
callq 0x76a8
leaq 0xa0(%rsp), %rdi
callq 0x76a8
leaq 0xc0(%rsp), %rdi
callq 0x76a8
leaq 0xe0(%rsp), %rdi
callq 0x76a8
leaq 0x60(%rsp), %rdi
callq 0x76a8
movq %rbx, %rdi
callq 0x75e0
nop