// File: /workspace/github_c_makefile_star2_O2/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 0xb1c4(%rip), %rdi      # 0x10810
callq 0x3050
movq 0xb1b8(%rip), %rdi      # 0x10810
movq 0xb009(%rip), %rsi      # 0x10668
callq 0x4974
movq 0xb1a5(%rip), %rdi      # 0x10810
callq 0x31b0
leaq 0xb1c9(%rip), %rax      # 0x10840
movq 0x10(%rax), %rax
xorl %r15d, %r15d
cmpq 0xa8fb(%rip), %rax      # 0xff80
sete %r15b
cmpq 0xa8f8(%rip), %rax      # 0xff88
pushq $0x2
popq %rbx
cmovel %ebx, %r15d
cmpq 0xa95a(%rip), %rax      # 0xfff8
pushq $0x3
popq %rbp
cmovel %ebp, %r15d
cmpq 0xa914(%rip), %rax      # 0xffc0
pushq $0x4
popq %rcx
cmovel %ecx, %r15d
cmpq 0xa916(%rip), %rax      # 0xffd0
pushq $0x5
popq %rax
cmovel %eax, %r15d
leaq 0x5b83(%rip), %r13      # 0xb24b
pushq $0x1e
popq %r12
movq 0xb155(%rip), %rdi      # 0x10828
callq 0x3050
movq 0xb149(%rip), %r14      # 0x10828
leaq 0x24b8(%rip), %rdi      # 0x7b9e
callq 0x7630
movq %r14, %rdi
movl %ebx, %esi
movl %ebx, %edx
movq %r13, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xb122(%rip), %r14      # 0x10828
leaq 0x22b7(%rip), %rdi      # 0x79c4
callq 0x7630
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
movq %r13, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xb0fb(%rip), %r14      # 0x10828
leaq 0x2081(%rip), %rdi      # 0x77b5
callq 0x7630
movq %r14, %rdi
pushq $0x4
popq %rsi
movl %ebx, %edx
movq %r13, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xb0d3(%rip), %r14      # 0x10828
leaq 0x1f5d(%rip), %rdi      # 0x76b9
callq 0x7630
movq %r14, %rdi
pushq $0x5
popq %rsi
movl %ebx, %edx
movq %r13, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xb0ab(%rip), %r14      # 0x10828
leaq 0x20e3(%rip), %rdi      # 0x7867
callq 0x7630
movq %r14, %rdi
pushq $0x6
popq %rsi
movl %ebx, %edx
movq %r13, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xb083(%rip), %r14      # 0x10828
leaq 0x23cc(%rip), %rdi      # 0x7b78
callq 0x7630
movq %r14, %rdi
pushq $0x7
popq %rsi
movl %ebx, %edx
movq %r13, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31c0
movq 0xb05b(%rip), %rdi      # 0x10828
pushq $0x8
popq %rsi
movl %ebx, %edx
leaq 0x61e8(%rip), %rcx      # 0xb9c1
xorl %eax, %eax
callq 0x31c0
movq 0xb041(%rip), %rdi      # 0x10828
leal 0x2(%r15), %esi
movl %ebx, %edx
callq 0x33b0
cmpl $-0x1, %eax
je 0x5810
movq 0xb02a(%rip), %rdi      # 0x10828
movq 0xa793(%rip), %rax      # 0xff98
movl 0xac(%rax), %esi
callq 0x33f0
movq 0xb011(%rip), %rdi      # 0x10828
movl %r15d, %eax
leaq 0x57f7(%rip), %rcx      # 0xb018
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %ebx, %esi
movl %r12d, %edx
leaq 0x6089(%rip), %rcx      # 0xb8bf
xorl %eax, %eax
callq 0x31c0
movq 0xafe4(%rip), %rdi      # 0x10828
movl %ebp, %esi
movl %r12d, %edx
leaq 0x6098(%rip), %rcx      # 0xb8e8
xorl %eax, %eax
callq 0x31c0
movq 0xafca(%rip), %rdi      # 0x10828
pushq $0x9
popq %rsi
movl %ebx, %edx
leaq 0x609b(%rip), %rcx      # 0xb905
xorl %eax, %eax
callq 0x31c0
movq 0xafb0(%rip), %rdi      # 0x10828
pushq $0xa
popq %rsi
movl %ebx, %edx
leaq 0x60cf(%rip), %rcx      # 0xb953
xorl %eax, %eax
callq 0x31c0
movq 0xaf96(%rip), %rdi      # 0x10828
pushq $0xb
popq %rsi
movl %ebx, %edx
leaq 0x6103(%rip), %rcx      # 0xb9a1
xorl %eax, %eax
callq 0x31c0
movq 0xaf7c(%rip), %rdi      # 0x10828
pushq $0xc
popq %rsi
movl %ebx, %edx
leaq 0x6137(%rip), %rcx      # 0xb9ef
xorl %eax, %eax
callq 0x31c0
movq 0xaf62(%rip), %rdi      # 0x10828
pushq $0xd
popq %rsi
movl %ebx, %edx
leaq 0x616b(%rip), %rcx      # 0xba3d
xorl %eax, %eax
callq 0x31c0
movq 0xaf48(%rip), %rdi      # 0x10828
pushq $0xe
popq %rsi
movl %ebx, %edx
leaq 0x619f(%rip), %rcx      # 0xba8b
jmp 0x5b63
movl %ebx, %esi
movl %r12d, %edx
leaq 0x6530(%rip), %rcx      # 0xbe2d
xorl %eax, %eax
callq 0x31c0
movq 0xaf1d(%rip), %rdi      # 0x10828
movl %ebp, %esi
movl %r12d, %edx
leaq 0x6542(%rip), %rcx      # 0xbe59
xorl %eax, %eax
callq 0x31c0
movq 0xaf03(%rip), %rdi      # 0x10828
pushq $0x9
popq %rsi
movl %ebx, %edx
leaq 0x6549(%rip), %rcx      # 0xbe7a
xorl %eax, %eax
callq 0x31c0
movq 0xaee9(%rip), %rdi      # 0x10828
pushq $0xa
popq %rsi
movl %ebx, %edx
leaq 0x657d(%rip), %rcx      # 0xbec8
jmp 0x5b63
movl %ebx, %esi
movl %r12d, %edx
leaq 0x62f9(%rip), %rcx      # 0xbc55
xorl %eax, %eax
callq 0x31c0
movq 0xaebe(%rip), %rdi      # 0x10828
movl %ebp, %esi
movl %r12d, %edx
leaq 0x630c(%rip), %rcx      # 0xbc82
xorl %eax, %eax
callq 0x31c0
movq 0xaea4(%rip), %rdi      # 0x10828
pushq $0x9
popq %rsi
movl %ebx, %edx
leaq 0x6314(%rip), %rcx      # 0xbca4
xorl %eax, %eax
callq 0x31c0
movq 0xae8a(%rip), %rdi      # 0x10828
pushq $0xa
popq %rsi
movl %ebx, %edx
leaq 0x6348(%rip), %rcx      # 0xbcf2
jmp 0x5b63
movl %ebx, %esi
movl %r12d, %edx
leaq 0x6385(%rip), %rcx      # 0xbd40
xorl %eax, %eax
callq 0x31c0
movq 0xae5f(%rip), %rdi      # 0x10828
movl %ebp, %esi
movl %r12d, %edx
leaq 0x639a(%rip), %rcx      # 0xbd6f
xorl %eax, %eax
callq 0x31c0
movq 0xae45(%rip), %rdi      # 0x10828
pushq $0x9
popq %rsi
movl %ebx, %edx
leaq 0x63a2(%rip), %rcx      # 0xbd91
xorl %eax, %eax
callq 0x31c0
movq 0xae2b(%rip), %rdi      # 0x10828
pushq $0xa
popq %rsi
movl %ebx, %edx
leaq 0x63d6(%rip), %rcx      # 0xbddf
jmp 0x5b63
movl %ebx, %esi
movl %r12d, %edx
leaq 0x60b8(%rip), %rcx      # 0xbad2
xorl %eax, %eax
callq 0x31c0
movq 0xae00(%rip), %rdi      # 0x10828
movl %ebp, %esi
movl %r12d, %edx
leaq 0x60c7(%rip), %rcx      # 0xbafb
xorl %eax, %eax
callq 0x31c0
movq 0xade6(%rip), %rdi      # 0x10828
pushq $0x9
popq %rsi
movl %ebx, %edx
leaq 0x60cf(%rip), %rcx      # 0xbb1d
xorl %eax, %eax
callq 0x31c0
movq 0xadcc(%rip), %rdi      # 0x10828
pushq $0xa
popq %rsi
movl %ebx, %edx
leaq 0x6103(%rip), %rcx      # 0xbb6b
xorl %eax, %eax
callq 0x31c0
movq 0xadb2(%rip), %rdi      # 0x10828
pushq $0xb
popq %rsi
movl %ebx, %edx
leaq 0x5f1f(%rip), %rcx      # 0xb9a1
xorl %eax, %eax
callq 0x31c0
movq 0xad98(%rip), %rdi      # 0x10828
pushq $0xc
popq %rsi
movl %ebx, %edx
leaq 0x611d(%rip), %rcx      # 0xbbb9
xorl %eax, %eax
callq 0x31c0
movq 0xad7e(%rip), %rdi      # 0x10828
pushq $0xd
popq %rsi
movl %ebx, %edx
leaq 0x6151(%rip), %rcx      # 0xbc07
jmp 0x5b63
movl %ebx, %esi
movl %r12d, %edx
leaq 0x644d(%rip), %rcx      # 0xbf14
xorl %eax, %eax
callq 0x31c0
movq 0xad53(%rip), %rdi      # 0x10828
movl %ebp, %esi
movl %r12d, %edx
leaq 0x645e(%rip), %rcx      # 0xbf3f
xorl %eax, %eax
callq 0x31c0
movq 0xad39(%rip), %rdi      # 0x10828
pushq $0x9
popq %rsi
movl %ebx, %edx
leaq 0x6466(%rip), %rcx      # 0xbf61
xorl %eax, %eax
callq 0x31c0
movq 0xad1f(%rip), %rdi      # 0x10828
pushq $0xa
popq %rsi
movl %ebx, %edx
leaq 0x649a(%rip), %rcx      # 0xbfaf
xorl %eax, %eax
callq 0x31c0
movq 0xad05(%rip), %rdi      # 0x10828
pushq $0xb
popq %rsi
movl %ebx, %edx
leaq 0x5e72(%rip), %rcx      # 0xb9a1
xorl %eax, %eax
callq 0x31c0
movq 0xaceb(%rip), %rdi      # 0x10828
pushq $0xc
popq %rsi
movl %ebx, %edx
leaq 0x64b4(%rip), %rcx      # 0xbffd
xorl %eax, %eax
callq 0x31c0
movq 0xacd1(%rip), %rdi      # 0x10828
pushq $0xd
popq %rsi
movl %ebx, %edx
leaq 0x64e8(%rip), %rcx      # 0xc04b
xorl %eax, %eax
callq 0x31c0
movq 0xacb7(%rip), %rdi      # 0x10828
subq $0x8, %rsp
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq $0x0
pushq $0x0
callq 0x3100
addq $0x20, %rsp
movq 0xac91(%rip), %rdi      # 0x10828
leaq 0x64fb(%rip), %rsi      # 0xc099
callq 0x4974
movq 0xac7e(%rip), %rdi      # 0x10828
callq 0x31b0
movq 0xa3ea(%rip), %rax      # 0xffa0
movq (%rax), %rdi
callq 0x3120
leal -0x101(%rax), %ecx
cmpl $0x6, %ecx
jbe 0x5bdf
cmpl $0x4a, %eax
je 0x5bef
cmpl $0x4b, %eax
je 0x5c02
cmpl $0x6b, %eax
je 0x5c02
cmpl $0x6a, %eax
je 0x5bef
jmp 0x5c0f
leaq 0x544a(%rip), %rdx      # 0xb030
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x5, %r15d
leal 0x1(%r15), %ecx
pushq $0x5
popq %rdx
cmovael %edx, %ecx
movl %ecx, %r15d
jmp 0x5c0f
subl $0x1, %r15d
movl $0x0, %ecx
cmovbl %ecx, %r15d
cmpl $0xa, %eax
je 0x5c24
cmpl $0x157, %eax            # imm = 0x157
je 0x5c24
cmpl $0x20, %eax
jne 0x56cc
movslq %r15d, %rax
leaq 0x9ea2(%rip), %rcx      # 0xfad0
movq (%rcx,%rax,8), %rax
leaq 0xac07(%rip), %rcx      # 0x10840
movq %rax, 0x10(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq