// File: /workspace/github_cpp_makefile_star2_O2/Laakeri[P]Triangulator/src/IO.cpp
// Function: IO::readInput(std::istream&, std::set<std::pair<int, int>, std::less<std::pair<int, int>>, std::allocator<std::pair<int, int>>>&)
int IO::readInput(istream& in, set<pair<int, int> >& edges) {
	ios_base::sync_with_stdio(0);
	string inputLine;
	bool dimacs = false;
	paceTreeWidth = false;
	paceVertices = 0;
	assert(edges.size() == 0);
	while (getline(in, inputLine)) {
		if (inputLine[0] == '#') continue;
		if (inputLine[0] == 'c' && (dimacs || paceTreeWidth) ) continue;
		if (inputLine.size() >= 7 && inputLine.substr(0, 7) == "p edge " && nTokens(inputLine) >= 3) {
			dimacs = true;
			edges.clear();
			continue;
		}
		if (inputLine.size() >= 6 && inputLine.substr(0, 6) == "p col " && nTokens(inputLine) >= 3) {
			dimacs = true;
			edges.clear();
			continue;
		}
		if (inputLine.size() >= 5 && inputLine.substr(0, 5) == "p tw " && nTokens(inputLine) >= 3) {
			edges.clear();
			stringstream ss;
			ss<<inputLine;
			string temp;
			ss>>temp;
			ss>>temp;
			ss>>paceVertices;
			paceTreeWidth = true;
			continue;
		}
		if (inputLine.size() >= 2 && inputLine.substr(0, 2) == "p " && nTokens(inputLine) >= 3) {
			edges.clear();
			dimacs = true;
			continue;
		}
		string vA,vB;
		stringstream ss;
		ss<<inputLine;
		if (inputLine[0] == 'e' && dimacs && nTokens(inputLine) == 3) {
			char e;
			if (!(ss>>e>>vA>>vB)) {
				cerr<<"Unexpected input "<<inputLine<<endl;
				edges.clear();
				continue;
			}
		}
		else if (nTokens(inputLine) == 2 && !dimacs) {
			if (!(ss>>vA>>vB)) {
				cerr<<"Unexpected input "<<inputLine<<endl;
				edges.clear();
				continue;
			}
		}
		else {
			continue;
		}
		if (vA == vB) continue;
		if (vertices.count(vA) == 0) {
			verticeLabels.push_back(vA);
			vertices[vA] = verticeLabels.size();
		}
		if (vertices.count(vB) == 0) {
			verticeLabels.push_back(vB);
			vertices[vB] = verticeLabels.size();
		}
		int a = vertices[vA];
		int b = vertices[vB];
		if (a > b) swap(a, b);
		edges.insert({a, b});
	}
	return vertices.size();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x20a0
leaq 0x78(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %bl, (%rax)
movb %bl, 0x4c(%r12)
andl $0x0, 0x48(%r12)
movq %r14, 0x10(%rsp)
cmpq $0x0, 0x28(%r14)
jne 0xd502
leaq 0x48(%r12), %rax
movq %rax, 0x88(%rsp)
movq %r12, 0x8(%rsp)
leaq 0x30(%r12), %rax
movq %rax, 0x60(%rsp)
leaq 0x68(%rsp), %rbp
leaq 0x150(%rsp), %r12
xorl %r13d, %r13d
movq %r15, %rdi
movq %rbp, %rsi
callq 0x2050
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xd4dc
movq 0x68(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x23, %eax
je 0xcfca
cmpl $0x63, %eax
jne 0xd00a
testb $0x1, %r13b
jne 0xcfca
movq 0x8(%rsp), %rax
cmpb $0x0, 0x4c(%rax)
jne 0xcfca
movq 0x70(%rsp), %rax
cmpq $0x7, %rax
jb 0xd07c
movq %r12, %rdi
movq %rbp, %rsi
xorl %edx, %edx
pushq $0x7
popq %rcx
callq 0x2240
movq %r12, %rdi
leaq 0x13b7e(%rip), %rsi     # 0x20bad
callq 0x35bb
testb %al, %al
je 0xd06f
leaq 0x130(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x22d0
movq %r14, %rsi
callq 0xced8
movl %eax, %ebx
movq %r14, %rdi
callq 0x20d0
movq %r12, %rdi
callq 0x20d0
cmpl $0x3, %ebx
jl 0xd077
jmp 0xd239
movq %r12, %rdi
callq 0x20d0
movq 0x70(%rsp), %rax
cmpq $0x6, %rax
jb 0xd0e4
movq %r12, %rdi
movq %rbp, %rsi
xorl %edx, %edx
pushq $0x6
popq %rcx
callq 0x2240
movq %r12, %rdi
leaq 0x13b19(%rip), %rsi     # 0x20bb5
callq 0x35bb
testb %al, %al
je 0xd0dc
leaq 0x110(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x22d0
movq %r14, %rsi
callq 0xced8
movl %eax, %ebx
movq %r14, %rdi
callq 0x20d0
movq %r12, %rdi
callq 0x20d0
cmpl $0x2, %ebx
jle 0xd0e4
jmp 0xd239
movq %r12, %rdi
callq 0x20d0
movq 0x70(%rsp), %rax
cmpq $0x5, %rax
jb 0xd1de
movq %r12, %rdi
movq %rbp, %rsi
xorl %edx, %edx
pushq $0x5
popq %rcx
callq 0x2240
movq %r12, %rdi
leaq 0x13aaf(%rip), %rsi     # 0x20bbc
callq 0x35bb
testb %al, %al
je 0xd1d1
leaq 0xf0(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x22d0
movq %r14, %rsi
callq 0xced8
movl %eax, %ebx
movq %r14, %rdi
callq 0x20d0
movq %r12, %rdi
callq 0x20d0
cmpl $0x3, %ebx
jl 0xd1d9
movq 0x10(%rsp), %rdi
callq 0xdd1c
movq %r12, %rdi
callq 0x2190
leaq 0x160(%rsp), %rdi
movq %rbp, %rsi
callq 0x21f0
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
andq $0x0, 0x20(%rsp)
movb $0x0, 0x28(%rsp)
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
callq 0x2290
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
callq 0x2290
movq %r12, %rdi
movq 0x88(%rsp), %rsi
callq 0x2140
movq 0x8(%rsp), %rax
movb $0x1, 0x4c(%rax)
leaq 0x18(%rsp), %rdi
callq 0x20d0
movq %r12, %rdi
callq 0x21b0
jmp 0xcfca
movq %r12, %rdi
callq 0x20d0
movq 0x70(%rsp), %rax
cmpq $0x2, %rax
jb 0xd253
movq %r12, %rdi
movq %rbp, %rsi
xorl %edx, %edx
pushq $0x2
popq %rcx
callq 0x2240
movq %r12, %rdi
leaq 0x139c4(%rip), %rsi     # 0x20bc2
callq 0x35bb
testb %al, %al
je 0xd24b
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x22d0
movq %r14, %rsi
callq 0xced8
movl %eax, %ebx
movq %r14, %rdi
callq 0x20d0
movq %r12, %rdi
callq 0x20d0
cmpl $0x2, %ebx
jle 0xd253
movq 0x10(%rsp), %rdi
callq 0xdd1c
movb $0x1, %r13b
jmp 0xcfca
movq %r12, %rdi
callq 0x20d0
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
andq $0x0, 0x20(%rsp)
xorl %ecx, %ecx
movb %cl, 0x28(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
andq $0x0, 0x48(%rsp)
movb %cl, 0x50(%rsp)
movq %r12, %rdi
callq 0x2190
leaq 0x160(%rsp), %rdi
movq %rbp, %rsi
callq 0x21f0
movq 0x68(%rsp), %rax
cmpb $0x65, (%rax)
setne %al
movl %r13d, %ecx
notb %cl
orb %al, %cl
testb $0x1, %cl
jne 0xd343
leaq 0xb0(%rsp), %rdi
movq %rbp, %rsi
callq 0x22d0
leaq 0xb0(%rsp), %r14
movq %r14, %rsi
callq 0xced8
movl %eax, %ebx
movq %r14, %rdi
callq 0x20d0
cmpl $0x3, %ebx
jne 0xd343
movq %r12, %rdi
leaq 0x38(%rsp), %rsi
callq 0x22b0
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
callq 0x2290
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x2290
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0xd3da
movq 0x22cd1(%rip), %rdi     # 0x2fff0
leaq 0x1389f(%rip), %rsi     # 0x20bc5
callq 0x2210
movq %rax, %rdi
movq %rbp, %rsi
callq 0x21f0
movq %rax, %rdi
callq 0x20e0
jmp 0xd3cb
leaq 0x90(%rsp), %rdi
movq %rbp, %rsi
callq 0x22d0
leaq 0x90(%rsp), %r14
movq %r14, %rsi
callq 0xced8
cmpl $0x2, %eax
setne %bl
orb %r13b, %bl
movq %r14, %rdi
callq 0x20d0
testb $0x1, %bl
jne 0xd4bb
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
callq 0x2290
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x2290
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0xd3da
movq 0x22c44(%rip), %rdi     # 0x2fff0
leaq 0x13812(%rip), %rsi     # 0x20bc5
callq 0x2210
movq %rax, %rdi
movq %rbp, %rsi
callq 0x21f0
movq %rax, %rdi
callq 0x20e0
movq 0x10(%rsp), %rdi
callq 0xdd1c
jmp 0xd4bb
leaq 0x18(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xdae4
testb %al, %al
jne 0xd4bb
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x6758
testq %rax, %rax
jne 0xd434
movq 0x60(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xcd0c
movq 0x8(%rsp), %rdi
movq 0x30(%rdi), %r14
movq 0x38(%rdi), %rbx
leaq 0x18(%rsp), %rsi
callq 0x6772
subq %r14, %rbx
shrq $0x5, %rbx
movl %ebx, (%rax)
movq 0x8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x6758
testq %rax, %rax
jne 0xd477
movq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xcd0c
movq 0x8(%rsp), %rdi
movq 0x30(%rdi), %r14
movq 0x38(%rdi), %rbx
leaq 0x40(%rsp), %rsi
callq 0x6772
subq %r14, %rbx
shrq $0x5, %rbx
movl %ebx, (%rax)
movq 0x8(%rsp), %r14
movq %r14, %rdi
leaq 0x18(%rsp), %rsi
callq 0x6772
movl (%rax), %ebx
movq %r14, %rdi
leaq 0x40(%rsp), %rsi
callq 0x6772
movl (%rax), %eax
cmpl %eax, %ebx
movl %eax, %ecx
cmovll %ebx, %ecx
cmovgl %ebx, %eax
movl %ecx, 0x38(%rsp)
movl %eax, 0x3c(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x7448
movq %r12, %rdi
callq 0x21b0
leaq 0x40(%rsp), %rdi
callq 0x20d0
leaq 0x18(%rsp), %rdi
callq 0x20d0
jmp 0xcfca
movq 0x8(%rsp), %rax
movl 0x28(%rax), %ebx
leaq 0x68(%rsp), %rdi
callq 0x20d0
movl %ebx, %eax
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13657(%rip), %rdi     # 0x20b60
leaq 0x13662(%rip), %rsi     # 0x20b72
leaq 0x13662(%rip), %rcx     # 0x20b79
pushq $0x20
popq %rdx
callq 0x2150
jmp 0xd5d3
jmp 0xd5d3
jmp 0xd5d3
movq %rax, %rbx
jmp 0xd591
jmp 0xd5ce
jmp 0xd565
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
jmp 0xd575
jmp 0xd565
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
jmp 0xd575
jmp 0xd565
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
jmp 0xd575
movq %rax, %rbx
jmp 0xd57a
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x20d0
leaq 0x150(%rsp), %rdi
jmp 0xd5f2
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x20d0
leaq 0x150(%rsp), %rdi
callq 0x21b0
jmp 0xd5f7
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
jmp 0xd5c0
jmp 0xd5ce
jmp 0xd5ce
jmp 0xd5ce
jmp 0xd5ce
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x20d0
jmp 0xd5d6
movq %rax, %rbx
jmp 0xd5e3
jmp 0xd5d3
movq %rax, %rbx
jmp 0xd5f7
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0x21b0
leaq 0x40(%rsp), %rdi
callq 0x20d0
leaq 0x18(%rsp), %rdi
callq 0x20d0
leaq 0x68(%rsp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x2340
nop