// File: 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:
subq $0x298, %rsp            # imm = 0x298
movq 0x201a2(%rip), %rax     # 0x3afe0
movq (%rax), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %eax, %eax
movl %eax, %edx
callq 0x51a0
xorl %esi, %esi
movl $0x31, %edx
movl $0x4, %ecx
movl %esi, %edi
callq 0x8b80
movq 0x20177(%rip), %rax     # 0x3afe0
movq (%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x52f0
movb $0x0, 0x256(%rsp)
movb $0x0, 0x243(%rsp)
movb $0x0, 0x242(%rsp)
cmpl $-0x1, %eax
jne 0x1ae97
jmp 0x1af2b
movq 0x20142(%rip), %rax     # 0x3afe0
movq (%rax), %rax
movq %rax, 0x78(%rsp)
leaq 0x257(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x5490
movq 0x80(%rsp), %rdx
movb $0x1, 0x256(%rsp)
leaq 0x13759(%rip), %rsi     # 0x2e62b
leaq 0x258(%rsp), %rdi
callq 0x53d0
jmp 0x1aee1
movb $0x1, 0x243(%rsp)
leaq 0x278(%rsp), %rdi
leaq 0x258(%rsp), %rsi
callq 0x219d0
jmp 0x1af00
movb $0x1, 0x242(%rsp)
leaq 0x278(%rsp), %rdi
callq 0x5160
movq 0x78(%rsp), %rdi
movq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5100
jmp 0x1af29
jmp 0x1af2b
testb $0x1, 0x242(%rsp)
jne 0x1af37
jmp 0x1af44
leaq 0x278(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x243(%rsp)
jne 0x1af50
jmp 0x1af5d
leaq 0x258(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x256(%rsp)
jne 0x1af69
jmp 0x1af76
leaq 0x257(%rsp), %rdi
callq 0x5310
movq 0x20063(%rip), %rax     # 0x3afe0
movq (%rax), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x52f0
movb $0x0, 0x1de(%rsp)
movb $0x0, 0x1dd(%rsp)
movb $0x0, 0x1b6(%rsp)
movb $0x0, 0x1b5(%rsp)
movb $0x0, 0x1b4(%rsp)
movb $0x0, 0x1b3(%rsp)
cmpl $-0x1, %eax
jne 0x1afc6
jmp 0x1b0f7
movq 0x20013(%rip), %rax     # 0x3afe0
movq (%rax), %rax
movq %rax, 0x60(%rsp)
xorl %edi, %edi
callq 0xf890
testl %eax, %eax
leaq 0x13673(%rip), %rcx     # 0x2e658
leaq 0x13075(%rip), %rax     # 0x2e061
cmovneq %rcx, %rax
movq %rax, 0x68(%rsp)
leaq 0x1df(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x5490
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
movb $0x1, 0x1de(%rsp)
leaq 0x1e0(%rsp), %rdi
callq 0x53d0
jmp 0x1b028
movb $0x1, 0x1dd(%rsp)
movl $0x1, %edi
callq 0xf890
testl %eax, %eax
leaq 0x13628(%rip), %rcx     # 0x2e66b
leaq 0x13017(%rip), %rax     # 0x2e061
cmovneq %rcx, %rax
movq %rax, 0x50(%rsp)
leaq 0x1b7(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x5490
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
movb $0x1, 0x1b6(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x53d0
jmp 0x1b086
movb $0x1, 0x1b5(%rsp)
leaq 0x200(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
leaq 0x1b8(%rsp), %rdx
callq 0x20350
jmp 0x1b0ad
movb $0x1, 0x1b4(%rsp)
leaq 0x220(%rsp), %rdi
leaq 0x200(%rsp), %rsi
callq 0x219d0
jmp 0x1b0cc
movb $0x1, 0x1b3(%rsp)
leaq 0x220(%rsp), %rdi
callq 0x5160
movq 0x60(%rsp), %rdi
movq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5100
jmp 0x1b0f5
jmp 0x1b0f7
testb $0x1, 0x1b3(%rsp)
jne 0x1b103
jmp 0x1b110
leaq 0x220(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x1b4(%rsp)
jne 0x1b11c
jmp 0x1b129
leaq 0x200(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x1b5(%rsp)
jne 0x1b135
jmp 0x1b142
leaq 0x1b8(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x1b6(%rsp)
jne 0x1b14e
jmp 0x1b15b
leaq 0x1b7(%rsp), %rdi
callq 0x5310
testb $0x1, 0x1dd(%rsp)
jne 0x1b167
jmp 0x1b174
leaq 0x1e0(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x1de(%rsp)
jne 0x1b180
jmp 0x1b18d
leaq 0x1df(%rsp), %rdi
callq 0x5310
movq 0x1fe4c(%rip), %rax     # 0x3afe0
movq (%rax), %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x52f0
movb $0x0, 0x14e(%rsp)
movb $0x0, 0x14d(%rsp)
movb $0x0, 0x126(%rsp)
movb $0x0, 0x125(%rsp)
movb $0x0, 0x124(%rsp)
movb $0x0, 0x123(%rsp)
cmpl $-0x1, %eax
jne 0x1b1dd
jmp 0x1b311
movq 0x1fdfc(%rip), %rax     # 0x3afe0
movq (%rax), %rax
movq %rax, 0x38(%rsp)
movl $0x2, %edi
callq 0xf890
testl %eax, %eax
leaq 0x13480(%rip), %rcx     # 0x2e67f
leaq 0x12e5b(%rip), %rax     # 0x2e061
cmovneq %rcx, %rax
movq %rax, 0x40(%rsp)
leaq 0x14f(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x5490
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movb $0x1, 0x14e(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x53d0
jmp 0x1b242
movb $0x1, 0x14d(%rsp)
movl $0x3, %edi
callq 0xf890
testl %eax, %eax
leaq 0x13439(%rip), %rcx     # 0x2e696
leaq 0x12dfd(%rip), %rax     # 0x2e061
cmovneq %rcx, %rax
movq %rax, 0x28(%rsp)
leaq 0x127(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x5490
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movb $0x1, 0x126(%rsp)
leaq 0x128(%rsp), %rdi
callq 0x53d0
jmp 0x1b2a0
movb $0x1, 0x125(%rsp)
leaq 0x170(%rsp), %rdi
leaq 0x150(%rsp), %rsi
leaq 0x128(%rsp), %rdx
callq 0x20350
jmp 0x1b2c7
movb $0x1, 0x124(%rsp)
leaq 0x190(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x219d0
jmp 0x1b2e6
movb $0x1, 0x123(%rsp)
leaq 0x190(%rsp), %rdi
callq 0x5160
movq 0x38(%rsp), %rdi
movq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5100
jmp 0x1b30f
jmp 0x1b311
testb $0x1, 0x123(%rsp)
jne 0x1b31d
jmp 0x1b32a
leaq 0x190(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x124(%rsp)
jne 0x1b336
jmp 0x1b343
leaq 0x170(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x125(%rsp)
jne 0x1b34f
jmp 0x1b35c
leaq 0x128(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x126(%rsp)
jne 0x1b368
jmp 0x1b375
leaq 0x127(%rsp), %rdi
callq 0x5310
testb $0x1, 0x14d(%rsp)
jne 0x1b381
jmp 0x1b38e
leaq 0x150(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x14e(%rsp)
jne 0x1b39a
jmp 0x1b3a7
leaq 0x14f(%rsp), %rdi
callq 0x5310
movq 0x1fc32(%rip), %rax     # 0x3afe0
movq (%rax), %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0x52f0
movb $0x0, 0xbe(%rsp)
movb $0x0, 0xbd(%rsp)
movb $0x0, 0x96(%rsp)
movb $0x0, 0x95(%rsp)
movb $0x0, 0x94(%rsp)
movb $0x0, 0x93(%rsp)
cmpl $-0x1, %eax
jne 0x1b3f7
jmp 0x1b529
movq 0x1fbe2(%rip), %rax     # 0x3afe0
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movl $0x4, %edi
callq 0xf890
testl %eax, %eax
leaq 0x13292(%rip), %rcx     # 0x2e6ab
leaq 0x12c41(%rip), %rax     # 0x2e061
cmovneq %rcx, %rax
movq %rax, 0x18(%rsp)
leaq 0xbf(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x5490
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movb $0x1, 0xbe(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x53d0
jmp 0x1b45c
movb $0x1, 0xbd(%rsp)
movl $0x5, %edi
callq 0xf890
testl %eax, %eax
leaq 0x13249(%rip), %rcx     # 0x2e6c0
leaq 0x12be3(%rip), %rax     # 0x2e061
cmovneq %rcx, %rax
movq %rax, (%rsp)
leaq 0x97(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x5490
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movb $0x1, 0x96(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x53d0
jmp 0x1b4b8
movb $0x1, 0x95(%rsp)
leaq 0xe0(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0x98(%rsp), %rdx
callq 0x20350
jmp 0x1b4df
movb $0x1, 0x94(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x219d0
jmp 0x1b4fe
movb $0x1, 0x93(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x5160
movq 0x10(%rsp), %rdi
movq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5100
jmp 0x1b527
jmp 0x1b529
testb $0x1, 0x93(%rsp)
jne 0x1b535
jmp 0x1b542
leaq 0x100(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x94(%rsp)
jne 0x1b54e
jmp 0x1b55b
leaq 0xe0(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x95(%rsp)
jne 0x1b567
jmp 0x1b574
leaq 0x98(%rsp), %rdi
callq 0x54f8
testb $0x1, 0x96(%rsp)
jne 0x1b580
jmp 0x1b58d
leaq 0x97(%rsp), %rdi
callq 0x5310
testb $0x1, 0xbd(%rsp)
jne 0x1b599
jmp 0x1b5a6
leaq 0xc0(%rsp), %rdi
callq 0x54f8
testb $0x1, 0xbe(%rsp)
jne 0x1b5b2
jmp 0x1b5bf
leaq 0xbf(%rsp), %rdi
callq 0x5310
movb $0x1, 0x92(%rsp)
testb $0x1, 0x92(%rsp)
je 0x1ba38
callq 0x21710
movl %eax, 0x88(%rsp)
cmpl $0x61, 0x88(%rsp)
jl 0x1ba02
cmpl $0x66, 0x88(%rsp)
jg 0x1ba02
movl 0x88(%rsp), %eax
subl $0x61, %eax
movl %eax, 0x8c(%rsp)
movl 0x8c(%rsp), %edi
callq 0xf890
cmpl $0x0, %eax
je 0x1ba00
movb $0x0, 0x92(%rsp)
jmp 0x1ba00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b6a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b68b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
testb $0x1, 0x242(%rsp)
jne 0x1b67c
jmp 0x1b689
leaq 0x278(%rsp), %rdi
callq 0x54f8
jmp 0x1b68b
testb $0x1, 0x243(%rsp)
jne 0x1b697
jmp 0x1b6a4
leaq 0x258(%rsp), %rdi
callq 0x54f8
jmp 0x1b6a6
testb $0x1, 0x256(%rsp)
jne 0x1b6b2
jmp 0x1b6bf
leaq 0x257(%rsp), %rdi
callq 0x5310
jmp 0x1ba4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b7bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b787
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b76c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b751
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
testb $0x1, 0x1b3(%rsp)
jne 0x1b742
jmp 0x1b74f
leaq 0x220(%rsp), %rdi
callq 0x54f8
jmp 0x1b751
testb $0x1, 0x1b4(%rsp)
jne 0x1b75d
jmp 0x1b76a
leaq 0x200(%rsp), %rdi
callq 0x54f8
jmp 0x1b76c
testb $0x1, 0x1b5(%rsp)
jne 0x1b778
jmp 0x1b785
leaq 0x1b8(%rsp), %rdi
callq 0x54f8
jmp 0x1b787
testb $0x1, 0x1b6(%rsp)
jne 0x1b793
jmp 0x1b7a0
leaq 0x1b7(%rsp), %rdi
callq 0x5310
testb $0x1, 0x1dd(%rsp)
jne 0x1b7ac
jmp 0x1b7b9
leaq 0x1e0(%rsp), %rdi
callq 0x54f8
jmp 0x1b7bb
testb $0x1, 0x1de(%rsp)
jne 0x1b7c7
jmp 0x1b7d4
leaq 0x1df(%rsp), %rdi
callq 0x5310
jmp 0x1ba4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b8d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b89c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b881
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b866
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
testb $0x1, 0x123(%rsp)
jne 0x1b857
jmp 0x1b864
leaq 0x190(%rsp), %rdi
callq 0x54f8
jmp 0x1b866
testb $0x1, 0x124(%rsp)
jne 0x1b872
jmp 0x1b87f
leaq 0x170(%rsp), %rdi
callq 0x54f8
jmp 0x1b881
testb $0x1, 0x125(%rsp)
jne 0x1b88d
jmp 0x1b89a
leaq 0x128(%rsp), %rdi
callq 0x54f8
jmp 0x1b89c
testb $0x1, 0x126(%rsp)
jne 0x1b8a8
jmp 0x1b8b5
leaq 0x127(%rsp), %rdi
callq 0x5310
testb $0x1, 0x14d(%rsp)
jne 0x1b8c1
jmp 0x1b8ce
leaq 0x150(%rsp), %rdi
callq 0x54f8
jmp 0x1b8d0
testb $0x1, 0x14e(%rsp)
jne 0x1b8dc
jmp 0x1b8e9
leaq 0x14f(%rsp), %rdi
callq 0x5310
jmp 0x1ba4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b9e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b9b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b996
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
jmp 0x1b97b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x248(%rsp)
movl %eax, 0x244(%rsp)
testb $0x1, 0x93(%rsp)
jne 0x1b96c
jmp 0x1b979
leaq 0x100(%rsp), %rdi
callq 0x54f8
jmp 0x1b97b
testb $0x1, 0x94(%rsp)
jne 0x1b987
jmp 0x1b994
leaq 0xe0(%rsp), %rdi
callq 0x54f8
jmp 0x1b996
testb $0x1, 0x95(%rsp)
jne 0x1b9a2
jmp 0x1b9af
leaq 0x98(%rsp), %rdi
callq 0x54f8
jmp 0x1b9b1
testb $0x1, 0x96(%rsp)
jne 0x1b9bd
jmp 0x1b9ca
leaq 0x97(%rsp), %rdi
callq 0x5310
testb $0x1, 0xbd(%rsp)
jne 0x1b9d6
jmp 0x1b9e3
leaq 0xc0(%rsp), %rdi
callq 0x54f8
jmp 0x1b9e5
testb $0x1, 0xbe(%rsp)
jne 0x1b9f1
jmp 0x1b9fe
leaq 0xbf(%rsp), %rdi
callq 0x5310
jmp 0x1ba4e
jmp 0x1ba02
cmpl $0x71, 0x88(%rsp)
je 0x1ba20
cmpl $0x51, 0x88(%rsp)
je 0x1ba20
cmpl $0x1b, 0x88(%rsp)
jne 0x1ba33
movl $0xffffffff, 0x8c(%rsp) # imm = 0xFFFFFFFF
movb $0x0, 0x92(%rsp)
jmp 0x1b5c7
xorl %edi, %edi
callq 0x176d0
movl 0x8c(%rsp), %eax
addq $0x298, %rsp            # imm = 0x298
retq
movq 0x248(%rsp), %rdi
callq 0x5480
nopl (%rax,%rax)