// File: /workspace/github_cpp_makefile_star2_O3/neubig[P]egret/Egret/src/Forest.cpp
// Function: genUnaryNode_viterbi(ListRuleSet&, Node&)
bool genUnaryNode_viterbi(RuleSet& ruleSet,Node& node)
{
	bool mark=false;
	vector<string> ntPool;
	map<string,int> ntMap;
	ntPool.clear();
	ntMap.clear();
	node.setUnaryInOrder(ruleSet,ntPool);

	for(int i=0;(size_t)i<ntPool.size();i++)
		ntMap[ntPool[i]]=1;

	for(int i=0;(size_t)i<ntPool.size();i++)
	{
		string rightPart=ntPool[i];
		//cout<<"here:"<<i<<","<<rightPart<<endl;
		Label& oldLb=node[rightPart];
		pair<RuleSet::RSIter,RuleSet::RSIter> iterPair=ruleSet.query(rightPart);
		for(RuleSet::RSIter iter=iterPair.first;iter!=iterPair.second;iter++)
		{
			string leftPart=iter->second.left;
			if(node.find(leftPart)==node.end())
			{
				if(ntMap.find(leftPart)==ntMap.end())
					ntPool.push_back(leftPart);
				Label newLabel;
				newLabel.init(leftPart,oldLb.start(),oldLb.stop());
				node[leftPart]=newLabel;
			}
			double ruleScore=log(iter->second.prob);
			//jout<<"\n"<<leftPart<<"--->add Child: "<<rightPart<<endl;
			node[leftPart].addChild_viterbi(&oldLb,ruleScore);
			mark=true;
		}
	}
	return mark;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %rbx
movq %rdi, %r15
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
xorl %eax, %eax
movq %rax, 0x10(%r14)
leaq 0xe8(%rsp), %rcx
movl $0x0, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0xe0(%rsp), %rdi
callq 0x1517c
movq %rbx, %rdi
movq %r15, 0xd0(%rsp)
movq %r15, %rsi
movq %r14, %rdx
callq 0x357e4
movq (%rsp), %rsi
movq 0x8(%rsp), %rax
cmpq %rsi, %rax
je 0x276bf
xorl %r15d, %r15d
leaq 0xe0(%rsp), %r14
xorl %r12d, %r12d
addq %r15, %rsi
movq %r14, %rdi
callq 0xb866
movl $0x1, (%rax)
incq %r12
movq (%rsp), %rsi
movq 0x8(%rsp), %rax
movq %rax, %rcx
subq %rsi, %rcx
sarq $0x5, %rcx
addq $0x20, %r15
cmpq %r12, %rcx
ja 0x2768f
cmpq %rsi, %rax
je 0x27b27
leaq 0x8(%rbx), %r15
xorl %ecx, %ecx
leaq 0x20(%rsp), %r14
leaq 0xa0(%rsp), %r12
leaq 0x40(%rsp), %r13
xorl %ebp, %ebp
movq %rcx, 0xd8(%rsp)
shlq $0x5, %rcx
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq (%rsi,%rcx), %rax
movq 0x8(%rsi,%rcx), %rdx
addq %rax, %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x6afc
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1fdec
movq %rax, 0x18(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x6afc
movq 0xd0(%rsp), %rdi
movq %r12, %rsi
callq 0x3d098
movq %rax, %r12
movq %rdx, %r14
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x2777f
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32e0
cmpq %r14, %r12
je 0x27ad8
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%r12), %rsi
movq 0x48(%r12), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x6afc
movq %rbx, %rdi
movq %r13, %rsi
callq 0x21d54
cmpq %r15, %rax
jne 0x27a6c
leaq 0xe0(%rsp), %rdi
movq %r13, %rsi
callq 0x2bf04
leaq 0xe8(%rsp), %rcx
cmpq %rcx, %rax
jne 0x277e3
movq %rsp, %rdi
movq %r13, %rsi
callq 0x17546
leaq 0x110(%rsp), %rdi
callq 0x1fe68
movq %r14, %rbp
movq %r15, %r14
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x6afc
movq 0x18(%rsp), %rax
movsd 0x48(%rax), %xmm0
movaps %xmm0, 0xc0(%rsp)
leaq 0x70(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x1966e(%rip), %rdx     # 0x40eb6
movq %rdx, %rsi
callq 0xb7d0
leaq 0x118(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x3150
movaps 0xc0(%rsp), %xmm0
movlps %xmm0, 0x158(%rsp)
leaq 0x138(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x3150
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x278a3
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x278c8
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32e0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1fdec
movq %rax, %r15
movb 0x110(%rsp), %al
movb %al, (%r15)
leaq 0x8(%r15), %rdi
leaq 0x118(%rsp), %rsi
callq 0x3150
leaq 0x28(%r15), %rdi
leaq 0x138(%rsp), %rsi
callq 0x3150
leaq 0x118(%rsp), %rcx
movb 0x48(%rcx), %al
movb %al, 0x50(%r15)
movq 0x40(%rcx), %rax
movq %rax, 0x48(%r15)
leaq 0x58(%r15), %rdi
leaq 0x168(%rsp), %rsi
callq 0x20524
leaq 0x70(%r15), %rdi
leaq 0x180(%rsp), %rsi
callq 0x20524
leaq 0x88(%r15), %rdi
leaq 0x198(%rsp), %rsi
callq 0x213d0
leaq 0x118(%rsp), %rax
movups 0xb0(%rax), %xmm0
movups %xmm0, 0xb8(%r15)
leaq 0xc8(%r15), %rdi
leaq 0x1d8(%rsp), %rsi
callq 0x208ac
leaq 0x118(%rsp), %rax
movups 0xd8(%rax), %xmm0
movups %xmm0, 0xe0(%r15)
movq %r15, %rdi
addq $0xf0, %rdi
leaq 0x200(%rsp), %rsi
callq 0x2123a
leaq 0x118(%rsp), %rcx
movl 0x108(%rcx), %eax
movl %eax, 0x110(%r15)
movq 0x100(%rcx), %rax
movq %rax, 0x108(%r15)
leaq 0x200(%rsp), %rdi
callq 0x1cee0
movq 0x1d8(%rsp), %rdi
testq %rdi, %rdi
je 0x279f5
movq 0x1e8(%rsp), %rsi
subq %rdi, %rsi
callq 0x32e0
leaq 0x198(%rsp), %rdi
callq 0x1cf88
leaq 0x180(%rsp), %rdi
callq 0x1cf34
leaq 0x168(%rsp), %rdi
callq 0x1cf34
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
movq %r14, %r15
je 0x27a44
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x118(%rsp), %rdi
leaq 0x128(%rsp), %rax
cmpq %rax, %rdi
movq %rbp, %r14
je 0x27a6c
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x32e0
movsd 0x80(%r12), %xmm0
callq 0x3260
movsd %xmm0, 0xc0(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1fdec
movq %rax, %rdi
movq 0x18(%rsp), %rsi
movsd 0xc0(%rsp), %xmm0
callq 0x2d28e
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x27ac1
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32e0
movq %r12, %rdi
callq 0x31f0
movq %rax, %r12
cmpq %r14, %rax
jne 0x27788
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x27af4
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0xd8(%rsp), %rcx
incq %rcx
movq (%rsp), %rsi
movq 0x8(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rcx, %rax
leaq 0x20(%rsp), %r14
leaq 0xa0(%rsp), %r12
ja 0x276e2
jmp 0x27b29
xorl %ebp, %ebp
leaq 0xe0(%rsp), %rdi
callq 0x10d92
movq %rsp, %rdi
callq 0x6186
andb $0x1, %bpl
movl %ebp, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x27b87
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x27c18
movq 0xb0(%rsp), %rsi
jmp 0x27c10
jmp 0x27b87
jmp 0x27be0
jmp 0x27be0
movq %rax, %rbx
jmp 0x27c34
jmp 0x27be7
movq %rax, %rbx
jmp 0x27bb9
jmp 0x27be7
jmp 0x27be7
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x27bb9
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x27bef
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32e0
jmp 0x27bef
movq %rax, %rbx
jmp 0x27c18
jmp 0x27be7
movq %rax, %rbx
jmp 0x27bfc
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x2025c
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x27c18
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x27c34
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32e0
leaq 0xe0(%rsp), %rdi
callq 0x10d92
movq %rsp, %rdi
callq 0x6186
movq %rbx, %rdi
callq 0x3530