// File: /workspace/github_cpp_makefile_star2_O3/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 0x12322(%rip), %rax     # 0x178b0
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 0xf217
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 0x4450
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 0x4450
decl %eax
cltq
movq %rax, 0x50(%r12)
addq $0xa0, %r14
leaq -0xf0(%rbp), %rdi
movq %r14, %rsi
callq 0x4170
movq -0x40(%rbp), %rsi
movq 0xc0(%rsi), %rax
cmpb $0x3d, (%rax)
jne 0x5737
cmpb $0x0, 0x1(%rax)
je 0x5869
addq $0xc0, %rsi
xorl %eax, %eax
movb %al, 0xc8(%r12)
movq %r13, %rdi
callq 0x4170
movq -0x40(%rbp), %r14
movq 0xe0(%r14), %rdi
callq 0x4450
decl %eax
cltq
movq %rax, 0x78(%r12)
movq 0x100(%r14), %rdi
callq 0x4450
movl %eax, 0x80(%r12)
addq $0x120, %r14            # imm = 0x120
leaq -0x70(%rbp), %rdi
movq %r14, %rsi
callq 0xfa34
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 0x57b5
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 0x58b1
movl $0xb, %ebx
movl $0x160, %r15d           # imm = 0x160
leaq 0xb815(%rip), %r13      # 0x11004
addq %r15, %rdi
movl $0x5, %ecx
movq %r13, %rsi
xorl %edx, %edx
callq 0x44e0
cmpq $-0x1, %rax
jne 0x5827
incq %rbx
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
subq %rdi, %rax
sarq $0x5, %rax
addq $0x20, %r15
cmpq %rbx, %rax
ja 0x57ef
jmp 0x58b1
movq %rax, %r14
movq -0x40(%rbp), %rdi
addq %r15, %rdi
leaq 0xb9d0(%rip), %rsi      # 0x11208
movl $0x1, %ecx
movq %rax, %rdx
callq 0x44e0
cmpq $-0x1, %rax
je 0x5873
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 0x588d
movb $0x1, %al
movq %r15, %rsi
jmp 0x5740
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 0x58b1
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 0x4b94
movq -0x110(%rbp), %rdi
cmpq %r14, %rdi
je 0x5935
callq 0x4280
movq -0x130(%rbp), %rdi
cmpq %rbx, %rdi
je 0x5946
callq 0x4280
leaq -0x40(%rbp), %rdi
callq 0x5aa0
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x5964
callq 0x4280
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x597c
callq 0x4280
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x59d7
jmp 0x59d7
movq %rax, %r15
movq -0x110(%rbp), %rdi
cmpq %r14, %rdi
je 0x59ab
callq 0x4280
jmp 0x59ab
movq %rax, %r15
movq -0x130(%rbp), %rdi
cmpq %rbx, %rdi
jne 0x59ce
jmp 0x59da
jmp 0x59d7
movq %rax, %r15
leaq -0x140(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x59da
callq 0x4280
jmp 0x59da
jmp 0x59d7
movq %rax, %r15
leaq -0x40(%rbp), %rdi
callq 0x5aa0
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x59f8
callq 0x4280
addq $0xd0, %r12
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x5a17
callq 0x4280
movq (%r12), %rdi
testq %rdi, %rdi
je 0x5a25
callq 0x4280
movq -0x48(%rbp), %rax
movq (%rax), %rdi
cmpq -0x98(%rbp), %rdi
je 0x5a3a
callq 0x4280
movq -0x50(%rbp), %rax
movq (%rax), %rdi
cmpq -0xa0(%rbp), %rdi
je 0x5a4f
callq 0x4280
movq -0xb0(%rbp), %rax
movq (%rax), %rdi
cmpq -0xa8(%rbp), %rdi
je 0x5a67
callq 0x4280
movq -0xc0(%rbp), %rax
movq (%rax), %rdi
cmpq -0xb8(%rbp), %rdi
je 0x5a7f
callq 0x4280
movq -0xd0(%rbp), %rax
movq (%rax), %rdi
cmpq -0xc8(%rbp), %rdi
je 0x5a97
callq 0x4280
movq %r15, %rdi
callq 0x44f0
nop