// File: /workspace/github_cpp_makefile_star2_O2/readmapping[P]alfalfa/src/sparseSA.cpp
// Function: sparseSA::save(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void sparseSA::save(const string &prefix){
    string basic = prefix;
    string aux = basic + ".aux";
    string sa = basic + ".sa";
    string lcp = basic + ".lcp";
    string ref = basic + ".ref";
    //print auxiliary information
    ofstream aux_s (aux.c_str());
    if (aux_s.is_open()){
        aux_s << N << endl;
        aux_s << K << endl;
        aux_s << logN << endl;
        aux_s << NKm1 << endl;
        aux_s << (hasSufLink ? 1 : 0) << endl;
        aux_s << (hasChild ? 1 : 0) << endl;
        aux_s << (hasKmer ? 1 : 0) << endl;
        aux_s << startpos.size() << endl;
        for(size_t i = 0; i < startpos.size(); i++)
            aux_s << startpos[i] << endl;
        for(size_t i = 0; i < descr.size(); i++)
            aux_s << descr[i] << endl;
        aux_s.close();
    }
    else cerr << "Unable to open " << aux.c_str() << endl;
    //print S
    ofstream ref_s (ref.c_str());
    if (ref_s.is_open()){
        ref_s << S << endl;
    }
    else cerr << "Unable to open " << ref.c_str() << endl;
    //print sa
    ofstream sa_s (sa.c_str(), ios::binary);
    unsigned int sizeSA = SA.size();
    sa_s.write((const char*)&sizeSA,sizeof(sizeSA));
    sa_s.write((const char*)&SA[0],sizeSA*sizeof(unsigned int));
    sa_s.close();
    //print LCP
    ofstream lcp_s (lcp.c_str(), ios::binary);
    unsigned int sizeLCP = LCP.vec.size();
    unsigned int sizeM = LCP.M.size();
    lcp_s.write((const char*)&sizeLCP,sizeof(sizeLCP));
    lcp_s.write((const char*)&sizeM,sizeof(sizeM));
    lcp_s.write((const char*)&LCP.vec[0],sizeLCP*sizeof(unsigned char));
    lcp_s.write((const char*)&LCP.M[0],sizeM*sizeof(vec_uchar::item_t));
    lcp_s.close();
    //print ISA if nec
    if(hasSufLink){
        string isa = basic + ".isa";
        ofstream isa_s (isa.c_str(), ios::binary);
        unsigned int sizeISA = ISA.size();
        isa_s.write((const char*)&sizeISA,sizeof(sizeISA));
        isa_s.write((const char*)&ISA[0],sizeISA*sizeof(int));
        isa_s.close();
    }
    //print child if nec
    if(hasChild){
        string child = basic + ".child";
        ofstream child_s (child.c_str(), ios::binary);
        unsigned int sizeCHILD = CHILD.size();
        child_s.write((const char*)&sizeCHILD,sizeof(sizeCHILD));
        child_s.write((const char*)&CHILD[0],sizeCHILD*sizeof(int));
        child_s.close();
    }
    //print child if nec
    if(hasKmer){
        string kmer = basic + ".kmer";
        ofstream kmer_s (kmer.c_str(), ios::binary);
        unsigned int sizeKMR = KMR.size();
        kmer_s.write((const char*)&sizeKMR,sizeof(sizeKMR));
        kmer_s.write((const char*)&KMR[0],sizeKMR*sizeof(saTuple_t));
        kmer_s.close();
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xad8, %rsp            # imm = 0xAD8
movq %rdi, %rbx
leaq 0x38(%rsp), %r14
movq %r14, %rdi
callq 0x7440
leaq 0x2836c(%rip), %rdx     # 0x36305
leaq 0x78(%rsp), %rdi
movq %r14, %rsi
callq 0x11081
leaq 0x2835d(%rip), %rdx     # 0x3630a
leaq 0xb8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x11081
leaq 0x28348(%rip), %rdx     # 0x3630e
leaq 0x98(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x11081
leaq 0x28334(%rip), %rdx     # 0x36313
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x11081
movq 0x78(%rsp), %rsi
leaq 0x2d8(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x7310
leaq 0x348(%rsp), %rdi
callq 0x70d0
testb %al, %al
je 0xe12c
movq 0x38(%rbx), %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x72a0
movq %rax, %rdi
callq 0x7160
movq 0xe8(%rbx), %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x72a0
movq %rax, %rdi
callq 0x7160
movq 0x40(%rbx), %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x72a0
movq %rax, %rdi
callq 0x7160
movq 0x48(%rbx), %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x72a0
movq %rax, %rdi
callq 0x7160
movzbl 0xf1(%rbx), %esi
leaq 0x2d8(%rsp), %rdi
callq 0x75c0
movq %rax, %rdi
callq 0x7160
movzbl 0xf0(%rbx), %esi
leaq 0x2d8(%rsp), %rdi
callq 0x75c0
movq %rax, %rdi
callq 0x7160
movzbl 0xf8(%rbx), %esi
leaq 0x2d8(%rsp), %rdi
callq 0x75c0
movq %rax, %rdi
callq 0x7160
movq 0x20(%rbx), %rsi
subq 0x18(%rbx), %rsi
sarq $0x3, %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x71d0
movq %rax, %rdi
callq 0x7160
xorl %r15d, %r15d
leaq 0x2d8(%rsp), %r14
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r15
jae 0xe156
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
callq 0x72a0
movq %rax, %rdi
callq 0x7160
incq %r15
jmp 0xe0ff
movq 0x3beb5(%rip), %rdi     # 0x49fe8
leaq 0x281de(%rip), %rsi     # 0x36318
callq 0x72b0
movq 0x78(%rsp), %rsi
movq %rax, %rdi
callq 0x72b0
movq %rax, %rdi
callq 0x7160
jmp 0xe1a0
xorl %r15d, %r15d
leaq 0x2d8(%rsp), %r14
xorl %r12d, %r12d
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rax, %r12
jae 0xe193
addq %r15, %rsi
movq %r14, %rdi
callq 0x7280
movq %rax, %rdi
callq 0x7160
incq %r12
addq $0x20, %r15
jmp 0xe164
leaq 0x2d8(%rsp), %rdi
callq 0x7470
movq 0x58(%rsp), %rsi
leaq 0x8d8(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x7310
leaq 0x948(%rsp), %rdi
callq 0x70d0
testb %al, %al
je 0xe1d9
leaq 0x50(%rbx), %rsi
leaq 0x8d8(%rsp), %rdi
callq 0x7280
jmp 0xe1f9
movq 0x3be08(%rip), %rdi     # 0x49fe8
leaq 0x28131(%rip), %rsi     # 0x36318
callq 0x72b0
movq 0x58(%rsp), %rsi
movq %rax, %rdi
callq 0x72b0
movq %rax, %rdi
callq 0x7160
movq 0xb8(%rsp), %rsi
leaq 0x6d8(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7310
movq 0x78(%rbx), %rax
subq 0x70(%rbx), %rax
shrq $0x2, %rax
leaq 0x14(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x6d8(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7420
movq 0x70(%rbx), %rsi
movl 0x14(%rsp), %edx
shlq $0x2, %rdx
leaq 0x6d8(%rsp), %rdi
callq 0x7420
leaq 0x6d8(%rsp), %rdi
callq 0x7470
movq 0x98(%rsp), %rsi
leaq 0x4d8(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7310
movl 0xa8(%rbx), %eax
subl 0xa0(%rbx), %eax
leaq 0x10(%rsp), %rsi
movl %eax, (%rsi)
movq 0xc0(%rbx), %rax
subq 0xb8(%rbx), %rax
shrq $0x4, %rax
movl %eax, 0xc(%rsp)
leaq 0x4d8(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7420
leaq 0x4d8(%rsp), %rdi
leaq 0xc(%rsp), %rsi
pushq $0x4
popq %rdx
callq 0x7420
movq 0xa0(%rbx), %rsi
movl 0x10(%rsp), %edx
leaq 0x4d8(%rsp), %rdi
callq 0x7420
movq 0xb8(%rbx), %rsi
movl 0xc(%rsp), %edx
shlq $0x4, %rdx
leaq 0x4d8(%rsp), %rdi
callq 0x7420
leaq 0x4d8(%rsp), %rdi
callq 0x7470
cmpb $0x1, 0xf1(%rbx)
jne 0xe3aa
leaq 0x2800b(%rip), %rdx     # 0x36328
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x11081
movq 0x18(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7310
movq 0x90(%rbx), %rax
subq 0x88(%rbx), %rax
shrq $0x2, %rax
leaq 0x8(%rsp), %rsi
movl %eax, (%rsi)
leaq 0xd8(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7420
movq 0x88(%rbx), %rsi
movl 0x8(%rsp), %edx
shlq $0x2, %rdx
leaq 0xd8(%rsp), %rdi
callq 0x7420
leaq 0xd8(%rsp), %rdi
callq 0x7470
leaq 0xd8(%rsp), %rdi
callq 0x74d0
leaq 0x18(%rsp), %rdi
callq 0x76a8
cmpb $0x1, 0xf0(%rbx)
jne 0xe44b
leaq 0x27f6f(%rip), %rdx     # 0x3632d
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x11081
movq 0x18(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7310
movq 0xd8(%rbx), %rax
subq 0xd0(%rbx), %rax
shrq $0x2, %rax
leaq 0x8(%rsp), %rsi
movl %eax, (%rsi)
leaq 0xd8(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7420
movq 0xd0(%rbx), %rsi
movl 0x8(%rsp), %edx
shlq $0x2, %rdx
leaq 0xd8(%rsp), %rdi
callq 0x7420
leaq 0xd8(%rsp), %rdi
callq 0x7470
leaq 0xd8(%rsp), %rdi
callq 0x74d0
leaq 0x18(%rsp), %rdi
callq 0x76a8
cmpb $0x1, 0xf8(%rbx)
jne 0xe4ec
leaq 0x27ed5(%rip), %rdx     # 0x36334
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x11081
movq 0x18(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7310
movq 0x108(%rbx), %rax
subq 0x100(%rbx), %rax
shrq $0x3, %rax
leaq 0x8(%rsp), %rsi
movl %eax, (%rsi)
leaq 0xd8(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x7420
movq 0x100(%rbx), %rsi
movl 0x8(%rsp), %edx
shlq $0x3, %rdx
leaq 0xd8(%rsp), %rdi
callq 0x7420
leaq 0xd8(%rsp), %rdi
callq 0x7470
leaq 0xd8(%rsp), %rdi
callq 0x74d0
leaq 0x18(%rsp), %rdi
callq 0x76a8
leaq 0x4d8(%rsp), %rdi
callq 0x74d0
leaq 0x6d8(%rsp), %rdi
callq 0x74d0
leaq 0x8d8(%rsp), %rdi
callq 0x74d0
leaq 0x2d8(%rsp), %rdi
callq 0x74d0
leaq 0x58(%rsp), %rdi
callq 0x76a8
leaq 0x98(%rsp), %rdi
callq 0x76a8
leaq 0xb8(%rsp), %rdi
callq 0x76a8
leaq 0x78(%rsp), %rdi
callq 0x76a8
leaq 0x38(%rsp), %rdi
callq 0x76a8
addq $0xad8, %rsp            # imm = 0xAD8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0xe56f
jmp 0xe5d1
jmp 0xe56f
jmp 0xe5d1
movq %rax, %rbx
jmp 0xe5bb
jmp 0xe5d1
jmp 0xe5cc
jmp 0xe5c7
jmp 0xe601
movq %rax, %rbx
jmp 0xe611
movq %rax, %rbx
jmp 0xe61b
movq %rax, %rbx
jmp 0xe628
movq %rax, %rbx
jmp 0xe635
movq %rax, %rbx
jmp 0xe63f
jmp 0xe5ab
jmp 0xe5ab
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x74d0
leaq 0x18(%rsp), %rdi
callq 0x76a8
jmp 0xe5d4
movq %rax, %rbx
jmp 0xe5ee
movq %rax, %rbx
jmp 0xe5e1
movq %rax, %rbx
leaq 0x4d8(%rsp), %rdi
callq 0x74d0
leaq 0x6d8(%rsp), %rdi
callq 0x74d0
leaq 0x8d8(%rsp), %rdi
callq 0x74d0
jmp 0xe604
jmp 0xe601
jmp 0xe601
movq %rax, %rbx
leaq 0x2d8(%rsp), %rdi
callq 0x74d0
leaq 0x58(%rsp), %rdi
callq 0x76a8
leaq 0x98(%rsp), %rdi
callq 0x76a8
leaq 0xb8(%rsp), %rdi
callq 0x76a8
leaq 0x78(%rsp), %rdi
callq 0x76a8
leaq 0x38(%rsp), %rdi
callq 0x76a8
movq %rbx, %rdi
callq 0x75e0
nop