// File: /workspace/github_cpp_makefile_star2_O3/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
movq %rdi, %rbx
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
movl %esi, (%rsp)
movslq %esi, %r14
leal 0x3f(%r14), %eax
testl %r14d, %r14d
cmovnsl %r14d, %eax
sarl $0x6, %eax
movslq %eax, %rsi
leaq (,%rsi,8), %rax
movq 0x98(%rdi), %rdi
addq %rax, %rdi
leaq 0x3f(%r12), %rcx
andq %r14, %rcx
xorl %r8d, %r8d
cmpq %r12, %rcx
setbe %r8b
movl $0x1, %edx
movl %r14d, %ecx
shlq %cl, %rdx
movq -0x8(%rdi,%r8,8), %r9
btq %r14, %r9
jae 0x33be
movq 0x38(%rbx), %rax
movl (%rax,%r14,4), %ebp
jmp 0x34c1
leaq -0x8(,%r8,8), %rcx
orq %rdx, %r9
movq %r9, (%rdi,%rcx)
movq 0xc0(%rbx), %rdi
leaq (%rdi,%rsi,8), %rsi
testq %rdx, (%rcx,%rsi)
je 0x33f1
movq 0x38(%rbx), %rax
movl $0x0, (%rax,%r14,4)
xorl %ebp, %ebp
jmp 0x34c1
movq 0x118(%rbx), %rsi
movslq (%rsi,%r14,4), %r8
movslq 0x4(%rsi,%r14,4), %r9
cmpl %r9d, %r8d
jge 0x34b1
movq %rcx, 0x80(%rsp)
movq %rax, 0x8(%rsp)
movq 0xe8(%rbx), %r11
xorl %r10d, %r10d
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x3f(%r12), %rax
movslq (%r11,%r8,4), %r13
leal 0x3f(%r13), %ebp
testq %r13, %r13
cmovnsl %r13d, %ebp
sarl $0x6, %ebp
movslq %ebp, %rbp
leaq (%rdi,%rbp,8), %rbp
movq %r12, %r15
movq %r13, %r12
andq %rax, %r12
xorl %ecx, %ecx
cmpq %r15, %r12
movq %r15, %r12
setbe %cl
movq -0x8(%rbp,%rcx,8), %rcx
btq %r13, %rcx
sbbl $-0x1, %r10d
btq %r13, %rcx
cmovael %r13d, %esi
incq %r8
cmpq %r8, %r9
jne 0x342b
testl %r10d, %r10d
movq %rax, %r15
movq 0x8(%rsp), %rax
movq 0x80(%rsp), %rcx
je 0x34b1
cmpl $0x1, %r10d
jne 0x34d5
cmpl $-0x1, %esi
je 0x34b1
testl %esi, %esi
js 0x34d5
movq %rbx, %rdi
callq 0x3342
movl %eax, %ebp
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
addl (%rax,%r14,4), %ebp
jmp 0x34bd
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movl (%rax,%r14,4), %ebp
movl %ebp, (%rcx,%r14,4)
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
addq 0x148(%rbx), %rax
orq %rdx, (%rcx,%rax)
movq %rsp, %rdx
xorl %esi, %esi
callq 0x6498
leaq 0x30(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x6574
movq 0x60(%rsp), %rax
movq 0x70(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x3542
movl (%rsp), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, 0x60(%rsp)
jmp 0x3552
leaq 0x30(%rsp), %rdi
movq %rsp, %rsi
callq 0x66ea
movl (%rsp), %ecx
movslq %ecx, %rcx
leal 0x3f(%rcx), %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
sarl $0x6, %eax
cltq
shlq $0x3, %rax
addq 0x1a0(%rbx), %rax
movq %rcx, %rdx
andq %r15, %rdx
xorl %esi, %esi
cmpq %r12, %rdx
setbe %sil
movl $0x1, %edx
shlq %cl, %rdx
andq -0x8(%rax,%rsi,8), %rdx
movq %rdx, 0x8(%rsp)
je 0x35a2
movl 0x170(%rbx), %esi
movq %rbx, %rdi
callq 0x3342
movl %eax, %ebp
jmp 0x35a4
xorl %ebp, %ebp
movq 0x40(%rsp), %rax
cmpq %rax, 0x60(%rsp)
je 0x376d
movslq (%rax), %r13
movq 0x50(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x35cb
addq $0x4, %rax
jmp 0x35fd
movq 0x48(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x2170
movq 0x58(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x58(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x48(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x50(%rsp)
movq %rax, 0x40(%rsp)
leal 0x3f(%r13), %ecx
testl %r13d, %r13d
cmovnsl %r13d, %ecx
sarl $0x6, %ecx
movslq %ecx, %rdx
shlq $0x3, %rdx
movq 0xc0(%rbx), %r8
addq %rdx, %r8
movq %r13, %rcx
andq %r15, %rcx
xorl %esi, %esi
cmpq %r12, %rcx
setbe %sil
movl $0x1, %edi
movl %r13d, %ecx
shlq %cl, %rdi
movq -0x8(%r8,%rsi,8), %rcx
btq %r13, %rcx
jb 0x35a9
cmpq $0x0, 0x8(%rsp)
je 0x366b
leaq -0x8(,%rsi,8), %rcx
addq 0x178(%rbx), %rdx
testq %rdi, (%rcx,%rdx)
jne 0x35a9
movq 0x8(%rbx), %rcx
addl (%rcx,%r13,4), %ebp
movq 0x118(%rbx), %rcx
movslq (%rcx,%r13,4), %r14
cmpl 0x4(%rcx,%r13,4), %r14d
jge 0x35a9
movq 0xe8(%rbx), %rax
movslq (%rax,%r14,4), %rcx
leal 0x3f(%rcx), %eax
testq %rcx, %rcx
movl %ecx, 0x4(%rsp)
cmovnsl %ecx, %eax
sarl $0x6, %eax
cltq
shlq $0x3, %rax
movq 0xc0(%rbx), %rdi
addq %rax, %rdi
movq %rcx, %rdx
andq %r15, %rdx
xorl %esi, %esi
cmpq %r12, %rdx
setbe %sil
movl $0x1, %edx
shlq %cl, %rdx
movq -0x8(%rdi,%rsi,8), %rdi
btq %rcx, %rdi
jb 0x3750
leaq -0x8(,%rsi,8), %rsi
addq 0x148(%rbx), %rax
movq (%rsi,%rax), %rdi
testq %rdx, %rdi
jne 0x3750
orq %rdx, %rdi
movq %rdi, (%rax,%rsi)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x370e
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x371d
leaq 0x10(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x6498
movq 0x60(%rsp), %rax
movq 0x70(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x3741
movl 0x4(%rsp), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, 0x60(%rsp)
jmp 0x3750
leaq 0x30(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x66ea
incq %r14
movq 0x118(%rbx), %rax
movslq 0x4(%rax,%r13,4), %rax
cmpq %rax, %r14
jl 0x3689
jmp 0x35a4
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rdx
subq %rax, %rdx
je 0x37d2
sarq $0x2, %rdx
movq 0x148(%rbx), %rsi
cmpq $0x1, %rdx
adcq $0x0, %rdx
xorl %edi, %edi
movslq (%rax,%rdi,4), %rcx
leal 0x3f(%rcx), %r8d
testq %rcx, %rcx
cmovnsl %ecx, %r8d
sarl $0x6, %r8d
movslq %r8d, %r8
movq %rcx, %r9
andq %r15, %r9
xorl %r10d, %r10d
cmpq %r12, %r9
setbe %r10b
movq $-0x2, %r9
rolq %cl, %r9
leaq (%rsi,%r8,8), %rcx
andq %r9, -0x8(%rcx,%r10,8)
incq %rdi
cmpq %rdi, %rdx
jne 0x3791
movslq (%rsp), %rax
movq 0x38(%rbx), %rcx
movl %ebp, (%rcx,%rax,4)
leaq 0x30(%rsp), %rdi
callq 0x50ee
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x34c1
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x34c1
jmp 0x3812
jmp 0x3812
jmp 0x380d
movq %rax, %rbx
jmp 0x381f
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x50ee
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3836
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2200