// File: /workspace/github_cpp_makefile_star2_O3/essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: reconfigure(item*)
bool reconfigure(item* a)
{
	update_device_desciption(a);

	bool unacceptable = true;
	bool cancel = false;
	while(unacceptable)
	{
		std::string s = a->description+" Reconfigure? Space or ("+std::string(1,a->configuration +'a')+
			". Q or ESC to cancel.";
		if(a->configuration != UNCONFIGURED)
		{s += std::string(" (a) remove ")+(a->configuration==ON_TIMER?"timer":"remote control");}
		if(a->configuration != ON_TIMER)
		{s += std::string(" (b) use a timer instead");}
		if(a->configuration != ON_REMOTE)
		{s += std::string(" (c) use a remote control instead");}
		s += ".";
		pretty_print(s);
		/*clear_area(0,0,viewport_width,5);
		mvaddstr(0,0,a->description.c_str());
		mvprintw(1,0,"Reconfigure? Space or (%c) to leave unchanged",a->configuration +'a');
		mvaddstr(2,0,"q or ESC to cancel");
		int i=3;
		if(a->configuration != UNCONFIGURED)
		{
			mvprintw(i,0,"(a) remove %s",a->configuration==ON_TIMER?"timer":"remote control");
			i++;
		}
		if(a->configuration != ON_TIMER)
		{
			mvprintw(i,0,"(b) use a timer instead");
			i++;
		}
		if(a->configuration != ON_REMOTE)
		{
			mvprintw(i,0,"(c) use a remote control instead");
		}*/
		int kp = fgetch();
		draw_scene();
		if(kp == 'q' || kp == 'Q' || kp == KEY_ESC)
		{
			unacceptable = false;
			cancel = true;
		}
		else if(kp == a->configuration + 'a' || kp == ' ')
		{
			unacceptable = false;
		}
		else if(kp == 'a') 
		{
			set_unconfigured(a);
			unacceptable = false;
		}
		else if( kp == 'b')
		{
			draw_scene();
			int t = ask_for_time();
			
			if (t >= 0)
			{
				set_timer(a,t);
				unacceptable = false;
			}
		}
		else if (kp == 'c')
		{
			draw_scene();
			int w = ask_for_wavelength();
			if(w>=0)
			{
				set_remote(a,w);
				unacceptable = false;
			}
		}
	}
	draw_scene();
	return cancel;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
callq 0xd453
leaq 0x38(%rsp), %r14
leaq 0x78(%rsp), %r13
leaq 0x18(%rsp), %r15
xorl %ebp, %ebp
movq %r14, 0x28(%rsp)
movq 0x30(%rbx), %rsi
movq 0x38(%rbx), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x15f56
movq %r12, %rdi
leaq 0x5e14(%rip), %rsi      # 0x1960b
callq 0x5410
movb 0x8c(%rbx), %al
addb $0x61, %al
movq %r13, 0x68(%rsp)
movsbl %al, %edx
movl $0x1, %esi
leaq 0x68(%rsp), %rdi
callq 0x52c0
movq 0x28(%rsp), %rcx
movl $0xf, %edi
cmpq %r14, %rcx
je 0x1382f
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %r8
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x1385b
movl $0xf, %edi
cmpq %r13, %rsi
je 0x13856
movq 0x78(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x13865
movq %r12, %rdi
callq 0x50c0
jmp 0x13873
leaq 0x68(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5290
movq %r15, 0x8(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x13893
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x1389a
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x8(%rsp), %rdi
leaq 0x5d61(%rip), %rsi      # 0x19624
callq 0x5410
leaq 0x58(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x138f0
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x138f6
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1391d
callq 0x5230
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x1392c
callq 0x5230
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
leaq 0x48(%rsp), %r13
je 0x13940
callq 0x5230
cmpl $0x0, 0x8c(%rbx)
je 0x13a04
movq %r14, 0x28(%rsp)
movq %r12, %rdi
leaq 0x5cde(%rip), %rsi      # 0x1963a
leaq 0x5ce3(%rip), %rdx      # 0x19646
callq 0x15b1a
cmpl $0x1, 0x8c(%rbx)
leaq 0x5cd1(%rip), %rsi      # 0x19647
leaq 0x710d(%rip), %rax      # 0x1aa8a
cmoveq %rax, %rsi
movq %r12, %rdi
callq 0x5410
movq %r15, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x139ac
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x139b3
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r13, %rdi
callq 0x50c0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x139ec
callq 0x5230
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x139fb
callq 0x5230
cmpl $0x1, 0x8c(%rbx)
je 0x13a4b
movq %r15, 0x8(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x5c41(%rip), %rsi      # 0x19656
leaq 0x5c52(%rip), %rdx      # 0x1966e
callq 0x15b1a
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r13, %rdi
callq 0x50c0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x13a42
callq 0x5230
cmpl $0x2, 0x8c(%rbx)
je 0x13a89
movq %r15, 0x8(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x5c13(%rip), %rsi      # 0x1966f
leaq 0x5c2d(%rip), %rdx      # 0x19690
callq 0x15b1a
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r13, %rdi
callq 0x50c0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x13a89
callq 0x5230
movq %r13, %rdi
leaq 0x6ba4(%rip), %rsi      # 0x1a637
callq 0x5410
leaq 0x88(%rsp), %r14
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x15f56
movq %r14, %rdi
callq 0x688f
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x13ae7
callq 0x5230
movq 0xd4ea(%rip), %rax      # 0x20fd8
movq (%rax), %rdi
callq 0x50f0
movl %eax, %r13d
callq 0x5130
xorl %edi, %edi
callq 0x10355
movb $0x1, %r12b
xorl %r14d, %r14d
cmpl $0x1b, %r13d
je 0x13b8f
cmpl $0x51, %r13d
je 0x13b8f
cmpl $0x71, %r13d
je 0x13b8f
xorl %r14d, %r14d
cmpl $0x20, %r13d
je 0x13b8c
movl 0x8c(%rbx), %eax
addl $0x61, %eax
cmpl %eax, %r13d
je 0x13b8c
movb $0x1, %r14b
cmpl $0x63, %r13d
je 0x13b6f
cmpl $0x62, %r13d
je 0x13b53
cmpl $0x61, %r13d
jne 0x13b8c
movq %rbx, %rdi
callq 0x135a3
jmp 0x13b89
xorl %edi, %edi
callq 0x10355
callq 0x133dd
testl %eax, %eax
js 0x13b8c
movq %rbx, %rdi
movl %eax, %esi
callq 0x13676
jmp 0x13b89
xorl %edi, %edi
callq 0x10355
callq 0x13464
testl %eax, %eax
js 0x13b8c
movq %rbx, %rdi
movl %eax, %esi
callq 0x13704
xorl %r14d, %r14d
movl %ebp, %r12d
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x13ba3
callq 0x5230
movl %r12d, %ebp
testb %r14b, %r14b
leaq 0x38(%rsp), %r14
leaq 0x78(%rsp), %r13
jne 0x137d0
xorl %edi, %edi
callq 0x10355
andb $0x1, %r12b
movl %r12d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13c8c
jmp 0x13c8c
jmp 0x13c8c
movq %rax, %rbx
jmp 0x13bff
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x13bff
callq 0x5230
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
jmp 0x13c7e
jmp 0x13c8c
jmp 0x13c11
jmp 0x13c8c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0x13c83
jmp 0x13c8f
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
jne 0x13c9e
jmp 0x13ca3
movq %rax, %rbx
jmp 0x13c5f
movq %rax, %rbx
jmp 0x13c4b
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x13c4b
callq 0x5230
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x13c5f
callq 0x5230
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
jmp 0x13c99
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x13c8f
callq 0x5230
jmp 0x13c8f
jmp 0x13c8c
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x13ca3
callq 0x5230
movq %rbx, %rdi
callq 0x53d0