// File: /workspace/github_cpp_makefile_star2_O2/essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: select_device()
int select_device()
{
	attron(COLOR_PAIR(COLOR_WHITE));
	clear_area(0,0,viewport_width,4);
	mvaddstr(0,0, padmsg("Which kind of device? Q, q or ESC to cancel.").c_str());
	mvaddstr(1,0, padmsg(std::string(count_inv_devices(LOW_EXPLOSIVE)?"a. Low explosive, ":"") +
		std::string(count_inv_devices(HIGH_EXPLOSIVE)?"b. High explosive, ":"")).c_str());
	mvaddstr(2,0,padmsg(std::string(count_inv_devices(HOLOGRAM_PROJECTOR)?"c. Hologram projector,":"")+
		std::string(count_inv_devices(NOISE_GENERATOR)?"d. Noise generator, ":"")).c_str());
	mvaddstr(3,0,padmsg(std::string(count_inv_devices(SCENT_GENERATOR)?"e. Scent generator, ":"")+
		std::string(count_inv_devices(BRAIN_SLICE)?"f. Brain slice":"")).c_str());
	bool unacceptable = true;
	int device_num;
	int kp;
	while(unacceptable)
	{
		kp = fgetch();
		if(kp >= 'a' && kp <= 'f')
		{
			device_num = kp - 'a';
			if(count_inv_devices(device_num))
			{unacceptable = false;}
		}
		if(kp == 'q' || kp == 'Q' || kp == KEY_ESC) 
		{
				device_num = -1;
				unacceptable = false;
		}
	}
	draw_scene();
	return device_num;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xe8, %rsp
movq 0xf7a7(%rip), %r14      # 0x1dfd8
movq (%r14), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x5150
pushq $0x31
popq %rdx
pushq $0x4
popq %rcx
xorl %edi, %edi
xorl %esi, %esi
callq 0x6a9c
movq (%r14), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5260
cmpl $-0x1, %eax
je 0xe8ff
movq (%r14), %rbx
leaq 0x6b22(%rip), %rsi      # 0x15390
leaq 0xc8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x5110
leaq 0x18(%rsp), %rsi
movq %rsi, -0x10(%rsi)
leaq 0xd8(%rsp), %rax
movq -0x10(%rax), %rcx
cmpq %rax, %rcx
je 0xe8b1
movq %rcx, 0x8(%rsp)
movq 0xd8(%rsp), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, %rsi
jmp 0xe8b7
movups (%rax), %xmm0
movups %xmm0, (%rsi)
movq 0xd0(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq %rax, 0xc8(%rsp)
andq $0x0, 0xd0(%rsp)
movb $0x0, 0xd8(%rsp)
pushq $-0x1
popq %rdx
movq %rbx, %rdi
callq 0x50d0
leaq 0x8(%rsp), %rdi
callq 0x5418
leaq 0xc8(%rsp), %rdi
callq 0x5418
movq (%r14), %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x5260
cmpl $-0x1, %eax
je 0xea10
movq (%r14), %rbx
xorl %edi, %edi
callq 0x9479
testl %eax, %eax
leaq 0x7794(%rip), %r15      # 0x160bc
leaq 0x6a8e(%rip), %rsi      # 0x153bd
cmoveq %r15, %rsi
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5110
pushq $0x1
popq %rdi
callq 0x9479
testl %eax, %eax
leaq 0x6a7d(%rip), %rsi      # 0x153d0
cmoveq %r15, %rsi
leaq 0x48(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x5110
leaq 0xa8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x10ebd
leaq 0x18(%rsp), %rsi
movq %rsi, -0x10(%rsi)
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rcx
cmpq %rax, %rcx
je 0xe9ae
movq %rcx, 0x8(%rsp)
movq 0xb8(%rsp), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, %rsi
jmp 0xe9b4
movups (%rax), %xmm0
movups %xmm0, (%rsi)
movq 0xb0(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq %rax, 0xa8(%rsp)
andq $0x0, 0xb0(%rsp)
movb $0x0, 0xb8(%rsp)
pushq $-0x1
popq %rdx
movq %rbx, %rdi
callq 0x50d0
leaq 0x8(%rsp), %rdi
callq 0x5418
leaq 0xa8(%rsp), %rdi
callq 0x5418
leaq 0x48(%rsp), %rdi
callq 0x5418
leaq 0x28(%rsp), %rdi
callq 0x5418
movq (%r14), %rdi
pushq $0x2
popq %rsi
xorl %edx, %edx
callq 0x5260
cmpl $-0x1, %eax
je 0xeb22
movq (%r14), %rbx
pushq $0x2
popq %rdi
callq 0x9479
testl %eax, %eax
leaq 0x7682(%rip), %r15      # 0x160bc
leaq 0x69a3(%rip), %rsi      # 0x153e4
cmoveq %r15, %rsi
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5110
pushq $0x3
popq %rdi
callq 0x9479
testl %eax, %eax
leaq 0x6996(%rip), %rsi      # 0x153fb
cmoveq %r15, %rsi
leaq 0x48(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x5110
leaq 0x88(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x10ebd
leaq 0x18(%rsp), %rsi
movq %rsi, -0x10(%rsi)
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rcx
cmpq %rax, %rcx
je 0xeac0
movq %rcx, 0x8(%rsp)
movq 0x98(%rsp), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, %rsi
jmp 0xeac6
movups (%rax), %xmm0
movups %xmm0, (%rsi)
movq 0x90(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq %rax, 0x88(%rsp)
andq $0x0, 0x90(%rsp)
movb $0x0, 0x98(%rsp)
pushq $-0x1
popq %rdx
movq %rbx, %rdi
callq 0x50d0
leaq 0x8(%rsp), %rdi
callq 0x5418
leaq 0x88(%rsp), %rdi
callq 0x5418
leaq 0x48(%rsp), %rdi
callq 0x5418
leaq 0x28(%rsp), %rdi
callq 0x5418
movq (%r14), %rdi
pushq $0x3
popq %rsi
xorl %edx, %edx
callq 0x5260
cmpl $-0x1, %eax
je 0xec1c
movq (%r14), %rbx
pushq $0x4
popq %rdi
callq 0x9479
testl %eax, %eax
leaq 0x7570(%rip), %r14      # 0x160bc
leaq 0x68bd(%rip), %rsi      # 0x15410
cmoveq %r14, %rsi
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5110
pushq $0x5
popq %rdi
callq 0x9479
testl %eax, %eax
leaq 0x68ae(%rip), %rsi      # 0x15425
cmoveq %r14, %rsi
leaq 0x48(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x5110
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x10ebd
leaq 0x18(%rsp), %rsi
movq %rsi, -0x10(%rsi)
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rcx
cmpq %rax, %rcx
je 0xebc9
movq %rcx, 0x8(%rsp)
movq 0x78(%rsp), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, %rsi
jmp 0xebcf
movups (%rax), %xmm0
movups %xmm0, (%rsi)
movq 0x70(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq %rax, 0x68(%rsp)
andq $0x0, 0x70(%rsp)
movb $0x0, 0x78(%rsp)
pushq $-0x1
popq %rdx
movq %rbx, %rdi
callq 0x50d0
leaq 0x8(%rsp), %rdi
callq 0x5418
leaq 0x68(%rsp), %rdi
callq 0x5418
leaq 0x48(%rsp), %rdi
callq 0x5418
leaq 0x28(%rsp), %rdi
callq 0x5418
pushq $-0x1
popq %r15
movb $0x1, %al
testb $0x1, %al
je 0xec60
callq 0x11424
movl %eax, %r14d
leal -0x61(%r14), %ebp
movb $0x1, %al
cmpl $0x5, %ebp
ja 0xec47
movl %ebp, %edi
callq 0x9479
testl %eax, %eax
sete %al
movl %ebp, %ebx
cmpl $0x1b, %r14d
je 0xec59
cmpl $0x71, %r14d
je 0xec59
cmpl $0x51, %r14d
jne 0xec22
xorl %eax, %eax
movl %r15d, %ebx
jmp 0xec22
xorl %edi, %edi
callq 0xcc13
movl %ebx, %eax
addq $0xe8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5418
leaq 0x68(%rsp), %rdi
jmp 0xecc1
jmp 0xecca
jmp 0xecd9
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5418
leaq 0x88(%rsp), %rdi
jmp 0xecc1
jmp 0xed01
jmp 0xecca
jmp 0xecd9
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5418
leaq 0xa8(%rsp), %rdi
callq 0x5418
jmp 0xeccd
jmp 0xed01
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x5418
jmp 0xecdc
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5418
jmp 0xed04
jmp 0xed01
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5418
leaq 0xc8(%rsp), %rdi
jmp 0xece1
movq %rax, %rbx
movq %rbx, %rdi
callq 0x53c0