// File: /workspace/github_cpp_makefile_star2_O3/superyuan[P]refeditor/MappingConvertor.cpp
// Function: main
int main(int argc, char *argv[])
{
	if (parseParameters (argc, argv) == false) 	{
		cerr << "Version: 1.0-r7" << endl;
		cerr << "Contact: shuaiyuan.emory@gmail.com" << endl << endl;	
		cerr << "Usage: " << argv[0] <<" -i input.sam -m dipmap -o output.sam" << endl << endl;
		cerr << "Convert the sam file created from being mapped to a diploid reference genome " << endl;
		cerr << "  to being mapped to a haploid reference genome according to a dipmap file." << endl << endl;
		cerr << "Example: " << argv[0] << " -i input.sam -m hg19.di.fa.dipmap -o output.sam" << endl << endl;
		cerr << "Parameters (mandatory): " << endl;
		cerr << "  -i\t\tinput SAM file " << endl;
		cerr << "  -m\t\tdipmap file created by DiploidConstructor" << endl;
		cerr << "  -o\t\toutput SAM file" << endl;
		exit(-1);
	}

	CLineFields inputSamFile;
	if (inputSamFile.openFile(inputSamFileName)==false) {
		cerr << "Can not open sam file: " << inputSamFileName << endl;
		exit (-1);
	}
	
	ofstream outputSamFile;
	outputSamFile.open(outputSamFileName);

	// process the map file
	readMapFile(dipmapFileName);
	
	// process sam file
	inputSamFile.readline(removeHeader);
	vector<string> locations;
	while (inputSamFile.endofFile()==false) {
		if (inputSamFile.field[0][0]=='@' || inputSamFile.field[0][0]=='#') {// it is the header
			outputSamFile << inputSamFile.line << endl;
		} else {
			unsigned int flag = atoi(inputSamFile.field[1].c_str());
			if (flag & 4) {
				// the flag indicates unmapped read, so we set mapping quality to zero.
				inputSamFile.field[4] = "0";
			}
			// convert  (chr3b.300, 2)  to (chr3, 301)
			GenomePosition gp = GenomeLib::toRef(inputSamFile.field[2], inputSamFile.field[3], removeB);
			readLength = inputSamFile.field[9].length();
			// map from the extended reference allele minichromes to the real position on reference allelel.
            mapExtendedChrome(gp);
			int mm = 0;
			if (inputSamFile.field.size()>=14)
				mm = atoi(inputSamFile.field[13].substr(5).c_str());

			locations.clear();
			if (inputSamFile.field[inputSamFile.field.size()-1].substr(0,5)=="XA:Z:") { 
				// mapping quality==0 and we have chance to fix it                
    			inputSamFile.divide(inputSamFile.field[inputSamFile.field.size()-1].substr(5),";",locations);

				for (int i=0; i<(int)locations.size(); i++) {
					if(locations[i].length()==0) {
						locations.erase(locations.begin()+i);
						i=-1;//invalidate the for loop.
						continue;
					}
					vector<string> f;
					inputSamFile.divide(locations[i],",",f);
					if (f.size()<4)
						break; //skip reads with positions like:  chr3;.28387,+24,36M,2

					GenomePosition gp2 = GenomeLib::toRef(f[0], f[1], removeB);
					
					// map from the extended reference allele minichromes to the real position on reference allelel.
					mapExtendedChrome(gp2);					

					int new_mis = atoi(f[3].c_str());
					if (gp2.allele != 0) { // on non-ref alleles, maybe only partially cover the allele.
						int more_mis = abs(atoi(f[1].c_str()))-readLength;
						if (more_mis>0)
							new_mis += more_mis;  // the tail of the read is outside of the mini-chromosome.
					}
					if ((gp.chrName==gp2.chrName && gp.pos==gp2.pos) || new_mis != mm) {
						// eg. the read is mapped to both (chr1, 201) and (chr1b.200, 2).
						// or the mismatch != the first hit
						if (new_mis < mm) {
							// this hit is better than the first hit, use this to replace the first hit.
							gp = gp2;
							mm=new_mis;
						}
						locations.erase(locations.begin()+i);
						i=-1;//invalidate the for loop.
					}						
				}
				if (locations.empty()) {
					if (mm/readLength < 0.06)
						inputSamFile.field[4]="37"; // make up the mapping quality
					else
						inputSamFile.field[4]="25"; // make up the mapping quality
					flag &= ~4; //clear the "unmapped read bit"
					if (gp.strand<0)
						flag |= 16; //negtive strand;
				}
			}
			outputSamFile << inputSamFile.field[0] << "\t" << flag << "\t" << gp.chrName << "\t" << gp.pos;
			for (int i=4, size=inputSamFile.field.size(); i<size; i++) {
				outputSamFile << "\t" << inputSamFile.field[i];
			}
			outputSamFile << endl;
		}
		inputSamFile.readline(removeHeader);
	}
	inputSamFile.fp->close();
	outputSamFile.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x28e6(%rip), %r14      # 0x520f
leaq 0x5900(%rip), %r15      # 0x8230
movq 0x5681(%rip), %r12      # 0x7fb8
leaq 0x5af2(%rip), %r13      # 0x8430
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2080
cmpl $0x6c, %eax
jle 0x295f
cmpl $0x6f, %eax
je 0x2976
cmpl $0x6d, %eax
jne 0x293e
movq %r13, %rdi
jmp 0x297d
movq %r15, %rdi
cmpl $0x69, %eax
je 0x297d
cmpl $-0x1, %eax
je 0x2988
cmpl $0x3f, %eax
jne 0x293e
jmp 0x33a5
leaq 0x59b3(%rip), %rdi      # 0x8330
movq (%r12), %rsi
callq 0x21d0
jmp 0x293e
cmpb $0x0, 0x58a1(%rip)      # 0x8230
je 0x33a5
cmpb $0x0, 0x5a94(%rip)      # 0x8430
je 0x33a5
cmpb $0x0, 0x5987(%rip)      # 0x8330
je 0x33a5
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
callq 0x4340
leaq 0x586d(%rip), %rsi      # 0x8230
movq %rbx, %rdi
callq 0x4292
testb %al, %al
je 0x34f0
leaq 0x228(%rsp), %rdi
callq 0x2350
leaq 0x5949(%rip), %rsi      # 0x8330
leaq 0x228(%rsp), %rbx
movq %rbx, %rdi
movl $0x10, %edx
callq 0x2050
leaq 0x5a2d(%rip), %rdi      # 0x8430
callq 0x259c
movb 0x5b21(%rip), %bpl      # 0x8530
leaq 0x218(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2616(%rip), %rsi      # 0x5038
leaq 0x2610(%rip), %rdx      # 0x5039
leaq 0x208(%rsp), %rdi
callq 0x39b6
movzbl %bpl, %esi
leaq 0x78(%rsp), %rdi
leaq 0x208(%rsp), %rdx
callq 0x4374
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x2a69
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x2210
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0x78(%rsp), %r12
movq %r12, %rdi
callq 0x4360
testb %al, %al
jne 0x330a
movq 0x78(%rsp), %r13
movq (%r13), %rax
movzbl (%rax), %eax
cmpl $0x40, %eax
je 0x2aa7
cmpl $0x23, %eax
jne 0x2afd
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rdx
movq %rbx, %rdi
callq 0x2250
leaq 0x2572(%rip), %r13      # 0x5038
leaq 0xe8(%rsp), %r15
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
jmp 0x32a1
movq 0x20(%r13), %rdi
callq 0x2300
movl %eax, %ebp
testb $0x4, %bpl
je 0x2b35
movq 0x88(%r13), %rdx
subq $-0x80, %r13
movl $0x1, %r8d
movq %r13, %rdi
xorl %esi, %esi
leaq 0x26d2(%rip), %rcx      # 0x51fd
callq 0x22f0
movq 0x78(%rsp), %r13
leaq 0x138(%rsp), %rax
movq %rax, 0x128(%rsp)
movq 0x40(%r13), %rsi
movq 0x48(%r13), %rdx
addq %rsi, %rdx
leaq 0x128(%rsp), %rdi
callq 0x3920
movq 0x78(%rsp), %rax
leaq 0x1d8(%rsp), %rcx
movq %rcx, 0x1c8(%rsp)
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rdx
addq %rsi, %rdx
leaq 0x1c8(%rsp), %r14
movq %r14, %rdi
callq 0x3920
leaq 0x24a4(%rip), %r13      # 0x5038
movzbl 0x565d(%rip), %ecx      # 0x81f8
leaq 0xb8(%rsp), %rdi
leaq 0x128(%rsp), %rsi
movq %r14, %rdx
callq 0x3f94
movq 0x1c8(%rsp), %rdi
leaq 0x1d8(%rsp), %rax
cmpq %rax, %rdi
je 0x2bd8
movq 0x1d8(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x128(%rsp), %rdi
leaq 0x138(%rsp), %rax
cmpq %rax, %rdi
je 0x2bfd
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x78(%rsp), %rax
movl 0x128(%rax), %eax
movl %eax, 0x5926(%rip)      # 0x8534
leaq 0xb8(%rsp), %rdi
callq 0x2866
movl %ebp, 0x8(%rsp)
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rax
subq %rsi, %rax
xorl %ebp, %ebp
cmpq $0x1a1, %rax            # imm = 0x1A1
jb 0x2c7f
addq $0x1a0, %rsi            # imm = 0x1A0
movl $0x5, %edx
leaq 0x30(%rsp), %rdi
movq $-0x1, %rcx
callq 0x2230
movq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x2300
movl %eax, %ebp
leaq 0x40(%rsp), %rax
cmpq %rax, %r15
je 0x2c7f
movq 0x40(%rsp), %rsi
incq %rsi
movq %r15, %rdi
callq 0x2210
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %r15
cmpq %r14, %r15
je 0x2cc3
leaq 0x10(%r14), %r12
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0x2ca8
movq (%r12), %rsi
incq %rsi
callq 0x2210
leaq 0x20(%r12), %rax
addq $0x10, %r12
cmpq %r15, %r12
movq %rax, %r12
jne 0x2c92
movq %r14, 0x18(%rsp)
leaq 0x78(%rsp), %r12
movq 0x80(%rsp), %rsi
addq $-0x20, %rsi
movl $0x5, %ecx
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %edx, %edx
callq 0x2230
movq %r14, %rdi
leaq 0x2512(%rip), %rsi      # 0x51ff
callq 0x20b0
movl %eax, %r15d
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x2d11
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2210
testl %r15d, %r15d
jne 0x3171
movq 0x80(%rsp), %rsi
addq $-0x20, %rsi
movl $0x5, %edx
leaq 0x1e8(%rsp), %rdi
movq $-0x1, %rcx
callq 0x2230
leaq 0x1b8(%rsp), %rax
movq %rax, 0x1a8(%rsp)
leaq 0x1a8(%rsp), %r14
movq %r14, %rdi
leaq 0x24a4(%rip), %rsi      # 0x5205
leaq 0x249e(%rip), %rdx      # 0x5206
callq 0x39b6
movq %r12, %rdi
leaq 0x1e8(%rsp), %rsi
movq %r14, %rdx
leaq 0x10(%rsp), %rcx
callq 0x415c
movq 0x1a8(%rsp), %rdi
leaq 0x1b8(%rsp), %rax
cmpq %rax, %rdi
je 0x2daa
movq 0x1b8(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x1e8(%rsp), %rdi
leaq 0x1f8(%rsp), %rax
cmpq %rax, %rdi
je 0x2dcf
movq 0x1f8(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x5, %rdx
testl %edx, %edx
jle 0x3115
xorl %r14d, %r14d
movslq %r14d, %r13
shlq $0x5, %r13
leaq (%rax,%r13), %rsi
cmpq $0x0, 0x8(%rax,%r13)
je 0x2ffb
movl %r14d, 0xc(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0x118(%rsp), %rax
movq %rax, 0x108(%rsp)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq 0x108(%rsp), %rdi
movq %rax, %rsi
callq 0x3920
leaq 0x198(%rsp), %rax
movq %rax, 0x188(%rsp)
leaq 0x188(%rsp), %r15
movq %r15, %rdi
leaq 0x23a0(%rip), %rsi      # 0x5207
leaq 0x239a(%rip), %rdx      # 0x5208
callq 0x39b6
movq %r12, %rdi
leaq 0x108(%rsp), %rsi
movq %r15, %rdx
leaq 0x60(%rsp), %rcx
callq 0x415c
movq 0x188(%rsp), %rdi
leaq 0x198(%rsp), %rax
cmpq %rax, %rdi
je 0x2eb0
movq 0x198(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x2ed5
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
subq %rax, %rcx
cmpq $0x60, %rcx
jbe 0x30fa
movq %rbx, %r14
movl %ebp, %ebx
leaq 0x178(%rsp), %rcx
movq %rcx, 0x168(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x168(%rsp), %r12
movq %r12, %rdi
callq 0x3920
movq 0x60(%rsp), %rax
leaq 0x158(%rsp), %rcx
movq %rcx, 0x148(%rsp)
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
addq %rsi, %rdx
leaq 0x148(%rsp), %rbp
movq %rbp, %rdi
callq 0x3920
leaq 0x30(%rsp), %r15
movzbl 0x52a1(%rip), %ecx      # 0x81f8
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x3f94
movq 0x148(%rsp), %rdi
leaq 0x158(%rsp), %rax
cmpq %rax, %rdi
movl %ebx, %ebp
je 0x2f8c
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x2210
movq 0x168(%rsp), %rdi
leaq 0x178(%rsp), %rax
cmpq %rax, %rdi
movq %r14, %rbx
je 0x2fb4
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x2210
movq %r15, %rdi
callq 0x2866
movq 0x60(%rsp), %r15
movq 0x60(%r15), %rdi
callq 0x2300
movl %eax, %r12d
cmpl $0x0, 0x54(%rsp)
je 0x3014
movq 0x20(%r15), %rdi
callq 0x2300
movl %eax, %r15d
negl %r15d
cmovsl %eax, %r15d
subl 0x5546(%rip), %r15d     # 0x8534
testl %r15d, %r15d
jg 0x2ff6
xorl %r15d, %r15d
addl %r12d, %r15d
jmp 0x3017
xorl %r14d, %r14d
leaq 0x10(%rsp), %rdi
callq 0x3f18
leaq 0x2029(%rip), %r13      # 0x5038
jmp 0x30db
movl %r12d, %r15d
movq 0xc0(%rsp), %rdx
cmpq 0x38(%rsp), %rdx
leaq 0x78(%rsp), %r12
jne 0x3053
testq %rdx, %rdx
je 0x3046
movq 0x30(%rsp), %rsi
movq 0xb8(%rsp), %rdi
callq 0x2220
testl %eax, %eax
jne 0x3053
movl 0xd8(%rsp), %eax
cmpl 0x50(%rsp), %eax
je 0x305f
cmpl %ebp, %r15d
jne 0x305f
movl 0xc(%rsp), %r14d
jmp 0x30ab
cmpl %ebp, %r15d
jge 0x3093
leaq 0xb8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x2120
leaq 0x40(%rsp), %rcx
movl 0x18(%rcx), %eax
leaq 0xd8(%rsp), %rdx
movl %eax, 0x8(%rdx)
movq 0x10(%rcx), %rax
movq %rax, (%rdx)
movl %r15d, %ebp
addq 0x10(%rsp), %r13
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x3f18
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
leaq 0x1f79(%rip), %r13      # 0x5038
je 0x30ce
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2210
leaq 0x60(%rsp), %rdi
callq 0x383e
incl %r14d
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x5, %rdx
cmpl %edx, %r14d
jl 0x2dee
jmp 0x3115
leaq 0x60(%rsp), %rdi
callq 0x383e
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
leaq 0x1f23(%rip), %r13      # 0x5038
cmpq %rcx, %rax
jne 0x3171
movl %ebp, %eax
cltd
idivl 0x5411(%rip)            # 0x8534
movq 0x78(%rsp), %rcx
leaq 0x80(%rcx), %rdi
testl %eax, %eax
movq 0x88(%rcx), %rdx
leaq 0x20cd(%rip), %rcx      # 0x520c
leaq 0x20c3(%rip), %rax      # 0x5209
cmovleq %rax, %rcx
movl $0x2, %r8d
xorl %esi, %esi
callq 0x22f0
movl 0x8(%rsp), %ecx
andl $-0x5, %ecx
movl 0xe0(%rsp), %eax
shrl $0x1b, %eax
andl $-0x10, %eax
orl %eax, %ecx
movl %ecx, 0x8(%rsp)
movq 0x78(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x2250
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x2250
movl 0x8(%rsp), %esi
movq %r15, %rdi
callq 0x2130
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x2250
movq 0xb8(%rsp), %rsi
movq 0xc0(%rsp), %rdx
movq %r14, %rdi
callq 0x2250
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x2250
movl 0xd8(%rsp), %esi
movq %r14, %rdi
callq 0x2360
movq 0x80(%rsp), %r14
subq 0x78(%rsp), %r14
shrq $0x5, %r14
cmpl $0x5, %r14d
jl 0x3248
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
addq $-0x4, %r14
movl $0x88, %r15d
movl $0x1, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2250
movq 0x78(%rsp), %rax
movq -0x8(%rax,%r15), %rsi
movq (%rax,%r15), %rdx
movq %rbx, %rdi
callq 0x2250
addq $0x20, %r15
decq %r14
jne 0x3219
movq 0x228(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x3299
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x2210
leaq 0xe8(%rsp), %r15
movq %r15, %r14
movb 0x5285(%rip), %bpl      # 0x8530
leaq 0xf8(%rsp), %rax
movq %rax, 0xe8(%rsp)
movq %r15, %rdi
movq %r13, %rsi
leaq 0x1d71(%rip), %rdx      # 0x5039
callq 0x39b6
movzbl %bpl, %esi
movq %r12, %rdi
movq %r14, %rdx
callq 0x4374
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x2a81
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x2210
jmp 0x2a81
movq 0x90(%rsp), %rdi
callq 0x2070
leaq 0x228(%rsp), %rdi
callq 0x22b0
leaq 0x10(%rsp), %rdi
callq 0x383e
movq 0x4c93(%rip), %rax      # 0x7fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x230(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x228(%rsp,%rcx)
callq 0x21b0
leaq 0x320(%rsp), %rdi
callq 0x20c0
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3387
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2210
leaq 0x78(%rsp), %rdi
callq 0x383e
xorl %eax, %eax
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4c44(%rip), %r14      # 0x7ff0
leaq 0x1c87(%rip), %rsi      # 0x503a
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
leaq 0x1c80(%rip), %rsi      # 0x504a
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x2100
leaq 0x1c84(%rip), %rsi      # 0x506d
movq %r14, %rdi
callq 0x21f0
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x21f0
leaq 0x1c72(%rip), %rsi      # 0x5075
movq %rax, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x2100
leaq 0x1c79(%rip), %rsi      # 0x509b
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
leaq 0x1cb0(%rip), %rsi      # 0x50e9
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x2100
leaq 0x1cdd(%rip), %rsi      # 0x5135
movq %r14, %rdi
callq 0x21f0
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x21f0
leaq 0x1ccd(%rip), %rsi      # 0x513f
movq %rax, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x2100
leaq 0x1cdf(%rip), %rsi      # 0x5170
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
leaq 0x1ce1(%rip), %rsi      # 0x5189
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
leaq 0x1ce0(%rip), %rsi      # 0x519f
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
leaq 0x1cf9(%rip), %rsi      # 0x51cf
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2100
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2270
movq 0x4af9(%rip), %rdi      # 0x7ff0
leaq 0x1ce7(%rip), %rsi      # 0x51e5
movl $0x17, %edx
callq 0x2250
leaq 0x4d21(%rip), %rbx      # 0x8230
movq %rbx, %rdi
callq 0x20f0
movq 0x4ad2(%rip), %rdi      # 0x7ff0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2250
movq 0x4ac0(%rip), %rdi      # 0x7ff0
callq 0x2100
jmp 0x34e6
movq %rax, %rbx
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x3777
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x2210
jmp 0x3777
jmp 0x3571
jmp 0x3564
movq %rax, %rbx
jmp 0x3784
jmp 0x3740
movq %rax, %rbx
jmp 0x3777
movq %rax, %rbx
movq 0x1a8(%rsp), %rdi
leaq 0x1b8(%rsp), %rax
cmpq %rax, %rdi
je 0x35a6
movq 0x1b8(%rsp), %rsi
incq %rsi
callq 0x2210
jmp 0x35a6
movq %rax, %rbx
movq 0x1e8(%rsp), %rdi
leaq 0x1f8(%rsp), %rax
cmpq %rax, %rdi
je 0x3748
movq 0x1f8(%rsp), %rsi
incq %rsi
callq 0x2210
jmp 0x3748
jmp 0x3745
jmp 0x3740
jmp 0x3678
jmp 0x3740
jmp 0x3745
jmp 0x3745
movq %rax, %rbx
movq 0x1c8(%rsp), %rdi
leaq 0x1d8(%rsp), %rax
cmpq %rax, %rdi
je 0x361f
movq 0x1d8(%rsp), %rsi
incq %rsi
callq 0x2210
jmp 0x361f
movq %rax, %rbx
movq 0x128(%rsp), %rdi
leaq 0x138(%rsp), %rax
cmpq %rax, %rdi
je 0x376d
movq 0x138(%rsp), %rsi
jmp 0x3765
jmp 0x3678
jmp 0x3745
movq %rax, %rbx
movq 0x148(%rsp), %rdi
leaq 0x158(%rsp), %rax
cmpq %rax, %rdi
je 0x3698
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x2210
jmp 0x3698
jmp 0x36b7
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x370e
movq 0x40(%rsp), %rsi
jmp 0x3706
movq %rax, %rbx
movq 0x168(%rsp), %rdi
leaq 0x178(%rsp), %rax
cmpq %rax, %rdi
je 0x370e
movq 0x178(%rsp), %rsi
jmp 0x3706
movq %rax, %rbx
jmp 0x370e
movq %rax, %rbx
movq 0x188(%rsp), %rdi
leaq 0x198(%rsp), %rax
cmpq %rax, %rdi
je 0x36e9
movq 0x198(%rsp), %rsi
incq %rsi
callq 0x2210
jmp 0x36e9
movq %rax, %rbx
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x370e
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x2210
leaq 0x60(%rsp), %rdi
callq 0x383e
jmp 0x3748
jmp 0x3740
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x376d
movq 0xf8(%rsp), %rsi
jmp 0x3765
jmp 0x3745
movq %rax, %rbx
jmp 0x376d
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x376d
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x2210
leaq 0x10(%rsp), %rdi
callq 0x383e
leaq 0x228(%rsp), %rdi
callq 0x22d0
leaq 0x78(%rsp), %rdi
callq 0x3818
movq %rbx, %rdi
callq 0x2380