// File: readmapping[P]alfalfa/src/performanceUtils.cpp
// Function: readRecord(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, samRecord_t&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool readRecord(string & line, samRecord_t & record, string tag){
    int tabPos = 0;
    char delimeter = '\t';
    //qname
    record.qname = nextField(line, delimeter, tabPos);
    if(record.qname.length() > 2 && record.qname[record.qname.length()-2]=='/')
        record.qname.erase(record.qname.length()-2);
    //flag
    record.flag = bitset<11>((ulong) atoi(nextField(line, delimeter, tabPos).c_str()));
    //rname
    record.rname = nextField(line, delimeter, tabPos);
    //pos
    record.pos = atoi(nextField(line, delimeter, tabPos).c_str());
    //mapq
    record.mapq = atoi(nextField(line, delimeter, tabPos).c_str());
    //skip CIGAR
    string cigar = nextField(line, delimeter, tabPos);
    int cigarPos = 0;
    while(cigar[cigarPos] >= 48 && cigar[cigarPos] <= 57)//integer
        cigarPos++;
    //now cigar[cigarPos] is character
    if(cigar[cigarPos] == 'S' || cigar[cigarPos] == 'H'){
        record.pos -= atoi(cigar.substr(0,cigarPos).c_str());
    }
    //rnext
    record.rnext = nextField(line, delimeter, tabPos);
    //pnext
    record.pnext = atoi(nextField(line, delimeter, tabPos).c_str());
    //edit distance NM tag
    //skip fields to make sure 
    tabPos = line.find(delimeter,tabPos)+1;
    tabPos = line.find(delimeter,tabPos)+1;
    tabPos = line.find(delimeter,tabPos)+1;
    //now passed qual
    string editTag = tag+":i:";
    int NMpos = line.find(editTag,tabPos);
    if(NMpos == -1 && !record.flag.test(2))
            record.edit = -1;
    else if(NMpos>=tabPos){
        tabPos = line.find(delimeter,NMpos);
        if(tabPos == -1)
            tabPos = line.length();
        record.edit = atoi(line.substr(NMpos+5,tabPos-NMpos-5).c_str());
    }
    return true;
}

// Assembly:
subq $0x208, %rsp            # imm = 0x208
movq %rdx, 0x58(%rsp)
movq %rdi, 0x200(%rsp)
movq %rsi, 0x1f8(%rsp)
movq %rdx, 0x1f0(%rsp)
movl $0x0, 0x1ec(%rsp)
movb $0x9, 0x1eb(%rsp)
movq 0x200(%rsp), %rsi
leaq 0x1c8(%rsp), %rdi
leaq 0x1ec(%rsp), %rcx
movsbl 0x1eb(%rsp), %edx
callq 0x66e60
movq 0x1f8(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x84b0
leaq 0x1c8(%rsp), %rdi
callq 0x8858
movq 0x1f8(%rsp), %rdi
callq 0x8630
cmpq $0x2, %rax
jbe 0x67146
movq 0x1f8(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x1f8(%rsp), %rdi
callq 0x8630
movq 0x50(%rsp), %rdi
movq %rax, %rsi
subq $0x2, %rsi
callq 0x8830
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x67146
movq 0x1f8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x1f8(%rsp), %rdi
callq 0x8630
movq 0x48(%rsp), %rdi
movq %rax, %rsi
subq $0x2, %rsi
movq $-0x1, %rdx
callq 0x80f0
movq 0x200(%rsp), %rsi
leaq 0x1a0(%rsp), %rdi
leaq 0x1ec(%rsp), %rcx
movsbl 0x1eb(%rsp), %edx
callq 0x66e60
leaq 0x1a0(%rsp), %rdi
callq 0x8170
movq %rax, %rdi
callq 0x8670
movslq %eax, %rsi
leaq 0x1c0(%rsp), %rdi
callq 0x52550
movq 0x1f8(%rsp), %rax
movq 0x1c0(%rsp), %rcx
movq %rcx, 0x20(%rax)
leaq 0x1a0(%rsp), %rdi
callq 0x8858
movq 0x200(%rsp), %rsi
leaq 0x180(%rsp), %rdi
leaq 0x1ec(%rsp), %rcx
movsbl 0x1eb(%rsp), %edx
callq 0x66e60
movq 0x1f8(%rsp), %rdi
addq $0x28, %rdi
leaq 0x180(%rsp), %rsi
callq 0x84b0
leaq 0x180(%rsp), %rdi
callq 0x8858
movq 0x200(%rsp), %rsi
leaq 0x160(%rsp), %rdi
leaq 0x1ec(%rsp), %rcx
movsbl 0x1eb(%rsp), %edx
callq 0x66e60
leaq 0x160(%rsp), %rdi
callq 0x8170
movq %rax, %rdi
callq 0x8670
movslq %eax, %rcx
movq 0x1f8(%rsp), %rax
movq %rcx, 0x48(%rax)
leaq 0x160(%rsp), %rdi
callq 0x8858
movq 0x200(%rsp), %rsi
leaq 0x140(%rsp), %rdi
leaq 0x1ec(%rsp), %rcx
movsbl 0x1eb(%rsp), %edx
callq 0x66e60
leaq 0x140(%rsp), %rdi
callq 0x8170
movq %rax, %rdi
callq 0x8670
movl %eax, %ecx
movq 0x1f8(%rsp), %rax
movl %ecx, 0x50(%rax)
leaq 0x140(%rsp), %rdi
callq 0x8858
movq 0x200(%rsp), %rsi
leaq 0x120(%rsp), %rdi
leaq 0x1ec(%rsp), %rcx
movsbl 0x1eb(%rsp), %edx
callq 0x66e60
movl $0x0, 0x11c(%rsp)
movslq 0x11c(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x8830
movq %rax, 0x40(%rsp)
jmp 0x672f2
movq 0x40(%rsp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x30, %ecx
movb %al, 0x3f(%rsp)
jl 0x67333
movslq 0x11c(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x8830
movq %rax, 0x30(%rsp)
jmp 0x67321
movq 0x30(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
setle %al
movb %al, 0x3f(%rsp)
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x6733d
jmp 0x67369
movl 0x11c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x11c(%rsp)
jmp 0x672d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
jmp 0x676bb
movslq 0x11c(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x8830
movq %rax, 0x28(%rsp)
jmp 0x67385
movq 0x28(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x53, %eax
je 0x673bb
movslq 0x11c(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x8830
movq %rax, 0x20(%rsp)
jmp 0x673ae
movq 0x20(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x48, %eax
jne 0x67416
movslq 0x11c(%rsp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq 0xe8(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x83a0
jmp 0x673de
leaq 0xe8(%rsp), %rdi
callq 0x8170
movq %rax, %rdi
callq 0x8670
movslq %eax, %rdx
movq 0x1f8(%rsp), %rax
movq 0x48(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x48(%rax)
leaq 0xe8(%rsp), %rdi
callq 0x8858
movq 0x200(%rsp), %rsi
movsbl 0x1eb(%rsp), %edx
leaq 0xc8(%rsp), %rdi
leaq 0x1ec(%rsp), %rcx
callq 0x66e60
jmp 0x6743d
movq 0x1f8(%rsp), %rdi
addq $0x58, %rdi
leaq 0xc8(%rsp), %rsi
movq %rsi, 0x18(%rsp)
callq 0x84b0
movq 0x18(%rsp), %rdi
callq 0x8858
movq 0x200(%rsp), %rsi
movsbl 0x1eb(%rsp), %edx
leaq 0xa8(%rsp), %rdi
leaq 0x1ec(%rsp), %rcx
callq 0x66e60
jmp 0x6748c
leaq 0xa8(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x8170
movq %rax, %rdi
callq 0x8670
movq 0x10(%rsp), %rdi
movslq %eax, %rcx
movq 0x1f8(%rsp), %rax
movq %rcx, 0x78(%rax)
callq 0x8858
movq 0x200(%rsp), %rdi
movsbl 0x1eb(%rsp), %esi
movslq 0x1ec(%rsp), %rdx
callq 0x8540
incl %eax
movl %eax, 0x1ec(%rsp)
movq 0x200(%rsp), %rdi
movsbl 0x1eb(%rsp), %esi
movslq 0x1ec(%rsp), %rdx
callq 0x8540
incl %eax
movl %eax, 0x1ec(%rsp)
movq 0x200(%rsp), %rdi
movsbl 0x1eb(%rsp), %esi
movslq 0x1ec(%rsp), %rdx
callq 0x8540
movq 0x58(%rsp), %rsi
incl %eax
movl %eax, 0x1ec(%rsp)
leaq 0x11f31(%rip), %rdx     # 0x7946e
leaq 0x88(%rsp), %rdi
callq 0x1f400
jmp 0x6754c
movq 0x200(%rsp), %rdi
movslq 0x1ec(%rsp), %rdx
leaq 0x88(%rsp), %rsi
callq 0x8840
movl %eax, 0x84(%rsp)
cmpl $-0x1, 0x84(%rsp)
jne 0x675dd
movq 0x1f8(%rsp), %rdi
addq $0x20, %rdi
movl $0x2, %esi
callq 0xe340
movb %al, 0xf(%rsp)
jmp 0x67596
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x675dd
jmp 0x675a0
movq 0x1f8(%rsp), %rax
movl $0xffffffff, 0x80(%rax) # imm = 0xFFFFFFFF
jmp 0x67695
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x8858
jmp 0x676bb
movl 0x84(%rsp), %eax
cmpl 0x1ec(%rsp), %eax
jl 0x67693
movq 0x200(%rsp), %rdi
movb 0x1eb(%rsp), %al
movslq 0x84(%rsp), %rdx
movsbl %al, %esi
callq 0x8540
movl %eax, 0x1ec(%rsp)
cmpl $-0x1, 0x1ec(%rsp)
jne 0x67635
movq 0x200(%rsp), %rdi
callq 0x8630
movl %eax, 0x1ec(%rsp)
movq 0x200(%rsp), %rsi
movl 0x84(%rsp), %ecx
movl %ecx, %eax
addl $0x5, %eax
movslq %eax, %rdx
movl 0x1ec(%rsp), %eax
subl %ecx, %eax
addl $-0x5, %eax
movslq %eax, %rcx
leaq 0x60(%rsp), %rdi
callq 0x83a0
jmp 0x67667
leaq 0x60(%rsp), %rdi
callq 0x8170
movq %rax, %rdi
callq 0x8670
movl %eax, %ecx
movq 0x1f8(%rsp), %rax
movl %ecx, 0x80(%rax)
leaq 0x60(%rsp), %rdi
callq 0x8858
jmp 0x67695
leaq 0x88(%rsp), %rdi
callq 0x8858
leaq 0x120(%rsp), %rdi
callq 0x8858
movb $0x1, %al
andb $0x1, %al
addq $0x208, %rsp            # imm = 0x208
retq
leaq 0x120(%rsp), %rdi
callq 0x8858
movq 0x110(%rsp), %rdi
callq 0x8730
nopw %cs:(%rax,%rax)