// File: neubig[P]egret/Egret/src/Forest-Berkeley-ruleByParent.cpp
// Function: genUnaryNode_withoutLabel_initLevel_berkeley(BerkeleyRuleSet const&, Node&, IorO, ExtentInfo&)
bool genUnaryNode_withoutLabel_initLevel_berkeley(const BerkeleyRuleSet& ruleSet, Node& node, IorO iot, ExtentInfo& extentInfo)
{
		const BerkeleyStateInfoOfOneLevel& bsio=ruleSet.bsio();
		int numOfState=(int)bsio.numOfState();

vector<double> temp_iScore,temp_oScore;
temp_iScore.clear();
temp_oScore.clear();
temp_iScore.reserve(numOfState);
temp_oScore.reserve(numOfState);
for(int i=0;i<numOfState;i++)
{
	if(iot==inside)
		temp_iScore.push_back(-1E10);
	else
		temp_oScore.push_back(-1E10);
}

		for(int pr=0;pr<numOfState;pr++)
		{
			if(iot==outside)
			{
				if(node.oScore(pr)<0)continue;
			}
			for(int ch=0;ch<numOfState;ch++)	
			{
				const BerkeleyUnaryRule* rule=ruleSet.getUnaryRuleByRule(ch,pr);
				if(rule==NULL)continue;
				if(ch==pr)continue;
				double ruleScore=rule->getScore(0,0);
				if(ruleScore>0)
				{
					if(iot==inside)
					{
						if(node.iScore(ch)<0)continue;
						//if(node.iScore(pr)<0)node.iScore(pr)=0;
						//node.iScore(pr)=max(node.iScore(ch)*ruleScore,node.iScore(pr));
						if(temp_iScore[pr]<0)temp_iScore[pr]=0;
						temp_iScore[pr]=max(node.iScore(ch)*ruleScore,temp_iScore[pr]);
					}
					else if(iot==outside)
					{
						if(node.oScore(pr)<0)continue;
						//if(node.oScore(ch)<0)node.oScore(ch)=0;
						//node.oScore(ch)=max(node.oScore(pr)*ruleScore,node.oScore(ch));
						if(temp_oScore[ch]<0)temp_oScore[ch]=0;
						temp_oScore[ch]=max(node.oScore(pr)*ruleScore,temp_oScore[ch]);
					}
				}
			}
		}
		for(int i=0;i<numOfState;i++)
		{
			if(iot==inside)
				node.iScore(i)=max(node.iScore(i),temp_iScore[i]);
			else if(iot==outside)
				node.oScore(i)=max(node.oScore(i),temp_oScore[i]);
		}

		if(iot==inside)
		for(int i=0;i<numOfState;i++)
		{
			if(node.iScore(i)>0)
			{
				extentInfo.update(node.start(),node.stop(),i);
			}
		}
		
	node.set_allowState_withoutLabel_for_initialLevel(1,0,0);
	//cout<<"allow State:"<<endl;
	//asi.print(cout);
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x45690
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xa270
movl %eax, -0x2c(%rbp)
leaq -0x48(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x21880
leaq -0x60(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x21880
movq -0xb8(%rbp), %rdi
callq 0x218a0
movq -0xc0(%rbp), %rdi
callq 0x218a0
movq -0xb8(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0x21930
jmp 0x58b0d
movslq -0x2c(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x21930
jmp 0x58b1c
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x58b9f
cmpl $0x0, -0x14(%rbp)
jne 0x58b73
movabsq $-0x3dfd5fa0e0000000, %rax # imm = 0xC202A05F20000000
movq %rax, -0x78(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x21a30
jmp 0x58b4e
jmp 0x58b92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xd760
leaq -0x48(%rbp), %rdi
callq 0xd760
jmp 0x590e2
movabsq $-0x3dfd5fa0e0000000, %rax # imm = 0xC202A05F20000000
movq %rax, -0x80(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x21a30
jmp 0x58b90
jmp 0x58b92
jmp 0x58b94
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x58b23
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x58eb2
cmpl $0x1, -0x14(%rbp)
jne 0x58bed
movq -0x10(%rbp), %rdi
movl -0x84(%rbp), %esi
callq 0x456b0
movq %rax, -0xc8(%rbp)
jmp 0x58bd6
movq -0xc8(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jbe 0x58beb
jmp 0x58e9e
jmp 0x58bed
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x58e9c
movq -0x8(%rbp), %rdi
movl -0x88(%rbp), %esi
movl -0x84(%rbp), %edx
callq 0x456e0
movq %rax, -0xd0(%rbp)
jmp 0x58c24
movq -0xd0(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
jne 0x58c41
jmp 0x58e88
movl -0x88(%rbp), %eax
cmpl -0x84(%rbp), %eax
jne 0x58c54
jmp 0x58e88
movq -0x90(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x45710
movsd %xmm0, -0xd8(%rbp)
jmp 0x58c6e
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x98(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x58e86
cmpl $0x0, -0x14(%rbp)
jne 0x58d8d
movq -0x10(%rbp), %rdi
movl -0x88(%rbp), %esi
callq 0x45750
movq %rax, -0xe0(%rbp)
jmp 0x58cb5
movq -0xe0(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jbe 0x58cca
jmp 0x58e88
movslq -0x84(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0xa180
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jbe 0x58cfa
movslq -0x84(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0xa180
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rdi
movl -0x88(%rbp), %esi
callq 0x45750
movq %rax, -0xe8(%rbp)
jmp 0x58d12
movq -0xe8(%rbp), %rax
movsd (%rax), %xmm0
movsd -0x98(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movslq -0x84(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0xa180
movq %rax, %rsi
leaq -0xa0(%rbp), %rdi
callq 0x45780
movq %rax, -0xf0(%rbp)
jmp 0x58d59
movq -0xf0(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xf8(%rbp)
movslq -0x84(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0xa180
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x58e84
cmpl $0x1, -0x14(%rbp)
jne 0x58e82
movq -0x10(%rbp), %rdi
movl -0x84(%rbp), %esi
callq 0x456b0
movq %rax, -0x100(%rbp)
jmp 0x58daf
movq -0x100(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jbe 0x58dc4
jmp 0x58e88
movslq -0x88(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0xa180
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jbe 0x58df4
movslq -0x88(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0xa180
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rdi
movl -0x84(%rbp), %esi
callq 0x456b0
movq %rax, -0x108(%rbp)
jmp 0x58e0c
movq -0x108(%rbp), %rax
movsd (%rax), %xmm0
movsd -0x98(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0xa8(%rbp)
movslq -0x88(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0xa180
movq %rax, %rsi
leaq -0xa8(%rbp), %rdi
callq 0x45780
movq %rax, -0x110(%rbp)
jmp 0x58e53
movq -0x110(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x118(%rbp)
movslq -0x88(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0xa180
movsd -0x118(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x58e84
jmp 0x58e86
jmp 0x58e88
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x58bf7
jmp 0x58e9e
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x58ba9
movl $0x0, -0xac(%rbp)
movl -0xac(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x58ff4
cmpl $0x0, -0x14(%rbp)
jne 0x58f58
movq -0x10(%rbp), %rdi
movl -0xac(%rbp), %esi
callq 0x45750
movq %rax, -0x120(%rbp)
jmp 0x58eed
movslq -0xac(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0xa180
movq -0x120(%rbp), %rdi
movq %rax, %rsi
callq 0x45780
movq %rax, -0x128(%rbp)
jmp 0x58f15
movq -0x128(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x138(%rbp)
movq -0x10(%rbp), %rdi
movl -0xac(%rbp), %esi
callq 0x45750
movq %rax, -0x130(%rbp)
jmp 0x58f40
movq -0x130(%rbp), %rax
movsd -0x138(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x58fde
cmpl $0x1, -0x14(%rbp)
jne 0x58fdc
movq -0x10(%rbp), %rdi
movl -0xac(%rbp), %esi
callq 0x456b0
movq %rax, -0x140(%rbp)
jmp 0x58f76
movslq -0xac(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0xa180
movq -0x140(%rbp), %rdi
movq %rax, %rsi
callq 0x45780
movq %rax, -0x148(%rbp)
jmp 0x58f9e
movq -0x148(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x158(%rbp)
movq -0x10(%rbp), %rdi
movl -0xac(%rbp), %esi
callq 0x456b0
movq %rax, -0x150(%rbp)
jmp 0x58fc9
movq -0x150(%rbp), %rax
movsd -0x158(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x58fde
jmp 0x58fe0
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x58ebc
cmpl $0x0, -0x14(%rbp)
jne 0x590aa
movl $0x0, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x590a8
movq -0x10(%rbp), %rdi
movl -0xb0(%rbp), %esi
callq 0x45750
movq %rax, -0x160(%rbp)
jmp 0x5902f
movq -0x160(%rbp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x59092
movq -0x20(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x10(%rbp), %rdi
callq 0x45920
movl %eax, -0x164(%rbp)
jmp 0x5905f
movq -0x10(%rbp), %rdi
callq 0x45940
movl %eax, -0x174(%rbp)
jmp 0x59070
movl -0x174(%rbp), %edx
movl -0x164(%rbp), %esi
movq -0x170(%rbp), %rdi
movl -0xb0(%rbp), %ecx
callq 0x40140
jmp 0x59090
jmp 0x59092
jmp 0x59094
movl -0xb0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb0(%rbp)
jmp 0x59008
jmp 0x590aa
movq -0x10(%rbp), %rdi
movsd 0x370b2(%rip), %xmm0    # 0x90168
xorps %xmm2, %xmm2
movaps %xmm2, %xmm1
callq 0x79cf0
jmp 0x590c3
leaq -0x60(%rbp), %rdi
callq 0xd760
leaq -0x48(%rbp), %rdi
callq 0xd760
movb $0x1, %al
andb $0x1, %al
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x4650
nopl (%rax,%rax)