// File: /workspace/github_cpp_makefile_star2_O3/dannycalegari[P]circle_pack/./Input_handler.cc
// Function: input_routine(Packing&, bool&)
void input_routine(Packing &P, bool &finished){
	char c;
	string s;
	ifstream packing_input_file;
	ofstream packing_output_file, eps_output_file;
	int i;
	Point Q;
	
	cout << "Current packing has " << P.size() << " circles. \n";
	cout << "Enter command ([h] for help):";
	cin >> c;
	switch (c){
		case 'h':
			cout << "[h] for help (i.e. return to this list) \n";
			cout << "[v] to toggle verbose \n";
			cout << "[r] to read packing from a file \n";
			cout << "[g] to change geometry \n";
			cout << "[n] to normalize Euclidean coordinates \n";
			cout << "[w] to write packing to a file \n";
			cout << "[e] to write .eps output \n";
			cout << "[f] to find closest center \n";
			cout << "[q] to quit to graphics display \n";
			break;
		case 'v':
			P.toggle_verbose();
			break;
		case 'r':
			cout << "enter name of packing file to read from:";
			cin >> s;
			packing_input_file.open(s.c_str());
			P.read_packing(packing_input_file);
			packing_input_file.close();
			cout << "read packing from file " << s << "\n";
			cout << "finding radii.\n";
			P.find_radii(0.000000001);
			cout << "radii found.\n";
			cout << "determining layout.\n";
			P.determine_layout();
			cout << "layout determined.\n";
			cout << "determining centers.\n";
			P.determine_centers();
			cout << "centers determined.\n";
			break;
		case 'g':
			cout << "change to what geometry (S/E/H):";
			cin >> c;
			P.change_geometry(c);
			cout << "geometry changed.\n";
			break;
		case 'n':
			cout << "normalizing coordinates.\n";
			P.rescale();
			break;
		case 'w':
			cout << "enter name of packing file to write to:";
			cin >> s;
			packing_output_file.open(s.c_str());
			P.write_packing(packing_output_file);
			packing_output_file.close();
			cout << "wrote packing to file " << s << "\n";
			break;
		case 'e':
			cout << "enter name of .eps file to write to:";
			cin >> s;
			eps_output_file.open(s.c_str());
			P.write_packing_eps(eps_output_file);
			eps_output_file.close();
			cout << "wrote .eps to file " << s << "\n";
			break;
		case 'f':
			cout << "current geometry is " << P.write_geometry() << "\n";
			cout << "enter coordinates of point: ";
			cin >> Q.x >> Q.y >> Q.z;
			i=P.find_closest_vertex(Q);
			cout << "closest point is " << i << "\n";
			break;
		case 'q':
			cout << "quit to graphics display.\n" 
				<< "focus in graphics window and press [q] again to exit.\n";
			finished=true;
			break;
		default:
			break;
	};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x668, %rsp            # imm = 0x668
movq %rsi, %r12
movq %rdi, %r15
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x460(%rsp), %rdi
callq 0x2210
leaq 0x260(%rsp), %rbx
movq %rbx, %rdi
callq 0x2380
leaq 0x60(%rsp), %r14
movq %r14, %rdi
callq 0x2380
movq 0x5a76(%rip), %rdi      # 0xdfd0
leaq 0x2159(%rip), %rsi      # 0xa6ba
movl $0x14, %edx
callq 0x2220
movq 0x8(%r15), %rax
subq (%r15), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %esi # imm = 0xAAAAAAAB
movq 0x5a4d(%rip), %rdi      # 0xdfd0
callq 0x2390
leaq 0x2140(%rip), %rsi      # 0xa6cf
movl $0xb, %edx
movq %rax, %rdi
callq 0x2220
movq 0x5a2d(%rip), %rdi      # 0xdfd0
leaq 0x2131(%rip), %rsi      # 0xa6db
movl $0x1d, %edx
callq 0x2220
movq 0x5a25(%rip), %rdi      # 0xdfe0
leaq 0x26(%rsp), %rsi
callq 0x2260
movzbl 0x26(%rsp), %eax
addl $-0x65, %eax
cmpl $0x12, %eax
ja 0x8a9f
leaq 0x1b4b(%rip), %rcx      # 0xa128
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x59e3(%rip), %rdi      # 0xdfd0
leaq 0x2350(%rip), %rsi      # 0xa944
movl $0x24, %edx
callq 0x2220
movq 0x59db(%rip), %rdi      # 0xdfe0
leaq 0x28(%rsp), %rsi
callq 0x2240
movq 0x28(%rsp), %rsi
leaq 0x60(%rsp), %rdi
movl $0x10, %edx
callq 0x2030
leaq 0x60(%rsp), %rsi
movq %r15, %rdi
callq 0x7f76
leaq 0x60(%rsp), %rdi
callq 0x22b0
movl $0x13, %edx
leaq 0x2323(%rip), %rsi      # 0xa969
jmp 0x8a63
movq 0x597e(%rip), %r13      # 0xdfd0
leaq 0x225e(%rip), %rsi      # 0xa8b7
movl $0x20, %edx
movq %r13, %rdi
callq 0x2220
movq 0x5973(%rip), %rdi      # 0xdfe0
leaq 0x26(%rsp), %rsi
callq 0x2260
movsbl 0x26(%rsp), %esi
movq %r15, %rdi
callq 0x61e6
movl $0x12, %edx
leaq 0x2248(%rip), %r12      # 0xa8d8
jmp 0x8a94
movq 0x5934(%rip), %rdi      # 0xdfd0
leaq 0x231e(%rip), %rsi      # 0xa9c1
movl $0x1a, %edx
callq 0x2220
movq 0x591c(%rip), %rdi      # 0xdfd0
leaq 0x2321(%rip), %rsi      # 0xa9dc
movl $0x36, %edx
callq 0x2220
movb $0x1, (%r12)
jmp 0x8a9f
movq 0x58fa(%rip), %rdi      # 0xdfd0
leaq 0x22a0(%rip), %rsi      # 0xa97d
movl $0x14, %edx
callq 0x2220
movb 0x60(%r15), %al
leaq 0x27(%rsp), %rsi
movb %al, (%rsi)
movq 0x58d7(%rip), %rdi      # 0xdfd0
movl $0x1, %edx
callq 0x2220
leaq 0x2017(%rip), %r12      # 0xa721
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2220
movq 0x58af(%rip), %rdi      # 0xdfd0
leaq 0x226a(%rip), %rsi      # 0xa992
movl $0x1c, %edx
callq 0x2220
movq 0x58a7(%rip), %rdi      # 0xdfe0
leaq 0x48(%rsp), %rsi
callq 0x2120
leaq 0x50(%rsp), %rsi
movq %rax, %rdi
callq 0x2120
leaq 0x58(%rsp), %rsi
movq %rax, %rdi
callq 0x2120
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
callq 0x6dc8
movl %eax, %ebp
movq 0x584f(%rip), %rdi      # 0xdfd0
leaq 0x2227(%rip), %rsi      # 0xa9af
movl $0x11, %edx
callq 0x2220
movq 0x5837(%rip), %rdi      # 0xdfd0
movl %ebp, %esi
callq 0x2390
movq %rax, %r13
movl $0x1, %edx
jmp 0x8a94
movq 0x581c(%rip), %rdi      # 0xdfd0
leaq 0x205f(%rip), %rsi      # 0xa81a
movl $0x28, %edx
callq 0x2220
movq 0x5814(%rip), %rdi      # 0xdfe0
leaq 0x28(%rsp), %rsi
callq 0x2240
movq 0x28(%rsp), %rsi
leaq 0x460(%rsp), %rdi
movl $0x8, %edx
callq 0x2110
leaq 0x460(%rsp), %rsi
movq %r15, %rdi
callq 0x4cd8
leaq 0x460(%rsp), %rdi
callq 0x2050
movq 0x57bf(%rip), %rdi      # 0xdfd0
leaq 0x202b(%rip), %rsi      # 0xa843
movl $0x17, %edx
callq 0x2220
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x579d(%rip), %rdi      # 0xdfd0
callq 0x2220
leaq 0x1ee2(%rip), %rsi      # 0xa721
movl $0x1, %edx
movq %rax, %rdi
callq 0x2220
movq 0x577d(%rip), %rdi      # 0xdfd0
leaq 0x2001(%rip), %rsi      # 0xa85b
movl $0xf, %edx
callq 0x2220
movsd 0x18b4(%rip), %xmm0     # 0xa120
movq %r15, %rdi
callq 0x4642
movq 0x5755(%rip), %rdi      # 0xdfd0
leaq 0x1fe9(%rip), %rsi      # 0xa86b
movl $0xd, %edx
callq 0x2220
movq 0x573d(%rip), %rdi      # 0xdfd0
leaq 0x1fdf(%rip), %rsi      # 0xa879
movl $0x14, %edx
callq 0x2220
movq %r15, %rdi
callq 0x51be
movq 0x571d(%rip), %rdi      # 0xdfd0
leaq 0x1fd4(%rip), %rsi      # 0xa88e
movl $0x13, %edx
callq 0x2220
movq 0x5705(%rip), %r13      # 0xdfd0
leaq 0x1ac6(%rip), %rsi      # 0xa398
movl $0x15, %edx
movq %r13, %rdi
callq 0x2220
movq %r15, %rdi
callq 0x5e2c
movl $0x14, %edx
leaq 0x1faf(%rip), %r12      # 0xa8a2
jmp 0x8a94
movq %r15, %rdi
callq 0x901a
jmp 0x8a9f
movq 0x56c4(%rip), %rdi      # 0xdfd0
leaq 0x1de6(%rip), %rsi      # 0xa6f9
movl $0x29, %edx
callq 0x2220
movq 0x56ac(%rip), %rdi      # 0xdfd0
leaq 0x1df8(%rip), %rsi      # 0xa723
movl $0x17, %edx
callq 0x2220
movq 0x5694(%rip), %rdi      # 0xdfd0
leaq 0x1df8(%rip), %rsi      # 0xa73b
movl $0x21, %edx
callq 0x2220
movq 0x567c(%rip), %rdi      # 0xdfd0
leaq 0x1e02(%rip), %rsi      # 0xa75d
movl $0x18, %edx
callq 0x2220
movq 0x5664(%rip), %rdi      # 0xdfd0
leaq 0x1e03(%rip), %rsi      # 0xa776
movl $0x28, %edx
callq 0x2220
movq 0x564c(%rip), %rdi      # 0xdfd0
leaq 0x1e14(%rip), %rsi      # 0xa79f
movl $0x20, %edx
callq 0x2220
movq 0x5634(%rip), %r13      # 0xdfd0
leaq 0x1e1d(%rip), %rsi      # 0xa7c0
movl $0x1a, %edx
movq %r13, %rdi
callq 0x2220
leaq 0x1e24(%rip), %rsi      # 0xa7db
movl $0x1c, %edx
movq %r13, %rdi
callq 0x2220
movl $0x21, %edx
leaq 0x1e28(%rip), %r12      # 0xa7f8
jmp 0x8a94
movq 0x55f4(%rip), %rdi      # 0xdfd0
leaq 0x1f08(%rip), %rsi      # 0xa8eb
movl $0x19, %edx
callq 0x2220
movq %r15, %rdi
callq 0x3d30
jmp 0x8a9f
movq 0x55cf(%rip), %rdi      # 0xdfd0
leaq 0x1efd(%rip), %rsi      # 0xa905
movl $0x27, %edx
callq 0x2220
movq 0x55c7(%rip), %rdi      # 0xdfe0
leaq 0x28(%rsp), %rsi
callq 0x2240
movq 0x28(%rsp), %rsi
leaq 0x260(%rsp), %rdi
movl $0x10, %edx
callq 0x2030
leaq 0x260(%rsp), %rsi
movq %r15, %rdi
callq 0x8320
leaq 0x260(%rsp), %rdi
callq 0x22b0
movl $0x16, %edx
leaq 0x1eca(%rip), %rsi      # 0xa92d
movq 0x5566(%rip), %rdi      # 0xdfd0
callq 0x2220
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x5550(%rip), %rdi      # 0xdfd0
callq 0x2220
movq %rax, %r13
movl $0x1, %edx
leaq 0x1c8d(%rip), %r12      # 0xa721
movq %r13, %rdi
movq %r12, %rsi
callq 0x2220
movq 0x5522(%rip), %rax      # 0xdfc8
movq (%rax), %r15
movq 0x18(%rax), %r12
leaq 0x68(%rsp), %rdi
movq %r15, -0x8(%rdi)
movq -0x18(%r15), %rax
movq %r12, 0x60(%rsp,%rax)
callq 0x2190
movl $0xf8, %r13d
addq %r13, %r14
movq %r14, %rdi
callq 0x20a0
leaq 0x268(%rsp), %rdi
movq %r15, -0x8(%rdi)
movq -0x18(%r15), %rax
movq %r12, 0x260(%rsp,%rax)
callq 0x2190
addq %r13, %rbx
movq %rbx, %rdi
callq 0x20a0
leaq 0x460(%rsp), %rdi
callq 0x2070
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x8b26
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
addq $0x668, %rsp            # imm = 0x668
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x8b54
movq %rax, %rbx
jmp 0x8b61
movq %rax, %rbx
jmp 0x8b6e
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x22e0
leaq 0x260(%rsp), %rdi
callq 0x22e0
leaq 0x460(%rsp), %rdi
callq 0x2070
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x8b8a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x23b0