// File: /workspace/github_cpp_makefile_star2_O3/todo314[P]pruned-monte-carlo/src/pmc.cpp
// Function: PrunedEstimater::init(int, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>&, std::vector<int, std::allocator<int>>&)
void PrunedEstimater::init(const int _n, vector<pair<int, int> > &_es,
		vector<int> &_comp) {
	flag = true;
	n = _n;
	n1 = _comp.size();

	visited.resize(n, false);

	int m = _es.size();
	vector<int> outdeg(n), indeg(n);

	for (int i = 0; i < m; i++) {
		int a = _es[i].first, b = _es[i].second;
		outdeg[a]++;
		indeg[b]++;
	}
	es.resize(m, -1);
	rs.resize(m, -1);

	at_e.resize(n + 1, 0);
	at_r.resize(n + 1, 0);

	at_e[0] = at_r[0] = 0;
	for (int i = 1; i <= n; i++) {
		at_e[i] = at_e[i - 1] + outdeg[i - 1];
		at_r[i] = at_r[i - 1] + indeg[i - 1];
	}

	for (int i = 0; i < m; i++) {
		int a = _es[i].first, b = _es[i].second;
		es[at_e[a]++] = b;
		rs[at_r[b]++] = a;
	}

	at_e[0] = at_r[0] = 0;
	for (int i = 1; i <= n; i++) {
		at_e[i] = at_e[i - 1] + outdeg[i - 1];
		at_r[i] = at_r[i - 1] + indeg[i - 1];
	}

	sigmas.resize(n);
	comp = _comp;
	vector<pair<int, int> > ps;
	for (int i = 0; i < n1; i++) {
		ps.push_back(make_pair(comp[i], i));
	}
	sort(ps.begin(), ps.end());
	at_p.resize(n + 1);
	for (int i = 0; i < n1; i++) {
		pmoc.push_back(ps[i].second);
		at_p[ps[i].first + 1]++;
	}
	for (int i = 1; i <= n; i++) {
		at_p[i] += at_p[i - 1];
	}

	memo.resize(n);
	removed.resize(n);

	weight.resize(n1, 0);
	for (int i = 0; i < n1; i++) {
		weight[comp[i]]++;
	}

	first();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, %r12
movq %rdx, %r15
movq %rdi, %rbx
movb $0x1, 0x1c8(%rdi)
movl %esi, (%rdi)
movq 0x8(%rcx), %rax
subq (%rcx), %rax
shrq $0x2, %rax
movl %eax, 0x4(%rdi)
addq $0x148, %rdi            # imm = 0x148
movslq %esi, %rsi
xorl %edx, %edx
callq 0x4d48
movq 0x8(%r15), %r14
subq (%r15), %r14
movslq (%rbx), %rsi
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x4db6
movslq (%rbx), %rsi
leaq 0x30(%rsp), %rdi
movq %rsp, %rdx
callq 0x4db6
movq %r12, 0x60(%rsp)
shrq $0x3, %r14
testl %r14d, %r14d
jle 0x2a6f
movq (%r15), %rax
movq 0x48(%rsp), %rcx
movq 0x30(%rsp), %rdx
movl %r14d, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %edi, %edi
movslq (%rax,%rdi,8), %r8
movslq 0x4(%rax,%rdi,8), %r9
incl (%rcx,%r8,4)
incl (%rdx,%r9,4)
incq %rdi
cmpq %rdi, %rsi
jne 0x2a56
leaq 0xe8(%rbx), %r12
movslq %r14d, %rbp
movq %rsp, %rdx
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
movq %r12, %rdi
movq %rbp, %rsi
callq 0x4e42
leaq 0x100(%rbx), %r13
movq %rsp, %rdx
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4e42
leaq 0x118(%rbx), %rdi
movslq (%rbx), %rsi
incq %rsi
movq %rsp, %rdx
movl $0x0, (%rdx)
callq 0x4e42
leaq 0x130(%rbx), %rdi
movslq (%rbx), %rsi
incq %rsi
movq %rsp, %rdx
movl $0x0, (%rdx)
callq 0x4e42
movq 0x130(%rbx), %rax
xorl %edx, %edx
movl %edx, (%rax)
movq 0x118(%rbx), %rcx
movl %edx, (%rcx)
cmpl %edx, (%rbx)
jle 0x2b27
movq 0x48(%rsp), %rdx
movq 0x30(%rsp), %rsi
xorl %edi, %edi
movl (%rdx,%rdi,4), %r8d
addl (%rcx,%rdi,4), %r8d
movl %r8d, 0x4(%rcx,%rdi,4)
movl (%rsi,%rdi,4), %r8d
addl (%rax,%rdi,4), %r8d
movl %r8d, 0x4(%rax,%rdi,4)
movslq (%rbx), %r8
incq %rdi
cmpq %r8, %rdi
jl 0x2b02
testl %r14d, %r14d
jle 0x2b72
movq (%r15), %rdx
movq (%r12), %rsi
movq (%r13), %rdi
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %r8d, %r8d
movslq (%rdx,%r8,8), %r9
movslq 0x4(%rdx,%r8,8), %r10
movslq (%rcx,%r9,4), %r11
leal 0x1(%r11), %ebp
movl %ebp, (%rcx,%r9,4)
movl %r10d, (%rsi,%r11,4)
movslq (%rax,%r10,4), %r11
leal 0x1(%r11), %ebp
movl %ebp, (%rax,%r10,4)
movl %r9d, (%rdi,%r11,4)
incq %r8
cmpq %r8, %r14
jne 0x2b41
xorl %edx, %edx
movl %edx, (%rax)
movl %edx, (%rcx)
movslq (%rbx), %rsi
testq %rsi, %rsi
jle 0x2bb2
movq 0x48(%rsp), %rdx
movq 0x30(%rsp), %rdi
xorl %r8d, %r8d
movl (%rdx,%r8,4), %esi
addl (%rcx,%r8,4), %esi
movl %esi, 0x4(%rcx,%r8,4)
movl (%rdi,%r8,4), %esi
addl (%rax,%r8,4), %esi
movl %esi, 0x4(%rax,%r8,4)
movslq (%rbx), %rsi
incq %r8
cmpq %rsi, %r8
jl 0x2b8d
leaq 0x38(%rbx), %rdi
callq 0x4e76
movq 0x60(%rsp), %rsi
leaq 0x20(%rbx), %rdi
movq %rdi, 0x20(%rsp)
callq 0x4ea8
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
cmpl $0x0, 0x4(%rbx)
jle 0x2c69
xorl %r13d, %r13d
movq %rsp, %r14
leaq 0x28(%rsp), %r12
movabsq $0x100000000, %rbp      # imm = 0x100000000
xorl %r15d, %r15d
movq 0x20(%rsp), %rax
movq (%rax), %rax
movl (%rax,%r15,4), %eax
addq %r13, %rax
movq %rax, 0x28(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x5ea4
incq %r15
movslq 0x4(%rbx), %rax
addq %rbp, %r13
cmpq %rax, %r15
jl 0x2c00
movq (%rsp), %r14
movq 0x8(%rsp), %r12
cmpq %r12, %r14
je 0x2c69
movq %r12, %rax
subq %r14, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x6021
movq %r14, %rdi
movq %r12, %rsi
callq 0x60d4
leaq 0x68(%rbx), %r14
movslq (%rbx), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4e76
cmpl $0x0, 0x4(%rbx)
jle 0x2cd6
leaq 0x50(%rbx), %r12
movl $0x4, %r13d
movq (%rsp), %rax
xorl %ebp, %ebp
leaq (%rax,%r13), %rdx
movq 0x58(%rbx), %rsi
cmpq 0x60(%rbx), %rsi
je 0x2cad
movl (%rdx), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x58(%rbx)
jmp 0x2cb9
movq %r12, %rdi
callq 0x6498
movq (%rsp), %rax
movslq -0x4(%rax,%r13), %rcx
movq 0x68(%rbx), %rdx
incl 0x4(%rdx,%rcx,4)
incq %rbp
movslq 0x4(%rbx), %rcx
addq $0x8, %r13
cmpq %rcx, %rbp
jl 0x2c91
movslq (%rbx), %rsi
testq %rsi, %rsi
jle 0x2cf8
movq (%r14), %rax
movl (%rax), %ecx
xorl %edx, %edx
addl 0x4(%rax,%rdx,4), %ecx
movl %ecx, 0x4(%rax,%rdx,4)
movslq (%rbx), %rsi
incq %rdx
cmpq %rsi, %rdx
jl 0x2ce5
leaq 0x98(%rbx), %rdi
xorl %edx, %edx
callq 0x4d48
leaq 0xc0(%rbx), %rdi
movslq (%rbx), %rsi
xorl %edx, %edx
callq 0x4d48
leaq 0x8(%rbx), %r14
movslq 0x4(%rbx), %rsi
leaq 0x28(%rsp), %rdx
movl $0x0, (%rdx)
movq %r14, %rdi
callq 0x4e42
cmpl $0x0, 0x4(%rbx)
jle 0x2d58
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq (%r14), %rcx
xorl %edx, %edx
movslq (%rax,%rdx,4), %rsi
incl (%rcx,%rsi,4)
incq %rdx
movslq 0x4(%rbx), %rsi
cmpq %rsi, %rdx
jl 0x2d45
movq %rbx, %rdi
callq 0x2e1a
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2d76
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x2d8d
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x2da4
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2dcb
jmp 0x2dc2
jmp 0x2dc2
jmp 0x2dc2
jmp 0x2dc2
movq %rax, %rbx
jmp 0x2dfb
movq %rax, %rbx
jmp 0x2de4
jmp 0x2dcb
jmp 0x2dcb
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2de4
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x2dfb
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x2e12
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2200