// File: /workspace/github_c_makefile_star2_O0/S01den[P]Lost_CavernRL/menu.c
// Function: objectMenu
void objectMenu(Weapons *weapon, Weapons listWeapons[], Armor *armor, Armor listArmors[], Inventory inventory[], Player *player, int *component, int caseInventory, int *colorPrint, char messagePrint[], int type)
{
	WINDOW* win;
	win = newwin(9,60,(LONGUEUR-5)/2+7,(LARGEUR-15)/2);
	box(win, 0 , 0);
	
	if(type == 1) // weapon
	{
		wattron(win,A_BOLD);
		mvwprintw(win,1,5,"%s",listWeapons[inventory[caseInventory].object].name);
		wattroff(win,A_BOLD);
		mvwprintw(win,2,1,"Degats: %d     State: %d",listWeapons[inventory[caseInventory].object].degat,listWeapons[inventory[caseInventory].object].state);
		mvwprintw(win,4,1,"%s",listWeapons[inventory[caseInventory].object].description);
		mvwprintw(win,6,1,"1) EQUIP");
		mvwprintw(win,7,1,"2) DESTROY TO COLLECT COMPONENTS");

		wrefresh(win);	

		int charMenu = wgetch(win);
		switch(charMenu)
		{
			case '1':
					if(listWeapons[inventory[caseInventory].object].strengthRequired <= player->strength)
					{
						int indiceWeapChange = weapon->indice;
						listWeapons[indiceWeapChange].state = weapon->state;
						*weapon = listWeapons[inventory[caseInventory].object];
						inventory[caseInventory].type = 0;
						inventory[caseInventory].object = indiceWeapChange;
					}
					else
					{
						*colorPrint = 197; 
						snprintf(messagePrint,100,"YOU MUST HAVE A MINIMUM STRENGTH OF %d !",listWeapons[inventory[caseInventory].object].strengthRequired);

					}
					break;
				
				case '2':
						*component += listWeapons[inventory[caseInventory].object].cost;
						snprintf(messagePrint,100,"BY DESTROYING THIS ITEM, YOU EARNED %d COMPONENTS !",listWeapons[inventory[caseInventory].object].cost);
						inventory[caseInventory].type = -1;
						inventory[caseInventory].object = 0;
						*colorPrint = 47; 
					break;
		}

	}
	else
	{
		wattron(win,A_BOLD);
		mvwprintw(win,1,5,"%s",listArmors[inventory[caseInventory].object].name);
		wattroff(win,A_BOLD);
		mvwprintw(win,2,1,"Resistance: %d    State: %d",listArmors[inventory[caseInventory].object].resistance,listArmors[inventory[caseInventory].object].state);
		mvwprintw(win,4,1,"%s",listArmors[inventory[caseInventory].object].description);
		mvwprintw(win,6,1,"1) EQUIP");
		mvwprintw(win,7,1,"2) DESTROY TO COLLECT COMPONENTS");

		int charMenu = wgetch(win);
		switch(charMenu)
		{
			case '1':

					if(listArmors[inventory[caseInventory].object].strengthRequired <= player->strength)
					{
						int indiceArmorChange = armor->indice;
						listArmors[indiceArmorChange].state = armor->state;
						*armor = listArmors[inventory[caseInventory].object];
						inventory[caseInventory].type = 1;
						inventory[caseInventory].object = indiceArmorChange;
					}
					else
					{
						*colorPrint = 197; 
						snprintf(messagePrint,100,"YOU MUST HAVE A MINIMUM STRENGTH OF %d !",listArmors[inventory[caseInventory].object].strengthRequired);
					}
					break;
				
				case '2':
						*component += listArmors[inventory[caseInventory].object].cost;
						snprintf(messagePrint,100,"BY DESTROYING THIS ITEM, YOU EARNED %d COMPONENTS !",listArmors[inventory[caseInventory].object].cost);
						inventory[caseInventory].type = -1;
						inventory[caseInventory].object = 0;
						*colorPrint = 47; 
					break;
		}
	}

	wrefresh(win);	

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movl 0x30(%rbp), %eax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl $0x9, %edi
movl $0x3c, %esi
movl $0x18, %edx
movl $0x39, %ecx
callq 0x2130
movq %rax, -0x38(%rbp)
movq -0x38(%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
cmpl $0x1, 0x30(%rbp)
jne 0x10cda
movq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, -0x70(%rbp)
movl %eax, %edx
movq %rdx, -0x68(%rbp)
movl $0x200000, %esi         # imm = 0x200000
movl %esi, -0x6c(%rbp)
callq 0x21d0
movl -0x70(%rbp), %eax
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rdx
movslq 0x18(%rbp), %rsi
movslq 0x4(%rdx,%rsi,8), %rdx
shlq $0x6, %rdx
movq (%rcx,%rdx), %r8
leaq 0x86df(%rip), %rcx      # 0x1916d
movq %rcx, -0x60(%rbp)
movb %al, -0x4d(%rbp)
movl $0x1, %esi
movl %esi, -0x54(%rbp)
movl $0x5, %edx
callq 0x2070
movl -0x6c(%rbp), %esi
movq -0x68(%rbp), %rdx
movq -0x38(%rbp), %rdi
callq 0x2060
movl -0x54(%rbp), %edx
movb -0x4d(%rbp), %al
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rsi
movslq 0x18(%rbp), %r8
movslq 0x4(%rsi,%r8,8), %rsi
shlq $0x6, %rsi
movl 0x10(%rcx,%rsi), %r8d
movl 0x1c(%rcx,%rsi), %r9d
leaq 0x8f24(%rip), %rcx      # 0x19a0b
movl $0x2, %esi
callq 0x2070
movq -0x60(%rbp), %rcx
movl -0x54(%rbp), %edx
movb -0x4d(%rbp), %al
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %r8
movslq 0x18(%rbp), %r9
movslq 0x4(%r8,%r9,8), %r8
shlq $0x6, %r8
movq 0x8(%rsi,%r8), %r8
movl $0x4, %esi
callq 0x2070
movl -0x54(%rbp), %edx
movb -0x4d(%rbp), %al
movq -0x38(%rbp), %rdi
leaq 0x8ef0(%rip), %rcx      # 0x19a24
movl $0x6, %esi
callq 0x2070
movl -0x54(%rbp), %edx
movb -0x4d(%rbp), %al
movq -0x38(%rbp), %rdi
leaq 0x8ede(%rip), %rcx      # 0x19a2d
movl $0x7, %esi
callq 0x2070
movq -0x38(%rbp), %rdi
callq 0x2100
movq -0x38(%rbp), %rdi
callq 0x21f0
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x4c(%rbp)
subl $0x31, %eax
je 0x10b8c
jmp 0x10b7b
movl -0x4c(%rbp), %eax
subl $0x32, %eax
je 0x10c57
jmp 0x10cd5
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq 0x18(%rbp), %rdx
movslq 0x4(%rcx,%rdx,8), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
movq -0x30(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jg 0x10c19
movq -0x8(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, 0x1c(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movslq 0x18(%rbp), %rcx
movslq 0x4(%rax,%rcx,8), %rax
shlq $0x6, %rax
addq %rax, %rsi
movl $0x40, %edx
callq 0x2200
movq -0x28(%rbp), %rax
movslq 0x18(%rbp), %rcx
movl $0x0, (%rax,%rcx,8)
movl -0x40(%rbp), %edx
movq -0x28(%rbp), %rax
movslq 0x18(%rbp), %rcx
movl %edx, 0x4(%rax,%rcx,8)
jmp 0x10c55
movq 0x20(%rbp), %rax
movl $0xc5, (%rax)
movq 0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq 0x18(%rbp), %rdx
movslq 0x4(%rcx,%rdx,8), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
movl $0x64, %esi
leaq 0x8e00(%rip), %rdx      # 0x19a4e
movb $0x0, %al
callq 0x2050
jmp 0x10cd5
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq 0x18(%rbp), %rdx
movslq 0x4(%rcx,%rdx,8), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
movq 0x10(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq 0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq 0x18(%rbp), %rdx
movslq 0x4(%rcx,%rdx,8), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
movl $0x64, %esi
leaq 0x8dd2(%rip), %rdx      # 0x19a77
movb $0x0, %al
callq 0x2050
movq -0x28(%rbp), %rax
movslq 0x18(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,8) # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
movslq 0x18(%rbp), %rcx
movl $0x0, 0x4(%rax,%rcx,8)
movq 0x20(%rbp), %rax
movl $0x2f, (%rax)
jmp 0x10f81
movq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, -0x98(%rbp)
movl %eax, %edx
movq %rdx, -0x90(%rbp)
movl $0x200000, %esi         # imm = 0x200000
movl %esi, -0x94(%rbp)
callq 0x21d0
movl -0x98(%rbp), %eax
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rdx
movslq 0x18(%rbp), %rsi
movslq 0x4(%rdx,%rsi,8), %rdx
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
movq (%rcx,%rdx), %r8
leaq 0x8440(%rip), %rcx      # 0x1916d
movq %rcx, -0x88(%rbp)
movb %al, -0x75(%rbp)
movl $0x1, %esi
movl %esi, -0x7c(%rbp)
movl $0x5, %edx
callq 0x2070
movl -0x94(%rbp), %esi
movq -0x90(%rbp), %rdx
movq -0x38(%rbp), %rdi
callq 0x2060
movl -0x7c(%rbp), %edx
movb -0x75(%rbp), %al
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rsi
movslq 0x18(%rbp), %r8
movslq 0x4(%rsi,%r8,8), %rsi
leaq (%rsi,%rsi,2), %rsi
shlq $0x4, %rsi
movl 0x14(%rcx,%rsi), %r8d
movl 0x18(%rcx,%rsi), %r9d
leaq 0x8d18(%rip), %rcx      # 0x19aab
movl $0x2, %esi
callq 0x2070
movq -0x88(%rbp), %rcx
movl -0x7c(%rbp), %edx
movb -0x75(%rbp), %al
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %r8
movslq 0x18(%rbp), %r9
movslq 0x4(%r8,%r9,8), %r8
leaq (%r8,%r8,2), %r8
shlq $0x4, %r8
movq 0x8(%rsi,%r8), %r8
movl $0x4, %esi
callq 0x2070
movl -0x7c(%rbp), %edx
movb -0x75(%rbp), %al
movq -0x38(%rbp), %rdi
leaq 0x8c3d(%rip), %rcx      # 0x19a24
movl $0x6, %esi
callq 0x2070
movl -0x7c(%rbp), %edx
movb -0x75(%rbp), %al
movq -0x38(%rbp), %rdi
leaq 0x8c2b(%rip), %rcx      # 0x19a2d
movl $0x7, %esi
callq 0x2070
movq -0x38(%rbp), %rdi
callq 0x21f0
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x74(%rbp)
subl $0x31, %eax
je 0x10e36
jmp 0x10e25
movl -0x74(%rbp), %eax
subl $0x32, %eax
je 0x10f01
jmp 0x10f7f
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq 0x18(%rbp), %rdx
movslq 0x4(%rcx,%rdx,8), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movq -0x30(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jg 0x10ec3
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x20(%rbp), %rax
movslq -0x48(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rax
movslq 0x18(%rbp), %rcx
movslq 0x4(%rax,%rcx,8), %rax
imulq $0x30, %rax, %rax
addq %rax, %rsi
movl $0x30, %edx
callq 0x2200
movq -0x28(%rbp), %rax
movslq 0x18(%rbp), %rcx
movl $0x1, (%rax,%rcx,8)
movl -0x48(%rbp), %edx
movq -0x28(%rbp), %rax
movslq 0x18(%rbp), %rcx
movl %edx, 0x4(%rax,%rcx,8)
jmp 0x10eff
movq 0x20(%rbp), %rax
movl $0xc5, (%rax)
movq 0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq 0x18(%rbp), %rdx
movslq 0x4(%rcx,%rdx,8), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %ecx
movl $0x64, %esi
leaq 0x8b56(%rip), %rdx      # 0x19a4e
movb $0x0, %al
callq 0x2050
jmp 0x10f7f
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq 0x18(%rbp), %rdx
movslq 0x4(%rcx,%rdx,8), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq 0x10(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq 0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq 0x18(%rbp), %rdx
movslq 0x4(%rcx,%rdx,8), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movl $0x64, %esi
leaq 0x8b28(%rip), %rdx      # 0x19a77
movb $0x0, %al
callq 0x2050
movq -0x28(%rbp), %rax
movslq 0x18(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,8) # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
movslq 0x18(%rbp), %rcx
movl $0x0, 0x4(%rax,%rcx,8)
movq 0x20(%rbp), %rax
movl $0x2f, (%rax)
jmp 0x10f81
movq -0x38(%rbp), %rdi
callq 0x2100
movq -0x38(%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 -0x38(%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 -0x38(%rbp), %rdi
callq 0x2030
movq -0x38(%rbp), %rdi
callq 0x2100
movq -0x38(%rbp), %rdi
callq 0x2110
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)