// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rsi, 0x8(%rsp)
movq %rdi, 0xe8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rsp)
leaq 0x108(%rsp), %rcx
movl $0x0, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r14
cmpq %rbx, %r14
je 0x28398
leaq 0x10(%rbx), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x28383
movq (%r15), %rsi
incq %rsi
callq 0x32e0
leaq 0x20(%r15), %rax
addq $0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0x2836f
movq %rbx, 0x18(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x15398
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rbx
addq $0x8, %rax
movq %rax, 0x50(%rsp)
cmpq %rax, %rbx
je 0x283fb
leaq 0x10(%rsp), %r14
leaq 0x100(%rsp), %r15
leaq 0x20(%rbx), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x17a82
movq %r15, %rdi
movq %r12, %rsi
callq 0xb932
movl $0x0, (%rax)
movq %rbx, %rdi
callq 0x31f0
movq %rax, %rbx
cmpq 0x50(%rsp), %rax
jne 0x283c9
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x28899
leaq 0x138(%rsp), %r14
leaq 0x188(%rsp), %r13
xorl %edx, %edx
leaq 0x30(%rsp), %r15
leaq 0x68(%rsp), %rbp
xorl %ebx, %ebx
movq %rdx, 0xf0(%rsp)
movq %rdx, %rcx
shlq $0x5, %rcx
leaq 0x40(%rsp), %rdx
movq %rdx, 0x30(%rsp)
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x6a88
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x20440
movq %rax, 0x58(%rsp)
leaq 0xd8(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %r15
movq %r15, %rdi
callq 0x6a88
movq 0xe8(%rsp), %rdi
movq %r15, %rsi
callq 0x3dd56
movq %rdx, 0x60(%rsp)
movq %rax, %r15
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x284d2
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x32e0
cmpq 0x60(%rsp), %r15
je 0x28851
leaq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x6a88
leaq 0x100(%rsp), %rdi
movq %rbp, %rsi
callq 0x2c6d2
leaq 0x108(%rsp), %rcx
cmpq %rcx, %rax
je 0x28532
leaq 0x100(%rsp), %rdi
movq %rbp, %rsi
callq 0xb932
cmpl $0x0, (%rax)
jne 0x2881f
jmp 0x28555
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x17a82
leaq 0x100(%rsp), %rdi
movq %rbp, %rsi
callq 0xb932
movl $0x0, (%rax)
movsd 0x80(%r15), %xmm0
callq 0x3260
movsd %xmm0, 0xf8(%rsp)
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x223b8
cmpq 0x50(%rsp), %rax
jne 0x287e2
leaq 0x130(%rsp), %rdi
callq 0x204bc
leaq 0xb8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %rdi
callq 0x6a88
movq %r14, %r12
movq 0x58(%rsp), %rax
movl 0x48(%rax), %ebx
movl 0x4c(%rax), %r14d
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x198ad(%rip), %rdx     # 0x41e96
movq %rdx, %rsi
callq 0xb8a2
movq %r12, %rdi
leaq 0xa8(%rsp), %rsi
callq 0x3150
movl %ebx, 0x178(%rsp)
movl %r14d, 0x17c(%rsp)
leaq 0x158(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x3150
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x2864a
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
movq %r12, %r14
je 0x28672
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x20440
movq %rax, %rbx
movb 0x130(%rsp), %al
movb %al, (%rbx)
leaq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0x3150
leaq 0x28(%rbx), %rdi
leaq 0x158(%rsp), %rsi
callq 0x3150
movb 0x48(%r14), %al
movb %al, 0x50(%rbx)
movq 0x40(%r14), %rax
movq %rax, 0x48(%rbx)
leaq 0x58(%rbx), %rdi
movq %r13, %rsi
callq 0x20b88
leaq 0x70(%rbx), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x20b88
leaq 0x88(%rbx), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x21a40
movups 0xb0(%r14), %xmm0
movups %xmm0, 0xb8(%rbx)
leaq 0xc8(%rbx), %rdi
leaq 0x1f8(%rsp), %rsi
callq 0x20ef0
movups 0xd8(%r14), %xmm0
movups %xmm0, 0xe0(%rbx)
movq %rbx, %rdi
addq $0xf0, %rdi
leaq 0x220(%rsp), %rsi
callq 0x218ca
movl 0x108(%r14), %eax
movl %eax, 0x110(%rbx)
movq 0x100(%r14), %rax
movq %rax, 0x108(%rbx)
leaq 0x220(%rsp), %rdi
callq 0x1d4e6
movq 0x1f8(%rsp), %rdi
testq %rdi, %rdi
je 0x28776
movq 0x208(%rsp), %rsi
subq %rdi, %rsi
callq 0x32e0
leaq 0x1b8(%rsp), %rdi
callq 0x1d582
leaq 0x1a0(%rsp), %rdi
callq 0x1d534
movq %r13, %rdi
callq 0x1d534
movq 0x158(%rsp), %rdi
leaq 0x168(%rsp), %rax
cmpq %rax, %rdi
je 0x287bd
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
je 0x287e2
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x20440
movq %rax, %rdi
movq 0x58(%rsp), %rsi
movsd 0xf8(%rsp), %xmm0
callq 0x2daa6
leaq 0x100(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xb932
movl $0x1, (%rax)
movb $0x1, %bl
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x2883b
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32e0
movq %r15, %rdi
callq 0x31f0
movq %rax, %r15
cmpq 0x60(%rsp), %rax
jne 0x284dd
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x2886d
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0xf0(%rsp), %rdx
incq %rdx
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %rdx, %rcx
leaq 0x30(%rsp), %r15
ja 0x28429
jmp 0x2889b
xorl %ebx, %ebx
leaq 0x100(%rsp), %rdi
callq 0x10ef2
leaq 0x10(%rsp), %rdi
callq 0x611e
andb $0x1, %bl
movl %ebx, %eax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x288fe
jmp 0x2895e
jmp 0x2895e
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x28998
movq 0xd8(%rsp), %rsi
jmp 0x28990
movq %rax, %rbx
jmp 0x289b4
movq %rax, %rbx
jmp 0x28935
jmp 0x28967
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x28935
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x2896f
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x32e0
jmp 0x2896f
jmp 0x28967
movq %rax, %rbx
jmp 0x28998
jmp 0x28967
jmp 0x28967
movq %rax, %rbx
jmp 0x2897c
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x208b0
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x28998
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x289b4
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32e0
leaq 0x100(%rsp), %rdi
callq 0x10ef2
leaq 0x10(%rsp), %rdi
callq 0x611e
movq %rbx, %rdi
callq 0x3530