// File: ChnMasterOG[P]KmerGO2/kmergo/kmer_union.cpp
// Function: kmer_union(KmerGO_parameters&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
short kmer_union(KmerGO_parameters& p, std::string &loginfo)
{
	std::vector<std::string> files, ab_files, kmerdb_list, beacon_list, beacon_kmer;
	std::vector<uint64> ALLcounter;
	std::vector<float> ALLfcounter;
	uint32 files_number;
	uint32 i, j;
	uint64 k, Allkmernumber = 0;

	getFiles(p.kmercountings_path, ab_files, true);
	getFiles(p.kmercountings_path, files, false);
	files_number = files.size();

	for (i = 0; i < files_number; i++)
	{
		if (files[i].compare(files[i].length() - 8, 8, ".kmc_suf", 0, 8) == 0)
		{
			kmerdb_list.push_back(files[i].substr(0, files[i].length() - 8));
		}
	}

	if (kmerdb_list.size() * 2 < files_number)
	{
		loginfo = "The number of k-mer database is error.";
		return -1;
	}

	//count all k-mer counters and k-mer number
	CKMCFile kmer_data_base;
	CKmerAPI* kmer_object;
	uint64 temp, counter;
	uint32 _kmer_length = 4;
	for (i = 0; i < kmerdb_list.size(); i++)
	{
		temp = 0;
		if (!kmer_data_base.OpenForListing(joinPath(p.kmercountings_path, kmerdb_list[i])))
		{
			loginfo = "Can not open some k-mer database.";
			return -2;
		}
		_kmer_length = kmer_data_base.KmerLength();
		kmer_object = new CKmerAPI(_kmer_length);
		while (kmer_data_base.ReadNextKmer(*kmer_object, counter))
		{
			temp += counter;
			Allkmernumber++;
		}
		delete kmer_object;
		ALLcounter.push_back(temp);
		kmer_data_base.Close();
	}

	//divided to process_number blocks
	std::string temp_kmer;
	for (i = 0; i < p.process_number; i++)
	{
		temp_kmer = "";
		if (p.process_number < 40)	//distribute k-mer nonuniformly
			distribute_kmer_nonuniformly(0, i * 10000 / p.process_number, 10000, temp_kmer);
		else	//distribute k-mer uniformly
			distribute_kmer_uniformly(0, i * 256 / p.process_number, temp_kmer);
		for (j = 0; j < _kmer_length - 4; j++) temp_kmer += "A";
		beacon_list.push_back(temp_kmer);
	}
	temp_kmer = "TTTT";
	for (i = 0; i < _kmer_length - 4; i++) temp_kmer += "T";
	beacon_list.push_back(temp_kmer);
	
	// normalization coefficient
	short power = -5;
	for (i = 0; i < kmerdb_list.size(); i++)
	{
		j = 0;
		k = ALLcounter[i];
		while (k != 0)
		{
			k /= 10;
			j++;
		}
		if (power < (short)j - 4) power = j - 4;
	}
	for (i = 0; i < kmerdb_list.size(); i++)
	{
		if (power > 0) ALLfcounter.push_back(ALLcounter[i] / pow(10, power));
		else ALLfcounter.push_back(ALLcounter[i] * pow(10, -power));
	}

	//start threads
	std::vector<std::thread> sub_thread;
	for (i = 0; i < p.process_number; i++)
	{
		beacon_kmer.push_back(beacon_list[i]);
		beacon_kmer.push_back(beacon_list[i + 1]);
		sub_thread.push_back(std::thread(get_Son_Matrix, i, p, kmerdb_list, beacon_kmer, ALLfcounter));
		beacon_kmer.clear();
	}
	sub_thread.push_back(std::thread(show_Progress, Allkmernumber));
	for (i = 0; i < p.process_number; i++)
	{
		sub_thread[i].join();
	}
	sub_thread[p.process_number].join();

	switch (union_err_number)
	{
	case -11:
		loginfo = "Can not open some k-mer database in at least one thread.";
	case -12:
		loginfo = "Can not open output files in at least one thread.";
	default:
		break;
	}

	return union_err_number;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3c0, %rsp            # imm = 0x3C0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x406f20
leaq -0x48(%rbp), %rdi
callq 0x406f20
leaq -0x60(%rbp), %rdi
callq 0x406f20
leaq -0x78(%rbp), %rdi
callq 0x406f20
leaq -0x90(%rbp), %rdi
callq 0x406f20
leaq -0xa8(%rbp), %rdi
callq 0x40be40
leaq -0xc0(%rbp), %rdi
callq 0x40be60
movq $0x0, -0xe0(%rbp)
movq -0x10(%rbp), %rsi
addq $0x40, %rsi
leaq -0x100(%rbp), %rdi
callq 0x4a15e0
jmp 0x40a67c
leaq -0x100(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movl $0x1, %edx
callq 0x406fc0
jmp 0x40a693
leaq -0x100(%rbp), %rdi
callq 0x49efd0
movq -0x10(%rbp), %rsi
addq $0x40, %rsi
leaq -0x130(%rbp), %rdi
callq 0x4a15e0
jmp 0x40a6b5
leaq -0x130(%rbp), %rdi
leaq -0x30(%rbp), %rsi
xorl %edx, %edx
callq 0x406fc0
jmp 0x40a6c9
leaq -0x130(%rbp), %rdi
callq 0x49efd0
leaq -0x30(%rbp), %rdi
callq 0x4072c0
movl %eax, -0xc4(%rbp)
movl $0x0, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
cmpl -0xc4(%rbp), %eax
jae 0x40a923
movl -0xc8(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x338(%rbp)
callq 0x4072e0
movq -0x338(%rbp), %rdi
movq %rax, -0x330(%rbp)
movl -0xc8(%rbp), %eax
movl %eax, %esi
callq 0x4072e0
movq %rax, %rdi
callq 0x49f200
addq $-0x8, %rax
movq %rax, -0x328(%rbp)
leaq -0x151(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x42ffd0
movq -0x320(%rbp), %rdx
leaq 0x1ab962(%rip), %rsi    # 0x5b60c9
leaq -0x150(%rbp), %rdi
callq 0x406db0
jmp 0x40a775
movq -0x328(%rbp), %rsi
movq -0x330(%rbp), %rdi
xorl %eax, %eax
movl %eax, %r8d
leaq -0x150(%rbp), %rcx
movl $0x8, %r9d
movq %r9, %rdx
callq 0x4a1120
movl %eax, -0x33c(%rbp)
jmp 0x40a7a5
leaq -0x150(%rbp), %rdi
callq 0x49efd0
leaq -0x151(%rbp), %rdi
callq 0x42fff0
movl -0x33c(%rbp), %eax
cmpl $0x0, %eax
jne 0x40a90d
movl -0xc8(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x4072e0
movq -0x350(%rbp), %rdi
movq %rax, -0x348(%rbp)
movl -0xc8(%rbp), %eax
movl %eax, %esi
callq 0x4072e0
movq %rax, %rdi
callq 0x49f200
movq -0x348(%rbp), %rsi
movq %rax, %rcx
addq $-0x8, %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x178(%rbp), %rdi
callq 0x4a1800
jmp 0x40a827
leaq -0x60(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x407910
jmp 0x40a839
leaq -0x178(%rbp), %rdi
callq 0x49efd0
jmp 0x40a90d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
jmp 0x40b32f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x49efd0
jmp 0x40b32f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x49efd0
jmp 0x40b32f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
jmp 0x40a8d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x49efd0
leaq -0x151(%rbp), %rdi
callq 0x42fff0
jmp 0x40b32f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x49efd0
jmp 0x40b32f
jmp 0x40a90f
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x40a6ee
leaq -0x60(%rbp), %rdi
callq 0x4072c0
shlq %rax
movl -0xc4(%rbp), %ecx
cmpq %rcx, %rax
jae 0x40a961
movq -0x18(%rbp), %rdi
leaq 0x1ab9f5(%rip), %rsi    # 0x5b633a
callq 0x4a0020
jmp 0x40a94c
movw $0xffff, -0x2(%rbp)     # imm = 0xFFFF
movl $0x1, -0x17c(%rbp)
jmp 0x40b2da
leaq -0x240(%rbp), %rdi
callq 0x424400
jmp 0x40a96f
movl $0x4, -0x25c(%rbp)
movl $0x0, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
movq %rax, -0x358(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x4072c0
movq %rax, %rcx
movq -0x358(%rbp), %rax
cmpq %rcx, %rax
jae 0x40ac46
movq $0x0, -0x250(%rbp)
movq -0x10(%rbp), %rsi
addq $0x40, %rsi
leaq -0x2a0(%rbp), %rdi
callq 0x4a15e0
jmp 0x40a9cd
movl -0xc8(%rbp), %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdi
callq 0x4072e0
movq %rax, %rsi
leaq -0x2c0(%rbp), %rdi
callq 0x4a15e0
jmp 0x40a9ef
leaq -0x280(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
leaq -0x2c0(%rbp), %rdx
callq 0x407470
jmp 0x40aa0b
leaq -0x240(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x424150
movb %al, -0x359(%rbp)
jmp 0x40aa26
movb -0x359(%rbp), %al
xorb $-0x1, %al
movb %al, -0x35a(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x49efd0
leaq -0x2c0(%rbp), %rdi
callq 0x49efd0
leaq -0x2a0(%rbp), %rdi
callq 0x49efd0
movb -0x35a(%rbp), %al
testb $0x1, %al
jne 0x40aa67
jmp 0x40ab08
movq -0x18(%rbp), %rdi
leaq 0x1ab8ef(%rip), %rsi    # 0x5b6361
callq 0x4a0020
jmp 0x40aa79
movw $0xfffe, -0x2(%rbp)     # imm = 0xFFFE
movl $0x1, -0x17c(%rbp)
jmp 0x40b2be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
jmp 0x40b2cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
jmp 0x40aaf7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
jmp 0x40aaeb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x49efd0
leaq -0x2c0(%rbp), %rdi
callq 0x49efd0
leaq -0x2a0(%rbp), %rdi
callq 0x49efd0
jmp 0x40b2cc
leaq -0x240(%rbp), %rdi
callq 0x4257e0
movl %eax, -0x360(%rbp)
jmp 0x40ab1c
movl -0x360(%rbp), %eax
movl %eax, -0x25c(%rbp)
movl $0x18, %edi
callq 0x42fb50
movq %rax, -0x368(%rbp)
jmp 0x40ab3b
movq -0x368(%rbp), %rdi
movl -0x25c(%rbp), %esi
callq 0x40b540
jmp 0x40ab4f
movq -0x368(%rbp), %rax
movq %rax, -0x248(%rbp)
movq -0x248(%rbp), %rsi
leaq -0x240(%rbp), %rdi
leaq -0x258(%rbp), %rdx
callq 0x425170
movb %al, -0x369(%rbp)
jmp 0x40ab7f
movb -0x369(%rbp), %al
testb $0x1, %al
jne 0x40ab8b
jmp 0x40abdc
movq -0x258(%rbp), %rax
addq -0x250(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x40ab5d
movq -0x368(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
movl $0x18, %esi
callq 0x42ec90
jmp 0x40b2cc
movq -0x248(%rbp), %rax
movq %rax, -0x378(%rbp)
cmpq $0x0, %rax
je 0x40ac0d
movq -0x378(%rbp), %rdi
callq 0x40bcf0
movq -0x378(%rbp), %rdi
movl $0x18, %esi
callq 0x42ec90
leaq -0xa8(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x40be80
jmp 0x40ac22
leaq -0x240(%rbp), %rdi
callq 0x4254b0
jmp 0x40ac30
jmp 0x40ac32
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x40a983
leaq -0x2e0(%rbp), %rdi
callq 0x49eec0
movl $0x0, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0xc(%rcx), %ecx
cmpl %ecx, %eax
jae 0x40ad72
leaq 0x1cf289(%rip), %rsi    # 0x5d9f02
leaq -0x2e0(%rbp), %rdi
callq 0x4a0020
jmp 0x40ac87
movq -0x10(%rbp), %rax
movzwl 0xc(%rax), %eax
cmpl $0x28, %eax
jge 0x40acdc
movl -0xc8(%rbp), %eax
imull $0x2710, %eax, %eax     # imm = 0x2710
movq -0x10(%rbp), %rcx
movzwl 0xc(%rcx), %ecx
xorl %edi, %edi
movl %edi, %edx
divl %ecx
movl %eax, %esi
movl $0x2710, %edx           # imm = 0x2710
leaq -0x2e0(%rbp), %rcx
callq 0x40a320
jmp 0x40acc3
jmp 0x40ad05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
jmp 0x40b2b0
movl -0xc8(%rbp), %eax
shll $0x8, %eax
movq -0x10(%rbp), %rcx
movzwl 0xc(%rcx), %ecx
xorl %edi, %edi
movl %edi, %edx
divl %ecx
movl %eax, %esi
leaq -0x2e0(%rbp), %rdx
callq 0x40a4d0
jmp 0x40ad03
jmp 0x40ad05
movl $0x0, -0xcc(%rbp)
movl -0xcc(%rbp), %eax
movl -0x25c(%rbp), %ecx
subl $0x4, %ecx
cmpl %ecx, %eax
jae 0x40ad4a
leaq 0x1c1164(%rip), %rsi    # 0x5cbe8d
leaq -0x2e0(%rbp), %rdi
callq 0x4a07d0
jmp 0x40ad37
jmp 0x40ad39
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x40ad0f
leaq -0x78(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x40bef0
jmp 0x40ad5c
jmp 0x40ad5e
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x40ac5c
leaq 0x1ab60a(%rip), %rsi    # 0x5b6383
leaq -0x2e0(%rbp), %rdi
callq 0x4a0020
jmp 0x40ad87
movl $0x0, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
movl -0x25c(%rbp), %ecx
subl $0x4, %ecx
cmpl %ecx, %eax
jae 0x40adcc
leaq 0x1c10ea(%rip), %rsi    # 0x5cbe95
leaq -0x2e0(%rbp), %rdi
callq 0x4a07d0
jmp 0x40adb9
jmp 0x40adbb
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x40ad91
leaq -0x78(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x40bef0
jmp 0x40adde
movw $0xfffb, -0x2e2(%rbp)   # imm = 0xFFFB
movl $0x0, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
movq %rax, -0x380(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x4072c0
movq %rax, %rcx
movq -0x380(%rbp), %rax
cmpq %rcx, %rax
jae 0x40aeb2
movl $0x0, -0xcc(%rbp)
movl -0xc8(%rbp), %eax
movl %eax, %esi
leaq -0xa8(%rbp), %rdi
callq 0x40bf60
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
cmpq $0x0, -0xd8(%rbp)
je 0x40ae75
movq -0xd8(%rbp), %rax
movl $0xa, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, -0xd8(%rbp)
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x40ae42
movswl -0x2e2(%rbp), %eax
movl -0xcc(%rbp), %ecx
movswl %cx, %ecx
subl $0x4, %ecx
cmpl %ecx, %eax
jge 0x40ae9c
movl -0xcc(%rbp), %eax
subl $0x4, %eax
movw %ax, -0x2e2(%rbp)
jmp 0x40ae9e
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x40adf1
movl $0x0, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
movq %rax, -0x388(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x4072c0
movq %rax, %rcx
movq -0x388(%rbp), %rax
cmpq %rcx, %rax
jae 0x40b038
movswl -0x2e2(%rbp), %eax
cmpl $0x0, %eax
jle 0x40af8c
movl -0xc8(%rbp), %eax
movl %eax, %esi
leaq -0xa8(%rbp), %rdi
callq 0x40bf60
movq (%rax), %xmm0
movaps 0x1ab35c(%rip), %xmm1   # 0x5b6270
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x1ab360(%rip), %xmm1   # 0x5b6280
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0x398(%rbp)
movswl -0x2e2(%rbp), %esi
movl $0xa, %edi
callq 0x40bfb0
movsd %xmm0, -0x390(%rbp)
jmp 0x40af52
movsd -0x390(%rbp), %xmm1
movsd -0x398(%rbp), %xmm0
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x2e8(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x40bf80
jmp 0x40af87
jmp 0x40b022
movl -0xc8(%rbp), %eax
movl %eax, %esi
leaq -0xa8(%rbp), %rdi
callq 0x40bf60
movq (%rax), %xmm0
movaps 0x1ab2c5(%rip), %xmm1   # 0x5b6270
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x1ab2c9(%rip), %xmm1   # 0x5b6280
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0x3a8(%rbp)
movswl -0x2e2(%rbp), %esi
negl %esi
movl $0xa, %edi
callq 0x40bfe0
movsd %xmm0, -0x3a0(%rbp)
jmp 0x40afeb
movsd -0x3a0(%rbp), %xmm1
movsd -0x3a8(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x2ec(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0x2ec(%rbp), %rsi
callq 0x40bf80
jmp 0x40b020
jmp 0x40b022
jmp 0x40b024
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x40aebc
leaq -0x308(%rbp), %rdi
callq 0x40c010
movl $0x0, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0xc(%rcx), %ecx
cmpl %ecx, %eax
jae 0x40b15d
movl -0xc8(%rbp), %eax
movl %eax, %esi
leaq -0x78(%rbp), %rdi
callq 0x4072e0
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
callq 0x40bef0
jmp 0x40b086
movl -0xc8(%rbp), %eax
incl %eax
movl %eax, %esi
leaq -0x78(%rbp), %rdi
callq 0x4072e0
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
callq 0x40bef0
jmp 0x40b0aa
movq -0x10(%rbp), %rcx
movq %rsp, %rax
leaq -0xc0(%rbp), %rdx
movq %rdx, (%rax)
leaq -0x2342(%rip), %rsi     # 0x408d80
leaq -0x310(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
leaq -0x60(%rbp), %r8
leaq -0x90(%rbp), %r9
callq 0x40c060
jmp 0x40b0e2
leaq -0x308(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0x40c030
jmp 0x40b0f7
leaq -0x310(%rbp), %rdi
callq 0x40c140
leaq -0x90(%rbp), %rdi
callq 0x4078f0
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x40b04e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
jmp 0x40b2a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x40c140
jmp 0x40b2a4
leaq 0x22c(%rip), %rsi       # 0x40b390
leaq -0x318(%rbp), %rdi
leaq -0xe0(%rbp), %rdx
callq 0x40c170
jmp 0x40b179
leaq -0x308(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x40c030
jmp 0x40b18e
leaq -0x318(%rbp), %rdi
callq 0x40c140
movl $0x0, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0xc(%rcx), %ecx
cmpl %ecx, %eax
jae 0x40b20a
movl -0xc8(%rbp), %eax
movl %eax, %esi
leaq -0x308(%rbp), %rdi
callq 0x40c230
movq %rax, %rdi
callq 0x4a1e00
jmp 0x40b1d4
jmp 0x40b1d6
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x40b1a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
leaq -0x318(%rbp), %rdi
callq 0x40c140
jmp 0x40b2a4
movq -0x10(%rbp), %rax
movzwl 0xc(%rax), %eax
movl %eax, %esi
leaq -0x308(%rbp), %rdi
callq 0x40c230
movq %rax, %rdi
callq 0x4a1e00
jmp 0x40b22a
movswl 0x22f449(%rip), %eax    # 0x63a67a
movl %eax, -0x3ac(%rbp)
subl $-0xc, %eax
je 0x40b25f
jmp 0x40b23e
movl -0x3ac(%rbp), %eax
subl $-0xb, %eax
jne 0x40b273
jmp 0x40b24b
movq -0x18(%rbp), %rdi
leaq 0x1ab05c(%rip), %rsi    # 0x5b62b2
callq 0x4a0020
jmp 0x40b25d
jmp 0x40b25f
movq -0x18(%rbp), %rdi
leaq 0x1ab08d(%rip), %rsi    # 0x5b62f7
callq 0x4a0020
jmp 0x40b271
jmp 0x40b273
jmp 0x40b275
movw 0x22f3fe(%rip), %ax     # 0x63a67a
movw %ax, -0x2(%rbp)
movl $0x1, -0x17c(%rbp)
leaq -0x308(%rbp), %rdi
callq 0x40c250
leaq -0x2e0(%rbp), %rdi
callq 0x49efd0
jmp 0x40b2be
leaq -0x308(%rbp), %rdi
callq 0x40c250
leaq -0x2e0(%rbp), %rdi
callq 0x49efd0
jmp 0x40b2cc
leaq -0x240(%rbp), %rdi
callq 0x424450
jmp 0x40b2da
leaq -0x240(%rbp), %rdi
callq 0x424450
jmp 0x40b32f
leaq -0xc0(%rbp), %rdi
callq 0x40c2b0
leaq -0xa8(%rbp), %rdi
callq 0x40c310
leaq -0x90(%rbp), %rdi
callq 0x407800
leaq -0x78(%rbp), %rdi
callq 0x407800
leaq -0x60(%rbp), %rdi
callq 0x407800
leaq -0x48(%rbp), %rdi
callq 0x407800
leaq -0x30(%rbp), %rdi
callq 0x407800
movw -0x2(%rbp), %ax
addq $0x3c0, %rsp            # imm = 0x3C0
popq %rbp
retq
leaq -0xc0(%rbp), %rdi
callq 0x40c2b0
leaq -0xa8(%rbp), %rdi
callq 0x40c310
leaq -0x90(%rbp), %rdi
callq 0x407800
leaq -0x78(%rbp), %rdi
callq 0x407800
leaq -0x60(%rbp), %rdi
callq 0x407800
leaq -0x48(%rbp), %rdi
callq 0x407800
leaq -0x30(%rbp), %rdi
callq 0x407800
movq -0x108(%rbp), %rdi
callq 0x4d3c10
nopw %cs:(%rax,%rax)