// File: /workspace/github_cpp_makefile_star2_O3/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 0x6c085
movl $0x0, 0x3c(%r14)
jmp 0x6c230
movq %rsi, %rbx
movq %r14, %rdi
callq 0x40a20
movl 0x3c(%r14), %ecx
testl %ecx, %ecx
je 0x6c23f
movq 0x40(%r14), %rax
testq %rax, %rax
je 0x6c0bd
movq 0x8(%r14), %rdx
subq (%r14), %rdx
sarq $0x4, %rdx
movslq 0x30(%rax), %rax
cmpq %rax, %rdx
jae 0x6c258
movl $0x1, %ebp
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0xc(%rsp)
movl %ecx, 0x34(%rsp)
cmpl $0x1f, %ecx
je 0x6c129
leaq 0x18(%r14), %r15
movl 0xc(%rsp), %eax
cmpl $0x2, %eax
cmovgel %eax, %ebp
leaq 0x10(%rsp), %r12
movl $0x48, %edi
callq 0x40810
movq %rax, %r13
movq %rax, %rdi
movq %r14, %rsi
callq 0x40c90
movq %r13, 0x10(%rsp)
movq 0x20(%r14), %rsi
cmpq 0x28(%r14), %rsi
je 0x6c11a
movq %r13, (%rsi)
addq $0x8, 0x20(%r14)
jmp 0x6c125
movq %r15, %rdi
movq %r12, %rdx
callq 0x3f930
decl %ebp
jne 0x6c0e9
movq (%r14), %rax
movq 0x8(%r14), %rcx
cmpq %rax, %rcx
je 0x6c1f4
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 0x41000
movq 0x10(%rsp), %rdi
cmpq %rdi, 0x18(%rsp)
je 0x6c1ab
xorl %ebp, %ebp
movl (%rdi,%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), %rdi
movq 0x18(%rsp), %rax
subq %rdi, %rax
sarq $0x2, %rax
cmpq %rbp, %rax
ja 0x6c176
movq (%r14), %rax
movq (%rax,%r13), %rax
testq %rax, %rax
je 0x6c1c5
movq (%rax), %rcx
movq %rax, %rdi
callq *0x8(%rcx)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6c1d7
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x40880
incq %r12
movq (%r14), %rax
movq 0x8(%r14), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x4, %rdx
cmpq %r12, %rdx
ja 0x6c141
cmpq %rax, %rcx
je 0x6c1fd
movq %rax, 0x8(%r14)
cmpl $0x1f, 0x34(%rsp)
je 0x6c230
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 0x40210
incq %r12
cmpq %r12, %r15
jne 0x6c218
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 0x41580
movl $0x20, %edi
callq 0x3fb00
movq %rax, %rbx
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1546e(%rip), %rsi     # 0x816e3
leaq 0x1548b(%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 0x36c09(%rip), %rsi     # 0xa2ea8
movq 0x36992(%rip), %rdx     # 0xa2c38
movq %rbx, %rdi
callq 0x41d70
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x6c2c8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x40880
testb %bpl, %bpl
jne 0x6c2d2
jmp 0x6c305
movq %rax, %r14
movq %rbx, %rdi
callq 0x40090
jmp 0x6c305
movq %rax, %r14
movl $0x48, %esi
movq %r13, %rdi
jmp 0x6c300
jmp 0x6c2eb
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6c305
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x40880
movq %r14, %rdi
callq 0x41f10
nop