// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movl %edi, %ebx
movq 0xf2b9(%rip), %r15      # 0x1dfd8
movq (%r15), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x5150
pushq $0x31
popq %rdx
pushq $0x2
popq %rcx
xorl %edi, %edi
xorl %esi, %esi
callq 0x6a9c
movq (%r15), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5260
cmpl $-0x1, %eax
je 0xedd5
movq (%r15), %r14
leaq 0x66d8(%rip), %rsi      # 0x15434
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5110
leaq 0x18(%rsp), %rsi
movq %rsi, -0x10(%rsi)
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rcx
cmpq %rax, %rcx
je 0xed96
movq %rcx, 0x8(%rsp)
movq 0x38(%rsp), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, %rsi
jmp 0xed9c
movups (%rax), %xmm0
movups %xmm0, (%rsi)
movq 0x30(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq %rax, 0x28(%rsp)
andq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
pushq $-0x1
popq %rdx
movq %r14, %rdi
callq 0x50d0
leaq 0x8(%rsp), %rdi
callq 0x5418
leaq 0x28(%rsp), %rdi
callq 0x5418
movq (%r15), %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x5260
cmpl $-0x1, %eax
je 0xee1d
movq (%r15), %r14
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x8(%rsp), %rdi
pushq $0x31
popq %rsi
pushq $0x20
popq %rdx
callq 0x52a0
movq 0x8(%rsp), %rsi
pushq $-0x1
popq %rdx
movq %r14, %rdi
callq 0x50d0
leaq 0x8(%rsp), %rdi
callq 0x5418
pushq $-0x1
popq %rbp
movslq %ebx, %rax
movq 0xb4616(%rip), %rcx     # 0xc3440
imulq $0x18, %rax, %r14
movq (%rcx,%r14), %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 0x6608(%rip), %rdx      # 0x15464
pushq $0x1
popq %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x5310
movb $0x1, %cl
testb $0x1, %cl
je 0xeeb2
callq 0x11424
leal -0x61(%rax), %ebx
cmpl $0x3, %ebx
ja 0xee9b
movq 0xb45bd(%rip), %rax     # 0xc3440
movl %ebx, %ecx
movq (%rax,%r14), %rax
imulq $0x18, %rcx, %rcx
movq 0x8(%rax,%rcx), %rdx
cmpq (%rax,%rcx), %rdx
sete %cl
jmp 0xee6a
cmpl $0x1b, %eax
je 0xeeac
cmpl $0x71, %eax
je 0xeeac
movb $0x1, %cl
cmpl $0x51, %eax
jne 0xee6a
xorl %ecx, %ecx
movl %ebp, %ebx
jmp 0xee6a
xorl %edi, %edi
callq 0xcc13
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
jmp 0xeee4
jmp 0xeeeb
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5418
leaq 0x28(%rsp), %rdi
callq 0x5418
jmp 0xeeee
movq %rax, %rbx
movq %rbx, %rdi
callq 0x53c0