// File: /workspace/github_cpp_makefile_star2_O1/CK7[P]abawaca/src/ReadMapping.cpp
// Function: Bio::ReadMapping::ReadMapping(char const*)
ReadMapping::ReadMapping(const char* SAM_line)
{
        // HWI-ST330_0096:2:2:5723:2221#TTAGGC/2        16      NODE_107_length_1448229_cov_184.575043  816000  255     85M     *       0       0       
        // AAGAANAAGCAACAAAAGGTAATTTGACAGTTGCAGGTCATGATTTAATGAACATAAAAAATAAAGAAGTTCCTTATTTACGTCG
        // A<6BB#3917.-8?4CDD?:D86DCD6;EC=BCDA,D=D:C>A+CCAA;0B>+B7ECEE?BEEFECDCCD7>1:;EE8DCEF8CF        XA:i:0  MD:Z:5A46A32    NM:i:2

        // HWI-ST330_0096:2:2:8826:2326#TTAGGC/2        4       *       0       0       *       *       0       0
        // TTTTACAGGCACTAATGCACACAGAAAAGGTTTCCAGGCAATTTTCAATGCTTGCTATAAAGCATAAATACTTAATAAAGAATTATTTTCCTTCAGATTA
        // HHHHHHHHHHEHHHHHHHHHHHHHHHHHHHDGHFFEFFDGGHFHEFBFBEHHEBHGHHHHHBEHG?FGGEHBG7HGBFH?DC?FBAB?=AFEBBFA+9DG XM:i:0

	string CIGAR_indels, CIGAR_mismatches;
	vector<string>	fs;

	split('\t', SAM_line, fs);

	QNAME = fs[0];
	FLAG = atoi(fs[1].c_str());
	RNAME = fs[2];
	POS = atoi(fs[3].c_str())-1;
	CIGAR_indels = fs[5];
	if(!strcmp(fs[6].c_str(), "=")) {
		m_same_ref = true;
		RNEXT = RNAME;
	}
	else {
		m_same_ref = false;
		RNEXT = fs[6];
	}
	PNEXT = atoi(fs[7].c_str())-1;
	TLEN = atoi(fs[8].c_str());
	SEQ = Bio::DNAString(fs[9]);
	QUAL = fs[10];

	// Look for the mismatch CIGAR string 
	for(int i=11; i<fs.size(); i++) {
		size_t pos_mdz = fs[i].find("MD:Z:");
		if(pos_mdz != string::npos) {
			size_t e = fs[i].find(" ", pos_mdz);
			if(e==string::npos) {
				CIGAR_mismatches = fs[i].substr(pos_mdz);
			}
			else {
				CIGAR_mismatches = fs[i].substr(pos_mdz, (e-pos_mdz+1));
			}
			break;
		}
	}	

	this->determine_snps(SEQ, QUAL, CIGAR_indels, CIGAR_mismatches, POS); 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdi, %r12
leaq 0x122ea(%rip), %rax     # 0x17878
movq %rax, (%rdi)
leaq 0x8(%rdi), %rbx
leaq 0x18(%rdi), %rax
movq %rax, -0xc8(%rbp)
movq %rax, 0x8(%rdi)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
movb %al, 0x18(%rdi)
leaq 0x30(%rdi), %r15
leaq 0x40(%rdi), %rcx
movq %rcx, -0xb8(%rbp)
movq %rcx, 0x30(%rdi)
movq %rax, 0x38(%rdi)
movb %al, 0x40(%rdi)
leaq 0x58(%rdi), %r13
leaq 0x68(%rdi), %rcx
movq %rcx, -0xa8(%rbp)
movq %rcx, 0x58(%rdi)
movq %rax, 0x60(%rdi)
movb %al, 0x68(%rdi)
leaq 0x98(%rdi), %rcx
movq %rcx, -0xa0(%rbp)
movq %rcx, 0x88(%rdi)
movq %rax, 0x90(%rdi)
movb %al, 0x98(%rdi)
leaq 0xb8(%rdi), %rcx
movq %rcx, -0x98(%rbp)
movq %rcx, 0xa8(%rdi)
movq %rax, 0xb0(%rdi)
movb %al, 0xb8(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0xd0(%rdi)
movq %rax, 0xe0(%rdi)
leaq -0xe0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x80(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movq %rax, -0x30(%rbp)
leaq 0x88(%rdi), %rax
movq %rax, -0x50(%rbp)
movaps %xmm0, -0x40(%rbp)
leaq 0xa8(%rdi), %rax
movq %rax, -0x48(%rbp)
leaq -0x150(%rbp), %rdi
leaq -0x70(%rbp), %rdx
movq %r15, -0xc0(%rbp)
movq %r13, -0xb0(%rbp)
movq %rbx, -0xd0(%rbp)
callq 0x4110
leaq -0x150(%rbp), %rsi
leaq -0x40(%rbp), %rdx
movl $0x9, %edi
callq 0xf2c2
leaq -0x140(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x56c2
callq 0x4280
movq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x4170
movq -0x40(%rbp), %r14
movq 0x20(%r14), %rdi
callq 0x4460
cltq
movq %rax, 0x28(%r12)
addq $0x40, %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x4170
movq -0x40(%rbp), %r14
movq 0x60(%r14), %rdi
callq 0x4460
decl %eax
cltq
movq %rax, 0x50(%r12)
addq $0xa0, %r14
leaq -0xf0(%rbp), %rdi
movq %r14, %rsi
callq 0x4170
movq -0x40(%rbp), %r14
movq 0xc0(%r14), %rdi
addq $0xc0, %r14
leaq 0xb8ce(%rip), %rsi      # 0x11004
callq 0x43d0
testl %eax, %eax
cmoveq %r15, %r14
sete 0xc8(%r12)
movq %r13, %rdi
movq %r14, %rsi
callq 0x4170
movq -0x40(%rbp), %r14
movq 0xe0(%r14), %rdi
callq 0x4460
decl %eax
cltq
movq %rax, 0x78(%r12)
movq 0x100(%r14), %rdi
callq 0x4460
movl %eax, 0x80(%r12)
addq $0x120, %r14            # imm = 0x120
leaq -0x70(%rbp), %rdi
movq %r14, %rsi
callq 0xfaf8
leaq -0x70(%rbp), %r14
movq -0x50(%rbp), %rdi
movq %r14, %rsi
callq 0x4380
movq (%r14), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
movq -0x48(%rbp), %rbx
je 0x57ba
callq 0x4280
movl $0x140, %esi            # imm = 0x140
addq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x4170
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
subq %rdi, %rax
cmpq $0x161, %rax            # imm = 0x161
jb 0x58ac
movl $0xb, %ebx
movl $0x160, %r15d           # imm = 0x160
leaq 0xb812(%rip), %r13      # 0x11006
addq %r15, %rdi
movl $0x5, %ecx
movq %r13, %rsi
xorl %edx, %edx
callq 0x44f0
cmpq $-0x1, %rax
jne 0x582c
incq %rbx
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
subq %rdi, %rax
sarq $0x5, %rax
addq $0x20, %r15
cmpq %rbx, %rax
ja 0x57f4
jmp 0x58ac
movq %rax, %r14
movq -0x40(%rbp), %rdi
addq %r15, %rdi
leaq 0xb9cd(%rip), %rsi      # 0x1120a
movl $0x1, %ecx
movq %rax, %rdx
callq 0x44f0
cmpq $-0x1, %rax
je 0x586e
addq -0x40(%rbp), %r15
subq %r14, %rax
incq %rax
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rax, %rcx
callq 0x42d0
jmp 0x5888
addq -0x40(%rbp), %r15
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq $-0x1, %rcx
callq 0x42d0
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %r14
movq %r14, %rsi
callq 0x4380
movq (%r14), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x58ac
callq 0x4280
leaq -0x120(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x130(%rbp), %rdi
callq 0x63a2
leaq -0x100(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
addq %rsi, %rdx
leaq -0x110(%rbp), %rdi
callq 0x63a2
movq 0x50(%r12), %r9
leaq -0x130(%rbp), %rcx
leaq -0x110(%rbp), %r8
movq %r12, %rdi
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x4ba4
movq -0x110(%rbp), %rdi
cmpq %r14, %rdi
je 0x5930
callq 0x4280
movq -0x130(%rbp), %rdi
cmpq %rbx, %rdi
je 0x5941
callq 0x4280
leaq -0x40(%rbp), %rdi
callq 0x5a9a
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x595f
callq 0x4280
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x5977
callq 0x4280
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x59d2
jmp 0x59d2
movq %rax, %r15
movq -0x110(%rbp), %rdi
cmpq %r14, %rdi
je 0x59a6
callq 0x4280
jmp 0x59a6
movq %rax, %r15
movq -0x130(%rbp), %rdi
cmpq %rbx, %rdi
jne 0x59c9
jmp 0x59d5
jmp 0x59d2
movq %rax, %r15
leaq -0x140(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x59d5
callq 0x4280
jmp 0x59d5
jmp 0x59d2
movq %rax, %r15
leaq -0x40(%rbp), %rdi
callq 0x5a9a
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x59f3
callq 0x4280
addq $0xd0, %r12
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x5a12
callq 0x4280
movq (%r12), %rdi
testq %rdi, %rdi
je 0x5a20
callq 0x4280
movq -0x48(%rbp), %rax
movq (%rax), %rdi
cmpq -0x98(%rbp), %rdi
je 0x5a35
callq 0x4280
movq -0x50(%rbp), %rax
movq (%rax), %rdi
cmpq -0xa0(%rbp), %rdi
je 0x5a4a
callq 0x4280
movq -0xb0(%rbp), %rax
movq (%rax), %rdi
cmpq -0xa8(%rbp), %rdi
je 0x5a62
callq 0x4280
movq -0xc0(%rbp), %rax
movq (%rax), %rdi
cmpq -0xb8(%rbp), %rdi
je 0x5a7a
callq 0x4280
movq -0xd0(%rbp), %rax
movq (%rax), %rdi
cmpq -0xc8(%rbp), %rdi
je 0x5a92
callq 0x4280
movq %r15, %rdi
callq 0x4500