// File: zeeev[P]DASVC/fastahack/Fasta.cpp
// Function: FastaReference::getSequence(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string FastaReference::getSequence(string seqname) {
    FastaIndexEntry entry = index->entry(seqname);
    int newlines_in_sequence = entry.length / entry.line_blen;
    int seqlen = newlines_in_sequence  + entry.length;
    char* seq = (char*) calloc (seqlen + 1, sizeof(char));
    fseek64(file, entry.offset, SEEK_SET);
    string s;
    if (fread(seq, sizeof(char), seqlen, file)) {
        seq[seqlen] = '\0';
        char* pbegin = seq;
        char* pend = seq + (seqlen/sizeof(char));
        pend = remove(pbegin, pend, '\n');
        pend = remove(pbegin, pend, '\0');
        s = seq;
        free(seq);
        s.resize((pend - pbegin)/sizeof(char));
    }
    return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdx, -0xe0(%rbp)
movq %rsi, %rax
movq -0xe0(%rbp), %rsi
movq %rdi, -0xd8(%rbp)
movq %rdi, %rcx
movq %rcx, -0xd0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq 0x40(%rax), %rax
movq %rax, -0xc0(%rbp)
leaq -0x70(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x3130
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x4a60
jmp 0x4fe8
leaq -0x70(%rbp), %rdi
callq 0x31a0
movl -0x30(%rbp), %eax
movl -0x20(%rbp), %ecx
cltd
idivl %ecx
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
movl -0x30(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
incl %eax
movslq %eax, %rdi
movl $0x1, %esi
callq 0x31c0
movq %rax, %rcx
movq -0xc8(%rbp), %rax
movq %rcx, -0x90(%rbp)
movq 0x28(%rax), %rdi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x3190
jmp 0x5042
movq -0xd8(%rbp), %rdi
movb $0x0, -0x91(%rbp)
callq 0x3400
movq -0xc8(%rbp), %rax
movq -0x90(%rbp), %rdi
movslq -0x84(%rbp), %rdx
movq 0x28(%rax), %rcx
movl $0x1, %esi
callq 0x3430
movq %rax, -0xe8(%rbp)
jmp 0x5081
movq -0xe8(%rbp), %rax
cmpq $0x0, %rax
je 0x51bb
movq -0x90(%rbp), %rax
movslq -0x84(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x90(%rbp), %rax
movslq -0x84(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movb $0xa, -0xa9(%rbp)
leaq -0xa9(%rbp), %rdx
callq 0x6190
movq %rax, -0xf0(%rbp)
jmp 0x50f4
movq -0xf0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movb $0x0, -0xaa(%rbp)
leaq -0xaa(%rbp), %rdx
callq 0x6190
movq %rax, -0xf8(%rbp)
jmp 0x512c
movq -0xd8(%rbp), %rdi
movq -0xf8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x90(%rbp), %rsi
callq 0x33e0
jmp 0x514f
movq -0x90(%rbp), %rdi
callq 0x3380
movq -0xd8(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rax
subq %rax, %rsi
callq 0x33f0
jmp 0x517a
jmp 0x51bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x31a0
jmp 0x51f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x51f0
movq -0xd8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
callq 0x31a0
jmp 0x51f0
movb $0x1, -0x91(%rbp)
testb $0x1, -0x91(%rbp)
jne 0x51d7
movq -0xd8(%rbp), %rdi
callq 0x31a0
leaq -0x50(%rbp), %rdi
callq 0x3800
movq -0xd0(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
leaq -0x50(%rbp), %rdi
callq 0x3800
movq -0x78(%rbp), %rdi
callq 0x3500
nopw %cs:(%rax,%rax)