// File: 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
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
callq 0x4250
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x76d40
callq 0x4250
movq %rax, %rcx
subq -0x20(%rbp), %rcx
leaq 0x74318(%rip), %rax     # 0xcf428
addq (%rax), %rcx
leaq 0x7430e(%rip), %rax     # 0xcf428
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x5e610
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movslq -0x2c(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0x28(%rbp), %rdi
callq 0x5e630
movq %rax, %rcx
movq -0x250(%rbp), %rax
cmpq %rcx, %rax
jae 0x5b56d
movq -0x28(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0x5e650
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x268(%rbp)
movq -0x38(%rbp), %rdi
callq 0x5e670
movq -0x268(%rbp), %rdi
movq %rax, %rsi
callq 0x4b350
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x4b7d0
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x4160
movq -0x260(%rbp), %rsi
movq -0x8(%rbp), %rdi
callq 0x5e4b0
movq %rax, -0x258(%rbp)
jmp 0x5b1c5
movq -0x258(%rbp), %rax
cmpq $0x0, %rax
jbe 0x5b54b
movl $0x0, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x270(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4160
jmp 0x5b1fa
movq -0x270(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x89570
movq %rdx, -0x280(%rbp)
movq %rax, -0x278(%rbp)
jmp 0x5b21d
movq -0x280(%rbp), %rax
movq -0x278(%rbp), %rcx
movq %rcx, -0x80(%rbp)
movq %rax, -0x78(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4728
movq -0x80(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x80(%rbp), %rsi
addq $0x8, %rsi
leaq -0xa8(%rbp), %rdi
callq 0x5e510
testb $0x1, %al
jne 0x5b267
jmp 0x5b549
leaq -0xa8(%rbp), %rdi
callq 0x5e540
movq %rax, %rsi
addq $0x20, %rsi
leaq -0xc8(%rbp), %rdi
callq 0x4160
jmp 0x5b288
movq -0x38(%rbp), %rdi
callq 0x5e680
movq %rax, -0x288(%rbp)
jmp 0x5b29a
movq -0x288(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x5e6a0
movq %rax, -0x290(%rbp)
jmp 0x5b2b6
movq -0x290(%rbp), %rax
cmpq $0x0, %rax
jbe 0x5b515
leaq -0xa8(%rbp), %rdi
callq 0x5e540
movsd 0x60(%rax), %xmm0
callq 0x4300
movsd %xmm0, -0xd0(%rbp)
movq -0x10(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x4b7a0
movq %rax, -0x298(%rbp)
jmp 0x5b2fe
movq -0x298(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4b7f0
movq %rax, -0xe0(%rbp)
leaq -0xd8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x4b770
testb $0x1, %al
jne 0x5b338
jmp 0x5b4de
leaq -0x1f8(%rbp), %rdi
callq 0x4b470
jmp 0x5b346
leaq -0x218(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x4160
jmp 0x5b35b
movq -0x40(%rbp), %rdi
callq 0x4b730
movl %eax, -0x29c(%rbp)
jmp 0x5b36c
movq -0x40(%rbp), %rdi
callq 0x4b750
movl %eax, -0x2a0(%rbp)
jmp 0x5b37d
leaq -0x239(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0x4660
movq -0x2a8(%rbp), %rdx
leaq 0x35ab8(%rip), %rsi     # 0x90e56
leaq -0x238(%rbp), %rdi
callq 0x1c730
jmp 0x5b3ac
movl -0x2a0(%rbp), %ecx
movl -0x29c(%rbp), %edx
leaq -0x1f8(%rbp), %rdi
leaq -0x218(%rbp), %rsi
leaq -0x238(%rbp), %r8
callq 0x5e570
jmp 0x5b3d4
leaq -0x238(%rbp), %rdi
callq 0x4728
leaq -0x239(%rbp), %rdi
callq 0x43f0
leaq -0x218(%rbp), %rdi
callq 0x4728
movq -0x10(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x4b350
movq %rax, -0x2b0(%rbp)
jmp 0x5b411
movq -0x2b0(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x4b820
jmp 0x5b426
leaq -0x1f8(%rbp), %rdi
callq 0x46ba0
jmp 0x5b4de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x5b562
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4728
jmp 0x5b562
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x5b53b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x5b4d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x5b4c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x5b4b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x4728
leaq -0x239(%rbp), %rdi
callq 0x43f0
leaq -0x218(%rbp), %rdi
callq 0x4728
leaq -0x1f8(%rbp), %rdi
callq 0x46ba0
jmp 0x5b53b
movq -0x10(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x4b350
movq %rax, -0x2b8(%rbp)
jmp 0x5b4f7
movq -0x2b8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movsd -0xd0(%rbp), %xmm0
callq 0x68010
jmp 0x5b511
movb $0x1, -0x11(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x4728
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
callq 0x5e5d0
movq %rax, -0x248(%rbp)
jmp 0x5b24a
leaq -0xc8(%rbp), %rdi
callq 0x4728
jmp 0x5b562
jmp 0x5b54b
leaq -0x60(%rbp), %rdi
callq 0x4728
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x5b131
leaq -0x60(%rbp), %rdi
callq 0x4728
jmp 0x5b57b
movb -0x11(%rbp), %al
andb $0x1, %al
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x4650
nopw %cs:(%rax,%rax)