// File: /workspace/github_c_makefile_star2_O2/sTeeLM[P]dwipe/gui.c
// Function: dwipe_gui_status
void dwipe_gui_status( int count, dwipe_context_t* c )
{
/**
 * Shows runtime statistics and overall progress.
 *
 * @parameter count           The number of contexts in the array.
 * @parameter c               An array of device contexts.
 *
 * @modifies  main_window     Prints information into the main window.
 * @modifies  c[].throughput  Updates the i/o throughput value. 
 *
 */

	/* Throughput print formats. */
	char* dwipe_tera = "%llu TB/s";
	char* dwipe_giga = "%llu GB/s";
	char* dwipe_mega = "%llu MB/s";
	char* dwipe_kilo = "%llu KB/s";
	char* dwipe_unit = "%llu B/s";

	/* The throughput format pointer. */
	char* dwipe_format;

	/* We count time from when this function is first called. */
	static time_t dwipe_time_start = 0;

	/* The current time. */
	time_t dwipe_time_now;

	/* The index of the element that is visible in the first slot. */
	static int offset;

	/* The number of elements that we can show in the window. */
	int slots;

	/* Window dimensions. */
	int wlines;
	int wcols;

	/* Generic loop variable. */
	int i;

	/* The current working line in the main window. */
	int yy;

	/* User input buffer. */
	int keystroke;

	/* The combined througput of all processes. */
	u64 dwipe_throughput = 0;

	/* The estimated runtime of the slowest device. */
	time_t dwipe_maxeta = 0;

	/* The combined number of errors of all processes. */
	u64 dwipe_errors = 0;

	/* Time values. */
	int dwipe_hh;
	int dwipe_mm;
	int dwipe_ss;

	/* The number of active wipe processes. */
	int dwipe_active = 0;


	if( dwipe_time_start == 0 )
	{
		/* This is the first time that we have been called. */
		dwipe_time_start = time( NULL ) -1;
	}

	/* Get the window dimensions. */
	getmaxyx( main_window, wlines, wcols );

	/* Less four lines for the box and padding. */
	slots = wlines - 4;

	/* Each element prints three lines. */
	slots /= 3;

	/* Get the current time. */
	dwipe_time_now = time( NULL );

	/* Erase the main window. */
	werase( main_window );

	/* Erase the stats window. */
	werase( stats_window );

	/* Initialize our working offset to the third line. */
	yy = 2;


	/* Try to get a keystroke. */
	keystroke = getch();

	switch( keystroke )
	{
			case KEY_DOWN:
			case 'j':
			case 'J':

				/* Scroll down. */
				offset += 1;

				if( count < slots )
				{
					offset = 0;
				}

				else if( offset + slots > count )
				{
					offset = count - slots;
				}

				break;

			case KEY_UP:
			case 'k':
			case 'K':

				/* Scroll up. */
				offset -= 1;

				if( offset < 0 )
				{
					offset = 0;
				}

				break;

			default:

				/* Do nothing. */
				break;

	} /* keystroke */


	/* Enumerate all contexts to compute statistics. */
	for( i = 0 ; i < count ; i++ )
	{
		/* Check whether the child process is still running the wipe. */
		if( c[i].pid > 0 )
		{
			/* Increment the child counter. */
			dwipe_active += 1;

			/* Maintain a rolling average of throughput. */
			dwipe_update_speedring( &c[i].speedring, c[i].round_done, dwipe_time_now );

			if( c[i].speedring.timestotal > 0 )
			{
				/* Update the current average throughput in bytes-per-second. */
				c[i].throughput = c[i].speedring.bytestotal / c[i].speedring.timestotal;

				/* Update the estimated remaining runtime. */
				c[i].eta = ( c[i].round_size - c[i].round_done ) / c[i].throughput;

				if( c[i].eta > dwipe_maxeta )
				{
					dwipe_maxeta = c[i].eta;
				}
			}

			/* Update the percentage value. */
			c[i].round_percent = (double) c[i].round_done / (double) c[i].round_size * 100;

			/* Accumulate combined throughput. */
			dwipe_throughput += c[i].throughput;

		} /* child running */

		/* Accumulate the error count. */
		dwipe_errors += c[i].pass_errors;
		dwipe_errors += c[i].verify_errors;

	} /* for statistics */


	/* Print information for the user. */
	for( i = offset ; i < offset + slots && i < count ; i++ )
	{
		/* Print the context label. */
		mvwprintw( main_window, yy++, 2, "%s", c[i].label );

		/* Check whether the child process is still running the wipe. */
		if( c[i].pid > 0 )
		{
			/* Print percentage and pass information. */
			mvwprintw( main_window, yy++, 4, "[%05.2f%%, round %i of %i, pass %i of %i] ", \
			  c[i].round_percent, c[i].round_working, c[i].round_count, c[i].pass_working, c[i].pass_count );

		} /* child running */

		else
		{
			if( c[i].result == 0 ) { mvwprintw( main_window, yy++, 4, "(success) " );                         }
			else if( c[i].signal ) { mvwprintw( main_window, yy++, 4, "(failure, signal %i) ", c[i].signal ); }
			else                   { mvwprintw( main_window, yy++, 4, "(failure, code %i) ", c[i].result );   }

		} /* child returned */

		if( c[i].verify_errors ) { wprintw( main_window, "[verify errors: %llu] ", c[i].verify_errors ); }
 		if( c[i].pass_errors   ) { wprintw( main_window, "[pass errors: %llu] ",   c[i].pass_errors   ); }


		switch( c[i].pass_type )
		{
			case DWIPE_PASS_FINAL_BLANK:
  				wprintw( main_window, "[blanking] " );
				break;

			case DWIPE_PASS_FINAL_OPS2:
  				wprintw( main_window, "[OPS-II final] " );
				break;

			case DWIPE_PASS_WRITE:
				wprintw( main_window, "[writing] " );
				break;

			case DWIPE_PASS_VERIFY:
				wprintw( main_window, "[verifying] " );
				break;

			case DWIPE_PASS_NONE:
				break;
		}

  		if( c[i].sync_status   ) { wprintw( main_window, "[syncing] "   ); }

		     if( c[i].throughput >= INT64_C( 1000000000000000 ) )
			    { wprintw( main_window, "[%llu TB/s] ", c[i].throughput / INT64_C( 1000000000000 ) ); }
		else if( c[i].throughput >= INT64_C( 1000000000000    ) )
		       { wprintw( main_window, "[%llu GB/s] ", c[i].throughput / INT64_C( 1000000000    ) ); }
		else if( c[i].throughput >= INT64_C( 1000000000       ) )
		       { wprintw( main_window, "[%llu MB/s] ", c[i].throughput / INT64_C( 1000000       ) ); }
		else if( c[i].throughput >= INT64_C( 1000000          ) )
		       { wprintw( main_window, "[%llu KB/s] ", c[i].throughput / INT64_C( 1000          ) ); }
		else
		       { wprintw( main_window, "[%llu B/s] ",  c[i].throughput / INT64_C( 1             ) ); }

		/* Insert whitespace. */
		yy += 1;

	} /* for */

	if( offset > 0 )
	{
		mvwprintw( main_window, 1, wcols -8, " More " );
		waddch( main_window, ACS_UARROW );
	}

	if( count - offset > slots )
	{
		mvwprintw( main_window, wlines -2, wcols -8, " More " );
		waddch( main_window, ACS_DARROW );
	}


	/* Box the main window. */
	box( main_window, 0, 0 );

	/* Refresh the main window. */
	wrefresh( main_window );

	/* Update the load average field. */
	dwipe_gui_load();


	     if( dwipe_throughput >= INT64_C( 1000000000000000 ) )
		    { dwipe_throughput /= INT64_C( 1000000000000    ); dwipe_format = dwipe_tera; }
	else if( dwipe_throughput >= INT64_C( 1000000000000    ) )
	       { dwipe_throughput /= INT64_C( 1000000000       ); dwipe_format = dwipe_giga; }
	else if( dwipe_throughput >= INT64_C( 1000000000       ) )
	       { dwipe_throughput /= INT64_C( 1000000          ); dwipe_format = dwipe_mega; }
	else if( dwipe_throughput >= INT64_C( 1000000          ) )
	       { dwipe_throughput /= INT64_C( 1000             ); dwipe_format = dwipe_kilo; }
	else
	       { dwipe_throughput /= INT64_C( 1                ); dwipe_format = dwipe_unit; }

	/* Print the combined throughput. */
	mvwprintw( stats_window, DWIPE_GUI_STATS_THROUGHPUT_Y, DWIPE_GUI_STATS_THROUGHPUT_X, "Throughput:" );

	if( dwipe_throughput > 0 )
	{
		mvwprintw( stats_window, DWIPE_GUI_STATS_THROUGHPUT_Y, DWIPE_GUI_STATS_TAB, dwipe_format, dwipe_throughput );
	}

	/* Change the current time into a delta. */
	dwipe_time_now -= dwipe_time_start;

	/* Put the delta into HH:mm:ss form. */
	dwipe_hh = dwipe_time_now / 3600;
	dwipe_time_now %= 3600;
	dwipe_mm = dwipe_time_now / 60;
	dwipe_time_now %= 60;
	dwipe_ss = dwipe_time_now;

	/* Print the runtime. */
	mvwprintw( stats_window, DWIPE_GUI_STATS_RUNTIME_Y, 1, "Runtime:" );
	mvwprintw( stats_window, DWIPE_GUI_STATS_RUNTIME_Y, DWIPE_GUI_STATS_TAB, "%02i:%02i:%02i", dwipe_hh, dwipe_mm, dwipe_ss );

	mvwprintw( stats_window, DWIPE_GUI_STATS_ETA_Y, 1, "Remaining:" );

	if( dwipe_maxeta > 0 )
	{
		/* Do it again for the estimated runtime remaining. */
		dwipe_hh = dwipe_maxeta / 3600;
		dwipe_maxeta %= 3600;
		dwipe_mm = dwipe_maxeta / 60;
		dwipe_maxeta %= 60;
		dwipe_ss = dwipe_maxeta;
	
		/* Print the estimated runtime remaining. */
		mvwprintw( stats_window, DWIPE_GUI_STATS_ETA_Y, DWIPE_GUI_STATS_TAB, "%02i:%02i:%02i", dwipe_hh, dwipe_mm, dwipe_ss );
	}

	/* Print the error count. */
	mvwprintw( stats_window, DWIPE_GUI_STATS_ERRORS_Y, DWIPE_GUI_STATS_ERRORS_X, "Errors:" );
	mvwprintw( stats_window, DWIPE_GUI_STATS_ERRORS_Y, DWIPE_GUI_STATS_TAB, "%llu", dwipe_errors );

	/* Add a border. */
	box( stats_window, 0, 0 );

	/* Add a title. */
	mvwprintw( stats_window, 0, ( DWIPE_GUI_STATS_W - strlen( stats_title ) ) /2, "%s", stats_title );

	/* Refresh the stats window. */
	wrefresh( stats_window );

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movl %edi, %ebp
cmpq $0x0, 0xa2e9(%rip)      # 0x10830
jne 0x655a
xorl %edi, %edi
callq 0x32b0
decq %rax
movq %rax, 0xa2d6(%rip)      # 0x10830
movq 0xa2c7(%rip), %rax      # 0x10828
testq %rax, %rax
je 0x6579
movswl 0x4(%rax), %ecx
incl %ecx
movswl 0x6(%rax), %eax
addl $-0x7, %eax
movl %eax, 0x18(%rsp)
jmp 0x6583
pushq $-0x9
popq %rax
movl %eax, 0x18(%rsp)
pushq $-0x1
popq %rcx
movq %rcx, 0x40(%rsp)
leal -0x4(%rcx), %eax
pushq $0x3
popq %rcx
cltd
idivl %ecx
movq %rax, 0x20(%rsp)
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x32b0
movq %rax, 0x38(%rsp)
movq 0xa27d(%rip), %rdi      # 0x10828
callq 0x3050
movq 0xa269(%rip), %rdi      # 0x10820
callq 0x3050
movq 0x99dd(%rip), %rax      # 0xffa0
movq (%rax), %rdi
callq 0x3120
cmpl $0x4a, %eax
je 0x65ed
cmpl $0x4b, %eax
je 0x660f
cmpl $0x6a, %eax
je 0x65ed
cmpl $0x6b, %eax
je 0x660f
cmpl $0x103, %eax            # imm = 0x103
je 0x660f
cmpl $0x102, %eax            # imm = 0x102
jne 0x6626
movl 0xa245(%rip), %ecx      # 0x10838
incl %ecx
movl %ecx, 0xa23d(%rip)      # 0x10838
movl %ebp, %eax
subl 0x20(%rsp), %eax
jl 0x6620
addl 0x20(%rsp), %ecx
cmpl %ebp, %ecx
jle 0x6626
movl %eax, %ebx
jmp 0x6620
movl 0xa223(%rip), %eax      # 0x10838
cmpl $0x2, %eax
pushq $0x1
popq %rbx
cmovgel %eax, %ebx
decl %ebx
movl %ebx, 0xa212(%rip)      # 0x10838
xorl %r15d, %r15d
testl %ebp, %ebp
movl $0x0, %eax
movl %ebp, 0x1c(%rsp)
cmovgl %ebp, %eax
imulq $0x590, %rax, %r12      # imm = 0x590
leaq 0x370(%r14), %r13
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
xorl %ebx, %ebx
cmpq %r15, %r12
je 0x676b
cmpl $0x0, 0x310(%r14,%r15)
jle 0x674f
leaq (%r15,%r13), %rdi
movq 0x340(%r14,%r15), %rsi
movq 0x38(%rsp), %rdx
callq 0x6ce7
movq 0x560(%r14,%r15), %rcx
movq 0x340(%r14,%r15), %rdi
testq %rcx, %rcx
jle 0x66e2
movq 0x350(%r14,%r15), %rsi
movq 0x460(%r14,%r15), %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq %rax, 0x580(%r14,%r15)
movq %rsi, %rax
subq %rdi, %rax
xorl %edx, %edx
divq %rcx
movq %rax, 0x2d0(%r14,%r15)
movq 0x28(%rsp), %rdx
cmpq %rdx, %rax
cmovaq %rax, %rdx
movq %rdx, 0x28(%rsp)
jmp 0x66f2
movq 0x350(%r14,%r15), %rsi
movq 0x580(%r14,%r15), %rcx
movq %rdi, %xmm0
movq 0x49a1(%rip), %xmm2     # 0xb0a0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x49a5(%rip), %xmm3     # 0xb0b0
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movq %rsi, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm3, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
divsd %xmm2, %xmm1
mulsd 0x4980(%rip), %xmm1     # 0xb0c0
movsd %xmm1, 0x358(%r14,%r15)
addq %rcx, 0x30(%rsp)
addq 0x2f8(%r14,%r15), %rbx
addq 0x588(%r14,%r15), %rbx
addq $0x590, %r15            # imm = 0x590
jmp 0x6659
movl 0xa0c7(%rip), %eax      # 0x10838
movslq %eax, %r15
movslq 0x1c(%rsp), %r13
imulq $0x590, %r15, %rcx      # imm = 0x590
leaq (%rcx,%r14), %r12
addq $0x2e0, %r12            # imm = 0x2E0
pushq $0x2
popq %rcx
movl %ecx, %r14d
movq 0x20(%rsp), %rcx
addl %eax, %ecx
movslq %ecx, %rcx
cmpq %rcx, %r15
jge 0x69c9
cmpq %r13, %r15
jge 0x69c9
movq 0xa074(%rip), %rdi      # 0x10828
leal 0x1(%r14), %ebp
movq (%r12), %r8
movl %r14d, %esi
pushq $0x2
popq %rdx
leaq 0x4a84(%rip), %rcx      # 0xb24d
xorl %eax, %eax
callq 0x31c0
cmpl $0x0, 0x30(%r12)
jle 0x6819
movq 0xa049(%rip), %rdi      # 0x10828
movsd 0x78(%r12), %xmm0
movl 0x80(%r12), %r8d
movl 0x5c(%r12), %r9d
movl 0x8(%r12), %eax
movl 0x2c(%r12), %ecx
movl %eax, 0x8(%rsp)
movl %ecx, (%rsp)
movl %ebp, %esi
pushq $0x4
popq %rdx
leaq 0x5926(%rip), %rcx      # 0xc136
movb $0x1, %al
callq 0x31c0
jmp 0x6871
movl 0x58(%r12), %r8d
testl %r8d, %r8d
je 0x6847
movl 0x8c(%r12), %eax
movq 0x9ff6(%rip), %rdi      # 0x10828
movl %ebp, %esi
pushq $0x4
popq %rdx
testl %eax, %eax
je 0x6863
leaq 0x592a(%rip), %rcx      # 0xc16c
movl %eax, %r8d
jmp 0x686a
movq 0x9fda(%rip), %rdi      # 0x10828
movl %ebp, %esi
pushq $0x4
popq %rdx
leaq 0x5907(%rip), %rcx      # 0xc161
xorl %eax, %eax
callq 0x31c0
jmp 0x6871
leaq 0x5918(%rip), %rcx      # 0xc182
xorl %eax, %eax
callq 0x31c0
movq 0x2a8(%r12), %rdx
testq %rdx, %rdx
je 0x6893
movq 0x9fa3(%rip), %rdi      # 0x10828
leaq 0x590a(%rip), %rsi      # 0xc196
xorl %eax, %eax
callq 0x3440
movq 0x18(%r12), %rdx
testq %rdx, %rdx
je 0x68b2
movq 0x9f84(%rip), %rdi      # 0x10828
leaq 0x5902(%rip), %rsi      # 0xc1ad
xorl %eax, %eax
callq 0x3440
movl 0x28(%r12), %eax
decl %eax
cmpl $0x3, %eax
ja 0x68dc
movl %eax, %eax
leaq 0x47bd(%rip), %rcx      # 0xb084
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movq 0x9f53(%rip), %rdi      # 0x10828
xorl %eax, %eax
callq 0x3440
cmpw $0x0, 0x29c(%r12)
je 0x68fd
movq 0x9f39(%rip), %rdi      # 0x10828
leaq 0x5900(%rip), %rsi      # 0xc1f6
xorl %eax, %eax
callq 0x3440
movq 0x2a0(%r12), %rax
movabsq $0x38d7ea4c67fff, %rcx  # imm = 0x38D7EA4C67FFF
cmpq %rcx, %rax
jbe 0x6933
movq 0x9f0d(%rip), %rdi      # 0x10828
xorl %edx, %edx
movabsq $0xe8d4a51000, %rcx     # imm = 0xE8D4A51000
divq %rcx
leaq 0x58d0(%rip), %rsi      # 0xc201
jmp 0x69a6
movabsq $0xe8d4a50fff, %rcx     # imm = 0xE8D4A50FFF
cmpq %rcx, %rax
jbe 0x695c
movq 0x9edf(%rip), %rdi      # 0x10828
xorl %edx, %edx
movl $0x3b9aca00, %ecx       # imm = 0x3B9ACA00
divq %rcx
leaq 0x58b4(%rip), %rsi      # 0xc20e
jmp 0x69a6
cmpq $0x3b9aca00, %rax       # imm = 0x3B9ACA00
jb 0x697e
movq 0x9ebd(%rip), %rdi      # 0x10828
xorl %edx, %edx
movl $0xf4240, %ecx          # imm = 0xF4240
divq %rcx
leaq 0x589f(%rip), %rsi      # 0xc21b
jmp 0x69a6
movq 0x9ea3(%rip), %rdi      # 0x10828
cmpq $0xf4240, %rax          # imm = 0xF4240
jb 0x699f
xorl %edx, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
divl %ecx
leaq 0x588b(%rip), %rsi      # 0xc228
jmp 0x69a6
leaq 0x588f(%rip), %rsi      # 0xc235
movq %rax, %rdx
xorl %eax, %eax
callq 0x3440
addl $0x3, %r14d
incq %r15
movl 0x9e7b(%rip), %eax      # 0x10838
addq $0x590, %r12            # imm = 0x590
jmp 0x6791
testl %eax, %eax
movl 0x18(%rsp), %ebp
jle 0x6a0a
movq 0x9e50(%rip), %rdi      # 0x10828
leaq 0x483e(%rip), %rcx      # 0xb21d
pushq $0x1
popq %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x31c0
movq 0x9e36(%rip), %rdi      # 0x10828
movq 0x959f(%rip), %rax      # 0xff98
movl 0xb4(%rax), %esi
callq 0x33f0
movl 0x9e2e(%rip), %eax      # 0x10838
movl 0x1c(%rsp), %ecx
subl %eax, %ecx
cmpl 0x20(%rsp), %ecx
movq 0x30(%rsp), %r15
jle 0x6a53
movq 0x9e06(%rip), %rdi      # 0x10828
movq 0x40(%rsp), %rsi
addl $-0x2, %esi
leaq 0x47ec(%rip), %rcx      # 0xb21d
movl %ebp, %edx
xorl %eax, %eax
callq 0x31c0
movq 0x9de7(%rip), %rdi      # 0x10828
movq 0x9550(%rip), %rax      # 0xff98
movl 0xb8(%rax), %esi
callq 0x33f0
movq 0x9dce(%rip), %rdi      # 0x10828
andl $0x0, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, (%rsp)
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x3100
movq 0x9da8(%rip), %rdi      # 0x10828
callq 0x31b0
callq 0x643c
movabsq $0x38d7ea4c67fff, %rax  # imm = 0x38D7EA4C67FFF
cmpq %rax, %r15
jbe 0x6ab4
movq %r15, %rax
xorl %edx, %edx
movabsq $0xe8d4a51000, %rcx     # imm = 0xE8D4A51000
divq %rcx
leaq 0x5653(%rip), %r14      # 0xc105
jmp 0x6afa
movabsq $0xe8d4a50fff, %rax     # imm = 0xE8D4A50FFF
cmpq %rax, %r15
jbe 0x6ad9
movl $0x3b9aca00, %ecx       # imm = 0x3B9ACA00
movq %r15, %rax
xorl %edx, %edx
divq %rcx
leaq 0x5638(%rip), %r14      # 0xc10f
jmp 0x6afa
cmpq $0x3b9aca00, %r15       # imm = 0x3B9ACA00
jb 0x6cb7
movl $0xf4240, %ecx          # imm = 0xF4240
movq %r15, %rax
xorl %edx, %edx
divq %rcx
leaq 0x561f(%rip), %r14      # 0xc119
movq %rax, %r15
movq 0x9d1c(%rip), %rdi      # 0x10820
leaq 0x5736(%rip), %rcx      # 0xc241
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
xorl %eax, %eax
callq 0x31c0
testq %r15, %r15
je 0x6b37
movq 0x9cfc(%rip), %rdi      # 0x10820
pushq $0x4
popq %rsi
pushq $0x10
popq %rdx
movq %r14, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x31c0
movq 0x38(%rsp), %rax
subq 0x9ced(%rip), %rax      # 0x10830
movl $0xe10, %ecx            # imm = 0xE10
cqto
idivq %rcx
movq %rax, %r14
movq %rdx, %rax
movw $0x3c, %r13w
cwtd
idivw %r13w
movswl %ax, %ebp
movswl %dx, %r15d
movq 0x9cb4(%rip), %rdi      # 0x10820
leaq 0x56da(%rip), %rcx      # 0xc24d
pushq $0x1
popq %r12
movl %r12d, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0x31c0
movq 0x9c95(%rip), %rdi      # 0x10820
movl %r15d, (%rsp)
leaq 0x56c0(%rip), %rcx      # 0xc256
pushq $0x10
popq %rdx
movl %r12d, %esi
movl %r14d, %r8d
movl %ebp, %r9d
xorl %eax, %eax
callq 0x31c0
movq 0x9c70(%rip), %rdi      # 0x10820
leaq 0x56ae(%rip), %rcx      # 0xc265
pushq $0x2
popq %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x31c0
movq 0x28(%rsp), %rax
testq %rax, %rax
jle 0x6c08
xorl %edx, %edx
movl $0xe10, %ecx            # imm = 0xE10
divq %rcx
movq %rax, %r8
movl %edx, %eax
xorl %edx, %edx
divw %r13w
movzwl %ax, %r9d
movzwl %dx, %eax
movq 0x9c2f(%rip), %rdi      # 0x10820
movl %eax, (%rsp)
leaq 0x565b(%rip), %rcx      # 0xc256
pushq $0x2
popq %rsi
pushq $0x10
popq %rdx
xorl %eax, %eax
callq 0x31c0
movq 0x9c11(%rip), %rdi      # 0x10820
leaq 0x565a(%rip), %rcx      # 0xc270
pushq $0x5
popq %rbp
pushq $0x1
popq %rdx
movl %ebp, %esi
xorl %eax, %eax
callq 0x31c0
movq 0x9bf4(%rip), %rdi      # 0x10820
leaq 0x5645(%rip), %rcx      # 0xc278
pushq $0x10
popq %rdx
movl %ebp, %esi
movq %rbx, %r8
xorl %eax, %eax
callq 0x31c0
movq 0x9bd7(%rip), %rdi      # 0x10820
andl $0x0, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, (%rsp)
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x3100
movq 0x9bb1(%rip), %rbx      # 0x10820
movq 0x99e2(%rip), %r14      # 0x10658
movq %r14, %rdi
callq 0x3150
pushq $0x24
popq %rdx
subq %rax, %rdx
shrq %rdx
leaq 0x45bf(%rip), %rcx      # 0xb24d
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %r8
xorl %eax, %eax
callq 0x31c0
movq 0x9b7c(%rip), %rdi      # 0x10820
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31b0
cmpq $0xf4240, %r15          # imm = 0xF4240
jb 0x6cdb
movl $0x3e8, %ecx            # imm = 0x3E8
movl %r15d, %eax
xorl %edx, %edx
divl %ecx
leaq 0x5450(%rip), %r14      # 0xc123
movl %eax, %r15d
jmp 0x6afd
leaq 0x544b(%rip), %r14      # 0xc12d
jmp 0x6afd