// File: gersteinlab[P]MUSIC/src/ms_filter_utils.cpp
// Function: multiscale_avg_filter_data(double*, int, double, double, double, std::vector<double, std::allocator<double>>*, bool, bool, bool, std::vector<std::vector<t_annot_region*, std::allocator<t_annot_region*>>*, std::allocator<std::vector<t_annot_region*, std::allocator<t_annot_region*>>*>>*, std::vector<std::vector<t_annot_region*, std::allocator<t_annot_region*>>*, std::allocator<std::vector<t_annot_region*, std::allocator<t_annot_region*>>*>>*, char*)
vector<double*>* multiscale_avg_filter_data(double* track_data, 
	int l_track_data, 
	double scale_start, double scale_end, double log_scale_step, 
	vector<double>* scales_per_i_scale,
	bool dump_decomposition,
	bool compute_extrema_regions,
	bool dump_extrema_regions,
	vector<vector<t_annot_region*>*>* per_scale_minima_regions, 
	vector<vector<t_annot_region*>*>* per_scale_maxima_regions,
	char* op_file_prefix)
{
	vector<double*>* decomps = new vector<double*>();

	// Start from the first scale, go over all the scales and filter the data.
	double scale = 1.0 / log_scale_step;
	int i_scale = 0;
	while(1)
	{
		scale *= log_scale_step;

		scales_per_i_scale->push_back(scale);

		// Are we going to process a scale within the requested limits? If not, we will skip this computation to save time.
		if(scale < scale_start)
		{
			decomps->push_back(NULL);

			if(compute_extrema_regions)
			{
				if(per_scale_minima_regions != NULL)
				{
					per_scale_minima_regions->push_back(new vector<t_annot_region*>());
				}

				if(per_scale_maxima_regions != NULL)
				{
					per_scale_maxima_regions->push_back(new vector<t_annot_region*>());
				}
			}

			i_scale++;
			continue;
		}
		else
		{
if(__DUMP_FILTER_MSGS__)
{
			fprintf(stderr, "Processing scale %lf (%lf)\n", scale, scale_end);
}

			// Get the filter for the current scale: The gaussian filter.
			int int_scale = (int)(scale);
			int l_averaging_win = ((int_scale % 2) == 1)?(int_scale-1):(int_scale);

			// Do copying from start to end.
			double* cur_filtered_track = new double[l_track_data + 2];

			int n_signal_wins = 0;
			int half_l_averaging = l_averaging_win / 2;

			// Initialize the current pdf.
			//int* cur_win_pdf = NULL;
			//int cur_win_max = 0;
			//int cur_win_min = 1000*1000;
			//double* cur_win_vals = new double[l_averaging_win + 2];
			int prev_avg_start = 0;
			int prev_avg_end = 0;

			// Go over all the positions as the middle of the filtering window.
			double cur_win_total = -123123;
			for(int cur_win_mid = 0; cur_win_mid < l_track_data; cur_win_mid++)
			{
				int cur_avg_start = (cur_win_mid > half_l_averaging)?(cur_win_mid - half_l_averaging):(1);
				int cur_avg_end = (cur_win_mid + half_l_averaging <= l_track_data)?(cur_win_mid + half_l_averaging):(l_track_data);
				if(cur_win_total == -123123)
				{
					// Get the total by a loop for the current window.
					cur_win_total = 0.0;
					for(int i = cur_avg_start; i <= cur_avg_end; i++)
					{
						cur_win_total += track_data[i];
					} // i loop.
				} // cur_win_pdf is NULL check.
				else
				{
					// Remove the old values from the pdf, add the new values.
					for(int i = prev_avg_start; i < cur_avg_start; i++)
					{
						cur_win_total -= track_data[i];
					} // i loop.

					// Update the min and max only for the values that are new in this window.
					for(int i = prev_avg_end+1; i <= cur_avg_end; i++)
					{
						cur_win_total += track_data[i];
					}
				} // cur_win_pdf is NULL check.

				// Set the median.
				cur_filtered_track[cur_win_mid] = cur_win_total / l_averaging_win;

				// Update the previous averaging window limits.
				prev_avg_start = cur_avg_start;
				prev_avg_end = cur_avg_end;

#undef _MANUAL_TOTAL_CHECK_
#ifdef _MANUAL_TOTAL_CHECK_
				// Get the median via qsort and compare as a sanity check.
				double manual_total = 0.0;
				for(int i = cur_avg_start; i <= cur_avg_end; i++)
				{
					manual_total += track_data[i];
				} // i loop.

				if(manual_total != cur_win_total)
				{
					fprintf(stderr, "Sanity check failed at manual total check, %s(%d)\n", __FILE__, __LINE__);
					exit(0);
				}
#endif // _MANUAL_TOTAL_CHECK_

				n_signal_wins++;
			} // main signal filtering loop.

			// Copy the data.
			if(dump_decomposition)
			{
				// Dump and free memory.
				char cur_decomp_fp[1000];
				//sprintf(cur_decomp_fp, "decomp_%d_%d_%d.bin", i_scale, cur_win_start, cur_win_start + cur_l_win);
				sprintf(cur_decomp_fp, "%s_scale_%d.bin", op_file_prefix, i_scale);
				fprintf(stderr, "Dumping %s\n", cur_decomp_fp);
				double* _cur_filtered_track = get_one_indexed_per_zero_indexed_data(cur_filtered_track, l_track_data);
				dump_per_nucleotide_binary_profile(_cur_filtered_track, l_track_data, cur_decomp_fp);
				fprintf(stderr, "Closing file\n");

				// Clean track memory.
				delete [] _cur_filtered_track;
				delete [] cur_filtered_track;
			}
			else if(compute_extrema_regions)
			{
if(__DUMP_FILTER_MSGS__)
				fprintf(stderr, "Getting the extrema regions.\n");

				// Get the extrema regions for the current filtered regions.
				vector<t_extrema_node*>* maxima = new vector<t_extrema_node*>();
				vector<t_extrema_node*>* minima = new vector<t_extrema_node*>();
				int* derivative_map = new int[l_track_data+2];
				memset(derivative_map, 0, sizeof(int) * (l_track_data+2));
				get_extrema_per_plateaus(cur_filtered_track, l_track_data, maxima, minima, derivative_map, 0);

				// Sort the extremas.
				sort(minima->begin(), minima->end(), sort_extremas_per_posn);
				sort(maxima->begin(), maxima->end(), sort_extremas_per_posn);

				if(dump_extrema_regions)
				{
					// Get the minima and maxima, then dump.
					char cur_minima_regs_fp[1000];
					char cur_maxima_regs_fp[1000];
					sprintf(cur_minima_regs_fp, "%s_scale_%d_mins.bed", op_file_prefix, i_scale);
					sprintf(cur_maxima_regs_fp, "%s_scale_%d_maxes.bed", op_file_prefix, i_scale);

					fprintf(stderr, "Dumping the extrema regions.\n");
					FILE* f_maxes = open_f(cur_maxima_regs_fp, "w");
					for(int i_m = 0; i_m < (int)maxima->size(); i_m++)
					{
						fprintf(f_maxes, "XX\t%d\t%d\n", translate_coord(maxima->at(i_m)->extrema_posn+1, CODEBASE_COORDS::start_base, BED_COORDS::start_base),
							translate_coord(maxima->at(i_m)->extrema_posn+1, CODEBASE_COORDS::end_base, BED_COORDS::end_base));
					} // i_m loop.
					fclose(f_maxes);

					FILE* f_mins = open_f(cur_minima_regs_fp, "w");
					for(int i_m = 0; i_m < (int)minima->size()-1; i_m++)
					{
						fprintf(f_mins, "XX\t%d\t%d\n", translate_coord(minima->at(i_m)->extrema_posn+1, CODEBASE_COORDS::start_base, BED_COORDS::start_base),
							translate_coord(minima->at(i_m+1)->extrema_posn+1, CODEBASE_COORDS::end_base, BED_COORDS::end_base));
					} // i_m loop.
					fclose(f_mins);
				}

				if(per_scale_minima_regions != NULL)
				{
					vector<t_annot_region*>* cur_scale_minima_regions = new vector<t_annot_region*>();
					for(int i_m = 0; i_m < (int)minima->size()-1; i_m++)
					{
						t_annot_region* new_minima = get_empty_region();
						new_minima->chrom = t_string::copy_me_str("XX");
						new_minima->start = translate_coord(minima->at(i_m)->extrema_posn+1, CODEBASE_COORDS::start_base, BED_COORDS::start_base);
						new_minima->end = translate_coord(minima->at(i_m+1)->extrema_posn+1, CODEBASE_COORDS::end_base, BED_COORDS::end_base);
						new_minima->strand = '+';

						cur_scale_minima_regions->push_back(new_minima);
					} // i_min loop.

					per_scale_minima_regions->push_back(cur_scale_minima_regions);
				}
			
				if(per_scale_maxima_regions != NULL)
				{
					vector<t_annot_region*>* cur_scale_maxima_regions = new vector<t_annot_region*>();
					for(int i_m = 0; i_m < (int)maxima->size(); i_m++)
					{
						t_annot_region* new_maxima = get_empty_region();
						new_maxima->chrom = t_string::copy_me_str("XX");
						new_maxima->start = translate_coord(maxima->at(i_m)->extrema_posn+1, CODEBASE_COORDS::start_base, BED_COORDS::start_base);
						new_maxima->end = translate_coord(maxima->at(i_m+1)->extrema_posn+1, CODEBASE_COORDS::end_base, BED_COORDS::end_base);
						new_maxima->strand = '+';

						cur_scale_maxima_regions->push_back(new_maxima);
					} // i_m loop.

					per_scale_maxima_regions->push_back(cur_scale_maxima_regions);
				}

				delete_extrema_nodes(minima);
				delete_extrema_nodes(maxima);
			
				// Free the current decomposition.
				delete [] derivative_map;
				delete [] cur_filtered_track;
			}
			else
			{
				// Store the decompositions.
				decomps->push_back(cur_filtered_track);
			}

			// Was the last processed value equal to or larger than what was requested?
			if(scale_end > 0 && 
				scale >= scale_end)
			{
				break;
			}

			i_scale++;
		} // scale computation check.
	} // scale loop.

	return(decomps);
}

// Assembly:
subq $0xdc8, %rsp            # imm = 0xDC8
movl %r8d, 0xa0(%rsp)
movl %ecx, %eax
movl 0xa0(%rsp), %ecx
movl %eax, 0xa4(%rsp)
movq %rdx, %rax
movl 0xa4(%rsp), %edx
movq %rax, 0xa8(%rsp)
movl %esi, %eax
movq 0xa8(%rsp), %rsi
movl %eax, 0xb4(%rsp)
movq %rdi, %r8
movl 0xb4(%rsp), %edi
movb %r9b, %al
movq 0xde0(%rsp), %r9
movq 0xdd8(%rsp), %r9
movq 0xdd0(%rsp), %r9
movq %r8, 0xdc0(%rsp)
movl %edi, 0xdbc(%rsp)
movsd %xmm0, 0xdb0(%rsp)
movsd %xmm1, 0xda8(%rsp)
movsd %xmm2, 0xda0(%rsp)
movq %rsi, 0xd98(%rsp)
andb $0x1, %dl
movb %dl, 0xd97(%rsp)
andb $0x1, %cl
movb %cl, 0xd96(%rsp)
andb $0x1, %al
movb %al, 0xd95(%rsp)
movl $0x18, %edi
callq 0x2190
movq %rax, %rdi
movq %rdi, 0xb8(%rsp)
xorl %esi, %esi
movl $0x18, %edx
callq 0x2110
movq 0xb8(%rsp), %rdi
callq 0x26a00
movq 0xb8(%rsp), %rax
movq %rax, 0xd88(%rsp)
movsd 0x2ee8c(%rip), %xmm0    # 0x52018
divsd 0xda0(%rsp), %xmm0
movsd %xmm0, 0xd80(%rsp)
movl $0x0, 0xd7c(%rsp)
movsd 0xda0(%rsp), %xmm0
mulsd 0xd80(%rsp), %xmm0
movsd %xmm0, 0xd80(%rsp)
movq 0xd98(%rsp), %rdi
leaq 0xd80(%rsp), %rsi
callq 0xc850
movsd 0xd80(%rsp), %xmm1
movsd 0xdb0(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x23318
movq 0xd88(%rsp), %rdi
movq $0x0, 0xd70(%rsp)
leaq 0xd70(%rsp), %rsi
callq 0x26a10
testb $0x1, 0xd96(%rsp)
je 0x23302
cmpq $0x0, 0xdd0(%rsp)
je 0x23292
movq 0xdd0(%rsp), %rax
movq %rax, 0x98(%rsp)
movl $0x18, %edi
callq 0x2190
movq %rax, %rdi
movq %rdi, 0x90(%rsp)
xorl %esi, %esi
movl $0x18, %edx
callq 0x2110
movq 0x90(%rsp), %rdi
callq 0xc670
movq 0x90(%rsp), %rax
movq 0x98(%rsp), %rdi
movq %rax, 0xd68(%rsp)
leaq 0xd68(%rsp), %rsi
callq 0x26a40
cmpq $0x0, 0xdd8(%rsp)
je 0x23300
movq 0xdd8(%rsp), %rax
movq %rax, 0x88(%rsp)
movl $0x18, %edi
callq 0x2190
movq %rax, %rdi
movq %rdi, 0x80(%rsp)
xorl %esi, %esi
movl $0x18, %edx
callq 0x2110
movq 0x80(%rsp), %rdi
callq 0xc670
movq 0x80(%rsp), %rax
movq 0x88(%rsp), %rdi
movq %rax, 0xd60(%rsp)
leaq 0xd60(%rsp), %rsi
callq 0x26a40
jmp 0x23302
movl 0xd7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd7c(%rsp)
jmp 0x231a9
testb $0x1, 0x41ebe(%rip)     # 0x651dd
je 0x2334b
movq 0x41cb8(%rip), %rax     # 0x64fe0
movq (%rax), %rdi
movsd 0xd80(%rsp), %xmm0
movsd 0xda8(%rsp), %xmm1
leaq 0x326cf(%rip), %rsi     # 0x55a13
movb $0x2, %al
callq 0x2250
cvttsd2si 0xd80(%rsp), %eax
movl %eax, 0xd5c(%rsp)
movl 0xd5c(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x1, %edx
jne 0x2337f
movl 0xd5c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x2338a
movl 0xd5c(%rsp), %eax
movl %eax, 0x7c(%rsp)
movl 0x7c(%rsp), %eax
movl %eax, 0xd58(%rsp)
movl 0xdbc(%rsp), %eax
addl $0x2, %eax
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2040
movq %rax, 0xd50(%rsp)
movl $0x0, 0xd4c(%rsp)
movl 0xd58(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, 0xd48(%rsp)
movl $0x0, 0xd44(%rsp)
movl $0x0, 0xd40(%rsp)
movsd 0x325bf(%rip), %xmm0    # 0x559c8
movsd %xmm0, 0xd38(%rsp)
movl $0x0, 0xd34(%rsp)
movl 0xd34(%rsp), %eax
cmpl 0xdbc(%rsp), %eax
jge 0x23655
movl 0xd34(%rsp), %eax
cmpl 0xd48(%rsp), %eax
jle 0x23455
movl 0xd34(%rsp), %eax
subl 0xd48(%rsp), %eax
movl %eax, 0x78(%rsp)
jmp 0x23460
movl $0x1, %eax
movl %eax, 0x78(%rsp)
jmp 0x23460
movl 0x78(%rsp), %eax
movl %eax, 0xd30(%rsp)
movl 0xd34(%rsp), %eax
addl 0xd48(%rsp), %eax
cmpl 0xdbc(%rsp), %eax
jg 0x23496
movl 0xd34(%rsp), %eax
addl 0xd48(%rsp), %eax
movl %eax, 0x74(%rsp)
jmp 0x234a1
movl 0xdbc(%rsp), %eax
movl %eax, 0x74(%rsp)
movl 0x74(%rsp), %eax
movl %eax, 0xd2c(%rsp)
movsd 0xd38(%rsp), %xmm0
movsd 0x3250b(%rip), %xmm1    # 0x559c8
ucomisd %xmm1, %xmm0
jne 0x2352e
jp 0x2352e
xorps %xmm0, %xmm0
movsd %xmm0, 0xd38(%rsp)
movl 0xd30(%rsp), %eax
movl %eax, 0xd28(%rsp)
movl 0xd28(%rsp), %eax
cmpl 0xd2c(%rsp), %eax
jg 0x23529
movq 0xdc0(%rsp), %rax
movslq 0xd28(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd 0xd38(%rsp), %xmm0
movsd %xmm0, 0xd38(%rsp)
movl 0xd28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd28(%rsp)
jmp 0x234df
jmp 0x235e7
movl 0xd44(%rsp), %eax
movl %eax, 0xd24(%rsp)
movl 0xd24(%rsp), %eax
cmpl 0xd30(%rsp), %eax
jge 0x2358a
movq 0xdc0(%rsp), %rax
movslq 0xd24(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movsd 0xd38(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0xd38(%rsp)
movl 0xd24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd24(%rsp)
jmp 0x2353c
movl 0xd40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd20(%rsp)
movl 0xd20(%rsp), %eax
cmpl 0xd2c(%rsp), %eax
jg 0x235e5
movq 0xdc0(%rsp), %rax
movslq 0xd20(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd 0xd38(%rsp), %xmm0
movsd %xmm0, 0xd38(%rsp)
movl 0xd20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd20(%rsp)
jmp 0x2359b
jmp 0x235e7
movsd 0xd38(%rsp), %xmm0
cvtsi2sdl 0xd58(%rsp), %xmm1
divsd %xmm1, %xmm0
movq 0xd50(%rsp), %rax
movslq 0xd34(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0xd30(%rsp), %eax
movl %eax, 0xd44(%rsp)
movl 0xd2c(%rsp), %eax
movl %eax, 0xd40(%rsp)
movl 0xd4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd4c(%rsp)
movl 0xd34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd34(%rsp)
jmp 0x2341d
testb $0x1, 0xd97(%rsp)
je 0x23737
leaq 0x930(%rsp), %rdi
movq 0xde0(%rsp), %rdx
movl 0xd7c(%rsp), %ecx
leaq 0x31941(%rip), %rsi     # 0x54fc2
movb $0x0, %al
callq 0x2090
movq 0x41951(%rip), %rax     # 0x64fe0
movq (%rax), %rdi
leaq 0x930(%rsp), %rdx
leaq 0x3238e(%rip), %rsi     # 0x55a2f
movb $0x0, %al
callq 0x2250
movq 0xd50(%rsp), %rdi
movl 0xdbc(%rsp), %esi
callq 0x34630
movq %rax, 0x928(%rsp)
movq 0x928(%rsp), %rdi
movl 0xdbc(%rsp), %esi
leaq 0x930(%rsp), %rdx
callq 0x35140
movq 0x418f9(%rip), %rax     # 0x64fe0
movq (%rax), %rdi
leaq 0x3234a(%rip), %rsi     # 0x55a3b
movb $0x0, %al
callq 0x2250
movq 0x928(%rsp), %rax
movq %rax, 0x68(%rsp)
cmpq $0x0, %rax
je 0x23715
movq 0x68(%rsp), %rdi
callq 0x2220
movq 0xd50(%rsp), %rax
movq %rax, 0x60(%rsp)
cmpq $0x0, %rax
je 0x23732
movq 0x60(%rsp), %rdi
callq 0x2220
jmp 0x23e54
testb $0x1, 0xd96(%rsp)
je 0x23e3d
testb $0x1, 0x41a91(%rip)     # 0x651dd
je 0x23766
movq 0x4188b(%rip), %rax     # 0x64fe0
movq (%rax), %rdi
leaq 0x322ea(%rip), %rsi     # 0x55a49
movb $0x0, %al
callq 0x2250
movl $0x18, %edi
callq 0x2190
movq %rax, %rdi
movq %rdi, 0x50(%rsp)
xorl %esi, %esi
movl $0x18, %edx
callq 0x2110
movq 0x50(%rsp), %rdi
callq 0x1ae90
movq 0x50(%rsp), %rax
movq %rax, 0x920(%rsp)
movl $0x18, %edi
callq 0x2190
movq %rax, %rdi
movq %rdi, 0x58(%rsp)
xorl %esi, %esi
movl $0x18, %edx
callq 0x2110
movq 0x58(%rsp), %rdi
callq 0x1ae90
movq 0x58(%rsp), %rax
movq %rax, 0x918(%rsp)
movl 0xdbc(%rsp), %eax
addl $0x2, %eax
cltq
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2040
movq %rax, 0x910(%rsp)
movq 0x910(%rsp), %rdi
movl 0xdbc(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x2110
movq 0xd50(%rsp), %rdi
movl 0xdbc(%rsp), %esi
movq 0x920(%rsp), %rdx
movq 0x918(%rsp), %rcx
movq 0x910(%rsp), %r8
xorl %r9d, %r9d
callq 0x409a0
movq 0x918(%rsp), %rdi
callq 0x1af10
movq %rax, 0x908(%rsp)
movq 0x918(%rsp), %rdi
callq 0x1af40
movq %rax, 0x900(%rsp)
movq 0x908(%rsp), %rdi
movq 0x900(%rsp), %rsi
leaq 0x1d0cb(%rip), %rdx     # 0x40960
callq 0x1aec0
movq 0x920(%rsp), %rdi
callq 0x1af10
movq %rax, 0x8f8(%rsp)
movq 0x920(%rsp), %rdi
callq 0x1af40
movq %rax, 0x8f0(%rsp)
movq 0x8f8(%rsp), %rdi
movq 0x8f0(%rsp), %rsi
leaq 0x1d085(%rip), %rdx     # 0x40960
callq 0x1aec0
testb $0x1, 0xd95(%rsp)
je 0x23b32
leaq 0x500(%rsp), %rdi
movq 0xde0(%rsp), %rdx
movl 0xd7c(%rsp), %ecx
leaq 0x3215b(%rip), %rsi     # 0x55a67
movb $0x0, %al
callq 0x2090
leaq 0x110(%rsp), %rdi
movq 0xde0(%rsp), %rdx
movl 0xd7c(%rsp), %ecx
leaq 0x3214b(%rip), %rsi     # 0x55a7c
movb $0x0, %al
callq 0x2090
movq 0x416a1(%rip), %rax     # 0x64fe0
movq (%rax), %rdi
leaq 0x32149(%rip), %rsi     # 0x55a92
movb $0x0, %al
callq 0x2250
leaq 0x110(%rsp), %rdi
leaq 0x2f145(%rip), %rsi     # 0x52aa4
callq 0x455f0
movq %rax, 0x108(%rsp)
movl $0x0, 0x104(%rsp)
movl 0x104(%rsp), %eax
movl %eax, 0x4c(%rsp)
movq 0x920(%rsp), %rdi
callq 0x1aea0
movq %rax, %rcx
movl 0x4c(%rsp), %eax
cmpl %ecx, %eax
jge 0x23a30
movq 0x108(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x920(%rsp), %rdi
movslq 0x104(%rsp), %rsi
callq 0x1af70
movq (%rax), %rax
movl (%rax), %edi
addl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1fd20
movl %eax, 0x48(%rsp)
movq 0x920(%rsp), %rdi
movslq 0x104(%rsp), %rsi
callq 0x1af70
movq (%rax), %rax
movl (%rax), %edi
addl $0x1, %edi
movl $0x1, %edx
movl %edx, %esi
callq 0x1fd20
movq 0x40(%rsp), %rdi
movl 0x48(%rsp), %edx
movl %eax, %ecx
leaq 0x3209d(%rip), %rsi     # 0x55ab0
movb $0x0, %al
callq 0x2250
movl 0x104(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x104(%rsp)
jmp 0x23977
movq 0x108(%rsp), %rdi
callq 0x2180
leaq 0x500(%rsp), %rdi
leaq 0x2f058(%rip), %rsi     # 0x52aa4
callq 0x455f0
movq %rax, 0xf8(%rsp)
movl $0x0, 0xf4(%rsp)
movl 0xf4(%rsp), %eax
movl %eax, 0x3c(%rsp)
movq 0x918(%rsp), %rdi
callq 0x1aea0
movq %rax, %rcx
movl 0x3c(%rsp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x23b25
movq 0xf8(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x918(%rsp), %rdi
movslq 0xf4(%rsp), %rsi
callq 0x1af70
movq (%rax), %rax
movl (%rax), %edi
addl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1fd20
movl %eax, 0x38(%rsp)
movq 0x918(%rsp), %rdi
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x1af70
movq (%rax), %rax
movl (%rax), %edi
addl $0x1, %edi
movl $0x1, %edx
movl %edx, %esi
callq 0x1fd20
movq 0x30(%rsp), %rdi
movl 0x38(%rsp), %edx
movl %eax, %ecx
leaq 0x31fa8(%rip), %rsi     # 0x55ab0
movb $0x0, %al
callq 0x2250
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xf4(%rsp)
jmp 0x23a64
movq 0xf8(%rsp), %rdi
callq 0x2180
cmpq $0x0, 0xdd0(%rsp)
je 0x23c8f
movl $0x18, %edi
callq 0x2190
movq %rax, %rdi
movq %rdi, 0x28(%rsp)
xorl %esi, %esi
movl $0x18, %edx
callq 0x2110
movq 0x28(%rsp), %rdi
callq 0xc670
movq 0x28(%rsp), %rax
movq %rax, 0xe8(%rsp)
movl $0x0, 0xe4(%rsp)
movl 0xe4(%rsp), %eax
movl %eax, 0x24(%rsp)
movq 0x918(%rsp), %rdi
callq 0x1aea0
movq %rax, %rcx
movl 0x24(%rsp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x23c7a
callq 0x27b00
movq %rax, 0xd8(%rsp)
leaq 0x31efb(%rip), %rdi     # 0x55aba
callq 0x47b60
movq %rax, %rcx
movq 0xd8(%rsp), %rax
movq %rcx, (%rax)
movq 0x918(%rsp), %rdi
movslq 0xe4(%rsp), %rsi
callq 0x1af70
movq (%rax), %rax
movl (%rax), %edi
addl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1fd20
movl %eax, %ecx
movq 0xd8(%rsp), %rax
movl %ecx, 0xc(%rax)
movq 0x918(%rsp), %rdi
movl 0xe4(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x1af70
movq (%rax), %rax
movl (%rax), %edi
addl $0x1, %edi
movl $0x1, %edx
movl %edx, %esi
callq 0x1fd20
movl %eax, %ecx
movq 0xd8(%rsp), %rax
movl %ecx, 0x20(%rax)
movq 0xd8(%rsp), %rax
movb $0x2b, 0x8(%rax)
movq 0xe8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0xc8c0
movl 0xe4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe4(%rsp)
jmp 0x23b81
movq 0xdd0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x1adc0
cmpq $0x0, 0xdd8(%rsp)
je 0x23de9
movl $0x18, %edi
callq 0x2190
movq %rax, %rdi
movq %rdi, 0x18(%rsp)
xorl %esi, %esi
movl $0x18, %edx
callq 0x2110
movq 0x18(%rsp), %rdi
callq 0xc670
movq 0x18(%rsp), %rax
movq %rax, 0xd0(%rsp)
movl $0x0, 0xcc(%rsp)
movl 0xcc(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0x920(%rsp), %rdi
callq 0x1aea0
movq %rax, %rcx
movl 0x14(%rsp), %eax
cmpl %ecx, %eax
jge 0x23dd4
callq 0x27b00
movq %rax, 0xc0(%rsp)
leaq 0x31da1(%rip), %rdi     # 0x55aba
callq 0x47b60
movq %rax, %rcx
movq 0xc0(%rsp), %rax
movq %rcx, (%rax)
movq 0x920(%rsp), %rdi
movslq 0xcc(%rsp), %rsi
callq 0x1af70
movq (%rax), %rax
movl (%rax), %edi
addl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1fd20
movl %eax, %ecx
movq 0xc0(%rsp), %rax
movl %ecx, 0xc(%rax)
movq 0x920(%rsp), %rdi
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x1af70
movq (%rax), %rax
movl (%rax), %edi
addl $0x1, %edi
movl $0x1, %edx
movl %edx, %esi
callq 0x1fd20
movl %eax, %ecx
movq 0xc0(%rsp), %rax
movl %ecx, 0x20(%rax)
movq 0xc0(%rsp), %rax
movb $0x2b, 0x8(%rax)
movq 0xd0(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0xc8c0
movl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xcc(%rsp)
jmp 0x23cde
movq 0xdd8(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x1adc0
movq 0x918(%rsp), %rdi
callq 0x41ae0
movq 0x920(%rsp), %rdi
callq 0x41ae0
movq 0x910(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x23e20
movq 0x8(%rsp), %rdi
callq 0x2220
movq 0xd50(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x23e3b
movq (%rsp), %rdi
callq 0x2220
jmp 0x23e52
movq 0xd88(%rsp), %rdi
leaq 0xd50(%rsp), %rsi
callq 0x26a70
jmp 0x23e54
movsd 0xda8(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x23e7c
movsd 0xd80(%rsp), %xmm0
ucomisd 0xda8(%rsp), %xmm0
jb 0x23e7c
jmp 0x23e92
movl 0xd7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd7c(%rsp)
jmp 0x231a9
movq 0xd88(%rsp), %rax
addq $0xdc8, %rsp            # imm = 0xDC8
retq
nopw %cs:(%rax,%rax)