// File: 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
movq %rsp, %rbp
subq $0x2f0, %rsp            # imm = 0x2F0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
callq 0x4250
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4ba50
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4b7f0
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x4ba80
testb $0x1, %al
jne 0x5a674
jmp 0x5ab3a
movq -0x18(%rbp), %rdi
callq 0x4ba50
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x4b7f0
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4ba80
testb $0x1, %al
jne 0x5a6a4
jmp 0x5ab21
leaq -0x30(%rbp), %rdi
callq 0x4bab0
addq $0x20, %rax
movq %rax, -0x50(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4bab0
addq $0x20, %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
callq 0x4b7d0
movq %rax, %rsi
leaq 0x36779(%rip), %rdx     # 0x90e52
leaq -0x98(%rbp), %rdi
callq 0x21540
movq -0x58(%rbp), %rdi
callq 0x4b7d0
movq %rax, -0x278(%rbp)
jmp 0x5a6f7
movq -0x278(%rbp), %rdx
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x214f0
jmp 0x5a710
leaq -0x98(%rbp), %rdi
callq 0x4728
movq -0x8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x5e4b0
movq %rax, -0x280(%rbp)
jmp 0x5a732
movq -0x280(%rbp), %rax
cmpq $0x0, %rax
jbe 0x5aaf6
movq -0x8(%rbp), %rax
movq %rax, -0x288(%rbp)
leaq -0xd8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4160
jmp 0x5a760
movq -0x288(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x89570
movq %rdx, -0x298(%rbp)
movq %rax, -0x290(%rbp)
jmp 0x5a783
movq -0x298(%rbp), %rax
movq -0x290(%rbp), %rcx
movq %rcx, -0xb8(%rbp)
movq %rax, -0xb0(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x4728
movq -0xb8(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0xb8(%rbp), %rsi
addq $0x8, %rsi
leaq -0xe0(%rbp), %rdi
callq 0x5e510
testb $0x1, %al
jne 0x5a7d9
jmp 0x5aaf4
leaq -0xe0(%rbp), %rdi
callq 0x5e540
movsd 0x60(%rax), %xmm0
callq 0x4300
movsd %xmm0, -0xe8(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x4b470
jmp 0x5a805
leaq -0xe0(%rbp), %rdi
callq 0x5e540
movq %rax, %rsi
addq $0x20, %rsi
leaq -0x220(%rbp), %rdi
callq 0x4160
jmp 0x5a826
movq -0x50(%rbp), %rdi
callq 0x4b730
movl %eax, -0x29c(%rbp)
jmp 0x5a837
movq -0x58(%rbp), %rdi
callq 0x4b750
movl %eax, -0x2a0(%rbp)
jmp 0x5a848
leaq -0x241(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0x4660
movq -0x2a8(%rbp), %rdx
leaq 0x365ed(%rip), %rsi     # 0x90e56
leaq -0x240(%rbp), %rdi
callq 0x1c730
jmp 0x5a877
movl -0x2a0(%rbp), %ecx
movl -0x29c(%rbp), %edx
leaq -0x200(%rbp), %rdi
leaq -0x220(%rbp), %rsi
leaq -0x240(%rbp), %r8
callq 0x5e570
jmp 0x5a89f
leaq -0x240(%rbp), %rdi
callq 0x4728
leaq -0x241(%rbp), %rdi
callq 0x43f0
leaq -0x220(%rbp), %rdi
callq 0x4728
movq -0x20(%rbp), %rax
movq %rax, -0x2b8(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x4b7d0
movq %rax, -0x2b0(%rbp)
jmp 0x5a8e3
movq -0x2b0(%rbp), %rsi
movq -0x2b8(%rbp), %rdi
callq 0x4b7a0
movq %rax, -0x2c0(%rbp)
jmp 0x5a8ff
movq -0x2c0(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4b7f0
movq %rax, -0x258(%rbp)
leaq -0x250(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x4b770
testb $0x1, %al
jne 0x5a939
jmp 0x5aa66
movq -0x20(%rbp), %rax
movq %rax, -0x2d0(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x4b7d0
movq %rax, -0x2c8(%rbp)
jmp 0x5a959
movq -0x2c8(%rbp), %rsi
movq -0x2d0(%rbp), %rdi
callq 0x4b350
movq %rax, -0x2d8(%rbp)
jmp 0x5a975
movq -0x2d8(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x4b820
jmp 0x5a98a
jmp 0x5aa66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4728
jmp 0x5ab67
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x5ab16
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x4728
jmp 0x5ab16
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x5aae6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x5aa55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x5aa49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x4728
leaq -0x241(%rbp), %rdi
callq 0x43f0
leaq -0x220(%rbp), %rdi
callq 0x4728
jmp 0x5aae6
movq -0x20(%rbp), %rax
movq %rax, -0x2e8(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x4b7d0
movq %rax, -0x2e0(%rbp)
jmp 0x5aa86
movq -0x2e0(%rbp), %rsi
movq -0x2e8(%rbp), %rdi
callq 0x4b350
movq %rax, -0x2f0(%rbp)
jmp 0x5aaa2
movq -0x2f0(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdx
movsd -0xe8(%rbp), %xmm0
callq 0x67db0
jmp 0x5aac0
leaq -0x200(%rbp), %rdi
callq 0x46ba0
leaq -0xe0(%rbp), %rdi
xorl %esi, %esi
callq 0x5e5d0
movq %rax, -0x260(%rbp)
jmp 0x5a7b9
leaq -0x200(%rbp), %rdi
callq 0x46ba0
jmp 0x5ab16
jmp 0x5aaf6
leaq -0x78(%rbp), %rdi
callq 0x4728
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0x4bad0
movq %rax, -0x268(%rbp)
jmp 0x5a681
leaq -0x78(%rbp), %rdi
callq 0x4728
jmp 0x5ab67
jmp 0x5ab23
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x4bad0
movq %rax, -0x270(%rbp)
jmp 0x5a651
callq 0x4250
movq %rax, %rcx
subq -0x28(%rbp), %rcx
leaq 0x748eb(%rip), %rax     # 0xcf438
addq (%rax), %rcx
leaq 0x748e1(%rip), %rax     # 0xcf438
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
addq $0x2f0, %rsp            # imm = 0x2F0
popq %rbp
retq
movq -0xa0(%rbp), %rdi
callq 0x4650
nopw %cs:(%rax,%rax)