// File: /workspace/github_c_makefile_star2_O3/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 0xbda3(%rip), %rdi      # 0x11810
callq 0x3050
movq 0xbd97(%rip), %rdi      # 0x11810
movq 0xbbe8(%rip), %rsi      # 0x11668
callq 0x4cbc
movq 0xbd84(%rip), %rdi      # 0x11810
callq 0x31b0
leaq 0xbda8(%rip), %rax      # 0x11840
movq 0x10(%rax), %rax
xorl %ebp, %ebp
cmpq 0xb4db(%rip), %rax      # 0x10f80
sete %bpl
cmpq 0xb4d8(%rip), %rax      # 0x10f88
movl $0x2, %ecx
cmovel %ecx, %ebp
cmpq 0xb539(%rip), %rax      # 0x10ff8
movl $0x3, %ecx
cmovel %ecx, %ebp
cmpq 0xb4f2(%rip), %rax      # 0x10fc0
movl $0x4, %ecx
cmovel %ecx, %ebp
cmpq 0xb4f3(%rip), %rax      # 0x10fd0
movl $0x5, %eax
cmovel %eax, %ebp
leaq 0x675f(%rip), %r14      # 0xc24b
xorl %ebx, %ebx
leaq 0x6523(%rip), %r15      # 0xc018
leaq 0x759d(%rip), %r12      # 0xd099
movq 0xbd25(%rip), %rdi      # 0x11828
callq 0x3050
movq 0xbd19(%rip), %r13      # 0x11828
leaq 0x27b5(%rip), %rdi      # 0x82cb
callq 0x7cf8
movq %r13, %rdi
movl $0x2, %esi
movl $0x2, %edx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xbcec(%rip), %r13      # 0x11828
leaq 0x258d(%rip), %rdi      # 0x80d0
callq 0x7cf8
movq %r13, %rdi
movl $0x3, %esi
movl $0x2, %edx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xbcbf(%rip), %r13      # 0x11828
leaq 0x2323(%rip), %rdi      # 0x7e93
callq 0x7cf8
movq %r13, %rdi
movl $0x4, %esi
movl $0x2, %edx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xbc92(%rip), %r13      # 0x11828
leaq 0x21e4(%rip), %rdi      # 0x7d81
callq 0x7cf8
movq %r13, %rdi
movl $0x5, %esi
movl $0x2, %edx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xbc65(%rip), %r13      # 0x11828
leaq 0x238c(%rip), %rdi      # 0x7f56
callq 0x7cf8
movq %r13, %rdi
movl $0x6, %esi
movl $0x2, %edx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xbc38(%rip), %r13      # 0x11828
leaq 0x26ae(%rip), %rdi      # 0x82a5
callq 0x7cf8
movq %r13, %rdi
movl $0x7, %esi
movl $0x2, %edx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xbc0b(%rip), %rdi      # 0x11828
movl $0x8, %esi
movl $0x2, %edx
leaq 0x6d93(%rip), %rcx      # 0xc9c1
xorl %eax, %eax
callq 0x31c0
movq 0xbbec(%rip), %rdi      # 0x11828
leal 0x2(%rbp), %esi
movl $0x2, %edx
callq 0x33b0
cmpl $-0x1, %eax
je 0x5c67
movq 0xbbd3(%rip), %rdi      # 0x11828
movq 0xb33c(%rip), %rax      # 0x10f98
movl 0xac(%rax), %esi
callq 0x33f0
movq 0xbbba(%rip), %rdi      # 0x11828
movl %ebp, %eax
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x6c35(%rip), %rcx      # 0xc8bf
xorl %eax, %eax
callq 0x31c0
movq 0xbb90(%rip), %rdi      # 0x11828
movl $0x3, %esi
movl $0x1e, %edx
leaq 0x6c3f(%rip), %rcx      # 0xc8e8
xorl %eax, %eax
callq 0x31c0
movq 0xbb71(%rip), %rdi      # 0x11828
movl $0x9, %esi
movl $0x2, %edx
leaq 0x6c3d(%rip), %rcx      # 0xc905
xorl %eax, %eax
callq 0x31c0
movq 0xbb52(%rip), %rdi      # 0x11828
movl $0xa, %esi
movl $0x2, %edx
leaq 0x6c6c(%rip), %rcx      # 0xc953
xorl %eax, %eax
callq 0x31c0
movq 0xbb33(%rip), %rdi      # 0x11828
movl $0xb, %esi
movl $0x2, %edx
leaq 0x6c9b(%rip), %rcx      # 0xc9a1
xorl %eax, %eax
callq 0x31c0
movq 0xbb14(%rip), %rdi      # 0x11828
movl $0xc, %esi
movl $0x2, %edx
leaq 0x6cca(%rip), %rcx      # 0xc9ef
xorl %eax, %eax
callq 0x31c0
movq 0xbaf5(%rip), %rdi      # 0x11828
movl $0xd, %esi
movl $0x2, %edx
leaq 0x6cf9(%rip), %rcx      # 0xca3d
xorl %eax, %eax
callq 0x31c0
movq 0xbad6(%rip), %rdi      # 0x11828
movl $0xe, %esi
movl $0x2, %edx
leaq 0x6d28(%rip), %rcx      # 0xca8b
jmp 0x605c
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x70b4(%rip), %rcx      # 0xce2d
xorl %eax, %eax
callq 0x31c0
movq 0xbaa1(%rip), %rdi      # 0x11828
movl $0x3, %esi
movl $0x1e, %edx
leaq 0x70c1(%rip), %rcx      # 0xce59
xorl %eax, %eax
callq 0x31c0
movq 0xba82(%rip), %rdi      # 0x11828
movl $0x9, %esi
movl $0x2, %edx
leaq 0x70c3(%rip), %rcx      # 0xce7a
xorl %eax, %eax
callq 0x31c0
movq 0xba63(%rip), %rdi      # 0x11828
movl $0xa, %esi
movl $0x2, %edx
leaq 0x70f2(%rip), %rcx      # 0xcec8
jmp 0x605c
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x6e69(%rip), %rcx      # 0xcc55
xorl %eax, %eax
callq 0x31c0
movq 0xba2e(%rip), %rdi      # 0x11828
movl $0x3, %esi
movl $0x1e, %edx
leaq 0x6e77(%rip), %rcx      # 0xcc82
xorl %eax, %eax
callq 0x31c0
movq 0xba0f(%rip), %rdi      # 0x11828
movl $0x9, %esi
movl $0x2, %edx
leaq 0x6e7a(%rip), %rcx      # 0xcca4
xorl %eax, %eax
callq 0x31c0
movq 0xb9f0(%rip), %rdi      # 0x11828
movl $0xa, %esi
movl $0x2, %edx
leaq 0x6ea9(%rip), %rcx      # 0xccf2
jmp 0x605c
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x6ee1(%rip), %rcx      # 0xcd40
xorl %eax, %eax
callq 0x31c0
movq 0xb9bb(%rip), %rdi      # 0x11828
movl $0x3, %esi
movl $0x1e, %edx
leaq 0x6ef1(%rip), %rcx      # 0xcd6f
xorl %eax, %eax
callq 0x31c0
movq 0xb99c(%rip), %rdi      # 0x11828
movl $0x9, %esi
movl $0x2, %edx
leaq 0x6ef4(%rip), %rcx      # 0xcd91
xorl %eax, %eax
callq 0x31c0
movq 0xb97d(%rip), %rdi      # 0x11828
movl $0xa, %esi
movl $0x2, %edx
leaq 0x6f23(%rip), %rcx      # 0xcddf
jmp 0x605c
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x6c00(%rip), %rcx      # 0xcad2
xorl %eax, %eax
callq 0x31c0
movq 0xb948(%rip), %rdi      # 0x11828
movl $0x3, %esi
movl $0x1e, %edx
leaq 0x6c0a(%rip), %rcx      # 0xcafb
xorl %eax, %eax
callq 0x31c0
movq 0xb929(%rip), %rdi      # 0x11828
movl $0x9, %esi
movl $0x2, %edx
leaq 0x6c0d(%rip), %rcx      # 0xcb1d
xorl %eax, %eax
callq 0x31c0
movq 0xb90a(%rip), %rdi      # 0x11828
movl $0xa, %esi
movl $0x2, %edx
leaq 0x6c3c(%rip), %rcx      # 0xcb6b
xorl %eax, %eax
callq 0x31c0
movq 0xb8eb(%rip), %rdi      # 0x11828
movl $0xb, %esi
movl $0x2, %edx
leaq 0x6a53(%rip), %rcx      # 0xc9a1
xorl %eax, %eax
callq 0x31c0
movq 0xb8cc(%rip), %rdi      # 0x11828
movl $0xc, %esi
movl $0x2, %edx
leaq 0x6c4c(%rip), %rcx      # 0xcbb9
xorl %eax, %eax
callq 0x31c0
movq 0xb8ad(%rip), %rdi      # 0x11828
movl $0xd, %esi
movl $0x2, %edx
leaq 0x6c7b(%rip), %rcx      # 0xcc07
jmp 0x605c
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x6f72(%rip), %rcx      # 0xcf14
xorl %eax, %eax
callq 0x31c0
movq 0xb878(%rip), %rdi      # 0x11828
movl $0x3, %esi
movl $0x1e, %edx
leaq 0x6f7e(%rip), %rcx      # 0xcf3f
xorl %eax, %eax
callq 0x31c0
movq 0xb859(%rip), %rdi      # 0x11828
movl $0x9, %esi
movl $0x2, %edx
leaq 0x6f81(%rip), %rcx      # 0xcf61
xorl %eax, %eax
callq 0x31c0
movq 0xb83a(%rip), %rdi      # 0x11828
movl $0xa, %esi
movl $0x2, %edx
leaq 0x6fb0(%rip), %rcx      # 0xcfaf
xorl %eax, %eax
callq 0x31c0
movq 0xb81b(%rip), %rdi      # 0x11828
movl $0xb, %esi
movl $0x2, %edx
leaq 0x6983(%rip), %rcx      # 0xc9a1
xorl %eax, %eax
callq 0x31c0
movq 0xb7fc(%rip), %rdi      # 0x11828
movl $0xc, %esi
movl $0x2, %edx
leaq 0x6fc0(%rip), %rcx      # 0xcffd
xorl %eax, %eax
callq 0x31c0
movq 0xb7dd(%rip), %rdi      # 0x11828
movl $0xd, %esi
movl $0x2, %edx
leaq 0x6fef(%rip), %rcx      # 0xd04b
xorl %eax, %eax
callq 0x31c0
movq 0xb7be(%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 0xb79b(%rip), %rdi      # 0x11828
movq %r12, %rsi
callq 0x4cbc
movq 0xb78c(%rip), %rdi      # 0x11828
callq 0x31b0
movq 0xaef8(%rip), %rax      # 0x10fa0
movq (%rax), %rdi
callq 0x3120
cmpl $0x6a, %eax
jle 0x60d0
leal -0x101(%rax), %ecx
cmpl $0x6, %ecx
ja 0x60f1
leaq 0x5f69(%rip), %rdx      # 0xc030
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x4a, %eax
je 0x60df
cmpl $0x4b, %eax
je 0x60f6
cmpl $0x6a, %eax
jne 0x60fc
cmpl $0x5, %ebp
leal 0x1(%rbp), %ecx
movl $0x5, %edx
cmovael %edx, %ecx
movl %ecx, %ebp
jmp 0x60fc
cmpl $0x6b, %eax
jne 0x60fc
subl $0x1, %ebp
cmovbl %ebx, %ebp
cmpl $0xa, %eax
je 0x6111
cmpl $0x157, %eax            # imm = 0x157
je 0x6111
cmpl $0x20, %eax
jne 0x5afc
movslq %ebp, %rax
leaq 0xa9b5(%rip), %rcx      # 0x10ad0
movq (%rcx,%rax,8), %rax
leaq 0xb71a(%rip), %rcx      # 0x11840
movq %rax, 0x10(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq