// File: neubig[P]egret/Egret/src/Forest.cpp
// Function: genUnaryNode_viterbi_coarse_old(ListRuleSet&, Node&)
bool genUnaryNode_viterbi_coarse_old(RuleSet& ruleSet,Node& node)
{
	bool mark=false;
	vector<string> ntPool;
	map<string,int> ntSet;
	ntPool.clear();
	ntSet.clear();
	for(Node::iterator iter=node.begin();iter!=node.end();iter++)
	{
		ntPool.push_back(iter->first);
		ntSet[iter->first]=0;
	}
	
	for(int i=0;(size_t)i<ntPool.size();i++)
	{
		string rightPart=ntPool[i];
		Label& oldLb=node[rightPart];
		//if(ruleSet.count(rightPart)==0)continue;
		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(ntSet.find(leftPart)==ntSet.end())
			{
				ntPool.push_back(leftPart);
				ntSet[leftPart]=0;
			}
			else if(ntSet[leftPart]!=0)continue;
			
			double ruleScore=log(iter->second.prob);
			if(node.find(leftPart)==node.end())
			{
				Label newLabel;
				newLabel.init(leftPart,oldLb.start(),oldLb.stop());
				node[leftPart]=newLabel;
			}
			//jout<<"\n"<<leftPart<<"--->add Child: "<<rightPart<<endl;
			node[leftPart].addChild_viterbi(&oldLb,ruleScore);
			ntSet[rightPart]=1;
			mark=true;
		}
	}
	return mark;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x8340
leaq -0x60(%rbp), %rdi
callq 0x25300
leaq -0x30(%rbp), %rdi
callq 0x8360
leaq -0x60(%rbp), %rdi
callq 0x34100
movq -0x10(%rbp), %rdi
callq 0x4ba50
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4b7f0
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x4ba80
testb $0x1, %al
jne 0x5bb68
jmp 0x5bbcf
leaq -0x68(%rbp), %rdi
callq 0x4bab0
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0x37000
jmp 0x5bb7f
leaq -0x68(%rbp), %rdi
callq 0x4bab0
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x1d350
movq %rax, -0x2b0(%rbp)
jmp 0x5bb9d
movq -0x2b0(%rbp), %rax
movl $0x0, (%rax)
leaq -0x68(%rbp), %rdi
xorl %esi, %esi
callq 0x4bad0
movq %rax, -0x88(%rbp)
jmp 0x5bb48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x5c0f4
movl $0x0, -0x8c(%rbp)
movslq -0x8c(%rbp), %rax
movq %rax, -0x2b8(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x87f0
movq %rax, %rcx
movq -0x2b8(%rbp), %rax
cmpq %rcx, %rax
jae 0x5c0be
movslq -0x8c(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x8810
movq %rax, %rsi
leaq -0xb0(%rbp), %rdi
callq 0x4160
jmp 0x5bc24
movq -0x10(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x4b350
movq %rax, -0x2c0(%rbp)
jmp 0x5bc3d
movq -0x2c0(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2c8(%rbp)
leaq -0xe8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x4160
jmp 0x5bc6b
movq -0x2c8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x89570
movq %rdx, -0x2d8(%rbp)
movq %rax, -0x2d0(%rbp)
jmp 0x5bc8e
movq -0x2d8(%rbp), %rax
movq -0x2d0(%rbp), %rcx
movq %rcx, -0xc8(%rbp)
movq %rax, -0xc0(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x4728
movq -0xc8(%rbp), %rax
movq %rax, -0xf0(%rbp)
leaq -0xc8(%rbp), %rsi
addq $0x8, %rsi
leaq -0xf0(%rbp), %rdi
callq 0x5e510
testb $0x1, %al
jne 0x5bce4
jmp 0x5c090
leaq -0xf0(%rbp), %rdi
callq 0x5e540
movq %rax, %rsi
addq $0x20, %rsi
leaq -0x110(%rbp), %rdi
callq 0x4160
jmp 0x5bd05
leaq -0x60(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x5e700
movq %rax, -0x2e0(%rbp)
jmp 0x5bd1e
movq -0x2e0(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x1d570
movq %rax, -0x120(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x1d540
testb $0x1, %al
jne 0x5bd55
jmp 0x5bdce
leaq -0x30(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x37000
jmp 0x5bd67
leaq -0x60(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x1d350
movq %rax, -0x2e8(%rbp)
jmp 0x5bd80
movq -0x2e8(%rbp), %rax
movl $0x0, (%rax)
jmp 0x5be04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x5c0b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x4728
jmp 0x5c0b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x5c082
leaq -0x60(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x1d350
movq %rax, -0x2f0(%rbp)
jmp 0x5bde7
movq -0x2f0(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5be02
movl $0xa, -0x124(%rbp)
jmp 0x5c04c
jmp 0x5be04
leaq -0xf0(%rbp), %rdi
callq 0x5e540
movsd 0x60(%rax), %xmm0
callq 0x4300
movsd %xmm0, -0x130(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x4b7a0
movq %rax, -0x2f8(%rbp)
jmp 0x5be3b
movq -0x2f8(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4b7f0
movq %rax, -0x140(%rbp)
leaq -0x138(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x4b770
testb $0x1, %al
jne 0x5be75
jmp 0x5bfe2
leaq -0x258(%rbp), %rdi
callq 0x4b470
jmp 0x5be83
leaq -0x278(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x4160
jmp 0x5be98
movq -0xb8(%rbp), %rdi
callq 0x4b730
movl %eax, -0x2fc(%rbp)
jmp 0x5beac
movq -0xb8(%rbp), %rdi
callq 0x4b750
movl %eax, -0x300(%rbp)
jmp 0x5bec0
leaq -0x299(%rbp), %rdi
movq %rdi, -0x308(%rbp)
callq 0x4660
movq -0x308(%rbp), %rdx
leaq 0x34f75(%rip), %rsi     # 0x90e56
leaq -0x298(%rbp), %rdi
callq 0x1c730
jmp 0x5beef
movl -0x300(%rbp), %ecx
movl -0x2fc(%rbp), %edx
leaq -0x258(%rbp), %rdi
leaq -0x278(%rbp), %rsi
leaq -0x298(%rbp), %r8
callq 0x5e570
jmp 0x5bf17
leaq -0x298(%rbp), %rdi
callq 0x4728
leaq -0x299(%rbp), %rdi
callq 0x43f0
leaq -0x278(%rbp), %rdi
callq 0x4728
movq -0x10(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x4b350
movq %rax, -0x310(%rbp)
jmp 0x5bf54
movq -0x310(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x4b820
jmp 0x5bf69
leaq -0x258(%rbp), %rdi
callq 0x46ba0
jmp 0x5bfe2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x5bfd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x5bfc5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x5bfb9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x4728
leaq -0x299(%rbp), %rdi
callq 0x43f0
leaq -0x278(%rbp), %rdi
callq 0x4728
leaq -0x258(%rbp), %rdi
callq 0x46ba0
jmp 0x5c082
movq -0x10(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x4b350
movq %rax, -0x318(%rbp)
jmp 0x5bffb
movq -0x318(%rbp), %rdi
movq -0xb8(%rbp), %rsi
movsd -0x130(%rbp), %xmm0
callq 0x68010
jmp 0x5c018
leaq -0x60(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x1d350
movq %rax, -0x320(%rbp)
jmp 0x5c031
movq -0x320(%rbp), %rax
movl $0x1, (%rax)
movb $0x1, -0x11(%rbp)
movl $0x0, -0x124(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x4728
movl -0x124(%rbp), %eax
testl %eax, %eax
je 0x5c066
jmp 0x5c064
jmp 0x5c068
jmp 0x5c068
leaq -0xf0(%rbp), %rdi
xorl %esi, %esi
callq 0x5e5d0
movq %rax, -0x2a8(%rbp)
jmp 0x5bcc4
leaq -0x110(%rbp), %rdi
callq 0x4728
jmp 0x5c0b0
leaq -0xb0(%rbp), %rdi
callq 0x4728
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x5bbd9
leaq -0xb0(%rbp), %rdi
callq 0x4728
jmp 0x5c0f4
movb -0x11(%rbp), %al
movb %al, -0x321(%rbp)
movl $0x1, -0x124(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x25780
leaq -0x30(%rbp), %rdi
callq 0x8830
movb -0x321(%rbp), %al
andb $0x1, %al
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x25780
leaq -0x30(%rbp), %rdi
callq 0x8830
movq -0x78(%rbp), %rdi
callq 0x4650
nop