// File: /workspace/github_c_makefile_star2_O1/sTeeLM[P]dwipe/gui.c
// Function: dwipe_gui_method
void dwipe_gui_method( void )
{
/**
 * Allows the user to change the wipe method.
 *
 * @modifies  dwipe_options.method
 * @modifies  main_window
 *
 */

	/* The number of implemented methods. */
	const int count = 6;

	/* The first tabstop. */
	const int tab1 = 2;

	/* The second tabstop. */
	const int tab2 = 30;

	/* The currently selected method. */
	int focus = 0;

	/* The current working row. */
	int yy;

	/* Input buffer. */
	int keystroke;

	/* Update the footer window. */
	werase( footer_window );
	dwipe_gui_title( footer_window, dwipe_buttons2 );
	wrefresh( footer_window );

	if( dwipe_options.method == &dwipe_zero       ) { focus = 0; }
	if( dwipe_options.method == &dwipe_ops2       ) { focus = 1; }
	if( dwipe_options.method == &dwipe_dodshort   ) { focus = 2; }
	if( dwipe_options.method == &dwipe_dod522022m ) { focus = 3; }
	if( dwipe_options.method == &dwipe_gutmann    ) { focus = 4; }
	if( dwipe_options.method == &dwipe_random     ) { focus = 5; }


	do
	{
		/* Clear the main window. */
		werase( main_window );

		/* Initialize the working row. */
		yy = 2;

		/* Print the options. */
		mvwprintw( main_window, yy++, tab1, "  %s", dwipe_method_label( &dwipe_zero       ) );
		mvwprintw( main_window, yy++, tab1, "  %s", dwipe_method_label( &dwipe_ops2       ) );
		mvwprintw( main_window, yy++, tab1, "  %s", dwipe_method_label( &dwipe_dodshort   ) );
		mvwprintw( main_window, yy++, tab1, "  %s", dwipe_method_label( &dwipe_dod522022m ) );
		mvwprintw( main_window, yy++, tab1, "  %s", dwipe_method_label( &dwipe_gutmann    ) );
		mvwprintw( main_window, yy++, tab1, "  %s", dwipe_method_label( &dwipe_random     ) );
		mvwprintw( main_window, yy++, tab1, "                                             " );

		/* Print the cursor. */
		mvwaddch( main_window, 2 + focus, tab1, ACS_RARROW );

		switch( focus )
		{
			case 0:

				mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"dwipe --method zero\"" );
				mvwprintw( main_window, 3, tab2, "Security Level: Low (1 pass)" );

				/*                                 0         1         2         3         4         5         6         7         8  */
				mvwprintw( main_window, yy++, tab1, "This method fills the device with zeros. Note that the rounds option does    " );
				mvwprintw( main_window, yy++, tab1, "not apply to this method. This method always runs one round.                 " );
				mvwprintw( main_window, yy++, tab1, "                                                                             " );
				mvwprintw( main_window, yy++, tab1, "Use this method to blank disks before internal redeployment, or before       " );
				mvwprintw( main_window, yy++, tab1, "reinstalling Microsoft Windows to remove the data areas that the format      " );
				mvwprintw( main_window, yy++, tab1, "utility preserves.                                                    " );
				break;

			case 1:

				mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"dwipe --method ops2\"" );
				mvwprintw( main_window, 3, tab2, "Security Level: Medium (8 passes)" );

				/*                                 0         1         2         3         4         5         6         7         8  */
				mvwprintw( main_window, yy++, tab1, "The Royal Canadian Mounted Police Technical Security Standard for            " );
				mvwprintw( main_window, yy++, tab1, "Information Technology, Appendix OPS-II: Media Sanitization.                 " );
				mvwprintw( main_window, yy++, tab1, "                                                                             " );
				mvwprintw( main_window, yy++, tab1, "This implementation, with regards to paragraph 2 section A of the standard,  " );
				mvwprintw( main_window, yy++, tab1, "uses a pattern that is one random byte and that is changed each round.       " );
				break;

			case 2:

				mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"dwipe --method dodshort\"" );
				mvwprintw( main_window, 3, tab2, "Security Level: Medium (3 passes)" );

				/*                                 0         1         2         3         4         5         6         7         8  */
				mvwprintw( main_window, yy++, tab1, "The American Department of Defense 5220.22-M short wipe.                     " );
				mvwprintw( main_window, yy++, tab1, "This method is composed of passes 1,2,7 from the standard wipe.              " );
				break;

			case 3:

				mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"dwipe --method dod522022m\"" );
				mvwprintw( main_window, 3, tab2, "Security Level: Medium (7 passes)" );

				/*                                 0         1         2         3         4         5         6         7         8  */
				mvwprintw( main_window, yy++, tab1, "The American Department of Defense 5220.22-M standard wipe.                  " );
				mvwprintw( main_window, yy++, tab1, "This implementation uses the same algorithm as the Heidi Eraser product.     " );
				break;

			case 4:

				mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"dwipe --method gutmann\"" );
				mvwprintw( main_window, 3, tab2, "Security Level: High (35 passes)" );

				/*                                 0         1         2         3         4         5         6         7         8  */
				mvwprintw( main_window, yy++, tab1, "This is the method described by Peter Gutmann in the paper entitled          " );
				mvwprintw( main_window, yy++, tab1, "\"Secure Deletion of Data from Magnetic and Solid-State Memory\".            " );
				break;

			case 5:

				mvwprintw( main_window, 2, tab2, "syslinux.cfg: nuke=\"dwipe --method random\"" );
				mvwprintw( main_window, 3, tab2, "Security Level: Depends on Rounds" );

				/*                                 0         1         2         3         4         5         6         7         8  */
				mvwprintw( main_window, yy++, tab1, "This method fills the device with a stream from the PRNG. It is probably the " );
				mvwprintw( main_window, yy++, tab1, "best method to use on modern hard disk drives because encoding schemes vary. " );
				mvwprintw( main_window, yy++, tab1, "                                                                             " );
				mvwprintw( main_window, yy++, tab1, "This method has a medium security level with 4 rounds, and a high security   " );
				mvwprintw( main_window, yy++, tab1, "level with 8 rounds.                                                         " );
				break;

		} /* switch */

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

		/* Add a title. */
		dwipe_gui_title( main_window, " Wipe Method " );

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

		/* Get a keystroke. */
		keystroke = getch();

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

				if( focus < count -1 ) { focus += 1; } 
				break;

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

				if( focus > 0 ) { focus -= 1; } 
				break;

			case KEY_BACKSPACE:
			case KEY_BREAK:

				return;

		} /* switch */

	} while( keystroke != KEY_ENTER && keystroke != ' ' && keystroke != 10 );

	switch( focus )
	{
		case 0:
			dwipe_options.method = &dwipe_zero;
			break;

		case 1:
			dwipe_options.method = &dwipe_ops2;
			break;

		case 2:
			dwipe_options.method = &dwipe_dodshort;
			break;

		case 3:
			dwipe_options.method = &dwipe_dod522022m;
			break;

		case 4:
			dwipe_options.method = &dwipe_gutmann;
			break;

		case 5:
			dwipe_options.method = &dwipe_random;
			break;
	}


}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0xbe12(%rip), %rdi      # 0x11810
callq 0x3050
movq 0xbe06(%rip), %rdi      # 0x11810
movq 0xbc57(%rip), %rsi      # 0x11668
callq 0x4c4c
movq 0xbdf3(%rip), %rdi      # 0x11810
callq 0x31b0
leaq 0xbe17(%rip), %rax      # 0x11840
movq 0x10(%rax), %rax
xorl %ebp, %ebp
cmpq 0xb54a(%rip), %rax      # 0x10f80
sete %bpl
cmpq 0xb547(%rip), %rax      # 0x10f88
movl $0x2, %ecx
cmovel %ecx, %ebp
cmpq 0xb5a8(%rip), %rax      # 0x10ff8
movl $0x3, %ecx
cmovel %ecx, %ebp
cmpq 0xb561(%rip), %rax      # 0x10fc0
movl $0x4, %ecx
cmovel %ecx, %ebp
cmpq 0xb562(%rip), %rax      # 0x10fd0
movl $0x5, %eax
cmovel %eax, %ebp
leaq 0x67ce(%rip), %r14      # 0xc24b
xorl %ebx, %ebx
leaq 0x6592(%rip), %r15      # 0xc018
leaq 0x760c(%rip), %r12      # 0xd099
movq 0xbd94(%rip), %rdi      # 0x11828
callq 0x3050
movq 0xbd88(%rip), %r13      # 0x11828
leaq 0x2798(%rip), %rdi      # 0x823f
callq 0x7c74
movq %r13, %rdi
movl $0x2, %esi
movl $0x2, %edx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xbd5b(%rip), %r13      # 0x11828
leaq 0x2578(%rip), %rdi      # 0x804c
callq 0x7c74
movq %r13, %rdi
movl $0x3, %esi
movl $0x2, %edx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xbd2e(%rip), %r13      # 0x11828
leaq 0x230e(%rip), %rdi      # 0x7e0f
callq 0x7c74
movq %r13, %rdi
movl $0x4, %esi
movl $0x2, %edx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xbd01(%rip), %r13      # 0x11828
leaq 0x21cf(%rip), %rdi      # 0x7cfd
callq 0x7c74
movq %r13, %rdi
movl $0x5, %esi
movl $0x2, %edx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xbcd4(%rip), %r13      # 0x11828
leaq 0x2377(%rip), %rdi      # 0x7ed2
callq 0x7c74
movq %r13, %rdi
movl $0x6, %esi
movl $0x2, %edx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xbca7(%rip), %r13      # 0x11828
leaq 0x2691(%rip), %rdi      # 0x8219
callq 0x7c74
movq %r13, %rdi
movl $0x7, %esi
movl $0x2, %edx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xbc7a(%rip), %rdi      # 0x11828
movl $0x8, %esi
movl $0x2, %edx
leaq 0x6e02(%rip), %rcx      # 0xc9c1
xorl %eax, %eax
callq 0x31c0
movq 0xbc5b(%rip), %rdi      # 0x11828
leal 0x2(%rbp), %esi
movl $0x2, %edx
callq 0x33a0
cmpl $-0x1, %eax
je 0x5bf8
movq 0xbc42(%rip), %rdi      # 0x11828
movq 0xb3ab(%rip), %rax      # 0x10f98
movl 0xac(%rax), %esi
callq 0x33e0
movq 0xbc29(%rip), %rdi      # 0x11828
movl %ebp, %eax
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x6ca4(%rip), %rcx      # 0xc8bf
xorl %eax, %eax
callq 0x31c0
movq 0xbbff(%rip), %rdi      # 0x11828
movl $0x3, %esi
movl $0x1e, %edx
leaq 0x6cae(%rip), %rcx      # 0xc8e8
xorl %eax, %eax
callq 0x31c0
movq 0xbbe0(%rip), %rdi      # 0x11828
movl $0x9, %esi
movl $0x2, %edx
leaq 0x6cac(%rip), %rcx      # 0xc905
xorl %eax, %eax
callq 0x31c0
movq 0xbbc1(%rip), %rdi      # 0x11828
movl $0xa, %esi
movl $0x2, %edx
leaq 0x6cdb(%rip), %rcx      # 0xc953
xorl %eax, %eax
callq 0x31c0
movq 0xbba2(%rip), %rdi      # 0x11828
movl $0xb, %esi
movl $0x2, %edx
leaq 0x6d0a(%rip), %rcx      # 0xc9a1
xorl %eax, %eax
callq 0x31c0
movq 0xbb83(%rip), %rdi      # 0x11828
movl $0xc, %esi
movl $0x2, %edx
leaq 0x6d39(%rip), %rcx      # 0xc9ef
xorl %eax, %eax
callq 0x31c0
movq 0xbb64(%rip), %rdi      # 0x11828
movl $0xd, %esi
movl $0x2, %edx
leaq 0x6d68(%rip), %rcx      # 0xca3d
xorl %eax, %eax
callq 0x31c0
movq 0xbb45(%rip), %rdi      # 0x11828
movl $0xe, %esi
movl $0x2, %edx
leaq 0x6d97(%rip), %rcx      # 0xca8b
jmp 0x5fed
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x7123(%rip), %rcx      # 0xce2d
xorl %eax, %eax
callq 0x31c0
movq 0xbb10(%rip), %rdi      # 0x11828
movl $0x3, %esi
movl $0x1e, %edx
leaq 0x7130(%rip), %rcx      # 0xce59
xorl %eax, %eax
callq 0x31c0
movq 0xbaf1(%rip), %rdi      # 0x11828
movl $0x9, %esi
movl $0x2, %edx
leaq 0x7132(%rip), %rcx      # 0xce7a
xorl %eax, %eax
callq 0x31c0
movq 0xbad2(%rip), %rdi      # 0x11828
movl $0xa, %esi
movl $0x2, %edx
leaq 0x7161(%rip), %rcx      # 0xcec8
jmp 0x5fed
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x6ed8(%rip), %rcx      # 0xcc55
xorl %eax, %eax
callq 0x31c0
movq 0xba9d(%rip), %rdi      # 0x11828
movl $0x3, %esi
movl $0x1e, %edx
leaq 0x6ee6(%rip), %rcx      # 0xcc82
xorl %eax, %eax
callq 0x31c0
movq 0xba7e(%rip), %rdi      # 0x11828
movl $0x9, %esi
movl $0x2, %edx
leaq 0x6ee9(%rip), %rcx      # 0xcca4
xorl %eax, %eax
callq 0x31c0
movq 0xba5f(%rip), %rdi      # 0x11828
movl $0xa, %esi
movl $0x2, %edx
leaq 0x6f18(%rip), %rcx      # 0xccf2
jmp 0x5fed
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x6f50(%rip), %rcx      # 0xcd40
xorl %eax, %eax
callq 0x31c0
movq 0xba2a(%rip), %rdi      # 0x11828
movl $0x3, %esi
movl $0x1e, %edx
leaq 0x6f60(%rip), %rcx      # 0xcd6f
xorl %eax, %eax
callq 0x31c0
movq 0xba0b(%rip), %rdi      # 0x11828
movl $0x9, %esi
movl $0x2, %edx
leaq 0x6f63(%rip), %rcx      # 0xcd91
xorl %eax, %eax
callq 0x31c0
movq 0xb9ec(%rip), %rdi      # 0x11828
movl $0xa, %esi
movl $0x2, %edx
leaq 0x6f92(%rip), %rcx      # 0xcddf
jmp 0x5fed
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x6c6f(%rip), %rcx      # 0xcad2
xorl %eax, %eax
callq 0x31c0
movq 0xb9b7(%rip), %rdi      # 0x11828
movl $0x3, %esi
movl $0x1e, %edx
leaq 0x6c79(%rip), %rcx      # 0xcafb
xorl %eax, %eax
callq 0x31c0
movq 0xb998(%rip), %rdi      # 0x11828
movl $0x9, %esi
movl $0x2, %edx
leaq 0x6c7c(%rip), %rcx      # 0xcb1d
xorl %eax, %eax
callq 0x31c0
movq 0xb979(%rip), %rdi      # 0x11828
movl $0xa, %esi
movl $0x2, %edx
leaq 0x6cab(%rip), %rcx      # 0xcb6b
xorl %eax, %eax
callq 0x31c0
movq 0xb95a(%rip), %rdi      # 0x11828
movl $0xb, %esi
movl $0x2, %edx
leaq 0x6ac2(%rip), %rcx      # 0xc9a1
xorl %eax, %eax
callq 0x31c0
movq 0xb93b(%rip), %rdi      # 0x11828
movl $0xc, %esi
movl $0x2, %edx
leaq 0x6cbb(%rip), %rcx      # 0xcbb9
xorl %eax, %eax
callq 0x31c0
movq 0xb91c(%rip), %rdi      # 0x11828
movl $0xd, %esi
movl $0x2, %edx
leaq 0x6cea(%rip), %rcx      # 0xcc07
jmp 0x5fed
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x6fe1(%rip), %rcx      # 0xcf14
xorl %eax, %eax
callq 0x31c0
movq 0xb8e7(%rip), %rdi      # 0x11828
movl $0x3, %esi
movl $0x1e, %edx
leaq 0x6fed(%rip), %rcx      # 0xcf3f
xorl %eax, %eax
callq 0x31c0
movq 0xb8c8(%rip), %rdi      # 0x11828
movl $0x9, %esi
movl $0x2, %edx
leaq 0x6ff0(%rip), %rcx      # 0xcf61
xorl %eax, %eax
callq 0x31c0
movq 0xb8a9(%rip), %rdi      # 0x11828
movl $0xa, %esi
movl $0x2, %edx
leaq 0x701f(%rip), %rcx      # 0xcfaf
xorl %eax, %eax
callq 0x31c0
movq 0xb88a(%rip), %rdi      # 0x11828
movl $0xb, %esi
movl $0x2, %edx
leaq 0x69f2(%rip), %rcx      # 0xc9a1
xorl %eax, %eax
callq 0x31c0
movq 0xb86b(%rip), %rdi      # 0x11828
movl $0xc, %esi
movl $0x2, %edx
leaq 0x702f(%rip), %rcx      # 0xcffd
xorl %eax, %eax
callq 0x31c0
movq 0xb84c(%rip), %rdi      # 0x11828
movl $0xd, %esi
movl $0x2, %edx
leaq 0x705e(%rip), %rcx      # 0xd04b
xorl %eax, %eax
callq 0x31c0
movq 0xb82d(%rip), %rdi      # 0x11828
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 0xb80a(%rip), %rdi      # 0x11828
movq %r12, %rsi
callq 0x4c4c
movq 0xb7fb(%rip), %rdi      # 0x11828
callq 0x31b0
movq 0xaf67(%rip), %rax      # 0x10fa0
movq (%rax), %rdi
callq 0x3120
cmpl $0x6a, %eax
jle 0x6061
leal -0x101(%rax), %ecx
cmpl $0x6, %ecx
ja 0x6080
leaq 0x5fd8(%rip), %rdx      # 0xc030
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x4a, %eax
je 0x6070
cmpl $0x4b, %eax
je 0x6085
cmpl $0x6a, %eax
jne 0x608f
cmpl $0x5, %ebp
leal 0x1(%rbp), %ecx
movl $0x5, %edx
cmovgel %edx, %ecx
jmp 0x608d
cmpl $0x6b, %eax
jne 0x608f
testl %ebp, %ebp
leal -0x1(%rbp), %ecx
cmovlel %ebx, %ecx
movl %ecx, %ebp
cmpl $0xa, %eax
je 0x60a4
cmpl $0x157, %eax            # imm = 0x157
je 0x60a4
cmpl $0x20, %eax
jne 0x5a8d
movslq %ebp, %rax
leaq 0xaa22(%rip), %rcx      # 0x10ad0
movq (%rcx,%rax,8), %rax
leaq 0xb787(%rip), %rcx      # 0x11840
movq %rax, 0x10(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq