// File: /workspace/github_cpp_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq 0xe778(%rip), %r14      # 0x20fd8
movq (%r14), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x5150
xorl %edi, %edi
xorl %esi, %esi
movl $0x31, %edx
movl $0x4, %ecx
callq 0x742a
movq (%r14), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x1294f
movq (%r14), %rbx
leaq 0xd8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x6b8a(%rip), %rsi      # 0x19437
leaq 0x6baf(%rip), %rdx      # 0x19463
leaq 0xc8(%rsp), %rdi
callq 0x15b1a
leaq 0x58(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0xc8(%rsp), %rsi
cmpq %r15, %rsi
je 0x128ec
movq %rsi, 0x48(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0x58(%rsp)
jmp 0x128f8
movups (%r15), %xmm0
movups %xmm0, (%r12)
movq %r12, %rsi
movq 0xd0(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r15, 0xc8(%rsp)
movq $0x0, 0xd0(%rsp)
movb $0x0, 0xd8(%rsp)
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x1293d
callq 0x5230
movq 0xc8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1294f
callq 0x5230
movq (%r14), %rdi
xorl %ebp, %ebp
movl $0x1, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x12b77
movq (%r14), %rbx
movq 0xb3acd(%rip), %rax     # 0xc6440
movq (%rax), %rax
movl $0x8, %ecx
movq (%rax,%rcx), %rdx
subq -0x8(%rax,%rcx), %rdx
shrq $0x3, %rdx
addl %edx, %ebp
addq $0x18, %rcx
cmpq $0x50, %rcx
jne 0x1297b
testl %ebp, %ebp
leaq 0x77c6(%rip), %r12      # 0x1a163
leaq 0x6ac0(%rip), %rsi      # 0x19464
cmoveq %r12, %rsi
leaq 0x12(%rsi), %rdx
testl %ebp, %ebp
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
cmoveq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x15b1a
movq 0xb3a74(%rip), %rax     # 0xc6440
movq 0x18(%rax), %rcx
xorl %eax, %eax
movl $0x8, %edx
movq (%rcx,%rdx), %rsi
subq -0x8(%rcx,%rdx), %rsi
shrq $0x3, %rsi
addl %esi, %eax
addq $0x18, %rdx
cmpq $0x50, %rdx
jne 0x129d7
testl %eax, %eax
leaq 0x6a7e(%rip), %rsi      # 0x19477
cmoveq %r12, %rsi
leaq 0x13(%rsi), %rdx
testl %eax, %eax
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
cmoveq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x15b1a
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %r8
movq 0x10(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %r15, %rcx
je 0x12a3d
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
cmpq %rdi, %rax
jbe 0x12a5b
movl $0xf, %edi
cmpq %r12, %rsi
je 0x12a56
movq 0x18(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x12a67
leaq 0x28(%rsp), %rdi
callq 0x50c0
jmp 0x12a75
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5290
leaq 0xb8(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x12aa2
movq %rsi, 0xa8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xb8(%rsp)
jmp 0x12aa8
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0xb0(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0xb8(%rsp), %r13
movq -0x10(%r13), %rsi
cmpq %r13, %rsi
je 0x12af6
movq %rsi, 0x48(%rsp)
movq 0xb8(%rsp), %rax
movq %rax, 0x58(%rsp)
jmp 0x12b02
movups (%r13), %xmm0
movups %xmm0, (%rbp)
movq %rbp, %rsi
movq 0xb0(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r13, 0xa8(%rsp)
movq $0x0, 0xb0(%rsp)
movb $0x0, 0xb8(%rsp)
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12b47
callq 0x5230
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x12b59
callq 0x5230
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x12b68
callq 0x5230
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x12b77
callq 0x5230
movq (%r14), %rdi
xorl %ebp, %ebp
movl $0x2, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x12da0
movq (%r14), %rbx
movq 0xb38a5(%rip), %rax     # 0xc6440
movq 0x30(%rax), %rax
movl $0x8, %ecx
movq (%rax,%rcx), %rdx
subq -0x8(%rax,%rcx), %rdx
shrq $0x3, %rdx
addl %edx, %ebp
addq $0x18, %rcx
cmpq $0x50, %rcx
jne 0x12ba4
testl %ebp, %ebp
leaq 0x759d(%rip), %r12      # 0x1a163
leaq 0x68be(%rip), %rsi      # 0x1948b
cmoveq %r12, %rsi
leaq 0x16(%rsi), %rdx
testl %ebp, %ebp
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
cmoveq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x15b1a
movq 0xb384b(%rip), %rax     # 0xc6440
movq 0x48(%rax), %rcx
xorl %eax, %eax
movl $0x8, %edx
movq (%rcx,%rdx), %rsi
subq -0x8(%rcx,%rdx), %rsi
shrq $0x3, %rsi
addl %esi, %eax
addq $0x18, %rdx
cmpq $0x50, %rdx
jne 0x12c00
testl %eax, %eax
leaq 0x6880(%rip), %rsi      # 0x194a2
cmoveq %r12, %rsi
leaq 0x14(%rsi), %rdx
testl %eax, %eax
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
cmoveq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x15b1a
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %r8
movq 0x10(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %r15, %rcx
je 0x12c66
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
cmpq %rdi, %rax
jbe 0x12c84
movl $0xf, %edi
cmpq %r12, %rsi
je 0x12c7f
movq 0x18(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x12c90
leaq 0x28(%rsp), %rdi
callq 0x50c0
jmp 0x12c9e
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5290
leaq 0x98(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x12ccb
movq %rsi, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0x12cd1
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x90(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x98(%rsp), %r13
movq -0x10(%r13), %rsi
cmpq %r13, %rsi
je 0x12d1f
movq %rsi, 0x48(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x58(%rsp)
jmp 0x12d2b
movups (%r13), %xmm0
movups %xmm0, (%rbp)
movq %rbp, %rsi
movq 0x90(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r13, 0x88(%rsp)
movq $0x0, 0x90(%rsp)
movb $0x0, 0x98(%rsp)
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12d70
callq 0x5230
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x12d82
callq 0x5230
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x12d91
callq 0x5230
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x12da0
callq 0x5230
movq (%r14), %rdi
xorl %ebp, %ebp
movl $0x3, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x12fa8
movq (%r14), %rbx
movq 0xb367c(%rip), %rax     # 0xc6440
movq 0x60(%rax), %rax
movl $0x8, %ecx
movq (%rax,%rcx), %rdx
subq -0x8(%rax,%rcx), %rdx
shrq $0x3, %rdx
addl %edx, %ebp
addq $0x18, %rcx
cmpq $0x50, %rcx
jne 0x12dcd
testl %ebp, %ebp
leaq 0x7374(%rip), %r12      # 0x1a163
leaq 0x66c1(%rip), %rsi      # 0x194b7
cmoveq %r12, %rsi
leaq 0x14(%rsi), %rdx
testl %ebp, %ebp
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
cmoveq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x15b1a
movq 0xb3622(%rip), %rax     # 0xc6440
movq 0x78(%rax), %rcx
xorl %eax, %eax
movl $0x8, %edx
movq (%rcx,%rdx), %rsi
subq -0x8(%rcx,%rdx), %rsi
shrq $0x3, %rsi
addl %esi, %eax
addq $0x18, %rdx
cmpq $0x50, %rdx
jne 0x12e29
testl %eax, %eax
leaq 0x6681(%rip), %rsi      # 0x194cc
cmoveq %r12, %rsi
leaq 0xe(%rsi), %rdx
testl %eax, %eax
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
cmoveq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x15b1a
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %r8
movq 0x10(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %r15, %rcx
je 0x12e8f
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
cmpq %rdi, %rax
jbe 0x12ead
movl $0xf, %edi
cmpq %r12, %rsi
je 0x12ea8
movq 0x18(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x12eb9
leaq 0x28(%rsp), %rdi
callq 0x50c0
jmp 0x12ec7
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5290
leaq 0x78(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x12eeb
movq %rsi, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x12ef1
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x70(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x78(%rsp), %r13
movq -0x10(%r13), %rsi
cmpq %r13, %rsi
je 0x12f36
movq %rsi, 0x48(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x58(%rsp)
jmp 0x12f42
movups (%r13), %xmm0
movups %xmm0, (%rbp)
movq %rbp, %rsi
movq 0x70(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r13, 0x68(%rsp)
movq $0x0, 0x70(%rsp)
movb $0x0, 0x78(%rsp)
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x12f7b
callq 0x5230
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x12f8a
callq 0x5230
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x12f99
callq 0x5230
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x12fa8
callq 0x5230
movq (%r14), %rdi
callq 0x50f0
movl %eax, %ebx
callq 0x5130
leal -0x61(%rbx), %eax
movb $0x1, %cl
cmpl $0x5, %eax
ja 0x12ffa
movl %eax, %ecx
movq 0xb3476(%rip), %rdx     # 0xc6440
leaq (%rcx,%rcx,2), %rcx
movq (%rdx,%rcx,8), %rdx
xorl %ecx, %ecx
movl $0x8, %esi
movq (%rdx,%rsi), %rdi
subq -0x8(%rdx,%rsi), %rdi
shrq $0x3, %rdi
addl %edi, %ecx
addq $0x18, %rsi
cmpq $0x50, %rsi
jne 0x12fd9
testl %ecx, %ecx
sete %cl
movl %eax, %r15d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x1b, %ebx
je 0x13015
cmpl $0x51, %ebx
je 0x13015
cmpl $0x71, %ebx
je 0x13015
movl %r15d, %ebp
testb %cl, %cl
jne 0x12fa8
xorl %edi, %edi
callq 0x10355
movl %ebp, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13042
callq 0x5230
movq 0x68(%rsp), %rdi
jmp 0x13089
jmp 0x13097
jmp 0x130ab
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1305f
callq 0x5230
movq 0x88(%rsp), %rdi
jmp 0x13089
jmp 0x130dd
jmp 0x13097
jmp 0x130ab
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13081
callq 0x5230
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x1309a
callq 0x5230
jmp 0x1309a
jmp 0x130dd
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x130ae
callq 0x5230
jmp 0x130ae
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x130e0
callq 0x5230
jmp 0x130e0
jmp 0x130dd
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x130d3
callq 0x5230
movq 0xc8(%rsp), %rdi
jmp 0x130b3
movq %rax, %rbx
movq %rbx, %rdi
callq 0x53d0