// File: /workspace/github_cpp_makefile_star2_O2/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 %rdx, %r15
movq %rdi, %rbx
movb $0x1, 0x1c8(%rdi)
movl %esi, (%rdi)
movq 0x8(%rcx), %rax
movq %rcx, 0x48(%rsp)
subq (%rcx), %rax
shrq $0x2, %rax
movl %eax, 0x4(%rdi)
addq $0x148, %rdi            # imm = 0x148
movslq %esi, %rsi
xorl %r14d, %r14d
xorl %edx, %edx
callq 0x3e44
movq 0x8(%r15), %r13
subq (%r15), %r13
movslq (%rbx), %rsi
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x3eb2
movslq (%rbx), %rsi
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x3eb2
shrq $0x3, %r13
movq (%r15), %rax
movq 0x50(%rsp), %rcx
movq 0x30(%rsp), %rdx
testl %r13d, %r13d
movl $0x0, %r12d
cmovgl %r13d, %r12d
cmpq %r14, %r12
je 0x2926
movslq (%rax,%r14,8), %rsi
movslq 0x4(%rax,%r14,8), %rdi
incl (%rcx,%rsi,4)
incl (%rdx,%rdi,4)
incq %r14
jmp 0x290d
leaq 0xe8(%rbx), %r14
movslq %r13d, %rbp
leaq 0x10(%rsp), %rdx
orl $-0x1, (%rdx)
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3f04
movq %r15, 0x8(%rsp)
leaq 0x100(%rbx), %r13
leaq 0x10(%rsp), %rdx
orl $-0x1, (%rdx)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3f04
movq %r14, %r15
leaq 0x118(%rbx), %rbp
movslq (%rbx), %rsi
incq %rsi
leaq 0x10(%rsp), %rdx
andl $0x0, (%rdx)
movq %rbp, %rdi
callq 0x3f04
leaq 0x130(%rbx), %r14
movslq (%rbx), %rsi
incq %rsi
leaq 0x10(%rsp), %rdx
andl $0x0, (%rdx)
movq %r14, %rdi
callq 0x3f04
movq (%r14), %rax
andl $0x0, (%rax)
movq (%rbp), %rcx
andl $0x0, (%rcx)
movq 0x50(%rsp), %rdx
pushq $0x1
popq %rsi
movq 0x30(%rsp), %rdi
movslq (%rbx), %r8
cmpq %r8, %rsi
jg 0x29e2
movl -0x4(%rdx,%rsi,4), %r8d
addl -0x4(%rcx,%rsi,4), %r8d
movl %r8d, (%rcx,%rsi,4)
movl -0x4(%rdi,%rsi,4), %r8d
addl -0x4(%rax,%rsi,4), %r8d
movl %r8d, (%rax,%rsi,4)
incq %rsi
jmp 0x29b9
movq 0x8(%rsp), %rdx
movq (%rdx), %rdx
movq (%r15), %rsi
movq (%r13), %rdi
xorl %r8d, %r8d
cmpq %r8, %r12
je 0x2a27
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
jmp 0x29f4
andl $0x0, (%rax)
andl $0x0, (%rcx)
movq 0x50(%rsp), %rdx
pushq $0x1
popq %rdi
movq 0x30(%rsp), %r8
movslq (%rbx), %rsi
cmpq %rsi, %rdi
jg 0x2a5e
movl -0x4(%rdx,%rdi,4), %esi
addl -0x4(%rcx,%rdi,4), %esi
movl %esi, (%rcx,%rdi,4)
movl -0x4(%r8,%rdi,4), %esi
addl -0x4(%rax,%rdi,4), %esi
movl %esi, (%rax,%rdi,4)
incq %rdi
jmp 0x2a3a
leaq 0x38(%rbx), %rdi
callq 0x3f38
leaq 0x20(%rbx), %rdi
movq %rdi, 0x8(%rsp)
movq 0x48(%rsp), %rsi
callq 0x3f6a
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r14
movaps %xmm0, (%r14)
andq $0x0, 0x10(%r14)
xorl %r13d, %r13d
leaq 0x28(%rsp), %r12
movabsq $0x100000000, %rbp      # imm = 0x100000000
xorl %r15d, %r15d
movslq 0x4(%rbx), %rax
cmpq %rax, %r15
jge 0x2ad0
movq 0x8(%rsp), %rax
movq (%rax), %rax
movl (%rax,%r15,4), %eax
addq %r13, %rax
movq %rax, 0x28(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x4e24
incq %r15
addq %rbp, %r13
jmp 0x2aa0
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x4fa1
leaq 0x68(%rbx), %r14
movslq (%rbx), %rsi
incq %rsi
movq %r14, %rdi
callq 0x3f38
leaq 0x50(%rbx), %r12
pushq $0x4
popq %r13
xorl %ebp, %ebp
movslq 0x4(%rbx), %rax
cmpq %rax, %rbp
jge 0x2b2d
movq 0x10(%rsp), %rsi
addq %r13, %rsi
movq %r12, %rdi
callq 0x4034
movq 0x10(%rsp), %rax
movslq (%rax,%rbp,8), %rax
movq (%r14), %rcx
incl 0x4(%rcx,%rax,4)
incq %rbp
addq $0x8, %r13
jmp 0x2afb
movq (%r14), %rax
pushq $0x1
popq %rcx
movslq (%rbx), %rsi
cmpq %rsi, %rcx
jg 0x2b47
movl -0x4(%rax,%rcx,4), %edx
addl %edx, (%rax,%rcx,4)
incq %rcx
jmp 0x2b33
leaq 0x98(%rbx), %rdi
xorl %edx, %edx
callq 0x3e44
leaq 0xc0(%rbx), %rdi
movslq (%rbx), %rsi
xorl %edx, %edx
callq 0x3e44
leaq 0x8(%rbx), %r14
movslq 0x4(%rbx), %rsi
leaq 0x28(%rsp), %rdx
andl $0x0, (%rdx)
movq %r14, %rdi
callq 0x3f04
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq (%r14), %rcx
xorl %edx, %edx
movslq 0x4(%rbx), %rsi
cmpq %rsi, %rdx
jge 0x2ba0
movslq (%rax,%rdx,4), %rsi
incl (%rcx,%rsi,4)
incq %rdx
jmp 0x2b8b
movq %rbx, %rdi
callq 0x2c16
leaq 0x10(%rsp), %rdi
callq 0x4df0
leaq 0x30(%rsp), %rdi
callq 0x284a
leaq 0x50(%rsp), %rdi
callq 0x284a
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2bed
jmp 0x2be4
jmp 0x2be4
jmp 0x2be4
jmp 0x2be4
movq %rax, %rbx
jmp 0x2c04
movq %rax, %rbx
jmp 0x2bfa
jmp 0x2bed
jmp 0x2bed
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4df0
leaq 0x30(%rsp), %rdi
callq 0x284a
leaq 0x50(%rsp), %rdi
callq 0x284a
movq %rbx, %rdi
callq 0x21d0