// File: /workspace/github_c_makefile_star2_O3/S01den[P]Lost_CavernRL/menu.c
// Function: questsMenu
void questsMenu(Quest actQuest[], int nbrQuestAct, Weapons listWeapons[], Armor listArmor[], int nbrTurretKilled, int nbrInfectedKilled, int nbrDroidKilled)
{
	int i = 0;
	int j = 0;
	char *typeRewards[] = {"VAX","LIFE POINTS","COMPONENTS","EXOTIC BLOOD"};

	WINDOW *win;
	win = newwin(20,75,LONGUEUR/2-2,LARGEUR/4-5);
	box(win,0,0);
	for(i = 1; i < 75/2-5; i++)
		mvwprintw(win,1,i,"-");
	for(i = 75/2+4; i < 74; i++)
		mvwprintw(win,1,i,"-");

	wattron(win, A_BOLD);
	mvwprintw(win,1,75/2-4,"QUESTS:");
	wattroff(win, A_BOLD);
	keypad(win, TRUE);

	for(i = 0; i < nbrQuestAct+1; i++)
	{
		for(j = 1; j < 74; j++)
			mvwprintw(win,i*3+6,j,"-");
		if(actQuest[i].isSet == 1)
		{
			if(actQuest[i].typeReward <= 3)
			{
				mvwprintw(win,i*3+2,1,"%s:\n%s\n  Reward: %d (%s)",actQuest[i].name,actQuest[i].description,actQuest[i].reward,typeRewards[actQuest[i].typeReward]);
			}
			else if(actQuest[i].typeReward == 4)
			{
				mvwprintw(win,i*3+2,1,"%s:\n%s\n Reward: %s",actQuest[i].name,actQuest[i].description,listWeapons[actQuest[i].reward].name);
			}
			else if(actQuest[i].typeReward == 5)
			{
				mvwprintw(win,i*3+2,1,"%s:\n%s\n Reward: %s",actQuest[i].name,actQuest[i].description,listArmor[actQuest[i].reward].name);
			}
			else if(actQuest[i].typeReward == 6)
			{
				mvwprintw(win,i*3+2,1,"%s:\n%s\n Reward: a drug",actQuest[i].name,actQuest[i].description);
			}
			if(actQuest[i].indice == 4)
			{
				wattron(win,A_BOLD);
				mvwprintw(win,i*3+5,1,"(%d/5 Killed)",nbrTurretKilled);
				wattroff(win,A_BOLD);
			}
			else if(actQuest[i].indice == 6)
			{
				wattron(win,A_BOLD);
				mvwprintw(win,i*3+5,1,"(%d/5 Killed)",nbrInfectedKilled);
				wattroff(win,A_BOLD);
			}
			else if(actQuest[i].indice == 8)
			{
				wattron(win,A_BOLD);
				mvwprintw(win,i*3+5,1,"(%d/10 Killed)",nbrDroidKilled);
				wattroff(win,A_BOLD);
			}
		}
		for(j = 1; j < 74; j++)
			mvwprintw(win,i*3+6,j,"-");

	}

	wrefresh(win);

	wgetch(win);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r9d, 0x1c(%rsp)
movl %r8d, 0x18(%rsp)
movq %rcx, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, 0x20(%rsp)
movl 0x70(%rsp), %eax
movl %eax, 0x14(%rsp)
movl $0x14, %edi
movl $0x4b, %esi
movl $0x11, %edx
movl $0x1b, %ecx
callq 0x1130
movq %rax, %rbx
subq $0x8, %rsp
xorl %eax, %eax
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rax
pushq %rax
pushq %rax
callq 0x1120
addq $0x20, %rsp
movl $0x1, %ebp
leaq 0x5d36(%rip), %r14      # 0xf33f
movq %rbx, %rdi
movl $0x1, %esi
movl %ebp, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x1070
incl %ebp
cmpl $0x20, %ebp
jne 0x9609
movl $0x29, %ebp
leaq 0x5d0f(%rip), %r14      # 0xf33f
movq %rbx, %rdi
movl $0x1, %esi
movl %ebp, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x1070
incl %ebp
cmpl $0x4a, %ebp
jne 0x9630
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
leaq 0x74d7(%rip), %rcx      # 0x10b38
movq %rbx, %rdi
movl $0x1, %esi
movl $0x21, %edx
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x1060
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1080
cmpl $0x0, 0x8(%rsp)
js 0x98c7
movq 0x8(%rsp), %rax
incl %eax
movq %rax, 0x8(%rsp)
leaq 0x5c90(%rip), %rbp      # 0xf33f
xorl %r15d, %r15d
leaq (%r15,%r15,2), %r12
leal 0x6(%r12), %r14d
movl $0x1, %r13d
movq %rbx, %rdi
movl %r14d, %esi
movl %r13d, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x1070
incl %r13d
cmpl $0x4a, %r13d
jne 0x96c1
movq %r15, %r13
shlq $0x5, %r13
movq 0x20(%rsp), %rax
cmpl $0x1, 0x1c(%rax,%r13)
jne 0x986d
addq 0x20(%rsp), %r13
movslq 0x10(%r13), %rax
cmpq $0x3, %rax
jg 0x973a
movq (%r13), %r8
movq 0x8(%r13), %r9
movl 0x14(%r13), %r10d
leaq 0x73d5(%rip), %rcx      # 0x10aec
movslq (%rcx,%rax,4), %r11
addq %rcx, %r11
leal 0x2(%r12), %esi
movq %rbx, %rdi
movl $0x1, %edx
leaq 0x740e(%rip), %rcx      # 0x10b40
xorl %eax, %eax
pushq %r11
pushq %r10
jmp 0x97b5
cmpl $0x6, %eax
je 0x989f
cmpl $0x5, %eax
je 0x977e
cmpl $0x4, %eax
jne 0x97be
movq (%r13), %r8
movq 0x8(%r13), %r9
movslq 0x14(%r13), %r10
shlq $0x6, %r10
leal 0x2(%r12), %esi
subq $0x8, %rsp
movq %rbx, %rdi
movl $0x1, %edx
leaq 0x73e4(%rip), %rcx      # 0x10b59
xorl %eax, %eax
movq 0x30(%rsp), %r11
jmp 0x97b1
movq (%r13), %r8
movq 0x8(%r13), %r9
movslq 0x14(%r13), %rax
leaq (%rax,%rax,2), %r10
shlq $0x4, %r10
leal 0x2(%r12), %esi
subq $0x8, %rsp
movq %rbx, %rdi
movl $0x1, %edx
leaq 0x73af(%rip), %rcx      # 0x10b59
xorl %eax, %eax
movq 0x38(%rsp), %r11
pushq (%r11,%r10)
callq 0x1070
addq $0x10, %rsp
movl 0x18(%r13), %eax
cmpl $0x8, %eax
je 0x982d
cmpl $0x6, %eax
je 0x9801
cmpl $0x4, %eax
jne 0x986d
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
addl $0x5, %r12d
movq %rbx, %rdi
movl %r12d, %esi
movl $0x1, %edx
leaq 0x7389(%rip), %rcx      # 0x10b83
movl 0x18(%rsp), %r8d
jmp 0x9857
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
addl $0x5, %r12d
movq %rbx, %rdi
movl %r12d, %esi
movl $0x1, %edx
leaq 0x735d(%rip), %rcx      # 0x10b83
movl 0x1c(%rsp), %r8d
jmp 0x9857
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
addl $0x5, %r12d
movq %rbx, %rdi
movl %r12d, %esi
movl $0x1, %edx
leaq 0x733f(%rip), %rcx      # 0x10b91
movl 0x14(%rsp), %r8d
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x1060
movl $0x1, %r12d
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x1070
incl %r12d
cmpl $0x4a, %r12d
jne 0x9873
incq %r15
cmpq 0x8(%rsp), %r15
jne 0x96b2
jmp 0x98c7
movq (%r13), %r8
movq 0x8(%r13), %r9
leal 0x2(%r12), %esi
movq %rbx, %rdi
movl $0x1, %edx
leaq 0x72b1(%rip), %rcx      # 0x10b6c
xorl %eax, %eax
callq 0x1070
jmp 0x97be
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rdi
callq 0x11e0
subq $0x8, %rsp
movl $0x20, %r14d
movq %rbx, %rdi
movl $0x20, %esi
movl $0x20, %edx
movl $0x20, %ecx
movl $0x20, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq %rax
pushq %rax
pushq %rax
callq 0x1120
addq $0x18, %rsp
movq %rbx, %rdi
movl $0x20, %esi
movl $0x20, %edx
movl $0x20, %ecx
movl $0x20, %r8d
movl $0x20, %r9d
pushq %r14
pushq %r14
pushq %r14
callq 0x1120
addq $0x20, %rsp
movq %rbx, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1110