// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edi, %ebx
movq 0xd89f(%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 0x743c
movq (%r15), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x13810
movq (%r15), %r14
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x5ce7(%rip), %rsi      # 0x1946b
leaq 0x5d0f(%rip), %rdx      # 0x1949a
leaq 0x28(%rsp), %rdi
callq 0x16274
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x28(%rsp), %rax
cmpq %r12, %rax
je 0x137b9
movq %rax, 0x8(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x137c3
movups (%r12), %xmm0
movups %xmm0, (%r13)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r12, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
movq 0x8(%rsp), %rsi
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x13801
callq 0x5230
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x13810
callq 0x5230
movq (%r15), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x13866
movq (%r15), %r14
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x8(%rsp), %rdi
movl $0x31, %esi
movl $0x20, %edx
callq 0x52c0
movq 0x8(%rsp), %rsi
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x13866
callq 0x5230
movslq %ebx, %rax
movq 0xb2be0(%rip), %rcx     # 0xc6450
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 0x5bf9(%rip), %rdx      # 0x1949b
movl $0x1, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x5320
movb $0x1, %bpl
movq (%r15), %rdi
callq 0x50f0
movl %eax, %r14d
callq 0x5130
leal -0x61(%r14), %ebx
cmpl $0x3, %ebx
ja 0x138ee
movq 0xb2b7d(%rip), %rax     # 0xc6450
movl %ebx, %ecx
movq (%rax,%r12,8), %rax
leaq (%rcx,%rcx,2), %rcx
movq 0x8(%rax,%rcx,8), %rdx
cmpq (%rax,%rcx,8), %rdx
jne 0x13905
movzbl %bpl, %ebp
jmp 0x13907
cmpl $0x1b, %r14d
je 0x13900
cmpl $0x71, %r14d
je 0x13900
cmpl $0x51, %r14d
jne 0x13907
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %ebp, %ebp
testb $0x1, %bpl
jne 0x138b3
xorl %edi, %edi
callq 0x1093e
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
jmp 0x13948
jmp 0x13954
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x13943
callq 0x5230
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x13957
callq 0x5230
jmp 0x13957
movq %rax, %rbx
movq %rbx, %rdi
callq 0x53d0