// File: /workspace/github_cpp_makefile_star2_O2/neubig[P]egret/Egret/src/Forest.cpp
// Function: genNewNode_viterbi(ListRuleSet&, Node&, Node&, Node&)
Node& genNewNode_viterbi(RuleSet& ruleSet,Node& n1, Node& n2, Node& n3)
{
	clock_t sec=clock();
	for(Node::iterator n1iter=n1.begin();n1iter!=n1.end();n1iter++)
	{
		for(Node::iterator n2iter=n2.begin();n2iter!=n2.end();n2iter++)
		{
			Label& label1=n1iter->second;
			Label& label2=n2iter->second;
			string rightPart=label1.nt()+" "+label2.nt();
			if(ruleSet.count(rightPart)>0)
			{
				pair<RuleSet::RSIter,RuleSet::RSIter> iterPair=ruleSet.query(rightPart);
				for(RuleSet::RSIter iter=iterPair.first;iter!=iterPair.second;iter++)
				{
					//jout<<rightPart<<"==>"<<iter->second.left<<endl;
					double ruleScore=log(iter->second.prob);
					Label label;
					label.init(iter->second.left,label1.start(),label2.stop());
					if(n3.find(label.nt())==n3.end())
						n3[label.nt()]=label;
					n3[label.nt()].addChildPair_viterbi(&label1,&label2,ruleScore);
				}
			}
		}
	}
	inbitime+=clock()-sec;
	return n3;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, 0x20(%rsp)
callq 0x31f0
movq %rax, 0x30(%rsp)
movq 0x18(%r15), %rcx
addq $0x8, %r15
movq %r15, 0x40(%rsp)
movq %r14, 0x38(%rsp)
leaq 0x8(%r14), %rax
movq %rax, 0x50(%rsp)
movq %rbx, 0x10(%rsp)
leaq 0x8(%rbx), %rax
movq %rax, 0x58(%rsp)
leaq 0x100(%rsp), %r12
leaq 0xc0(%rsp), %r13
cmpq 0x40(%rsp), %rcx
je 0x1ef71
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rbx
leaq 0x40(%rcx), %rax
movq %rax, 0x60(%rsp)
movq %rcx, 0x28(%rsp)
leaq 0x48(%rcx), %rax
movq %rax, 0x48(%rsp)
cmpq 0x50(%rsp), %rbx
je 0x1ef5f
movq %r12, %rdi
movq 0x48(%rsp), %rsi
leaq 0x140ff(%rip), %rdx     # 0x32eb2
callq 0xbf0b
movq %rbx, 0x18(%rsp)
leaq 0x48(%rbx), %rdx
leaq 0x80(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0xbeec
movq %r12, %rdi
callq 0x3578
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x212f6
testq %rax, %rax
movq 0x18(%rsp), %rbx
je 0x1ef42
leaq 0xe0(%rsp), %r15
movq %r15, %rdi
leaq 0x80(%rsp), %rsi
callq 0x33c0
movq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x2f88a
movq %rdx, 0x70(%rsp)
movq %rax, %rbp
leaq 0x40(%rbx), %rax
movq %rax, 0x68(%rsp)
movq %r15, %rdi
callq 0x3578
cmpq 0x70(%rsp), %rbp
je 0x1ef42
movsd 0x80(%rbp), %xmm0
callq 0x3280
movsd %xmm0, 0x78(%rsp)
movq %r12, %rdi
callq 0x19b8a
leaq 0x40(%rbp), %rsi
movq %r13, %rdi
callq 0x33c0
movq %r12, %r14
movq 0x28(%rsp), %rax
movl 0x88(%rax), %r15d
movq 0x18(%rsp), %rax
movl 0x8c(%rax), %r12d
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
leaq 0x14022(%rip), %rsi     # 0x32eb6
leaq 0xf(%rsp), %rdx
callq 0x9f86
movq %r14, %rdi
movq %r13, %rsi
movl %r15d, %edx
movl %r12d, %ecx
movq %rbx, %r8
callq 0x21310
movq %rbx, %rdi
callq 0x3578
movq %r13, %rdi
callq 0x3578
movq 0x10(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x1b8b0
cmpq 0x58(%rsp), %rax
movq %r14, %r12
jne 0x1eefb
movq 0x10(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x19b24
movq %rax, %rdi
movq %r12, %rsi
callq 0x19d82
movq 0x10(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x19b24
movq %rax, %rdi
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movsd 0x78(%rsp), %xmm0
callq 0x23adc
movq %r12, %rdi
callq 0x17b24
movq %rbp, %rdi
callq 0x3210
movq %rax, %rbp
movq 0x18(%rsp), %rbx
jmp 0x1ee35
leaq 0x80(%rsp), %rdi
callq 0x3578
movq %rbx, %rdi
callq 0x3210
movq %rax, %rbx
jmp 0x1ed99
movq 0x28(%rsp), %rdi
callq 0x3210
movq %rax, %rcx
jmp 0x1ed6e
callq 0x31f0
subq 0x30(%rsp), %rax
leaq 0x2d3de(%rip), %rcx     # 0x4c360
addq %rax, (%rcx)
movq 0x10(%rsp), %rax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1efbf
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x3578
jmp 0x1effa
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
jmp 0x1f002
jmp 0x1efbf
movq %rax, %rbx
jmp 0x1effa
movq %rax, %rbx
jmp 0x1efd9
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x3578
leaq 0xc0(%rsp), %rdi
callq 0x3578
jmp 0x1efed
jmp 0x1efea
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x17b24
leaq 0x80(%rsp), %rdi
callq 0x3578
movq %rbx, %rdi
callq 0x34f0