// File: /workspace/github_c_makefile_star2_O0/sTeeLM[P]dwipe/gui.c
// Function: dwipe_gui_prng
void dwipe_gui_prng( void )
{
/**
 * Allows the user to change the PRNG.
 *
 * @modifies  dwipe_options.prng
 * @modifies  main_window
 *
 */

	extern dwipe_prng_t dwipe_twister;
	extern dwipe_prng_t dwipe_isaac;

	/* The number of implemented PRNGs. */
	const int count = 2;

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

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

	/* Set the initial focus. */
	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.prng == &dwipe_twister ) { focus = 0; }
	if( dwipe_options.prng == &dwipe_isaac   ) { focus = 1; }


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

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

		/* Print the options. */
		mvwprintw( main_window, yy++, tab1, ""                  );
		mvwprintw( main_window, yy++, tab1, ""                  );
		mvwprintw( main_window, yy++, tab1, "  %s", dwipe_twister.label );
		mvwprintw( main_window, yy++, tab1, "  %s", dwipe_isaac.label   );
		mvwprintw( main_window, yy++, tab1, ""                  );

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


		switch( focus )
		{
			case 0:

				mvwprintw( main_window, 2, tab2, "syslinux.cfg:  nuke=\"dwipe --prng twister\"" );

				/*                                 0         1         2         3         4         5         6         7        8  */
				mvwprintw( main_window, yy++, tab1, "The Mersenne Twister, by Makoto Matsumoto and Takuji Nishimura, is a        " );
				mvwprintw( main_window, yy++, tab1, "generalized feedback shift register PRNG that is uniform and                " );
				mvwprintw( main_window, yy++, tab1, "equidistributed in 623-dimensions with a proven period of 2^19937-1.        " );
				mvwprintw( main_window, yy++, tab1, "                                                                            " );
				mvwprintw( main_window, yy++, tab1, "This implementation passes the Marsaglia Diehard test suite.                " );
				mvwprintw( main_window, yy++, tab1, "                                                                            " );
				break;

			case 1:

				mvwprintw( main_window, 2, tab2, "syslinux.cfg:  nuke=\"dwipe --prng isaac\"" );

				/*                                 0         1         2         3         4         5         6         7        8  */
				mvwprintw( main_window, yy++, tab1, "ISAAC, by Bob Jenkins, is a PRNG derived from RC4 with a minimum period of  " );
				mvwprintw( main_window, yy++, tab1, "2^40 and an expected period of 2^8295.  It is difficult to recover the      " );
				mvwprintw( main_window, yy++, tab1, "initial PRNG state by cryptanalysis of the ISAAC stream.                    " );
				mvwprintw( main_window, yy++, tab1, "                                                                            " );
				break;

		} /* switch */

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

		/* Add a title. */
		dwipe_gui_title( main_window, " Pseudo Random Number Generator " );

		/* 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_ENTER:
			case ' ':
			case 10:

				if( focus == 0 ) { dwipe_options.prng = &dwipe_twister; }
				if( focus == 1 ) { dwipe_options.prng = &dwipe_isaac;   }
				return;

			case KEY_BACKSPACE:
			case KEY_BREAK:

				return;

		} /* switch */
		
	} /* while */

}

// Assembly:
subq $0x38, %rsp
movl $0x2, 0x34(%rsp)
movl $0x2, 0x30(%rsp)
movl $0x1e, 0x2c(%rsp)
movl $0x0, 0x28(%rsp)
movq 0xc9b5(%rip), %rdi      # 0x14800
callq 0x3050
movq 0xc9a9(%rip), %rdi      # 0x14800
movq 0xc7fa(%rip), %rsi      # 0x14658
callq 0x5a80
movq 0xc996(%rip), %rdi      # 0x14800
callq 0x31b0
leaq 0xc94a(%rip), %rcx      # 0x147c0
leaq 0xc9b3(%rip), %rax      # 0x14830
cmpq %rcx, 0x18(%rax)
jne 0x7e8b
movl $0x0, 0x28(%rsp)
leaq 0xc946(%rip), %rcx      # 0x147d8
leaq 0xc997(%rip), %rax      # 0x14830
cmpq %rcx, 0x18(%rax)
jne 0x7ea7
movl $0x1, 0x28(%rsp)
jmp 0x7ea9
movq 0xc968(%rip), %rdi      # 0x14818
callq 0x3050
movl $0x2, 0x24(%rsp)
movq 0xc954(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x9aa6(%rip), %rcx      # 0x11983
movb $0x0, %al
callq 0x31c0
movq 0xc92d(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x9a7f(%rip), %rcx      # 0x11983
movb $0x0, %al
callq 0x31c0
movq 0xc906(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
leaq 0xc89a(%rip), %rax      # 0x147c0
movq (%rax), %r8
movl $0x2, %edx
leaq 0x82ae(%rip), %rcx      # 0x101e3
movb $0x0, %al
callq 0x31c0
movq 0xc8d5(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
leaq 0xc881(%rip), %rax      # 0x147d8
movq (%rax), %r8
movl $0x2, %edx
leaq 0x827d(%rip), %rcx      # 0x101e3
movb $0x0, %al
callq 0x31c0
movq 0xc8a4(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x99f6(%rip), %rcx      # 0x11983
movb $0x0, %al
callq 0x31c0
movq 0xc87d(%rip), %rdi      # 0x14818
movl 0x28(%rsp), %esi
addl $0x4, %esi
movl $0x2, %edx
callq 0x3390
cmpl $-0x1, %eax
jne 0x7fb3
jmp 0x7fcc
movq 0xc85e(%rip), %rdi      # 0x14818
movq 0xbff7(%rip), %rax      # 0x13fb8
movl 0xac(%rax), %esi
callq 0x33d0
movl 0x28(%rsp), %eax
movl %eax, 0x1c(%rsp)
testl %eax, %eax
je 0x7fec
jmp 0x7fda
movl 0x1c(%rsp), %eax
subl $0x1, %eax
je 0x80fa
jmp 0x81b5
movq 0xc825(%rip), %rdi      # 0x14818
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x82d9(%rip), %rcx      # 0x102dd
movb $0x0, %al
callq 0x31c0
movq 0xc806(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x82dd(%rip), %rcx      # 0x10308
movb $0x0, %al
callq 0x31c0
movq 0xc7df(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x8303(%rip), %rcx      # 0x10355
movb $0x0, %al
callq 0x31c0
movq 0xc7b8(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x8329(%rip), %rcx      # 0x103a2
movb $0x0, %al
callq 0x31c0
movq 0xc791(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x889a(%rip), %rcx      # 0x1093a
movb $0x0, %al
callq 0x31c0
movq 0xc76a(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x8328(%rip), %rcx      # 0x103ef
movb $0x0, %al
callq 0x31c0
movq 0xc743(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x884c(%rip), %rcx      # 0x1093a
movb $0x0, %al
callq 0x31c0
jmp 0x81b5
movq 0xc717(%rip), %rdi      # 0x14818
movl $0x2, %esi
movl $0x1e, %edx
leaq 0x832a(%rip), %rcx      # 0x1043c
movb $0x0, %al
callq 0x31c0
movq 0xc6f8(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x832c(%rip), %rcx      # 0x10465
movb $0x0, %al
callq 0x31c0
movq 0xc6d1(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x8352(%rip), %rcx      # 0x104b2
movb $0x0, %al
callq 0x31c0
movq 0xc6aa(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x8378(%rip), %rcx      # 0x104ff
movb $0x0, %al
callq 0x31c0
movq 0xc683(%rip), %rdi      # 0x14818
movl 0x24(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl $0x2, %edx
leaq 0x878c(%rip), %rcx      # 0x1093a
movb $0x0, %al
callq 0x31c0
movq 0xc65c(%rip), %rdi      # 0x14818
movq %rsp, %rax
movl $0x0, 0x10(%rax)
movl $0x0, 0x8(%rax)
movl $0x0, (%rax)
xorl %r9d, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x3100
movq 0xc62a(%rip), %rdi      # 0x14818
leaq 0x8357(%rip), %rsi      # 0x1054c
callq 0x5a80
movq 0xc617(%rip), %rdi      # 0x14818
callq 0x31b0
movq 0xbdb3(%rip), %rax      # 0x13fc0
movq (%rax), %rdi
callq 0x3120
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %eax
movl %eax, 0x18(%rsp)
subl $0xa, %eax
je 0x82d4
jmp 0x822c
movl 0x18(%rsp), %eax
subl $0x20, %eax
je 0x82d4
jmp 0x823b
movl 0x18(%rsp), %eax
subl $0x4a, %eax
je 0x82ac
jmp 0x8246
movl 0x18(%rsp), %eax
subl $0x4b, %eax
je 0x82c0
jmp 0x8251
movl 0x18(%rsp), %eax
subl $0x6a, %eax
je 0x82ac
jmp 0x825c
movl 0x18(%rsp), %eax
subl $0x6b, %eax
je 0x82c0
jmp 0x8267
movl 0x18(%rsp), %eax
subl $0x101, %eax            # imm = 0x101
je 0x8308
jmp 0x8278
movl 0x18(%rsp), %eax
subl $0x102, %eax            # imm = 0x102
je 0x82ac
jmp 0x8285
movl 0x18(%rsp), %eax
subl $0x103, %eax            # imm = 0x103
je 0x82c0
jmp 0x8292
movl 0x18(%rsp), %eax
subl $0x107, %eax            # imm = 0x107
je 0x8308
jmp 0x829f
movl 0x18(%rsp), %eax
subl $0x157, %eax            # imm = 0x157
je 0x82d4
jmp 0x830a
cmpl $0x1, 0x28(%rsp)
jge 0x82be
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x830a
cmpl $0x0, 0x28(%rsp)
jle 0x82d2
movl 0x28(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x830a
cmpl $0x0, 0x28(%rsp)
jne 0x82ed
leaq 0xc54e(%rip), %rax      # 0x14830
leaq 0xc4d7(%rip), %rcx      # 0x147c0
movq %rcx, 0x18(%rax)
cmpl $0x1, 0x28(%rsp)
jne 0x8306
leaq 0xc535(%rip), %rax      # 0x14830
leaq 0xc4d6(%rip), %rcx      # 0x147d8
movq %rcx, 0x18(%rax)
jmp 0x830f
jmp 0x830f
jmp 0x7ea9
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)