// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %rsi, %r12
movl %edi, %ebx
cmpq $0x0, 0xad88(%rip)      # 0x11830
jne 0x6abb
xorl %edi, %edi
callq 0x32a0
decq %rax
movq %rax, 0xad75(%rip)      # 0x11830
movq 0xad66(%rip), %rax      # 0x11828
testq %rax, %rax
je 0x6ad1
movswl 0x4(%rax), %r14d
incl %r14d
jmp 0x6ad7
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x6ae8
movswl 0x6(%rax), %eax
addl $-0x7, %eax
movl %eax, (%rsp)
jmp 0x6aef
movl $0xfffffff7, (%rsp)     # imm = 0xFFFFFFF7
leal -0x4(%r14), %eax
cltq
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rax
shrq $0x3f, %rax
shrq $0x20, %rcx
addl %eax, %ecx
movq %rcx, 0x10(%rsp)
xorl %edi, %edi
callq 0x32a0
movq %rax, 0x20(%rsp)
movq 0xad07(%rip), %rdi      # 0x11828
callq 0x3050
movq 0xacf3(%rip), %rdi      # 0x11820
callq 0x3050
movq 0xa467(%rip), %rax      # 0x10fa0
movq (%rax), %rdi
callq 0x3120
cmpl $0x6a, %eax
jg 0x6b57
cmpl $0x4a, %eax
je 0x6b6a
cmpl $0x4b, %eax
je 0x6b8e
cmpl $0x6a, %eax
je 0x6b6a
jmp 0x6ba7
cmpl $0x6b, %eax
je 0x6b8e
cmpl $0x103, %eax            # imm = 0x103
je 0x6b8e
cmpl $0x102, %eax            # imm = 0x102
jne 0x6ba7
movl 0xacc8(%rip), %ecx      # 0x11838
incl %ecx
movl %ecx, 0xacc0(%rip)      # 0x11838
xorl %eax, %eax
movl %ebx, %edx
subl 0x10(%rsp), %edx
jl 0x6ba1
addl 0x10(%rsp), %ecx
cmpl %ebx, %ecx
jle 0x6ba7
movl %edx, %eax
jmp 0x6ba1
movl 0xaca4(%rip), %ecx      # 0x11838
cmpl $0x2, %ecx
movl $0x1, %eax
cmovgel %ecx, %eax
decl %eax
movl %eax, 0xac91(%rip)      # 0x11838
movq %r14, 0x18(%rsp)
testl %ebx, %ebx
movl %ebx, 0x4(%rsp)
jle 0x6cdf
movl %ebx, %eax
leaq 0x370(%r12), %rbx
imulq $0x590, %rax, %r15      # imm = 0x590
xorl %ebp, %ebp
xorl %r14d, %r14d
movq $0x0, 0x8(%rsp)
xorl %r13d, %r13d
cmpl $0x0, 0x310(%r12,%rbp)
jle 0x6cbd
leaq (%rbx,%rbp), %rdi
movq 0x340(%r12,%rbp), %rsi
movq 0x20(%rsp), %rdx
callq 0x7332
movq 0x560(%r12,%rbp), %rsi
testq %rsi, %rsi
jle 0x6c55
movq 0x350(%r12,%rbp), %rcx
movq 0x460(%r12,%rbp), %rax
xorl %edx, %edx
divq %rsi
movq %rax, %rsi
movq %rax, 0x580(%r12,%rbp)
subq 0x340(%r12,%rbp), %rcx
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
movq %rax, 0x2d0(%r12,%rbp)
movq 0x8(%rsp), %rcx
cmpq %rcx, %rax
cmovaq %rax, %rcx
movq %rcx, 0x8(%rsp)
movsd 0x340(%r12,%rbp), %xmm0
movsd 0x5439(%rip), %xmm2     # 0xc0a0
unpcklps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x543e(%rip), %xmm3     # 0xc0b0
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x350(%r12,%rbp), %xmm0
unpcklps %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 0x5415(%rip), %xmm1     # 0xc0c0
movsd %xmm1, 0x358(%r12,%rbp)
addq 0x580(%r12,%rbp), %r13
addq 0x2f8(%r12,%rbp), %r14
addq 0x588(%r12,%rbp), %r14
addq $0x590, %rbp            # imm = 0x590
cmpq %rbp, %r15
jne 0x6bda
jmp 0x6cee
xorl %r13d, %r13d
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movl 0xab44(%rip), %eax      # 0x11838
movl 0x4(%rsp), %ecx
cmpl %ecx, %eax
jge 0x6f7e
cmpl $0x7, 0x18(%rsp)
jl 0x6f7e
movslq %eax, %rbp
movslq %ecx, %rbx
imulq $0x590, %rbp, %rax      # imm = 0x590
leaq (%rax,%r12), %r15
addq $0x2e0, %r15            # imm = 0x2E0
incq %rbp
movl $0x3, %r12d
leal -0x1(%r12), %esi
movq 0xaaf0(%rip), %rdi      # 0x11828
movq (%r15), %r8
movl $0x2, %edx
leaq 0x5506(%rip), %rcx      # 0xc24d
xorl %eax, %eax
callq 0x31c0
cmpl $0x0, 0x30(%r15)
jle 0x6d95
movq 0xaacc(%rip), %rdi      # 0x11828
movsd 0x78(%r15), %xmm0
movl 0x80(%r15), %r8d
movl 0x5c(%r15), %r9d
movl 0x8(%r15), %r10d
movl 0x2c(%r15), %r11d
movl %r12d, %esi
movl $0x4, %edx
leaq 0x63b2(%rip), %rcx      # 0xd136
movb $0x1, %al
pushq %r10
pushq %r11
callq 0x31c0
addq $0x10, %rsp
jmp 0x6df1
movl 0x58(%r15), %r8d
testl %r8d, %r8d
je 0x6dc4
movl 0x8c(%r15), %eax
movq 0xaa7c(%rip), %rdi      # 0x11828
movl %r12d, %esi
movl $0x4, %edx
testl %eax, %eax
je 0x6de3
leaq 0x63ad(%rip), %rcx      # 0xd16c
movl %eax, %r8d
jmp 0x6dea
movq 0xaa5d(%rip), %rdi      # 0x11828
movl %r12d, %esi
movl $0x4, %edx
leaq 0x6387(%rip), %rcx      # 0xd161
xorl %eax, %eax
callq 0x31c0
jmp 0x6df1
leaq 0x6398(%rip), %rcx      # 0xd182
xorl %eax, %eax
callq 0x31c0
movq 0x2a8(%r15), %rdx
testq %rdx, %rdx
je 0x6e12
movq 0xaa24(%rip), %rdi      # 0x11828
leaq 0x638b(%rip), %rsi      # 0xd196
xorl %eax, %eax
callq 0x3430
movq 0x18(%r15), %rdx
testq %rdx, %rdx
je 0x6e30
movq 0xaa06(%rip), %rdi      # 0x11828
leaq 0x6384(%rip), %rsi      # 0xd1ad
xorl %eax, %eax
callq 0x3430
movl 0x28(%r15), %eax
decl %eax
cmpl $0x3, %eax
ja 0x6e59
movl %eax, %eax
leaq 0x5240(%rip), %rcx      # 0xc084
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movq 0xa9d6(%rip), %rdi      # 0x11828
xorl %eax, %eax
callq 0x3430
cmpw $0x0, 0x29c(%r15)
je 0x6e79
movq 0xa9bd(%rip), %rdi      # 0x11828
leaq 0x6384(%rip), %rsi      # 0xd1f6
xorl %eax, %eax
callq 0x3430
movq 0x2a0(%r15), %rax
movabsq $0x38d7ea4c67fff, %rcx  # imm = 0x38D7EA4C67FFF
cmpq %rcx, %rax
jbe 0x6eb3
movq 0xa992(%rip), %rdi      # 0x11828
movabsq $0x232f33025bd42233, %rcx # imm = 0x232F33025BD42233
mulq %rcx
shrq $0x25, %rdx
leaq 0x6353(%rip), %rsi      # 0xd201
jmp 0x6f47
movabsq $0xe8d4a50fff, %rcx     # imm = 0xE8D4A50FFF
cmpq %rcx, %rax
jbe 0x6ee7
movq 0xa95f(%rip), %rdi      # 0x11828
shrq $0x9, %rax
movabsq $0x44b82fa09b5a53, %rcx # imm = 0x44B82FA09B5A53
mulq %rcx
shrq $0xb, %rdx
leaq 0x6329(%rip), %rsi      # 0xd20e
jmp 0x6f47
cmpq $0x3b9aca00, %rax       # imm = 0x3B9ACA00
jb 0x6f10
movq 0xa932(%rip), %rdi      # 0x11828
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
mulq %rcx
shrq $0x12, %rdx
leaq 0x630d(%rip), %rsi      # 0xd21b
jmp 0x6f47
movq 0xa911(%rip), %rdi      # 0x11828
cmpq $0xf4240, %rax          # imm = 0xF4240
jb 0x6f3d
shrq $0x3, %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
mulq %rcx
shrq $0x4, %rdx
leaq 0x62ed(%rip), %rsi      # 0xd228
jmp 0x6f47
leaq 0x62f1(%rip), %rsi      # 0xd235
movq %rax, %rdx
xorl %eax, %eax
callq 0x3430
movl 0xa8e4(%rip), %eax      # 0x11838
cmpq %rbx, %rbp
jge 0x6f7e
movq 0x10(%rsp), %rcx
addl %eax, %ecx
movslq %ecx, %rcx
addq $0x590, %r15            # imm = 0x590
leaq 0x1(%rbp), %rdx
addl $0x3, %r12d
cmpq %rcx, %rbp
movq %rdx, %rbp
jl 0x6d2c
testl %eax, %eax
movl (%rsp), %ebx
jle 0x6fba
movq 0xa89c(%rip), %rdi      # 0x11828
leaq 0x528a(%rip), %rcx      # 0xc21d
movl $0x1, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x31c0
movq 0xa880(%rip), %rdi      # 0x11828
movq 0x9fe9(%rip), %rax      # 0x10f98
movl 0xb4(%rax), %esi
callq 0x33e0
movl 0x4(%rsp), %eax
subl 0xa874(%rip), %eax      # 0x11838
cmpl 0x10(%rsp), %eax
jle 0x7002
movq 0xa857(%rip), %rdi      # 0x11828
movq 0x18(%rsp), %rsi
addl $-0x2, %esi
leaq 0x523d(%rip), %rcx      # 0xc21d
movl %ebx, %edx
xorl %eax, %eax
callq 0x31c0
movq 0xa838(%rip), %rdi      # 0x11828
movq 0x9fa1(%rip), %rax      # 0x10f98
movl 0xb8(%rax), %esi
callq 0x33e0
movq 0xa81f(%rip), %rdi      # 0x11828
subq $0x8, %rsp
xorl %eax, %eax
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rax
pushq %rax
pushq %rax
callq 0x3100
addq $0x20, %rsp
movq 0xa7fa(%rip), %rdi      # 0x11828
callq 0x31b0
callq 0x698d
movabsq $0x38d7ea4c67fff, %rax  # imm = 0x38D7EA4C67FFF
cmpq %rax, %r13
jbe 0x706a
movabsq $0x232f33025bd42233, %rcx # imm = 0x232F33025BD42233
movq %r13, %rax
mulq %rcx
movq %rdx, %r13
shrq $0x25, %r13
leaq 0x60a0(%rip), %r12      # 0xd105
jmp 0x70fa
movq %r13, %rax
shrq $0xc, %rax
cmpq $0xe8d4a51, %rax        # imm = 0xE8D4A51
jb 0x709d
shrq $0x9, %r13
movabsq $0x44b82fa09b5a53, %rcx # imm = 0x44B82FA09B5A53
movq %r13, %rax
mulq %rcx
movq %rdx, %r13
shrq $0xb, %r13
leaq 0x6074(%rip), %r12      # 0xd10f
jmp 0x70fa
cmpq $0x3b9aca00, %r13       # imm = 0x3B9ACA00
jb 0x70c6
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
movq %r13, %rax
mulq %rcx
movq %rdx, %r13
shrq $0x12, %r13
leaq 0x6055(%rip), %r12      # 0xd119
jmp 0x70fa
cmpq $0xf4240, %r13          # imm = 0xF4240
jb 0x70f3
shrq $0x3, %r13
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
movq %r13, %rax
mulq %rcx
movq %rdx, %r13
shrq $0x4, %r13
leaq 0x6032(%rip), %r12      # 0xd123
jmp 0x70fa
leaq 0x6033(%rip), %r12      # 0xd12d
movq 0xa71f(%rip), %rdi      # 0x11820
leaq 0x6139(%rip), %rcx      # 0xd241
movl $0x4, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x31c0
testq %r13, %r13
je 0x713c
movq 0xa6fb(%rip), %rdi      # 0x11820
movl $0x4, %esi
movl $0x10, %edx
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x31c0
movq 0x20(%rsp), %r15
subq 0xa6e8(%rip), %r15      # 0x11830
movabsq $0x48d159e26af37c05, %rcx # imm = 0x48D159E26AF37C05
movq %r15, %rax
imulq %rcx
movq %rdx, %r12
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0xa, %r12
addq %rax, %r12
imulq $0xe10, %r12, %rax      # imm = 0xE10
subq %rax, %r15
movabsq $-0x7777777777777777, %rcx # imm = 0x8888888888888889
movq %r15, %rax
imulq %rcx
leaq (%rdx,%r15), %r13
movq %r13, %rax
shrq $0x3f, %rax
shrq $0x5, %r13
addl %eax, %r13d
imull $0x3c, %r13d, %eax
subl %eax, %r15d
movq 0xa67d(%rip), %rdi      # 0x11820
leaq 0x60a3(%rip), %rcx      # 0xd24d
xorl %ebx, %ebx
movl $0x1, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x31c0
movq 0xa65c(%rip), %rdi      # 0x11820
subq $0x8, %rsp
leaq 0x6087(%rip), %rcx      # 0xd256
movl $0x1, %esi
movl $0x10, %edx
movl %r12d, %r8d
movl %r13d, %r9d
xorl %eax, %eax
pushq %r15
callq 0x31c0
addq $0x10, %rsp
movq 0xa62d(%rip), %rdi      # 0x11820
leaq 0x606b(%rip), %rcx      # 0xd265
movl $0x2, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x31c0
movq 0x8(%rsp), %r10
testq %r10, %r10
jle 0x727d
movq %r10, %rax
shrq $0x4, %rax
movabsq $0x91a2b3c4d5e6f81, %rcx # imm = 0x91A2B3C4D5E6F81
mulq %rcx
movq %rdx, %r8
shrq $0x3, %r8
imulq $0xe10, %r8, %rax       # imm = 0xE10
subq %rax, %r10
movabsq $0x444444444444445, %rcx # imm = 0x444444444444445
movq %r10, %rax
mulq %rcx
movq %rdx, %r9
imull $0x3c, %r9d, %eax
subl %eax, %r10d
movq 0xa5c5(%rip), %rdi      # 0x11820
subq $0x8, %rsp
leaq 0x5ff0(%rip), %rcx      # 0xd256
movl $0x2, %esi
movl $0x10, %edx
xorl %eax, %eax
pushq %r10
callq 0x31c0
addq $0x10, %rsp
movq 0xa59c(%rip), %rdi      # 0x11820
leaq 0x5fe5(%rip), %rcx      # 0xd270
movl $0x5, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x31c0
movq 0xa57d(%rip), %rdi      # 0x11820
leaq 0x5fce(%rip), %rcx      # 0xd278
movl $0x5, %esi
movl $0x10, %edx
movq %r14, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xa55b(%rip), %rdi      # 0x11820
subq $0x8, %rsp
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rbx
pushq %rbx
pushq %rbx
callq 0x3100
addq $0x20, %rsp
movq 0xa538(%rip), %rbx      # 0x11820
movq 0xa369(%rip), %r14      # 0x11658
movq %r14, %rdi
callq 0x3150
movl $0x24, %edx
subq %rax, %rdx
shrq %rdx
leaq 0x4f44(%rip), %rcx      # 0xc24d
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xa501(%rip), %rdi      # 0x11820
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31b0