// File: /workspace/github_cpp_makefile_star2_O2/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 $0x248, %rsp            # imm = 0x248
movq %rsi, %rbx
movq %rdi, %r15
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %r14
movaps %xmm0, (%r14)
andq $0x0, 0x10(%r14)
leaq 0x68(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %r14, %rdi
callq 0x515e
leaq 0x60(%rsp), %rdi
callq 0x1101c
movq %rbx, 0x10(%rsp)
movq %rbx, %rdi
movq %r15, 0x38(%rsp)
movq %r15, %rsi
movq %r14, %rdx
callq 0x29d4a
xorl %r15d, %r15d
leaq 0x60(%rsp), %r14
xorl %r12d, %r12d
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rax
movq %rax, %rcx
subq %rsi, %rcx
sarq $0x5, %rcx
cmpq %r12, %rcx
jbe 0x1f684
addq %r15, %rsi
movq %r14, %rdi
callq 0xa262
movl $0x1, (%rax)
incq %r12
addq $0x20, %r15
jmp 0x1f651
movq 0x10(%rsp), %rcx
addq $0x8, %rcx
movq %rcx, 0x48(%rsp)
xorl %ecx, %ecx
leaq 0xd0(%rsp), %r14
leaq 0xb0(%rsp), %r15
leaq 0x110(%rsp), %r13
xorl %r12d, %r12d
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rcx, %rax
jbe 0x1f884
movq %rcx, 0x40(%rsp)
movq %rcx, %rax
shlq $0x5, %rax
addq %rax, %rsi
movq %r14, %rdi
callq 0x33c0
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x19b24
movq %rax, 0x18(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x33c0
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x2f88a
movq %rdx, 0x50(%rsp)
movq %rax, %rbp
movq %r15, %rdi
callq 0x3578
cmpq 0x50(%rsp), %rbp
je 0x1f855
leaq 0x40(%rbp), %rsi
movq %r13, %rdi
callq 0x33c0
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x1b8b0
cmpq 0x48(%rsp), %rax
leaq 0x90(%rsp), %r15
jne 0x1f807
leaq 0x60(%rsp), %rdi
movq %r13, %rsi
callq 0x22d1e
leaq 0x68(%rsp), %rcx
cmpq %rcx, %rax
jne 0x1f76b
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x129cc
leaq 0x130(%rsp), %rdi
callq 0x19b8a
movq %r15, %rdi
movq %r13, %rsi
callq 0x33c0
movq 0x18(%rsp), %rax
movl 0x48(%rax), %r12d
movl 0x4c(%rax), %r15d
leaq 0xf0(%rsp), %r14
movq %r14, %rdi
leaq 0x13714(%rip), %rsi     # 0x32eb6
leaq 0xf(%rsp), %rdx
callq 0x9f86
leaq 0x130(%rsp), %rdi
leaq 0x90(%rsp), %rbx
movq %rbx, %rsi
movl %r12d, %edx
movl %r15d, %ecx
movq %r14, %r8
callq 0x21310
movq %r14, %rdi
callq 0x3578
movq %rbx, %rdi
callq 0x3578
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x19b24
movq %rax, %rdi
leaq 0x130(%rsp), %rsi
callq 0x19d82
leaq 0x130(%rsp), %rdi
callq 0x17b24
movsd 0x80(%rbp), %xmm0
callq 0x3280
movsd %xmm0, 0x58(%rsp)
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x19b24
movq %rax, %rdi
movq 0x18(%rsp), %rsi
movsd 0x58(%rsp), %xmm0
callq 0x23c76
movq %r13, %rdi
callq 0x3578
movq %rbp, %rdi
callq 0x3210
movq %rax, %rbp
movb $0x1, %r12b
jmp 0x1f710
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
callq 0x3578
movq 0x40(%rsp), %rcx
incq %rcx
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rax
leaq 0xb0(%rsp), %r15
jmp 0x1f6af
leaq 0x60(%rsp), %rdi
callq 0xd1fa
leaq 0x20(%rsp), %rdi
callq 0x5166
andb $0x1, %r12b
movl %r12d, %eax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1f8c6
jmp 0x1f8f5
jmp 0x1f8c6
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
jmp 0x1f919
jmp 0x1f8f5
movq %rax, %rbx
jmp 0x1f92b
jmp 0x1f90e
movq %rax, %rbx
jmp 0x1f8e6
jmp 0x1f90e
jmp 0x1f90e
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x3578
leaq 0x90(%rsp), %rdi
callq 0x3578
jmp 0x1f8ff
movq %rax, %rbx
jmp 0x1f91e
jmp 0x1f90e
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x17b24
jmp 0x1f911
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x3578
leaq 0xd0(%rsp), %rdi
callq 0x3578
leaq 0x60(%rsp), %rdi
callq 0xd1fa
leaq 0x20(%rsp), %rdi
callq 0x5166
movq %rbx, %rdi
callq 0x34f0