// File: /workspace/github_cpp_makefile_star2_O3/WeiqiangZhou[P]BIRD/source/predict_function.cpp
// Function: WriteWIG(double**, char**, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, char*, int, int, int, int, double, int)
int WriteWIG(double **data_out, char **select_idx, std::vector<std::string> outname, char *outfile, int bin_size, int loci_length, int sample_size, int flag, double up_bound, int flag_log)
{
	char *part;
	char temp_name[255];
	char chrname[10];
	int startsite, count;
	double value;
	FILE * pFile;

	//standard output
	if (flag != 1)
	{
		pFile = fopen(outfile, "w");
		if (pFile != NULL)
		{
			fprintf(pFile, "Chromosome\tStart\tEnd\t");
			for (int i = 0; i < sample_size-1; i++)
			{
				fprintf(pFile, "%s\t", outname[i].c_str());
			}
			fprintf(pFile, "%s\n", outname[sample_size-1].c_str());
			for (int i = 0; i < loci_length; i++)
			{
				fprintf(pFile, "%s\t", select_idx[i]);
				for (int j = 0; j < sample_size-1; j++)
				{
					value = data_out[j][i];
					if (value < 0)
					{
						value = 0;
					}
					else if (value > up_bound)
					{
						value = up_bound;
					}
					fprintf(pFile, "%lf\t", value);   //report original output value, log2(x+1) transformed.
				}

				value = data_out[sample_size-1][i];
				if (value < 0)
				{
					value = 0;
				}
				else if (value > up_bound)
				{
					value = up_bound;
				}
				fprintf(pFile, "%lf\n", value);

			}
			fclose(pFile);
		}
		else
		{
			std::cout << "Error! Cannot write file " << outfile << std::endl;
			return 1;
		}


	}
	else    //WIG output
	{
		std::vector<std::vector<int> > location;
		std::vector<int>::iterator it;
		for (int i = 0; i < 23; i++)
		{
			location.push_back(std::vector<int>());
		}

		for (int i = 0; i < loci_length; i++)
		{
			part = strtok(select_idx[i], "\t\0");
			if (strcmp(part, "chrX") == 0)
			{
				part = strtok(NULL, "\t\0");
				startsite = atoi(part);
				location[22].push_back(startsite);
			}
			else
			{
				for (int j = 0; j < 22; j++)
				{
					sprintf(chrname, "chr%d", j + 1);
					if (strcmp(part, chrname) == 0)
					{
						part = strtok(NULL, "\t\0");
						startsite = atoi(part);
						location[j].push_back(startsite);
						break;
					}
				}
			}
		}
        
        if (flag_log != 1)
        {
            for (int i = 0; i < sample_size; i++)
            {
                count = 0;
                strcpy(temp_name, outfile);
                strcat(temp_name, ".");
                strcat(temp_name, outname[i].c_str());
                strcat(temp_name, ".wig");
                std::cout << "Writing file " << temp_name << std::endl;
                pFile = fopen(temp_name, "w");
                if (pFile != NULL)
                {
                    fprintf(pFile, "track\ttype=wiggle_0\tname=%s\tvisibility=full\tautoScale=off\tmaxHeightPixels=100:50:10\tviewLimits=0.0:100.0\tyLineOnOff=off\n", outname[i].c_str());
                    //print chr1-chr22
                    for (int j = 0; j < 22; j++)
                    {
                        fprintf(pFile, "variableStep\tchrom=chr%d\tspan=%d\n", j + 1, bin_size);
                        for (it = location[j].begin(); it != location[j].end(); it++)
                        {
                            value = pow(2, data_out[i][count]) - 1;
                            if (value < 0)
                            {
                                value = 0;
                            }
                            else if (value > pow(2,up_bound))
                            {
                                value = pow(2,up_bound);
                            }
                            count++;
                            fprintf(pFile, "%d\t%lf\n", (*it), value);        //report value is limited from 0 to 10000.
                        }
                    }
                    //print chrX
                    fprintf(pFile, "variableStep\tchrom=chrX\tspan=%d\n", bin_size);
                    for (it = location[22].begin(); it != location[22].end(); it++)
                    {
                        value = pow(2, data_out[i][count]) - 1;
                        if (value < 0)
                        {
                            value = 0;
                        }
                        else if (value > pow(2,up_bound))
                        {
                            value = pow(2,up_bound);
                        }
                        count++;
                        fprintf(pFile, "%d\t%lf\n", (*it), value);
                    }

                    fclose(pFile);
                }
                else
                {
                    std::cout << "Error! Cannot write file " << temp_name << std::endl;
                    return 1;
                }

            }
        }
        else
        {
            for (int i = 0; i < sample_size; i++)
            {
                count = 0;
                strcpy(temp_name, outfile);
                strcat(temp_name, ".");
                strcat(temp_name, outname[i].c_str());
                strcat(temp_name, ".wig");
                std::cout << "Writing file " << temp_name << std::endl;
                pFile = fopen(temp_name, "w");
                if (pFile != NULL)
                {
                    fprintf(pFile, "track\ttype=wiggle_0\tname=%s\tvisibility=full\tautoScale=off\tmaxHeightPixels=100:50:10\tviewLimits=0.0:100.0\tyLineOnOff=off\n", outname[i].c_str());
                    //print chr1-chr22
                    for (int j = 0; j < 22; j++)
                    {
                        fprintf(pFile, "variableStep\tchrom=chr%d\tspan=%d\n", j + 1, bin_size);
                        for (it = location[j].begin(); it != location[j].end(); it++)
                        {
                            value = data_out[i][count];
                            if (value < 0)
                            {
                                value = 0;
                            }
                            else if (value > up_bound)
                            {
                                value = up_bound;
                            }
                            count++;
                            fprintf(pFile, "%d\t%lf\n", (*it), value);        //report value is limited from 0 to 10000.
                        }
                    }
                    //print chrX
                    fprintf(pFile, "variableStep\tchrom=chrX\tspan=%d\n", bin_size);
                    for (it = location[22].begin(); it != location[22].end(); it++)
                    {
                        value = data_out[i][count];
                        if (value < 0)
                        {
                            value = 0;
                        }
                        else if (value > up_bound)
                        {
                            value = up_bound;
                        }
                        count++;
                        fprintf(pFile, "%d\t%lf\n", (*it), value);
                    }

                    fclose(pFile);
                }
                else
                {
                    std::cout << "Error! Cannot write file " << temp_name << std::endl;
                    return 1;
                }

            }
        }
        
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movsd %xmm0, -0x30(%rbp)
movl %r9d, %r13d
movl %r8d, -0x40(%rbp)
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, -0x50(%rbp)
movq %rdi, -0x58(%rbp)
movl 0x10(%rbp), %r12d
cmpl $0x1, 0x18(%rbp)
jne 0x5d68
movq %r15, -0x90(%rbp)
movq %rbx, -0x60(%rbp)
xorpd %xmm0, %xmm0
leaq -0x80(%rbp), %r14
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movl $0x17, %ebx
leaq -0xb0(%rbp), %r12
xorpd %xmm0, %xmm0
movapd %xmm0, -0xb0(%rbp)
movq $0x0, -0xa0(%rbp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x7238
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x59dc
callq 0x21d0
decl %ebx
jne 0x59a9
testl %r13d, %r13d
jle 0x5b20
movl %r13d, %eax
movq %rax, -0x88(%rbp)
leaq 0x2ea5(%rip), %r15      # 0x889f
xorl %ecx, %ecx
movq -0x50(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq (%rax,%rcx,8), %rdi
movq %r15, %rsi
callq 0x2300
movq %rax, %r14
movq %rax, %rdi
leaq 0x2b19(%rip), %rsi      # 0x8536
callq 0x2290
testl %eax, %eax
je 0x5aac
movl $0x18, %r15d
movq $-0x10, %r13
movl $0x1, %r12d
cmpl $0xfffffe08, %r15d      # imm = 0xFFFFFE08
je 0x5b05
leaq -0xba(%rbp), %rbx
movq %rbx, %rdi
leaq 0x2ae0(%rip), %rsi      # 0x853b
movl %r12d, %edx
xorl %eax, %eax
callq 0x2050
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2290
addq $-0x18, %r15
addq $0x18, %r13
incl %r12d
testl %eax, %eax
jne 0x5a3d
xorl %edi, %edi
leaq 0x2e17(%rip), %rsi      # 0x889f
callq 0x2300
movq %rax, %rdi
callq 0x22f0
movl %eax, -0x44(%rbp)
movq -0x80(%rbp), %rdi
movq (%rdi,%r13), %rsi
cmpq 0x8(%rdi,%r13), %rsi
je 0x5af9
addq %r13, %rdi
jmp 0x5adc
xorl %edi, %edi
movq %r15, %rsi
callq 0x2300
movq %rax, %rdi
callq 0x22f0
movl %eax, -0x44(%rbp)
movq -0x80(%rbp), %rdi
movq 0x218(%rdi), %rsi
cmpq 0x220(%rdi), %rsi
je 0x5ae7
addq $0x218, %rdi            # imm = 0x218
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, (%rdi)
jmp 0x5b05
addq $0x210, %rdi            # imm = 0x210
leaq -0x44(%rbp), %rdx
callq 0x744a
jmp 0x5b05
subq %r15, %rdi
leaq -0x44(%rbp), %rdx
callq 0x744a
movq -0x38(%rbp), %rcx
incq %rcx
cmpq -0x88(%rbp), %rcx
leaq 0x2d85(%rip), %r15      # 0x889f
jne 0x59fc
movl 0x10(%rbp), %eax
cmpl $0x1, 0x20(%rbp)
jne 0x5ed6
testl %eax, %eax
movq -0x60(%rbp), %r15
jle 0x6167
movl %eax, %eax
movq %rax, -0x50(%rbp)
leaq -0x1c0(%rbp), %r13
movq 0x648b(%rip), %r14      # 0xbfd8
xorl %r12d, %r12d
movq %r13, %rdi
movq -0x90(%rbp), %rsi
callq 0x21c0
movq %r13, %rdi
callq 0x2100
movw $0x2e, -0x1c0(%rbp,%rax)
movq %r15, %rbx
movq (%r15), %rax
movq %r12, %r15
shlq $0x5, %r15
movq (%rax,%r15), %rsi
movq %r13, %rdi
callq 0x2390
movq %r13, %rdi
callq 0x2100
movl $0x6769772e, -0x1c0(%rbp,%rax) # imm = 0x6769772E
movb $0x0, -0x1bc(%rbp,%rax)
movl $0xd, %edx
movq %r14, %rdi
leaq 0x2992(%rip), %rsi      # 0x8546
callq 0x2230
movq %r13, %rdi
callq 0x2100
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x2230
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq %r13, %rdi
leaq 0x2654(%rip), %rsi      # 0x8254
callq 0x2240
testq %rax, %rax
je 0x61ba
movq %rax, %r14
movq (%rbx), %rax
movq (%rax,%r15), %rdx
xorl %ebx, %ebx
movq %r14, %rdi
leaq 0x2930(%rip), %rsi      # 0x8554
xorl %eax, %eax
callq 0x22a0
xorl %r15d, %r15d
leaq 0x1(%rbx), %rdx
movq %r14, %rdi
leaq 0x2991(%rip), %rsi      # 0x85cd
movq %rdx, -0x38(%rbp)
movl -0x40(%rbp), %ecx
xorl %eax, %eax
callq 0x22a0
movq -0x80(%rbp), %rax
leaq (%rbx,%rbx,2), %rbx
movq (%rax,%rbx,8), %r13
cmpq 0x8(%rax,%rbx,8), %r13
je 0x5caf
movslq %r15d, %r15
movq -0x58(%rbp), %rax
movq (%rax,%r12,8), %rax
movsd (%rax,%r15,8), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
ja 0x5c88
ucomisd -0x30(%rbp), %xmm1
movapd %xmm1, %xmm0
jbe 0x5c88
movsd -0x30(%rbp), %xmm0
incq %r15
movl (%r13), %edx
movq %r14, %rdi
leaq 0x2956(%rip), %rsi      # 0x85ef
movb $0x1, %al
callq 0x22a0
addq $0x4, %r13
movq -0x80(%rbp), %rax
cmpq 0x8(%rax,%rbx,8), %r13
jne 0x5c60
movq -0x38(%rbp), %rbx
cmpq $0x16, %rbx
jne 0x5c2e
movq %r14, %rdi
leaq 0x2930(%rip), %rsi      # 0x85f7
movl -0x40(%rbp), %edx
xorl %eax, %eax
callq 0x22a0
movq -0x80(%rbp), %rax
movq 0x210(%rax), %rbx
cmpq 0x218(%rax), %rbx
leaq -0x1c0(%rbp), %r13
je 0x5d43
movslq %r15d, %r15
shlq $0x3, %r15
movq -0x58(%rbp), %rax
movq (%rax,%r12,8), %rax
movsd (%rax,%r15), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
ja 0x5d1b
ucomisd -0x30(%rbp), %xmm1
movapd %xmm1, %xmm0
jbe 0x5d1b
movsd -0x30(%rbp), %xmm0
movl (%rbx), %edx
movq %r14, %rdi
leaq 0x28c8(%rip), %rsi      # 0x85ef
movb $0x1, %al
callq 0x22a0
addq $0x4, %rbx
movq -0x80(%rbp), %rax
addq $0x8, %r15
cmpq 0x218(%rax), %rbx
jne 0x5cf3
movq %r14, %rdi
callq 0x21f0
incq %r12
cmpq -0x50(%rbp), %r12
movq -0x60(%rbp), %r15
movq 0x627b(%rip), %r14      # 0xbfd8
jne 0x5b50
jmp 0x6167
leaq 0x24e5(%rip), %rsi      # 0x8254
movq %r15, %rdi
callq 0x2240
testq %rax, %rax
je 0x6177
movq %rax, %r14
movl %r13d, -0x40(%rbp)
leaq 0x2792(%rip), %rdi      # 0x8520
movl $0x15, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x23e0
leal -0x1(%r12), %eax
movl %eax, -0x38(%rbp)
movl %eax, %r15d
cmpl $0x2, %r12d
movq %rbx, %r12
jl 0x5ddf
movq %r15, %r13
shlq $0x5, %r13
xorl %ebx, %ebx
movq (%r12), %rax
movq (%rax,%rbx), %rdx
movq %r14, %rdi
leaq 0x26c1(%rip), %rsi      # 0x8490
xorl %eax, %eax
callq 0x22a0
addq $0x20, %rbx
cmpq %rbx, %r13
jne 0x5dbd
movslq -0x38(%rbp), %rcx
movq (%r12), %rax
movq %rcx, -0x38(%rbp)
shlq $0x5, %rcx
movq (%rax,%rcx), %rdx
leaq 0x26a2(%rip), %rsi      # 0x849c
movq %r14, %rdi
xorl %eax, %eax
callq 0x22a0
movl -0x40(%rbp), %eax
testl %eax, %eax
jle 0x5ec9
movl %eax, %eax
movq %rax, -0x40(%rbp)
leaq 0x2684(%rip), %r13      # 0x84a0
xorl %r12d, %r12d
movq -0x50(%rbp), %rax
movq (%rax,%r12,8), %rdx
movq %r14, %rdi
leaq 0x265f(%rip), %rsi      # 0x8490
xorl %eax, %eax
callq 0x22a0
movl 0x10(%rbp), %eax
cmpl $0x2, %eax
jl 0x5e7f
xorl %ebx, %ebx
movq -0x58(%rbp), %rax
movq (%rax,%rbx,8), %rax
movsd (%rax,%r12,8), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
ja 0x5e6a
ucomisd -0x30(%rbp), %xmm1
movapd %xmm1, %xmm0
jbe 0x5e6a
movsd -0x30(%rbp), %xmm0
movq %r14, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x22a0
incq %rbx
cmpq %rbx, %r15
jne 0x5e42
movq -0x58(%rbp), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax,%r12,8), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
ja 0x5eab
ucomisd -0x30(%rbp), %xmm1
movapd %xmm1, %xmm0
jbe 0x5eab
movsd -0x30(%rbp), %xmm0
movq %r14, %rdi
leaq 0x273d(%rip), %rsi      # 0x85f2
movb $0x1, %al
callq 0x22a0
incq %r12
cmpq -0x40(%rbp), %r12
jne 0x5e1f
movq %r14, %rdi
callq 0x21f0
jmp 0x6170
testl %eax, %eax
movq -0x60(%rbp), %r14
jle 0x6167
movl %eax, %eax
movq %rax, -0x88(%rbp)
leaq -0x1c0(%rbp), %r15
movq 0x60df(%rip), %r13      # 0xbfd8
xorl %r12d, %r12d
movq %r15, %rdi
movq -0x90(%rbp), %rsi
callq 0x21c0
movq %r15, %rdi
callq 0x2100
movw $0x2e, -0x1c0(%rbp,%rax)
movq %r14, %rbx
movq (%r14), %rax
movq %r12, %r14
shlq $0x5, %r14
movq (%rax,%r14), %rsi
movq %r15, %rdi
callq 0x2390
movq %r15, %rdi
callq 0x2100
movl $0x6769772e, -0x1c0(%rbp,%rax) # imm = 0x6769772E
movb $0x0, -0x1bc(%rbp,%rax)
movl $0xd, %edx
movq %r13, %rdi
leaq 0x25e6(%rip), %rsi      # 0x8546
callq 0x2230
movq %r15, %rdi
callq 0x2100
movq %r13, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2230
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq %r15, %rdi
leaq 0x22a7(%rip), %rsi      # 0x8254
callq 0x2240
testq %rax, %rax
je 0x6223
movq %rax, %r13
movq (%rbx), %rax
movq (%rax,%r14), %rdx
xorl %ebx, %ebx
movq %r13, %rdi
leaq 0x2583(%rip), %rsi      # 0x8554
xorl %eax, %eax
callq 0x22a0
xorl %r14d, %r14d
leaq 0x1(%rbx), %rdx
movq %r13, %rdi
leaq 0x25e4(%rip), %rsi      # 0x85cd
movq %rdx, -0x50(%rbp)
movl -0x40(%rbp), %ecx
xorl %eax, %eax
callq 0x22a0
movq -0x80(%rbp), %rax
leaq (%rbx,%rbx,2), %r15
movq (%rax,%r15,8), %rbx
cmpq 0x8(%rax,%r15,8), %rbx
je 0x6083
movslq %r14d, %r14
movq -0x58(%rbp), %rax
movq (%rax,%r12,8), %rax
movsd (%rax,%r14,8), %xmm0
callq 0x21b0
movapd %xmm0, %xmm1
addsd 0x2444(%rip), %xmm1     # 0x8470
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
ja 0x605e
movsd -0x30(%rbp), %xmm0
movsd %xmm1, -0x38(%rbp)
callq 0x21b0
movsd -0x38(%rbp), %xmm1
ucomisd %xmm0, %xmm1
movapd %xmm1, %xmm0
jbe 0x605e
movsd -0x30(%rbp), %xmm0
callq 0x21b0
incq %r14
movl (%rbx), %edx
movq %r13, %rdi
leaq 0x2582(%rip), %rsi      # 0x85ef
movb $0x1, %al
callq 0x22a0
addq $0x4, %rbx
movq -0x80(%rbp), %rax
cmpq 0x8(%rax,%r15,8), %rbx
jne 0x600d
movq -0x50(%rbp), %rbx
cmpq $0x16, %rbx
jne 0x5fdb
movq %r13, %rdi
leaq 0x255c(%rip), %rsi      # 0x85f7
movl -0x40(%rbp), %edx
xorl %eax, %eax
callq 0x22a0
movq -0x80(%rbp), %rax
movq 0x210(%rax), %r15
cmpq 0x218(%rax), %r15
je 0x613d
movslq %r14d, %rbx
shlq $0x3, %rbx
movq -0x58(%rbp), %rax
movq (%rax,%r12,8), %rax
movsd (%rax,%rbx), %xmm0
callq 0x21b0
movapd %xmm0, %xmm1
addsd 0x238e(%rip), %xmm1     # 0x8470
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
ja 0x6114
movsd -0x30(%rbp), %xmm0
movsd %xmm1, -0x38(%rbp)
callq 0x21b0
movsd -0x38(%rbp), %xmm1
ucomisd %xmm0, %xmm1
movapd %xmm1, %xmm0
jbe 0x6114
movsd -0x30(%rbp), %xmm0
callq 0x21b0
movl (%r15), %edx
movq %r13, %rdi
leaq 0x24ce(%rip), %rsi      # 0x85ef
movb $0x1, %al
callq 0x22a0
addq $0x4, %r15
movq -0x80(%rbp), %rax
addq $0x8, %rbx
cmpq 0x218(%rax), %r15
jne 0x60c4
movq %r13, %rdi
callq 0x21f0
incq %r12
cmpq -0x88(%rbp), %r12
movq -0x60(%rbp), %r14
leaq -0x1c0(%rbp), %r15
movq 0x5e77(%rip), %r13      # 0xbfd8
jne 0x5efc
leaq -0x80(%rbp), %rdi
callq 0x66f4
xorl %eax, %eax
jmp 0x62d8
movq 0x5e5a(%rip), %rbx      # 0xbfd8
leaq 0x2320(%rip), %rsi      # 0x84a5
movl $0x19, %edx
movq %rbx, %rdi
callq 0x2230
testq %r15, %r15
je 0x6295
movq %r15, %rdi
callq 0x2100
movq 0x5e2e(%rip), %rdi      # 0xbfd8
movq %r15, %rsi
movq %rax, %rdx
callq 0x2230
jmp 0x62ac
movq 0x5e17(%rip), %rdi      # 0xbfd8
leaq 0x22dd(%rip), %rsi      # 0x84a5
movl $0x19, %edx
callq 0x2230
leaq -0x1c0(%rbp), %r14
movq %r14, %rdi
callq 0x2100
movq 0x5df0(%rip), %rbx      # 0xbfd8
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x2230
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq 0x5dc4(%rip), %rdi      # 0xbfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
jmp 0x628a
movq 0x5dae(%rip), %rdi      # 0xbfd8
leaq 0x2274(%rip), %rsi      # 0x84a5
movl $0x19, %edx
callq 0x2230
leaq -0x1c0(%rbp), %r14
movq %r14, %rdi
callq 0x2100
movq 0x5d87(%rip), %rbx      # 0xbfd8
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x2230
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq 0x5d5b(%rip), %rdi      # 0xbfd8
callq 0x2040
movq %rax, %rdi
callq 0x2150
leaq -0x80(%rbp), %rdi
callq 0x66f4
jmp 0x62d3
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x2360
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movl $0x1, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x62f4
jmp 0x62f4
jmp 0x62f4
jmp 0x62f4
jmp 0x62f4
movq %rax, %rbx
jmp 0x630d
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x630d
callq 0x21d0
leaq -0x80(%rbp), %rdi
callq 0x66f4
movq %rbx, %rdi
callq 0x2380