// File: /workspace/github_cpp_makefile_star2_O1/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 0xd971
leaq 0x38(%rsp), %r13
leaq 0x78(%rsp), %rbp
movb $0x1, %r14b
xorl %r15d, %r15d
movq %r13, 0x28(%rsp)
movq 0x30(%rbx), %rsi
movq 0x38(%rbx), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x166e0
movq %r12, %rdi
leaq 0x5741(%rip), %rsi      # 0x1959b
callq 0x5420
movb 0x8c(%rbx), %al
addb $0x61, %al
movq %rbp, 0x68(%rsp)
movsbl %al, %edx
movl $0x1, %esi
leaq 0x68(%rsp), %rdi
callq 0x52c0
movq 0x28(%rsp), %rcx
movl $0xf, %esi
cmpq %r13, %rcx
je 0x13e92
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %r8
movq 0x70(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
leaq 0x18(%rsp), %r12
jbe 0x13ec0
movl $0xf, %esi
cmpq %rbp, 0x68(%rsp)
je 0x13ebb
movq 0x78(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x13ed1
movq 0x68(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x50c0
jmp 0x13edf
leaq 0x68(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5290
movq %r12, 0x8(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x13eff
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x13f07
movups (%rcx), %xmm0
movups %xmm0, (%r12)
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 0x5684(%rip), %rsi      # 0x195b4
callq 0x5420
leaq 0x58(%rsp), %rsi
movq %rsi, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x13f5d
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x13f63
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 %r12, %rdi
je 0x13f8a
callq 0x5230
movq 0x68(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13f99
callq 0x5230
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
leaq 0x28(%rsp), %rbp
je 0x13fad
callq 0x5230
cmpl $0x0, 0x8c(%rbx)
je 0x1406b
movq %r13, 0x28(%rsp)
movq %rbp, %rdi
leaq 0x5601(%rip), %rsi      # 0x195ca
leaq 0x5606(%rip), %rdx      # 0x195d6
callq 0x16274
cmpl $0x1, 0x8c(%rbx)
leaq 0x55f4(%rip), %rsi      # 0x195d7
leaq 0x6a30(%rip), %rax      # 0x1aa1a
cmoveq %rax, %rsi
movq %rbp, %rdi
callq 0x5420
movq %r12, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x14019
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x14021
movups (%rcx), %xmm0
movups %xmm0, (%r12)
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
leaq 0x48(%rsp), %rdi
callq 0x50c0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1405c
callq 0x5230
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x1406b
callq 0x5230
cmpl $0x1, 0x8c(%rbx)
leaq 0x88(%rsp), %r13
je 0x140bc
movq %r12, 0x8(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x5559(%rip), %rsi      # 0x195e6
leaq 0x556a(%rip), %rdx      # 0x195fe
callq 0x16274
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x48(%rsp), %rdi
callq 0x50c0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x140bc
callq 0x5230
cmpl $0x2, 0x8c(%rbx)
je 0x14105
movq %r12, 0x8(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x5529(%rip), %rsi      # 0x195ff
leaq 0x5543(%rip), %rdx      # 0x19620
callq 0x16274
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x48(%rsp), %rdi
callq 0x50c0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x14105
callq 0x5230
leaq 0x48(%rsp), %rdi
leaq 0x64b6(%rip), %rsi      # 0x1a5c7
callq 0x5420
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x166e0
movq %r13, %rdi
callq 0x68a8
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x1415d
callq 0x5230
movq 0xce74(%rip), %rax      # 0x20fd8
movq (%rax), %rdi
callq 0x50f0
movl %eax, %ebp
callq 0x5130
xorl %edi, %edi
callq 0x1093e
movb $0x1, %r12b
xorl %r13d, %r13d
cmpl $0x1b, %ebp
je 0x14201
cmpl $0x51, %ebp
je 0x14201
cmpl $0x71, %ebp
je 0x14201
xorl %r13d, %r13d
cmpl $0x20, %ebp
je 0x141f6
movl 0x8c(%rbx), %eax
addl $0x61, %eax
cmpl %eax, %ebp
je 0x141f6
cmpl $0x63, %ebp
je 0x141d9
cmpl $0x62, %ebp
je 0x141bd
cmpl $0x61, %ebp
jne 0x141fb
movq %rbx, %rdi
callq 0x13c16
jmp 0x141f3
xorl %edi, %edi
callq 0x1093e
callq 0x13a32
testl %eax, %eax
js 0x141fb
movq %rbx, %rdi
movl %eax, %esi
callq 0x13cd9
jmp 0x141f3
xorl %edi, %edi
callq 0x1093e
callq 0x13acc
testl %eax, %eax
js 0x141fb
movq %rbx, %rdi
movl %eax, %esi
callq 0x13d69
xorl %r13d, %r13d
movl %r15d, %r12d
jmp 0x14201
movl %r15d, %r12d
movl %r14d, %r13d
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x14215
callq 0x5230
movl %r13d, %r14d
movl %r12d, %r15d
testb $0x1, %r13b
leaq 0x38(%rsp), %r13
leaq 0x78(%rsp), %rbp
jne 0x13e33
xorl %edi, %edi
callq 0x1093e
andb $0x1, %r12b
movl %r12d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1430b
jmp 0x1430b
jmp 0x1430b
jmp 0x1430b
jmp 0x14265
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
jne 0x142b7
jmp 0x1430e
jmp 0x1430b
movq %rax, %rbx
jmp 0x14293
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x14293
callq 0x5230
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
jmp 0x142b2
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x1430e
callq 0x5230
jmp 0x1430e
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
jne 0x1431d
jmp 0x14322
movq %rax, %rbx
jmp 0x142fd
movq %rax, %rbx
jmp 0x142e9
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x142e9
callq 0x5230
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x142fd
callq 0x5230
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
jmp 0x14318
jmp 0x1430b
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x14322
callq 0x5230
movq %rbx, %rdi
callq 0x53d0