// File: /workspace/github_cpp_makefile_star2_O1/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 0x34c7e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x72f0
incl %r12d
movq 0x8(%rbx), %rax
cmpq $0x3, %rax
jb 0x34ca1
movq (%rbx), %rcx
cmpb $0x2f, -0x2(%rcx,%rax)
jne 0x34ca1
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 0x34d02
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 0x34d5b
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 0x34db9
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 0x34e14
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 $-0x1, %rcx
movq (%rbp), %rdx
movzbl 0x1(%rdx,%rcx), %eax
leal -0x30(%rax), %esi
incq %rcx
cmpb $0xa, %sil
jb 0x34e4e
cmpl $0x53, %eax
je 0x34e69
cmpl $0x48, %eax
jne 0x34ea6
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 0x34ea6
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 0x34f04
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 0x34f58
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 0xc1f4
leaq 0xb4ba(%rip), %rsi      # 0x4046a
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 0x34fed
testb $0x4, 0x20(%rbx)
jne 0x34fed
movl $0xffffffff, 0x80(%rbx) # imm = 0xFFFFFFFF
jmp 0x35054
cmpl %r15d, %r12d
jg 0x35054
movslq %r15d, %rdx
movq %r14, %rdi
movl $0x9, %esi
callq 0x7410
cmpl $-0x1, %eax
jne 0x3500b
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 0x35054
movq 0x58(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x72f0
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3506b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x72f0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x35087
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 0x3509c
jmp 0x350bc
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x350bf
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x72f0
jmp 0x350bf
jmp 0x350bc
jmp 0x350bc
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x350db
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x72f0
movq %rbx, %rdi
callq 0x7600