// File: /workspace/github_cpp_makefile_star2_O2/todo314[P]pruned-monte-carlo/src/pmc.cpp
// Function: PrunedEstimater::sigma(int)
int PrunedEstimater::sigma(const int v0) {
	if (memo[v0]) {
		return sigmas[v0];
	}
	memo[v0] = true;
	if (removed[v0]) {
		return sigmas[v0] = 0;
	} else {
		int child = unique_child(v0);
		if (child == -1) {
			return sigmas[v0] = weight[v0];
		} else if (child >= 0) {
			return sigmas[v0] = sigma(child) + weight[v0];
		} else {
			int delta = 0;
			vector<int> vec;
			visited[v0] = true;
			vec.push_back(v0);
			queue<int> Q;
			Q.push(v0);
			bool prune = ancestor[v0];

			if (prune) {
				delta += sigma(hub);
			}

			for (; !Q.empty();) {
				const int v = Q.front();
				Q.pop();
				if (removed[v]) {
					continue;
				}
				if (prune && descendant[v]) {
					continue;
				}
				delta += weight[v];
				for (int i = at_e[v]; i < at_e[v + 1]; i++) {
					const int u = es[i];
					if (removed[u]) {
						continue;
					}
					if (!visited[u]) {
						visited[u] = true;
						vec.push_back(u);
						Q.push(u);
					}
				}
			}
			for (int i = 0; i < vec.size(); i++) {
				visited[vec[i]] = false;
			}
			return sigmas[v0] = delta;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
leaq 0x98(%rdi), %r14
movslq %esi, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x4052
testq %rdx, (%rax)
je 0x2f0b
movq 0x38(%rbx), %rax
movl (%rax,%r12,4), %ebp
jmp 0x312e
movq %r14, %rdi
movq %r12, %rsi
callq 0x4052
orq %rdx, (%rax)
leaq 0xc0(%rbx), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x4052
testq %rdx, (%rax)
je 0x2f40
movq 0x38(%rbx), %rax
andl $0x0, (%rax,%r12,4)
xorl %ebp, %ebp
jmp 0x312e
movq %rbx, %rdi
movl %ebp, %esi
callq 0x408c
cmpl $-0x1, %eax
je 0x2f6d
testl %eax, %eax
js 0x2f82
movq %rbx, %rdi
movl %eax, %esi
callq 0x2eca
movl %eax, %ebp
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
addl (%rax,%r12,4), %ebp
jmp 0x2f79
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movl (%rax,%r12,4), %ebp
movl %ebp, (%rcx,%r12,4)
jmp 0x312e
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0x148(%rbx), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x4052
orq %rdx, (%rax)
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x4034
leaq 0x38(%rsp), %rdi
callq 0x4114
leaq 0x38(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x57a8
leaq 0x1a0(%rbx), %rdi
movslq 0xc(%rsp), %rsi
callq 0x4052
movq %rdx, %r13
andq (%rax), %r13
je 0x2ff8
movl 0x170(%rbx), %esi
movq %rbx, %rdi
callq 0x2eca
movl %eax, %ebp
jmp 0x2ffa
xorl %ebp, %ebp
leaq 0x178(%rbx), %rax
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rax
cmpq %rax, 0x68(%rsp)
je 0x30de
movslq (%rax), %r12
leaq 0x38(%rsp), %rdi
callq 0x59dc
movq %r15, %rdi
movq %r12, %rsi
callq 0x4052
testq %rdx, (%rax)
jne 0x3006
testq %r13, %r13
je 0x304a
movq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x4052
testq %rdx, (%rax)
jne 0x3006
movq %r13, 0x28(%rsp)
movq 0x8(%rbx), %rcx
movq 0x118(%rbx), %rax
addl (%rcx,%r12,4), %ebp
movslq (%rax,%r12,4), %r13
movslq 0x4(%rax,%r12,4), %rax
cmpq %rax, %r13
jge 0x30d4
movq 0xe8(%rbx), %rax
movslq (%rax,%r13,4), %rsi
movl %esi, 0x8(%rsp)
movq %r15, %rdi
callq 0x4052
testq %rdx, (%rax)
jne 0x30c8
movslq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x4052
testq %rdx, (%rax)
jne 0x30c8
movslq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x4052
orq %rdx, (%rax)
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x4034
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x57a8
incq %r13
movq 0x118(%rbx), %rax
jmp 0x3062
movq 0x28(%rsp), %r13
jmp 0x3006
xorl %r15d, %r15d
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
jbe 0x310e
movslq (%rax,%r15,4), %rsi
movq %r14, %rdi
callq 0x4052
notq %rdx
andq %rdx, (%rax)
incq %r15
jmp 0x30e1
movslq 0xc(%rsp), %rax
movq 0x38(%rbx), %rcx
movl %ebp, (%rcx,%rax,4)
leaq 0x38(%rsp), %rdi
callq 0x42c6
leaq 0x10(%rsp), %rdi
callq 0x284a
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x315d
jmp 0x315d
jmp 0x315d
jmp 0x314c
jmp 0x314c
movq %rax, %rbx
jmp 0x316a
jmp 0x315d
jmp 0x315d
jmp 0x315d
jmp 0x315d
jmp 0x315d
jmp 0x315d
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x42c6
leaq 0x10(%rsp), %rdi
callq 0x284a
movq %rbx, %rdi
callq 0x21d0