// File: /workspace/github_c_makefile_star2_O0/S01den[P]Lost_CavernRL/menu.c
// Function: pauseMenu
int pauseMenu(int y, int *keyboard)
{
	int ret = 0;
	int select = 2;
	int choice = -1;
	int i = 0;
	int key = 0;

	WINDOW *win;
	win = newwin(14,20,LONGUEUR/2,LARGEUR/2+y);
	box(win,0,0);
	wattron(win, A_UNDERLINE);
	mvwprintw(win,4,8,"MENU");
	wattroff(win, A_UNDERLINE);
	keypad(win, TRUE);

	char *menus[] = {"KEYS LIST","TILES LIST","RETURN TO GAME","CHANGE KEYBOARD","EXIT THE GAME"};

	while(1)
	{
		for(i = 0; i < 5; i++)
		{
			if(i == select)
			{
				wattron(win, COLOR_PAIR(STAIRS_COLOR));
				mvwprintw(win, i+7, 4, menus[i]);
				wattroff(win,COLOR_PAIR(STAIRS_COLOR));
			}
			else
			{
				mvwprintw(win, i+7, 4, menus[i]);
			}
		}

		wrefresh(win);

		key = wgetch(win);
		switch(key)
		{	
			case KEY_DOWN:
				if(select+1<=4)
					select++;
				break;

			case KEY_UP:
				if(select-1 >= 0)
					select--;
				break;

			case'\n':
				choice = select;
				break;
		}

		if(choice != -1)
			break;
	}

	if(choice == 4)
		ret = 1;

	box(win, ' ', ' ');
	wborder(win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
	wclear(win);
	wrefresh(win);
	delwin(win);

	if(choice == 0)
	{
		WINDOW *winKey;
		winKey = newwin(15,65,LONGUEUR/2-2,LARGEUR/2+5);
		box(winKey,0,0);
		keypad(winKey, TRUE);	

		wattron(winKey,A_UNDERLINE);
		mvwprintw(winKey,1,15,"*** KEY LIST ***");
		wattroff(winKey,A_UNDERLINE);
		mvwprintw(winKey,2,1,"[ESC] : MENU");
		mvwprintw(winKey,8,1,"c : CRAFT MENU");
		mvwprintw(winKey,3,1,"[SPACE] : MISS A TURN");
		mvwprintw(winKey,9,1,", : QUEST JOURNAL");
		mvwprintw(winKey,6,1,"[ARROWS] : MOVE");
		mvwprintw(winKey,7,1,"zsqdaewx : ATTACK ON A DIRECTION (OR TALK TO A PNJ)");
		mvwprintw(winKey,4,1,"A_NUMBER : USE AN OBJECT IN YOUR INVENTORY");
		mvwprintw(winKey,5,1,"[ENTER] : USE YOUR SPECIAL POWER");

		wrefresh(winKey);
		wgetch(winKey);

		box(winKey, ' ', ' ');
		wborder(winKey, ' ', ' ', ' ',' ',' ',' ',' ',' ');
		wclear(winKey);
		wrefresh(winKey);
		delwin(winKey);
	}
	else if(choice == 1)
	{
		WINDOW *winKey;
		winKey = newwin(24,65,LONGUEUR/2-2,LARGEUR/2+5);
		box(winKey,0,0);
		keypad(winKey, TRUE);	

		wattron(winKey,A_UNDERLINE);
		mvwprintw(winKey,1,15,"*** TILES LIST ***");
		wattroff(winKey,A_UNDERLINE);
		mvwprintw(winKey,2,1,"# : WALL");
		wattron(winKey,COLOR_PAIR(124));
		mvwprintw(winKey,3,1,"# : GEM");
		wattroff(winKey,COLOR_PAIR(124));
		mvwprintw(winKey,4,1,"@ : PLAYER");
		mvwprintw(winKey,5,1,"= : TRAP");
		wattron(winKey,COLOR_PAIR(COLOR_LAVA));
		mvwprintw(winKey,6,1,"* : LAVA");
		wattroff(winKey,COLOR_PAIR(COLOR_LAVA));
		mvwprintw(winKey,7,1,"* : BOMB");
		mvwprintw(winKey,8,1,"> : STAIRS");
		mvwprintw(winKey,9,1,"! : DRUG");
		mvwprintw(winKey,10,1,"+ : SHIELD");
		mvwprintw(winKey,11,1,"; : DISTANCE WEAPON");
		mvwprintw(winKey,12,1,"/ : CONTACT WEAPON");
		mvwprintw(winKey,13,1,"[ : ARMOR");
		mvwprintw(winKey,14,1,"d : DROID");
		mvwprintw(winKey,15,1,"t : TURRET");
		mvwprintw(winKey,16,1,"n : INFECTED GUARDIAN");
		mvwprintw(winKey,17,1,"g : GUARDIAN");
		mvwprintw(winKey,18,1,"c : CLERIC");
		mvwprintw(winKey,19,1,"s : SCIENTIST");
		mvwprintw(winKey,20,1,"e : ERMIT");
		mvwprintw(winKey,21,1,"w : WORKER");
		wattron(winKey,COLOR_PAIR(47));
		mvwprintw(winKey,22,1,".: RADIOACTIVITY");
		wattroff(winKey,COLOR_PAIR(47));

		wrefresh(winKey);
		wgetch(winKey);

		box(winKey, ' ', ' ');
		wborder(winKey, ' ', ' ', ' ',' ',' ',' ',' ',' ');
		wclear(winKey);
		wrefresh(winKey);
		delwin(winKey);	
	}
	if(choice == 3)
	{
		(*keyboard) ^= 1;
	}

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x2, -0x18(%rbp)
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x4(%rbp), %ecx
addl $0x41, %ecx
movl $0xe, %edi
movl $0x14, %esi
movl $0x13, %edx
callq 0x2130
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
xorl %r9d, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x2120
movq -0x30(%rbp), %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
movq -0x30(%rbp), %rdi
movl $0x4, %esi
movl $0x8, %edx
leaq 0x83f1(%rip), %rcx      # 0x185ba
movb $0x0, %al
callq 0x2070
movq -0x30(%rbp), %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %eax, %eax
movl %eax, %edx
callq 0x2060
movq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x2080
leaq -0x60(%rbp), %rdi
leaq 0xca85(%rip), %rsi      # 0x1cc80
movl $0x28, %edx
callq 0x2200
movl $0x0, -0x20(%rbp)
cmpl $0x5, -0x20(%rbp)
jge 0x1028b
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x1025f
movq -0x30(%rbp), %rdi
movl $0xfe00, %esi           # imm = 0xFE00
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
movq -0x30(%rbp), %rdi
movl -0x20(%rbp), %esi
addl $0x7, %esi
movslq -0x20(%rbp), %rax
movq -0x60(%rbp,%rax,8), %rcx
movl $0x4, %edx
movb $0x0, %al
callq 0x2070
movq -0x30(%rbp), %rdi
movl $0xfe00, %esi           # imm = 0xFE00
xorl %eax, %eax
movl %eax, %edx
callq 0x2060
jmp 0x1027e
movq -0x30(%rbp), %rdi
movl -0x20(%rbp), %esi
addl $0x7, %esi
movslq -0x20(%rbp), %rax
movq -0x60(%rbp,%rax,8), %rcx
movl $0x4, %edx
movb $0x0, %al
callq 0x2070
jmp 0x10280
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1020c
movq -0x30(%rbp), %rdi
callq 0x2100
movq -0x30(%rbp), %rdi
callq 0x21f0
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x74(%rbp)
subl $0xa, %eax
je 0x102f1
jmp 0x102ad
movl -0x74(%rbp), %eax
subl $0x102, %eax            # imm = 0x102
je 0x102c5
jmp 0x102b9
movl -0x74(%rbp), %eax
subl $0x103, %eax            # imm = 0x103
je 0x102db
jmp 0x102f7
movl -0x18(%rbp), %eax
addl $0x1, %eax
cmpl $0x4, %eax
jg 0x102d9
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x102f7
movl -0x18(%rbp), %eax
subl $0x1, %eax
cmpl $0x0, %eax
jl 0x102ef
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x102f7
movl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
je 0x102ff
jmp 0x10304
jmp 0x10205
cmpl $0x4, -0x1c(%rbp)
jne 0x10311
movl $0x1, -0x14(%rbp)
movq -0x30(%rbp), %rdi
movl $0x20, %r8d
xorl %r9d, %r9d
movl %r8d, %esi
movl %r8d, %edx
movl %r8d, %ecx
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x2120
movq -0x30(%rbp), %rdi
movl $0x20, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
movl $0x20, (%rsp)
movl $0x20, 0x8(%rsp)
movl $0x20, 0x10(%rsp)
callq 0x2120
movq -0x30(%rbp), %rdi
callq 0x2030
movq -0x30(%rbp), %rdi
callq 0x2100
movq -0x30(%rbp), %rdi
callq 0x2110
cmpl $0x0, -0x1c(%rbp)
jne 0x105aa
movl $0xf, %edi
movl $0x41, %esi
movl $0x11, %edx
movl $0x46, %ecx
callq 0x2130
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
xorl %r9d, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x2120
movq -0x68(%rbp), %rdi
movl $0x1, %esi
callq 0x2080
movq -0x68(%rbp), %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
movq -0x68(%rbp), %rdi
movl $0x1, %esi
movl $0xf, %edx
leaq 0x9407(%rip), %rcx      # 0x19822
movb $0x0, %al
callq 0x2070
movq -0x68(%rbp), %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %eax, %eax
movl %eax, %edx
callq 0x2060
movq -0x68(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
leaq 0x8169(%rip), %rcx      # 0x185b2
movb $0x0, %al
callq 0x2070
movq -0x68(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
leaq 0x93ce(%rip), %rcx      # 0x19833
movb $0x0, %al
callq 0x2070
movq -0x68(%rbp), %rdi
movl $0x3, %esi
movl $0x1, %edx
leaq 0x93c1(%rip), %rcx      # 0x19842
movb $0x0, %al
callq 0x2070
movq -0x68(%rbp), %rdi
movl $0x9, %esi
movl $0x1, %edx
leaq 0x93bb(%rip), %rcx      # 0x19858
movb $0x0, %al
callq 0x2070
movq -0x68(%rbp), %rdi
movl $0x6, %esi
movl $0x1, %edx
leaq 0x93b1(%rip), %rcx      # 0x1986a
movb $0x0, %al
callq 0x2070
movq -0x68(%rbp), %rdi
movl $0x7, %esi
movl $0x1, %edx
leaq 0x93a5(%rip), %rcx      # 0x1987a
movb $0x0, %al
callq 0x2070
movq -0x68(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
leaq 0x93bd(%rip), %rcx      # 0x198ae
movb $0x0, %al
callq 0x2070
movq -0x68(%rbp), %rdi
movl $0x5, %esi
movl $0x1, %edx
leaq 0x93cc(%rip), %rcx      # 0x198d9
movb $0x0, %al
callq 0x2070
movq -0x68(%rbp), %rdi
callq 0x2100
movq -0x68(%rbp), %rdi
callq 0x21f0
movq -0x68(%rbp), %rdi
movl $0x20, %r8d
xorl %r9d, %r9d
movl %r8d, %esi
movl %r8d, %edx
movl %r8d, %ecx
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x2120
movq -0x68(%rbp), %rdi
movl $0x20, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
movl $0x20, (%rsp)
movl $0x20, 0x8(%rsp)
movl $0x20, 0x10(%rsp)
callq 0x2120
movq -0x68(%rbp), %rdi
callq 0x2030
movq -0x68(%rbp), %rdi
callq 0x2100
movq -0x68(%rbp), %rdi
callq 0x2110
jmp 0x10999
cmpl $0x1, -0x1c(%rbp)
jne 0x10997
movl $0x18, %edi
movl $0x41, %esi
movl $0x11, %edx
movl $0x46, %ecx
callq 0x2130
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
xorl %r9d, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x2120
movq -0x70(%rbp), %rdi
movl $0x1, %esi
callq 0x2080
movq -0x70(%rbp), %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
movq -0x70(%rbp), %rdi
movl $0x1, %esi
movl $0xf, %edx
leaq 0x92c5(%rip), %rcx      # 0x198fa
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %eax, %eax
movl %eax, %edx
callq 0x2060
movq -0x70(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
leaq 0x92aa(%rip), %rcx      # 0x1990d
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x7c00, %esi           # imm = 0x7C00
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
movq -0x70(%rbp), %rdi
movl $0x3, %esi
movl $0x1, %edx
leaq 0x9285(%rip), %rcx      # 0x19916
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x7c00, %esi           # imm = 0x7C00
xorl %eax, %eax
movl %eax, %edx
callq 0x2060
movq -0x70(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
leaq 0x925f(%rip), %rcx      # 0x1991e
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x5, %esi
movl $0x1, %edx
leaq 0x924e(%rip), %rcx      # 0x19929
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0xf500, %esi           # imm = 0xF500
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
movq -0x70(%rbp), %rdi
movl $0x6, %esi
movl $0x1, %edx
leaq 0x9229(%rip), %rcx      # 0x19932
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0xf500, %esi           # imm = 0xF500
xorl %eax, %eax
movl %eax, %edx
callq 0x2060
movq -0x70(%rbp), %rdi
movl $0x7, %esi
movl $0x1, %edx
leaq 0x9204(%rip), %rcx      # 0x1993b
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
leaq 0x91f1(%rip), %rcx      # 0x19944
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x9, %esi
movl $0x1, %edx
leaq 0x91e0(%rip), %rcx      # 0x1994f
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0xa, %esi
movl $0x1, %edx
leaq 0x91cd(%rip), %rcx      # 0x19958
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0xb, %esi
movl $0x1, %edx
leaq 0x91bc(%rip), %rcx      # 0x19963
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0xc, %esi
movl $0x1, %edx
leaq 0x91b4(%rip), %rcx      # 0x19977
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0xd, %esi
movl $0x1, %edx
leaq 0x91ab(%rip), %rcx      # 0x1998a
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0xe, %esi
movl $0x1, %edx
leaq 0x9199(%rip), %rcx      # 0x19994
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0xf, %esi
movl $0x1, %edx
leaq 0x9187(%rip), %rcx      # 0x1999e
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x10, %esi
movl $0x1, %edx
leaq 0x9176(%rip), %rcx      # 0x199a9
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x11, %esi
movl $0x1, %edx
leaq 0x9170(%rip), %rcx      # 0x199bf
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x12, %esi
movl $0x1, %edx
leaq 0x9161(%rip), %rcx      # 0x199cc
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x13, %esi
movl $0x1, %edx
leaq 0x9150(%rip), %rcx      # 0x199d7
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x14, %esi
movl $0x1, %edx
leaq 0x9142(%rip), %rcx      # 0x199e5
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x15, %esi
movl $0x1, %edx
leaq 0x9130(%rip), %rcx      # 0x199ef
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x2f00, %esi           # imm = 0x2F00
xorl %eax, %eax
movl %eax, %edx
callq 0x21d0
movq -0x70(%rbp), %rdi
movl $0x16, %esi
movl $0x1, %edx
leaq 0x910d(%rip), %rcx      # 0x199fa
movb $0x0, %al
callq 0x2070
movq -0x70(%rbp), %rdi
movl $0x2f00, %esi           # imm = 0x2F00
xorl %eax, %eax
movl %eax, %edx
callq 0x2060
movq -0x70(%rbp), %rdi
callq 0x2100
movq -0x70(%rbp), %rdi
callq 0x21f0
movq -0x70(%rbp), %rdi
movl $0x20, %r8d
xorl %r9d, %r9d
movl %r8d, %esi
movl %r8d, %edx
movl %r8d, %ecx
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x2120
movq -0x70(%rbp), %rdi
movl $0x20, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
movl $0x20, (%rsp)
movl $0x20, 0x8(%rsp)
movl $0x20, 0x10(%rsp)
callq 0x2120
movq -0x70(%rbp), %rdi
callq 0x2030
movq -0x70(%rbp), %rdi
callq 0x2100
movq -0x70(%rbp), %rdi
callq 0x2110
jmp 0x10999
cmpl $0x3, -0x1c(%rbp)
jne 0x109aa
movq -0x10(%rbp), %rax
movl (%rax), %ecx
xorl $0x1, %ecx
movl %ecx, (%rax)
movl -0x14(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)