// File: /workspace/github_cpp_makefile_star2_O1/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 0x4de4
movq 0x8(%r15), %r14
subq (%r15), %r14
movslq (%rbx), %rsi
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x4e52
movslq (%rbx), %rsi
leaq 0x30(%rsp), %rdi
movq %rsp, %rdx
callq 0x4e52
movq %r12, 0x60(%rsp)
shrq $0x3, %r14
testl %r14d, %r14d
jle 0x2a67
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 0x2a4e
leaq 0xe8(%rbx), %r12
movslq %r14d, %rbp
movq %rsp, %rdx
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
movq %r12, %rdi
movq %rbp, %rsi
callq 0x4edc
leaq 0x100(%rbx), %r13
movq %rsp, %rdx
movl $0xffffffff, (%rdx)     # imm = 0xFFFFFFFF
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4edc
leaq 0x118(%rbx), %rdi
movslq (%rbx), %rsi
incq %rsi
movq %rsp, %rdx
movl $0x0, (%rdx)
callq 0x4edc
leaq 0x130(%rbx), %rdi
movslq (%rbx), %rsi
incq %rsi
movq %rsp, %rdx
movl $0x0, (%rdx)
callq 0x4edc
movq 0x130(%rbx), %rax
xorl %edx, %edx
movl %edx, (%rax)
movq 0x118(%rbx), %rcx
movl %edx, (%rcx)
cmpl %edx, (%rbx)
jle 0x2b1f
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 0x2afa
testl %r14d, %r14d
jle 0x2b6a
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 0x2b39
xorl %edx, %edx
movl %edx, (%rax)
movl %edx, (%rcx)
movl (%rbx), %r8d
testl %r8d, %r8d
movq 0x60(%rsp), %r14
jle 0x2bae
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 0x2b89
leaq 0x38(%rbx), %rdi
movslq %r8d, %rsi
callq 0x4f10
leaq 0x20(%rbx), %rdi
movq %rdi, 0x20(%rsp)
movq %r14, %rsi
callq 0x4f42
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
cmpl $0x0, 0x4(%rbx)
jle 0x2c27
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 0x5b40
incq %r15
movslq 0x4(%rbx), %rax
addq %rbp, %r13
cmpq %rax, %r15
jl 0x2bf9
movq (%rsp), %r14
movq 0x8(%rsp), %r12
cmpq %r12, %r14
je 0x2c62
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 0x5cb5
movq %r14, %rdi
movq %r12, %rsi
callq 0x5d68
leaq 0x68(%rbx), %r14
movslq (%rbx), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f10
cmpl $0x0, 0x4(%rbx)
jle 0x2cce
leaq 0x50(%rbx), %r12
movl $0x4, %r13d
xorl %ebp, %ebp
movq (%rsp), %rdx
addq %r13, %rdx
movq 0x58(%rbx), %rsi
cmpq 0x60(%rbx), %rsi
je 0x2ca5
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x58(%rbx)
jmp 0x2cad
movq %r12, %rdi
callq 0x6140
movq (%rsp), %rax
movslq -0x4(%rax,%r13), %rax
movq 0x68(%rbx), %rcx
incl 0x4(%rcx,%rax,4)
incq %rbp
movslq 0x4(%rbx), %rax
addq $0x8, %r13
cmpq %rax, %rbp
jl 0x2c86
movl (%rbx), %ecx
testl %ecx, %ecx
jle 0x2cee
movq (%r14), %rax
movl (%rax), %edx
xorl %esi, %esi
addl 0x4(%rax,%rsi,4), %edx
movl %edx, 0x4(%rax,%rsi,4)
movslq (%rbx), %rcx
incq %rsi
cmpq %rcx, %rsi
jl 0x2cdb
leaq 0x98(%rbx), %rdi
movslq %ecx, %rsi
xorl %edx, %edx
callq 0x4de4
leaq 0xc0(%rbx), %rdi
movslq (%rbx), %rsi
xorl %edx, %edx
callq 0x4de4
leaq 0x8(%rbx), %r14
movslq 0x4(%rbx), %rsi
leaq 0x28(%rsp), %rdx
movl $0x0, (%rdx)
movq %r14, %rdi
callq 0x4edc
cmpl $0x0, 0x4(%rbx)
jle 0x2d51
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 0x2d3e
movq %rbx, %rdi
callq 0x2e14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2d6f
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x2d86
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x2d9d
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 0x2dc4
jmp 0x2dbb
jmp 0x2dbb
jmp 0x2dbb
jmp 0x2dbb
movq %rax, %rbx
jmp 0x2df4
movq %rax, %rbx
jmp 0x2ddd
jmp 0x2dc4
jmp 0x2dc4
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2ddd
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x2df4
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x2e0b
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2200
nop