// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
movq %rdi, %r15
callq 0x31c0
movq %rax, %r14
movq %rbx, %rdi
movq %r15, %rsi
callq 0x35bd0
callq 0x31c0
subq %r14, %rax
leaq 0x2ec59(%rip), %rcx     # 0x56358
addq %rax, (%rcx)
movq 0x30(%rbx), %rax
cmpq %rax, 0x38(%rbx)
je 0x27b9d
movq %rbx, %rdi
leaq 0x8(%r15), %rcx
movq %rcx, 0xc8(%rsp)
leaq 0x8(%rbx), %rcx
movq %rcx, 0xd8(%rsp)
leaq 0xf8(%rsp), %rbx
leaq 0x148(%rsp), %r13
xorl %ebp, %ebp
xorl %r12d, %r12d
movq %r15, 0xc0(%rsp)
movq %rdi, 0x8(%rsp)
movq %rbp, 0xd0(%rsp)
shlq $0x7, %rbp
addq %rax, %rbp
movq %rbp, %rsi
callq 0x20440
movq %rax, %rcx
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x8(%rcx), %rsi
movq %rcx, 0x30(%rsp)
movq 0x10(%rcx), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0x6a88
movq %r15, %rdi
movq %r14, %rsi
callq 0x2c5be
cmpq 0xc8(%rsp), %rax
leaq 0xa0(%rsp), %r14
je 0x27b4f
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x6a88
movq %r15, %rdi
movq %r14, %rsi
callq 0x3dd56
movq %rdx, 0x38(%rsp)
movq %rax, %r15
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x2780c
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32e0
cmpq 0x38(%rsp), %r15
je 0x27b4f
leaq 0x20(%rbp), %rax
movq %rax, 0xe0(%rsp)
addq $0x28, %rbp
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x6a88
movq 0xe0(%rsp), %rdi
movq %r14, %rsi
callq 0x2c648
cmpq %rbp, %rax
je 0x27b1d
movsd 0x80(%r15), %xmm0
callq 0x3260
movsd %xmm0, 0xe8(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x223b8
cmpq 0xd8(%rsp), %rax
jne 0x27af5
leaq 0xf0(%rsp), %rdi
callq 0x204bc
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x6a88
movq %r13, %r14
movq %rbx, %r13
movq 0x30(%rsp), %rax
movl 0x48(%rax), %r12d
movl 0x4c(%rax), %ebx
leaq 0x70(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x1a5a1(%rip), %rdx     # 0x41e96
movq %rdx, %rsi
callq 0xb8a2
movq %r13, %rdi
leaq 0x80(%rsp), %rsi
callq 0x3150
movl %r12d, 0x138(%rsp)
movl %ebx, 0x13c(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x3150
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x2794a
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
movq %r13, %rbx
je 0x27972
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x20440
movq %rax, %r12
movq %r14, %r13
movb 0xf0(%rsp), %al
movb %al, (%r12)
leaq 0x8(%r12), %rdi
movq %rbx, %rsi
callq 0x3150
leaq 0x28(%r12), %rdi
leaq 0x118(%rsp), %rsi
callq 0x3150
movb 0x48(%rbx), %al
movb %al, 0x50(%r12)
movq 0x40(%rbx), %rax
movq %rax, 0x48(%r12)
leaq 0x58(%r12), %rdi
movq %r13, %rsi
callq 0x20b88
leaq 0x70(%r12), %rdi
leaq 0x160(%rsp), %rsi
callq 0x20b88
leaq 0x88(%r12), %rdi
leaq 0x178(%rsp), %rsi
callq 0x21a40
movups 0xb0(%rbx), %xmm0
movups %xmm0, 0xb8(%r12)
leaq 0xc8(%r12), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x20ef0
movups 0xd8(%rbx), %xmm0
movups %xmm0, 0xe0(%r12)
movq %r12, %rdi
addq $0xf0, %rdi
leaq 0x1e0(%rsp), %rsi
callq 0x218ca
movl 0x108(%rbx), %eax
movl %eax, 0x110(%r12)
movq 0x100(%rbx), %rax
movq %rax, 0x108(%r12)
leaq 0x1e0(%rsp), %rdi
callq 0x1d4e6
movq 0x1b8(%rsp), %rdi
testq %rdi, %rdi
je 0x27a89
movq 0x1c8(%rsp), %rsi
subq %rdi, %rsi
callq 0x32e0
leaq 0x178(%rsp), %rdi
callq 0x1d582
leaq 0x160(%rsp), %rdi
callq 0x1d534
movq %r13, %rdi
callq 0x1d534
movq 0x118(%rsp), %rdi
leaq 0x128(%rsp), %rax
cmpq %rax, %rdi
je 0x27ad0
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0xf8(%rsp), %rdi
leaq 0x108(%rsp), %rax
cmpq %rax, %rdi
je 0x27af5
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x20440
movb $0x1, %r12b
movq %rax, %rdi
movq 0x30(%rsp), %rsi
movsd 0xe8(%rsp), %xmm0
callq 0x2daa6
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x27b39
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32e0
movq %r15, %rdi
callq 0x31f0
movq %rax, %r15
cmpq 0x38(%rsp), %rax
jne 0x27827
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x27b6b
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0xd0(%rsp), %rbp
incq %rbp
movq 0x8(%rsp), %rdi
movq 0x30(%rdi), %rax
movq 0x38(%rdi), %rcx
subq %rax, %rcx
sarq $0x7, %rcx
cmpq %rbp, %rcx
movq 0xc0(%rsp), %r15
ja 0x2774d
jmp 0x27ba0
xorl %r12d, %r12d
andb $0x1, %r12b
movl %r12d, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x27c35
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x27c6d
movq 0xb0(%rsp), %rsi
jmp 0x27c65
jmp 0x27c35
movq %rax, %rbx
jmp 0x27c0c
jmp 0x27c3c
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x27c0c
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x27c44
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32e0
jmp 0x27c44
jmp 0x27c3c
movq %rax, %rbx
jmp 0x27c6d
jmp 0x27c3c
movq %rax, %rbx
jmp 0x27c51
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x208b0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x27c6d
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x27c89
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32e0
movq %rbx, %rdi
callq 0x3530