// File: /workspace/github_cpp_makefile_star2_O3/essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: select_configuration(int)
int select_configuration(int dev_type)
{
	attron(COLOR_PAIR(COLOR_WHITE));
	clear_area(0,0,viewport_width,2);
	mvaddstr(0,0,padmsg("Use a preconfigured device? Q or ESC to cancel.").c_str());
	mvaddstr(1,0,std::string(viewport_width,' ').c_str());
	mvprintw(1,0,"(a) %d unconfigured, (b) %d timer, (c) %d remote",dev_inv[dev_type][UNCONFIGURED].size(),
		dev_inv[dev_type][ON_TIMER].size(),dev_inv[dev_type][ON_REMOTE].size());
	
	bool unacceptable = true;
	int config;
	while(unacceptable)
	{
		int kp = fgetch();
		config = kp - 'a';
		if(0 <= config && config <= DEVICE_CONFIGURATIONS)
		{
			if(dev_inv[dev_type][config].size()) unacceptable = false;
		}
		else if(kp == 'q' || kp == 'Q' || kp == KEY_ESC)
		{
			config = -1; unacceptable = false;
		}
	}
	draw_scene();
	return config;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movl %edi, %ebx
movq 0xdeda(%rip), %r15      # 0x20fd8
movq (%r15), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x5150
xorl %edi, %edi
xorl %esi, %esi
movl $0x31, %edx
movl $0x2, %ecx
callq 0x742a
movq (%r15), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x131d1
movq (%r15), %r14
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x6392(%rip), %rsi      # 0x194db
leaq 0x63ba(%rip), %rdx      # 0x1950a
leaq 0x20(%rsp), %rdi
callq 0x15b1a
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x20(%rsp), %rsi
cmpq %r12, %rsi
je 0x1317d
movq %rsi, (%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x1318a
movups (%r12), %xmm0
movups %xmm0, (%r13)
movq %r13, %rsi
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r12, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movb $0x0, 0x30(%rsp)
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x131c2
callq 0x5230
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x131d1
callq 0x5230
movq (%r15), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x13223
movq (%r15), %r14
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rsp, %rdi
movl $0x31, %esi
movl $0x20, %edx
callq 0x52c0
movq (%rsp), %rsi
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x13223
callq 0x5230
movslq %ebx, %rax
movq 0xb3213(%rip), %rcx     # 0xc6440
leaq (%rax,%rax,2), %r12
movq (%rcx,%r12,8), %rax
movq 0x8(%rax), %rcx
movq 0x20(%rax), %r8
subq (%rax), %rcx
sarq $0x3, %rcx
subq 0x18(%rax), %r8
sarq $0x3, %r8
movq 0x38(%rax), %r9
subq 0x30(%rax), %r9
sarq $0x3, %r9
leaq 0x62ac(%rip), %rdx      # 0x1950b
movl $0x1, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x5320
movq (%r15), %rdi
callq 0x50f0
movl %eax, %r14d
callq 0x5130
leal -0x61(%r14), %ebx
cmpl $0x3, %ebx
ja 0x132a4
movq 0xb31b3(%rip), %rax     # 0xc6440
movl %ebx, %ecx
movq (%rax,%r12,8), %rax
leaq (%rcx,%rcx,2), %rcx
movq 0x8(%rax,%rcx,8), %rdx
cmpq (%rax,%rcx,8), %rdx
je 0x1326d
jmp 0x132bb
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x1b, %r14d
je 0x132bb
cmpl $0x71, %r14d
je 0x132bb
cmpl $0x51, %r14d
jne 0x1326d
xorl %edi, %edi
callq 0x10355
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq (%rsp), %rdi
jmp 0x132f3
jmp 0x132ff
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x132ee
callq 0x5230
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x13302
callq 0x5230
jmp 0x13302
movq %rax, %rbx
movq %rbx, %rdi
callq 0x53d0