// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movl $0x9, %esi
xorl %edx, %edx
callq 0x7410
movq %rax, %r12
movslq %r12d, %rcx
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x7310
movq %rbx, %rdi
movq %r13, %rsi
callq 0x73c0
movq (%r13), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x34a78
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x72f0
incl %r12d
movq 0x8(%rbx), %rax
cmpq $0x3, %rax
jb 0x34a9b
movq (%rbx), %rcx
cmpb $0x2f, -0x2(%rcx,%rax)
jne 0x34a9b
addq $-0x2, %rax
movq %rax, 0x8(%rbx)
movb $0x0, (%rcx,%rax)
movslq %r12d, %r13
movq %r14, %rdi
movl $0x9, %esi
movq %r13, %rdx
callq 0x7410
movq %rax, %r12
subl %r13d, %eax
movslq %eax, %rcx
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x7310
incl %r12d
movq (%rbp), %r13
movq %r13, %rdi
callq 0x7520
andl $0x7ff, %eax            # imm = 0x7FF
movq %rax, 0x20(%rbx)
leaq 0x18(%rsp), %rax
cmpq %rax, %r13
je 0x34afc
movq 0x18(%rsp), %rsi
incq %rsi
movq %r13, %rdi
callq 0x72f0
movslq %r12d, %r13
movq %r14, %rdi
movl $0x9, %esi
movq %r13, %rdx
callq 0x7410
movq %rax, %r12
subl %r13d, %eax
movslq %eax, %rcx
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x7310
incl %r12d
leaq 0x28(%rbx), %rdi
movq %rbp, %rsi
callq 0x73c0
movq (%rbp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x34b55
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x72f0
movslq %r12d, %r13
movq %r14, %rdi
movl $0x9, %esi
movq %r13, %rdx
callq 0x7410
movq %rax, %r12
subl %r13d, %eax
movslq %eax, %rcx
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x7310
incl %r12d
movq (%rbp), %r13
movq %r13, %rdi
callq 0x7520
cltq
movq %rax, 0x48(%rbx)
leaq 0x18(%rsp), %rax
cmpq %rax, %r13
je 0x34bb3
movq 0x18(%rsp), %rsi
incq %rsi
movq %r13, %rdi
callq 0x72f0
movslq %r12d, %r13
movq %r14, %rdi
movl $0x9, %esi
movq %r13, %rdx
callq 0x7410
movq %rax, %r12
subl %r13d, %eax
movslq %eax, %rcx
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x7310
incl %r12d
movq (%rbp), %r13
movq %r13, %rdi
callq 0x7520
movl %eax, 0x50(%rbx)
leaq 0x18(%rsp), %rax
cmpq %rax, %r13
je 0x34c0e
movq 0x18(%rsp), %rsi
incq %rsi
movq %r13, %rdi
callq 0x72f0
movslq %r12d, %r13
movq %r14, %rdi
movl $0x9, %esi
movq %r13, %rdx
callq 0x7410
movq %rax, %r12
subl %r13d, %eax
movslq %eax, %rcx
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x7310
movq (%rbp), %rdx
movb (%rdx), %al
cmpb $0x30, %al
jl 0x34ca3
xorl %ecx, %ecx
cmpb $0x3a, %al
jae 0x34c5a
movb 0x1(%rdx,%rcx), %al
incq %rcx
cmpb $0x30, %al
jge 0x34c49
jmp 0x34ca3
cmpb $0x53, %al
je 0x34c66
movzbl %al, %eax
cmpl $0x48, %eax
jne 0x34ca3
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x7310
leaq 0x38(%rsp), %rbp
movq -0x10(%rbp), %r13
movq %r13, %rdi
callq 0x7520
cltq
subq %rax, 0x48(%rbx)
cmpq %rbp, %r13
je 0x34ca3
movq 0x38(%rsp), %rsi
incq %rsi
movq %r13, %rdi
callq 0x72f0
incl %r12d
movslq %r12d, %r13
movq %r14, %rdi
movl $0x9, %esi
movq %r13, %rdx
callq 0x7410
movq %rax, %r12
subl %r13d, %eax
movslq %eax, %rcx
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x7310
incl %r12d
leaq 0x58(%rbx), %rdi
leaq 0x28(%rsp), %r13
movq %r13, %rsi
callq 0x73c0
movq (%r13), %rdi
leaq 0x38(%rsp), %rbp
cmpq %rbp, %rdi
je 0x34d01
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x72f0
movslq %r12d, %r13
movq %r14, %rdi
movl $0x9, %esi
movq %r13, %rdx
callq 0x7410
movq %rax, %r12
subl %r13d, %eax
movslq %eax, %rcx
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x7310
movq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x7520
cltq
movq %rax, 0x78(%rbx)
cmpq %rbp, %r13
je 0x34d55
movq 0x38(%rsp), %rsi
incq %rsi
movq %r13, %rdi
callq 0x72f0
incl %r12d
movslq %r12d, %rdx
movq %r14, %rdi
movl $0x9, %esi
callq 0x7410
incl %eax
movslq %eax, %rdx
movq %r14, %rdi
movl $0x9, %esi
callq 0x7410
incl %eax
movslq %eax, %rdx
movq %r14, %rdi
movl $0x9, %esi
callq 0x7410
movq %rax, %r12
leaq 0x28(%rsp), %rdi
movq %rbp, (%rdi)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
callq 0xc1d8
leaq 0xb6ba(%rip), %rsi      # 0x40467
leaq 0x28(%rsp), %rdi
callq 0x7680
incl %r12d
movslq %r12d, %rdx
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rcx
movq %r14, %rdi
callq 0x75f0
movq %rax, %r15
cmpl $-0x1, %r15d
jne 0x34dea
testb $0x4, 0x20(%rbx)
jne 0x34dea
movl $0xffffffff, 0x80(%rbx) # imm = 0xFFFFFFFF
jmp 0x34e51
cmpl %r15d, %r12d
jg 0x34e51
movslq %r15d, %rdx
movq %r14, %rdi
movl $0x9, %esi
callq 0x7410
cmpl $-0x1, %eax
jne 0x34e08
movl 0x8(%r14), %eax
leal 0x5(%r15), %ecx
movslq %ecx, %rdx
subl %r15d, %eax
addl $-0x5, %eax
movslq %eax, %rcx
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
callq 0x7310
leaq 0x58(%rsp), %r15
movq -0x10(%r15), %r14
movq %r14, %rdi
callq 0x7520
movl %eax, 0x80(%rbx)
cmpq %r15, %r14
je 0x34e51
movq 0x58(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x72f0
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x34e68
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x72f0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x34e84
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x72f0
movb $0x1, %al
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x34eb9
jmp 0x34e99
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x34ebc
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x72f0
jmp 0x34ebc
jmp 0x34eb9
jmp 0x34eb9
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x34ed8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x72f0
movq %rbx, %rdi
callq 0x7600