// File: /workspace/github_cpp_makefile_star2_O1/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 0xe156(%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 0x743c
movq (%r14), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x12f73
movq (%r14), %rbx
leaq 0xd8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x64f8(%rip), %rsi      # 0x193c7
leaq 0x651d(%rip), %rdx      # 0x193f3
leaq 0xc8(%rsp), %rdi
callq 0x16274
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0xc8(%rsp), %rax
cmpq %r15, %rax
je 0x12f0e
movq %rax, 0x8(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x12f17
movups (%r15), %xmm0
movups %xmm0, (%r12)
movq 0xd0(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r15, 0xc8(%rsp)
movq $0x0, 0xd0(%rsp)
movb $0x0, 0xd8(%rsp)
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x12f61
callq 0x5230
movq 0xc8(%rsp), %rdi
cmpq %r15, %rdi
je 0x12f73
callq 0x5230
movq (%r14), %rdi
xorl %ebp, %ebp
movl $0x1, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x1319f
movq (%r14), %rbx
movq 0xb34b9(%rip), %rax     # 0xc6450
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 0x12f9f
testl %ebp, %ebp
leaq 0x7132(%rip), %r12      # 0x1a0f3
leaq 0x642c(%rip), %rsi      # 0x193f4
cmoveq %r12, %rsi
leaq 0x12(%rsi), %rdx
testl %ebp, %ebp
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
cmoveq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x16274
movq 0xb3460(%rip), %rax     # 0xc6450
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 0x12ffb
testl %eax, %eax
leaq 0x63ea(%rip), %rsi      # 0x19407
cmoveq %r12, %rsi
leaq 0x13(%rsi), %rdx
testl %eax, %eax
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
cmoveq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x16274
movq 0x48(%rsp), %rcx
movq 0x50(%rsp), %r8
movq 0x30(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r15, %rcx
je 0x13061
movq 0x58(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x1307c
movl $0xf, %esi
cmpq %r12, 0x28(%rsp)
je 0x13077
movq 0x38(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x1308d
movq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x50c0
jmp 0x1309b
leaq 0x28(%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 0x130c8
movq %rsi, 0xa8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xb8(%rsp)
jmp 0x130ce
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 0x18(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0xb8(%rsp), %r13
movq -0x10(%r13), %rax
cmpq %r13, %rax
je 0x1311c
movq %rax, 0x8(%rsp)
movq 0xb8(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x13125
movups (%r13), %xmm0
movups %xmm0, (%rbp)
movq 0xb0(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r13, 0xa8(%rsp)
movq $0x0, 0xb0(%rsp)
movb $0x0, 0xb8(%rsp)
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1316f
callq 0x5230
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x13181
callq 0x5230
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x13190
callq 0x5230
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x1319f
callq 0x5230
movq (%r14), %rdi
xorl %ebp, %ebp
movl $0x2, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x133cc
movq (%r14), %rbx
movq 0xb328d(%rip), %rax     # 0xc6450
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 0x131cc
testl %ebp, %ebp
leaq 0x6f05(%rip), %r12      # 0x1a0f3
leaq 0x6226(%rip), %rsi      # 0x1941b
cmoveq %r12, %rsi
leaq 0x16(%rsi), %rdx
testl %ebp, %ebp
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
cmoveq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x16274
movq 0xb3233(%rip), %rax     # 0xc6450
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 0x13228
testl %eax, %eax
leaq 0x61e8(%rip), %rsi      # 0x19432
cmoveq %r12, %rsi
leaq 0x14(%rsi), %rdx
testl %eax, %eax
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
cmoveq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x16274
movq 0x48(%rsp), %rcx
movq 0x50(%rsp), %r8
movq 0x30(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r15, %rcx
je 0x1328e
movq 0x58(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x132a9
movl $0xf, %esi
cmpq %r12, 0x28(%rsp)
je 0x132a4
movq 0x38(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x132ba
movq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x50c0
jmp 0x132c8
leaq 0x28(%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 0x132f5
movq %rsi, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0x132fb
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 0x18(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x98(%rsp), %r13
movq -0x10(%r13), %rax
cmpq %r13, %rax
je 0x13349
movq %rax, 0x8(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x13352
movups (%r13), %xmm0
movups %xmm0, (%rbp)
movq 0x90(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r13, 0x88(%rsp)
movq $0x0, 0x90(%rsp)
movb $0x0, 0x98(%rsp)
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1339c
callq 0x5230
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x133ae
callq 0x5230
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x133bd
callq 0x5230
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x133cc
callq 0x5230
movq (%r14), %rdi
xorl %ebp, %ebp
movl $0x3, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x135d8
movq (%r14), %rbx
movq 0xb3060(%rip), %rax     # 0xc6450
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 0x133f9
testl %ebp, %ebp
leaq 0x6cd8(%rip), %r12      # 0x1a0f3
leaq 0x6025(%rip), %rsi      # 0x19447
cmoveq %r12, %rsi
leaq 0x14(%rsi), %rdx
testl %ebp, %ebp
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
cmoveq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x16274
movq 0xb3006(%rip), %rax     # 0xc6450
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 0x13455
testl %eax, %eax
leaq 0x5fe5(%rip), %rsi      # 0x1945c
cmoveq %r12, %rsi
leaq 0xe(%rsi), %rdx
testl %eax, %eax
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
cmoveq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x16274
movq 0x48(%rsp), %rcx
movq 0x50(%rsp), %r8
movq 0x30(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r15, %rcx
je 0x134bb
movq 0x58(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x134d6
movl $0xf, %esi
cmpq %r12, 0x28(%rsp)
je 0x134d1
movq 0x38(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x134e7
movq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x50c0
jmp 0x134f5
leaq 0x28(%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 0x13519
movq %rsi, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x1351f
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 0x18(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x78(%rsp), %r13
movq -0x10(%r13), %rax
cmpq %r13, %rax
je 0x13564
movq %rax, 0x8(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x1356d
movups (%r13), %xmm0
movups %xmm0, (%rbp)
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r13, 0x68(%rsp)
movq $0x0, 0x70(%rsp)
movb $0x0, 0x78(%rsp)
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x135ab
callq 0x5230
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x135ba
callq 0x5230
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x135c9
callq 0x5230
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x135d8
callq 0x5230
movb $0x1, %r12b
xorl %r15d, %r15d
movq (%r14), %rdi
callq 0x50f0
movl %eax, %ebx
callq 0x5130
leal -0x61(%rbx), %eax
cmpl $0x5, %eax
ja 0x13632
movl %eax, %ecx
movq 0xb2e52(%rip), %rdx     # 0xc6450
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 0x1360d
testl %ecx, %ecx
movzbl %r12b, %r12d
cmovnel %r15d, %r12d
movl %eax, %ebp
cmpl $0x1b, %ebx
je 0x13641
cmpl $0x71, %ebx
je 0x13641
cmpl $0x51, %ebx
jne 0x13649
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %r12d, %r12d
testb $0x1, %r12b
jne 0x135de
xorl %edi, %edi
callq 0x1093e
movl %ebp, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1367c
callq 0x5230
movq 0x68(%rsp), %rdi
jmp 0x136c3
jmp 0x136d1
jmp 0x136e5
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13699
callq 0x5230
movq 0x88(%rsp), %rdi
jmp 0x136c3
jmp 0x13717
jmp 0x136d1
jmp 0x136e5
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x136bb
callq 0x5230
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x136d4
callq 0x5230
jmp 0x136d4
jmp 0x13717
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x136e8
callq 0x5230
jmp 0x136e8
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x1371a
callq 0x5230
jmp 0x1371a
jmp 0x13717
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1370d
callq 0x5230
movq 0xc8(%rsp), %rdi
jmp 0x136ed
movq %rax, %rbx
movq %rbx, %rdi
callq 0x53d0