// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/slghsymbol.cc
// Function: DecisionNode::split(DecisionProperties&)
void DecisionNode::split(DecisionProperties &props)

{
  if (list.size() <= 1) {
    bitsize = 0;		// Only one pattern, terminal node by default
    return;
  }

  chooseOptimalField();
  if (bitsize == 0) {
    orderPatterns(props);
    return;
  }
  if ((parent != (DecisionNode *)0) && (list.size() >= parent->num))
    throw LowlevelError("Child has as many Patterns as parent");

  int4 numChildren = 1 << bitsize;

  for(int4 i=0;i<numChildren;++i) {
    DecisionNode *nd = new DecisionNode( this );
    children.push_back( nd );
  }
  for(int4 i=0;i<list.size();++i) {
    vector<uint4> vals;		// Bins this pattern belongs in
				// If the pattern does not care about some
				// bits in the field we are splitting on, that
				// pattern will get put into multiple bins
    consistentValues(vals,list[i].first);
    for(int4 j=0;j<vals.size();++j)
      children[vals[j]]->addConstructorPair(list[i].first,list[i].second);
    delete list[i].first;	// We no longer need original pattern
  }
  list.clear();

  for(int4 i=0;i<numChildren;++i)
    children[i]->split(props);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r14
movq 0x8(%rdi), %rax
subq (%rdi), %rax
cmpq $0x10, %rax
ja 0x6c365
movl $0x0, 0x3c(%r14)
jmp 0x6c50d
movq %rsi, %rbx
movq %r14, %rdi
callq 0x40a10
movl 0x3c(%r14), %ecx
testl %ecx, %ecx
je 0x6c51c
movq 0x40(%r14), %rax
testq %rax, %rax
je 0x6c39d
movq 0x8(%r14), %rdx
subq (%r14), %rdx
sarq $0x4, %rdx
movslq 0x30(%rax), %rax
cmpq %rax, %rdx
jae 0x6c535
movl $0x1, %ebp
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0xc(%rsp)
movl %ecx, 0x34(%rsp)
cmpl $0x1f, %ecx
je 0x6c409
leaq 0x18(%r14), %r15
movl 0xc(%rsp), %eax
cmpl $0x2, %eax
cmovgel %eax, %ebp
leaq 0x10(%rsp), %r12
movl $0x48, %edi
callq 0x40800
movq %rax, %r13
movq %rax, %rdi
movq %r14, %rsi
callq 0x40c80
movq %r13, 0x10(%rsp)
movq 0x20(%r14), %rsi
cmpq 0x28(%r14), %rsi
je 0x6c3fa
movq %r13, (%rsi)
addq $0x8, 0x20(%r14)
jmp 0x6c405
movq %r15, %rdi
movq %r12, %rdx
callq 0x3f930
decl %ebp
jne 0x6c3c9
movq (%r14), %rax
movq 0x8(%r14), %rcx
cmpq %rax, %rcx
je 0x6c4d1
xorl %r12d, %r12d
leaq 0x10(%rsp), %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq %r12, %r13
shlq $0x4, %r13
movq (%rax,%r13), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x40ff0
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x6c48b
xorl %ebp, %ebp
movl (%rax,%rbp,4), %eax
movq (%r14), %rcx
movq 0x18(%r14), %rdx
movq (%rdx,%rax,8), %rdi
movq (%rcx,%r13), %rsi
movq 0x8(%rcx,%r13), %rdx
callq 0x3f3f0
incq %rbp
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbp, %rcx
ja 0x6c456
movq (%r14), %rax
movq (%rax,%r13), %rdi
testq %rdi, %rdi
je 0x6c49d
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6c4b4
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x40870
incq %r12
movq (%r14), %rax
movq 0x8(%r14), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x4, %rdx
cmpq %r12, %rdx
ja 0x6c421
cmpq %rax, %rcx
je 0x6c4da
movq %rax, 0x8(%r14)
cmpl $0x1f, 0x34(%rsp)
je 0x6c50d
movl 0xc(%rsp), %eax
cmpl $0x2, %eax
movl $0x1, %r15d
cmovgel %eax, %r15d
xorl %r12d, %r12d
movq 0x18(%r14), %rax
movq (%rax,%r12,8), %rdi
movq %rbx, %rsi
callq 0x40200
incq %r12
cmpq %r12, %r15
jne 0x6c4f5
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movq %rbx, %rsi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x41570
movl $0x20, %edi
callq 0x3fb00
movq %rax, %rbx
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x15191(%rip), %rsi     # 0x816e3
leaq 0x151ae(%rip), %rdx     # 0x81707
leaq 0x10(%rsp), %rdi
callq 0x3f8a0
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x3f890
xorl %ebp, %ebp
movq 0x3692c(%rip), %rsi     # 0xa2ea8
movq 0x366b5(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d60
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x6c5ad
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x40870
jmp 0x6c5ad
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x6c5e5
movq %rbx, %rdi
callq 0x40080
jmp 0x6c5e5
movq %rax, %r14
movl $0x48, %esi
movq %r13, %rdi
jmp 0x6c5e0
jmp 0x6c5cb
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6c5e5
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x40870
movq %r14, %rdi
callq 0x41f00
nop