// File: /workspace/github_cpp_makefile_star2_O1/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 $0xa8, %rsp
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
movslq %esi, %rcx
leaq 0x3f(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
movl %esi, 0x8(%rsp)
sarq $0x6, %rax
leaq (,%rax,8), %r11
movq 0x98(%rdi), %r9
addq %r11, %r9
leaq 0x3f(%rdx), %r10
andq %rcx, %r10
xorl %r8d, %r8d
cmpq %rdx, %r10
setbe %r8b
movl $0x1, %edx
shlq %cl, %rdx
movq -0x8(%r9,%r8,8), %r10
btq %rcx, %r10
jae 0x33ac
movq 0x38(%rdi), %rax
movl (%rax,%rcx,4), %ebp
jmp 0x33d9
leaq -0x8(,%r8,8), %r8
orq %rdx, %r10
movq %r10, (%r9,%r8)
movq 0xc0(%rdi), %r9
leaq (%r9,%rax,8), %rax
testq %rdx, (%r8,%rax)
je 0x33ed
movq 0x38(%rdi), %rax
movl $0x0, (%rax,%rcx,4)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, 0x98(%rsp)
movq %r8, 0xa0(%rsp)
movq %r11, 0x30(%rsp)
movq %rdi, 0x38(%rsp)
movq 0x118(%rdi), %rax
movslq (%rax,%rcx,4), %r11
movslq 0x4(%rax,%rcx,4), %r15
xorl %r10d, %r10d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl %r15d, %r11d
jge 0x348c
movq 0x38(%rsp), %rax
movq 0xe8(%rax), %r12
xorl %r10d, %r10d
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
leaq 0x3f(%rax), %r13
movabsq $-0x8000000000000000, %rbx # imm = 0x8000000000000000
movslq (%r12,%r11,4), %rax
leaq 0x3f(%rax), %r14
testq %rax, %rax
cmovnsq %rax, %r14
sarq $0x6, %r14
leaq (%r9,%r14,8), %r14
movq %rax, %r8
andq %r13, %r8
xorl %edx, %edx
cmpq %rbx, %r8
setbe %dl
movq -0x8(%r14,%rdx,8), %rdx
btq %rax, %rdx
sbbl $-0x1, %r10d
btq %rax, %rdx
cmovael %eax, %ebp
incq %r11
cmpq %r11, %r15
jne 0x344b
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
testl %r10d, %r10d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
je 0x34ad
movl %ebp, %eax
cmpl $0x1, %r10d
je 0x34ad
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpl $-0x1, %eax
movq 0x38(%rsp), %rbx
je 0x34df
testl %eax, %eax
js 0x34f2
movq %rbx, %rdi
movl %eax, %esi
callq 0x333c
movl %eax, %ebp
movslq 0x8(%rsp), %rax
movq 0x8(%rbx), %rcx
movq 0x38(%rbx), %rdx
addl (%rcx,%rax,4), %ebp
movl %ebp, (%rdx,%rax,4)
jmp 0x33d9
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rdx
movl (%rax,%rcx,4), %ebp
movl %ebp, (%rdx,%rcx,4)
jmp 0x33d9
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x30(%rsp), %rax
addq 0x148(%rbx), %rax
movq 0xa0(%rsp), %rcx
movq 0x98(%rsp), %rdx
orq %rdx, (%rcx,%rax)
movq 0x18(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0x353c
movl %esi, (%rax)
addq $0x4, %rax
movq %rax, 0x18(%rsp)
jmp 0x354e
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rax, %rsi
callq 0x6140
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x621c
movq 0x70(%rsp), %rax
movq 0x80(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x3597
movl 0x8(%rsp), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, 0x70(%rsp)
jmp 0x35a6
leaq 0x40(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x6392
movslq 0x8(%rsp), %rcx
leaq 0x3f(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
sarq $0x6, %rax
shlq $0x3, %rax
addq 0x1a0(%rbx), %rax
leaq 0x3f(%r14), %r12
movq %rcx, %rdx
andq %r12, %rdx
xorl %esi, %esi
cmpq %r14, %rdx
setbe %sil
movl $0x1, %edx
shlq %cl, %rdx
andq -0x8(%rax,%rsi,8), %rdx
movq %rdx, 0x30(%rsp)
je 0x3601
movl 0x170(%rbx), %esi
movq %rbx, %rdi
callq 0x333c
movl %eax, %ebp
jmp 0x37bd
xorl %ebp, %ebp
jmp 0x37bd
movslq (%rax), %r13
movq 0x60(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x361f
addq $0x4, %rax
jmp 0x3651
movq 0x58(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x2170
movq 0x68(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x68(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x58(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x60(%rsp)
leaq 0x3f(%r13), %rdx
testq %r13, %r13
cmovnsq %r13, %rdx
movq %rax, 0x50(%rsp)
sarq $0x6, %rdx
shlq $0x3, %rdx
movq 0xc0(%rbx), %rdi
addq %rdx, %rdi
movq %r13, %rcx
andq %r12, %rcx
xorl %eax, %eax
cmpq %r14, %rcx
setbe %al
movl $0x1, %esi
movl %r13d, %ecx
shlq %cl, %rsi
movq -0x8(%rdi,%rax,8), %rcx
btq %r13, %rcx
jb 0x37bd
cmpq $0x0, 0x30(%rsp)
je 0x36bc
leaq -0x8(,%rax,8), %rax
addq 0x178(%rbx), %rdx
testq %rsi, (%rax,%rdx)
jne 0x37bd
movq 0x8(%rbx), %rax
addl (%rax,%r13,4), %ebp
movq 0x118(%rbx), %rax
movslq (%rax,%r13,4), %r15
cmpl 0x4(%rax,%r13,4), %r15d
jge 0x37bd
movq 0xe8(%rbx), %rax
movslq (%rax,%r15,4), %rcx
leaq 0x3f(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
movl %ecx, 0xc(%rsp)
sarq $0x6, %rax
shlq $0x3, %rax
movq 0xc0(%rbx), %rdi
addq %rax, %rdi
movq %rcx, %rdx
andq %r12, %rdx
xorl %esi, %esi
cmpq %r14, %rdx
setbe %sil
movl $0x1, %edx
shlq %cl, %rdx
movq -0x8(%rdi,%rsi,8), %rdi
btq %rcx, %rdi
jb 0x37a5
leaq -0x8(,%rsi,8), %rsi
addq 0x148(%rbx), %rax
movq (%rsi,%rax), %rdi
testq %rdx, %rdi
jne 0x37a5
orq %rdx, %rdi
movq %rdi, (%rax,%rsi)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x3760
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x376f
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x6140
movq 0x70(%rsp), %rax
movq 0x80(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x3796
movl 0xc(%rsp), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, 0x70(%rsp)
jmp 0x37a5
leaq 0x40(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x6392
incq %r15
movq 0x118(%rbx), %rax
movslq 0x4(%rax,%r13,4), %rax
cmpq %rax, %r15
jl 0x36da
movq 0x50(%rsp), %rax
cmpq %rax, 0x70(%rsp)
jne 0x3608
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rdx
subq %rax, %rdx
je 0x382f
sarq $0x2, %rdx
movq 0x148(%rbx), %rsi
cmpq $0x1, %rdx
adcq $0x0, %rdx
xorl %edi, %edi
movslq (%rax,%rdi,4), %rcx
leaq 0x3f(%rcx), %r8
testq %rcx, %rcx
cmovnsq %rcx, %r8
sarq $0x6, %r8
movq %rcx, %r9
andq %r12, %r9
xorl %r10d, %r10d
cmpq %r14, %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 0x37f1
movslq 0x8(%rsp), %rax
movq 0x38(%rbx), %rcx
movl %ebp, (%rcx,%rax,4)
leaq 0x40(%rsp), %rdi
callq 0x5170
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x33d9
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x33d9
jmp 0x3870
jmp 0x386b
jmp 0x3870
movq %rax, %rbx
jmp 0x387d
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x5170
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3894
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2200