// File: /workspace/github_cpp_makefile_star2_O2/neubig[P]egret/Egret/src/Forest.cpp
// Function: genUnaryNode_viterbi_old(ListRuleSet&, Node&)
bool genUnaryNode_viterbi_old(RuleSet& ruleSet,Node& node)
{
	bool mark=false;
	clock_t sec=clock();
	node.setUnaryInOrder(ruleSet);
	setutime+=clock()-sec;
	vector<LabelAndFamily>& uio=node.unaryInOrder();
	for(int i=0;(size_t)i<uio.size();i++)
	{
		LabelAndFamily& laf=uio[i];
		Label& oldLb=node[laf.term()];
		string rightPart=oldLb.nt();
		if(ruleSet.count(rightPart)>0)
		{
			int count=0;
			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(laf.ancestor().count(leftPart)>0)
				{
					double ruleScore=log(iter->second.prob);
					if(node.find(leftPart)==node.end())
					{
						Label newLabel;
						newLabel.init(leftPart,oldLb.start(),oldLb.stop());
						node[leftPart]=newLabel;
					}
					//cout<<"\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 $0x208, %rsp            # imm = 0x208
movq %rsi, %r14
movq %rdi, %r15
callq 0x31f0
movq %rax, %rbx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2980e
callq 0x31f0
subq %rbx, %rax
leaq 0x2d008(%rip), %rcx     # 0x4c350
addq %rax, (%rcx)
movq %r14, 0x10(%rsp)
leaq 0x8(%r14), %rax
movq %rax, 0x38(%rsp)
xorl %ecx, %ecx
leaq 0x90(%rsp), %rbp
leaq 0xd0(%rsp), %r13
xorl %ebx, %ebx
movq %r15, 0x28(%rsp)
movq 0x10(%rsp), %rdi
movq 0x30(%rdi), %rsi
movq 0x38(%rdi), %rax
subq %rsi, %rax
sarq $0x7, %rax
cmpq %rcx, %rax
jbe 0x1f552
movq %rcx, 0x30(%rsp)
movq %rcx, %rax
shlq $0x7, %rax
addq %rax, %rsi
movq %rsi, 0x20(%rsp)
callq 0x19b24
movq %rax, 0x18(%rsp)
leaq 0x8(%rax), %rsi
leaq 0x50(%rsp), %r12
movq %r12, %rdi
callq 0x33c0
movq %r15, %rdi
movq %r12, %rsi
callq 0x212f6
testq %rax, %rax
je 0x1f53b
movq %rbp, %rdi
leaq 0x50(%rsp), %rsi
callq 0x33c0
leaq 0x70(%rsp), %r12
movq %r15, %rdi
movq %rbp, %rsi
callq 0x2f88a
movq %rdx, 0x40(%rsp)
movq %rbp, %rdi
movq %rax, %rbp
callq 0x3578
addq $0x20, 0x20(%rsp)
cmpq 0x40(%rsp), %rbp
je 0x1f52e
leaq 0x40(%rbp), %rsi
movq %r13, %rdi
callq 0x33c0
movq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x2134c
testq %rax, %rax
je 0x1f516
movsd 0x80(%rbp), %xmm0
callq 0x3280
movsd %xmm0, 0x48(%rsp)
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x1b8b0
cmpq 0x38(%rsp), %rax
jne 0x1f4f4
leaq 0xf0(%rsp), %rdi
callq 0x19b8a
movq %r12, %rdi
movq %r13, %rsi
callq 0x33c0
movq 0x18(%rsp), %rax
movl 0x48(%rax), %ebx
movl 0x4c(%rax), %r15d
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
leaq 0x13a23(%rip), %rsi     # 0x32eb6
leaq 0xf(%rsp), %rdx
callq 0x9f86
leaq 0xf0(%rsp), %rdi
leaq 0x70(%rsp), %r12
movq %r12, %rsi
movl %ebx, %edx
movl %r15d, %ecx
movq %r14, %r8
callq 0x21310
movq %r14, %rdi
callq 0x3578
movq %r12, %rdi
callq 0x3578
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x19b24
movq %rax, %rdi
leaq 0xf0(%rsp), %rsi
callq 0x19d82
leaq 0xf0(%rsp), %rdi
callq 0x17b24
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x19b24
movb $0x1, %bl
movq %rax, %rdi
movq 0x18(%rsp), %rsi
movsd 0x48(%rsp), %xmm0
callq 0x23c76
movq %r13, %rdi
callq 0x3578
movq %rbp, %rdi
callq 0x3210
movq %rax, %rbp
jmp 0x1f405
movq 0x28(%rsp), %r15
leaq 0x90(%rsp), %rbp
leaq 0x50(%rsp), %rdi
callq 0x3578
movq 0x30(%rsp), %rcx
incq %rcx
jmp 0x1f372
andb $0x1, %bl
movl %ebx, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
jmp 0x1f5c3
jmp 0x1f5b1
jmp 0x1f5b1
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x3578
jmp 0x1f58f
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x3578
jmp 0x1f5a2
jmp 0x1f5b8
jmp 0x1f5b8
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x17b24
jmp 0x1f5bb
movq %rax, %rbx
jmp 0x1f5c8
jmp 0x1f5b8
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x3578
leaq 0x50(%rsp), %rdi
callq 0x3578
movq %rbx, %rdi
callq 0x34f0