// File: /workspace/github_cpp_makefile_star2_O1/neubig[P]egret/Egret/src/Forest.cpp
// Function: genUnaryNode_viterbi(ListRuleSet&, Node&)
bool genUnaryNode_viterbi(RuleSet& ruleSet,Node& node)
{
	bool mark=false;
	vector<string> ntPool;
	map<string,int> ntMap;
	ntPool.clear();
	ntMap.clear();
	node.setUnaryInOrder(ruleSet,ntPool);

	for(int i=0;(size_t)i<ntPool.size();i++)
		ntMap[ntPool[i]]=1;

	for(int i=0;(size_t)i<ntPool.size();i++)
	{
		string rightPart=ntPool[i];
		//cout<<"here:"<<i<<","<<rightPart<<endl;
		Label& oldLb=node[rightPart];
		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(node.find(leftPart)==node.end())
			{
				if(ntMap.find(leftPart)==ntMap.end())
					ntPool.push_back(leftPart);
				Label newLabel;
				newLabel.init(leftPart,oldLb.start(),oldLb.stop());
				node[leftPart]=newLabel;
			}
			double ruleScore=log(iter->second.prob);
			//jout<<"\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 $0x228, %rsp            # imm = 0x228
movq %rsi, %rbx
movq %rdi, 0x18(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
leaq 0xe8(%rsp), %rcx
movl $0x0, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq (%rsp), %r14
movq 0x8(%rsp), %r15
cmpq %r14, %r15
je 0x27d14
leaq 0x10(%r14), %r12
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0x27cfe
movq (%r12), %rsi
incq %rsi
callq 0x32e0
leaq 0x20(%r12), %rax
addq $0x10, %r12
cmpq %r15, %r12
movq %rax, %r12
jne 0x27ce8
movq %r14, 0x8(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x15398
movq %rsp, %rdx
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
callq 0x362f8
movq (%rsp), %rsi
cmpq %rsi, 0x8(%rsp)
je 0x27d77
xorl %r15d, %r15d
leaq 0xe0(%rsp), %r14
xorl %r12d, %r12d
addq %r15, %rsi
movq %r14, %rdi
callq 0xb932
movl $0x1, (%rax)
incq %r12
movq (%rsp), %rsi
movq 0x8(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
addq $0x20, %r15
cmpq %r12, %rax
ja 0x27d4a
movq (%rsp), %rax
cmpq %rax, 0x8(%rsp)
je 0x281e7
leaq 0x8(%rbx), %r14
xorl %edx, %edx
leaq 0x28(%rsp), %r15
leaq 0xa8(%rsp), %r12
leaq 0x48(%rsp), %r13
xorl %ebp, %ebp
movq %rdx, 0xc8(%rsp)
movq %rdx, %rcx
shlq $0x5, %rcx
leaq 0x38(%rsp), %rdx
movq %rdx, 0x28(%rsp)
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x6a88
movq %rbx, %rdi
movq %r15, %rsi
callq 0x20440
movq %rax, 0x20(%rsp)
leaq 0xb8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x6a88
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x3dd56
movq %rax, %r12
movq %rdx, %r15
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x27e3a
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x32e0
cmpq %r15, %r12
je 0x28198
movq %r15, 0xd0(%rsp)
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x40(%r12), %rsi
movq 0x48(%r12), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x6a88
movq %rbx, %rdi
movq %r13, %rsi
callq 0x223b8
cmpq %r14, %rax
jne 0x2812c
leaq 0xe0(%rsp), %rdi
movq %r13, %rsi
callq 0x2c6d2
leaq 0xe8(%rsp), %rcx
cmpq %rcx, %rax
jne 0x27ea6
movq %rsp, %rdi
movq %r13, %rsi
callq 0x17a82
leaq 0x110(%rsp), %rdi
callq 0x204bc
movq %r14, %rbp
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %rdi
callq 0x6a88
movq 0x20(%rsp), %rax
movl 0x48(%rax), %r15d
movl 0x4c(%rax), %r14d
leaq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x68(%rsp), %rdi
leaq 0x19f93(%rip), %rdx     # 0x41e96
movq %rdx, %rsi
callq 0xb8a2
leaq 0x118(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x3150
movl %r15d, 0x158(%rsp)
movl %r14d, 0x15c(%rsp)
leaq 0x138(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3150
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x27f5e
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x27f83
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x32e0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x20440
movq %rax, %r15
movb 0x110(%rsp), %al
movb %al, (%r15)
leaq 0x8(%r15), %rdi
leaq 0x118(%rsp), %rsi
callq 0x3150
leaq 0x28(%r15), %rdi
leaq 0x138(%rsp), %rsi
callq 0x3150
leaq 0x118(%rsp), %rcx
movb 0x48(%rcx), %al
movb %al, 0x50(%r15)
movq 0x40(%rcx), %rax
movq %rax, 0x48(%r15)
leaq 0x58(%r15), %rdi
leaq 0x168(%rsp), %rsi
callq 0x20b88
leaq 0x70(%r15), %rdi
leaq 0x180(%rsp), %rsi
callq 0x20b88
leaq 0x88(%r15), %rdi
leaq 0x198(%rsp), %rsi
callq 0x21a40
leaq 0x118(%rsp), %rax
movups 0xb0(%rax), %xmm0
movups %xmm0, 0xb8(%r15)
leaq 0xc8(%r15), %rdi
leaq 0x1d8(%rsp), %rsi
callq 0x20ef0
leaq 0x118(%rsp), %rax
movups 0xd8(%rax), %xmm0
movups %xmm0, 0xe0(%r15)
movq %r15, %rdi
addq $0xf0, %rdi
leaq 0x200(%rsp), %rsi
callq 0x218ca
leaq 0x118(%rsp), %rcx
movl 0x108(%rcx), %eax
movl %eax, 0x110(%r15)
movq 0x100(%rcx), %rax
movq %rax, 0x108(%r15)
leaq 0x200(%rsp), %rdi
callq 0x1d4e6
movq 0x1d8(%rsp), %rdi
testq %rdi, %rdi
je 0x280b0
movq 0x1e8(%rsp), %rsi
subq %rdi, %rsi
callq 0x32e0
leaq 0x198(%rsp), %rdi
callq 0x1d582
leaq 0x180(%rsp), %rdi
callq 0x1d534
leaq 0x168(%rsp), %rdi
callq 0x1d534
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
movq %rbp, %r14
movq 0xd0(%rsp), %r15
je 0x28107
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x118(%rsp), %rdi
leaq 0x128(%rsp), %rax
cmpq %rax, %rdi
je 0x2812c
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x32e0
movsd 0x80(%r12), %xmm0
callq 0x3260
movsd %xmm0, 0xd8(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x20440
movq %rax, %rdi
movq 0x20(%rsp), %rsi
movsd 0xd8(%rsp), %xmm0
callq 0x2daa6
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x28181
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32e0
movq %r12, %rdi
callq 0x31f0
movq %rax, %r12
cmpq %r15, %rax
jne 0x27e4b
movb $0x1, %bpl
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x281b4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0xc8(%rsp), %rdx
incq %rdx
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %rdx, %rcx
leaq 0x28(%rsp), %r15
leaq 0xa8(%rsp), %r12
ja 0x27da0
jmp 0x281e9
xorl %ebp, %ebp
leaq 0xe0(%rsp), %rdi
callq 0x10ef2
movq %rsp, %rdi
callq 0x611e
andb $0x1, %bpl
movl %ebp, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x28247
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x282d8
movq 0xb8(%rsp), %rsi
jmp 0x282d0
jmp 0x28247
jmp 0x282a0
jmp 0x282a0
movq %rax, %rbx
jmp 0x282f4
jmp 0x282a7
movq %rax, %rbx
jmp 0x28279
jmp 0x282a7
jmp 0x282a7
movq %rax, %rbx
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x28279
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x282af
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x32e0
jmp 0x282af
movq %rax, %rbx
jmp 0x282d8
jmp 0x282a7
movq %rax, %rbx
jmp 0x282bc
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x208b0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x282d8
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32e0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x282f4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32e0
leaq 0xe0(%rsp), %rdi
callq 0x10ef2
movq %rsp, %rdi
callq 0x611e
movq %rbx, %rdi
callq 0x3530