// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/slgh_compile.cc
// Function: SleighCompile::finalizeSections(Constructor*, SectionVector*)
bool SleighCompile::finalizeSections(Constructor *big,SectionVector *vec)

{ // Do all final checks, expansions, and linking for p-code sections
  vector<string> errors;

  RtlPair cur = vec->getMainPair();
  int4 i=-1;
  string sectionstring = "   Main section: ";
  int4 max = vec->getMaxId();
  for(;;) {
    string errstring;

    errstring = checkSymbols(cur.scope); // Check labels in the section's scope
    if (errstring.size()==0) {
      if (!expandMacros(cur.section,macrotable))
	errors.push_back(sectionstring + "Could not expand macros");
      vector<int4> check;
      big->markSubtableOperands(check);
      int4 res = cur.section->fillinBuild(check,getConstantSpace());
      if (res == 1)
	errors.push_back(sectionstring + "Duplicate BUILD statements");
      if (res == 2)
	errors.push_back(sectionstring + "Unnecessary BUILD statements");
  
      if (!PcodeCompile::propagateSize(cur.section))
	errors.push_back(sectionstring + "Could not resolve at least 1 variable size");
    }
    if (i < 0) {		// These potential errors only apply to main section
      if (cur.section->getResult() != (HandleTpl *)0) {	// If there is an export statement
	if (big->getParent()==root)
	  errors.push_back("   Cannot have export statement in root constructor");
	else if (!force_exportsize(cur.section))
	  errors.push_back("   Size of export is unknown");
      }
    }
    if (cur.section->delaySlot() != 0) { // Delay slot is present in this constructor
      if (root != big->getParent()) { // it is not in a root constructor
	reportWarning("Delay slot used in",false);
	cerr << "   ";
	big->printInfo(cerr);
	cerr << endl;
      }
      if (cur.section->delaySlot() > maxdelayslotbytes)	// Keep track of maximum delayslot parameter
	maxdelayslotbytes = cur.section->delaySlot();
    }
    do {
      i += 1;
      if (i >= max) break;
      cur = vec->getNamedPair(i);
    } while(cur.section == (ConstructTpl *)0);
      
    if (i >= max) break;
    SectionSymbol *sym = sections[i];
    sectionstring = "   " + sym->getName() + " section: ";
  }
  if (!errors.empty()) {
    ostringstream s;
    s << "in ";
    big->printInfo(s);
    reportError(s.str(),false);
    for(int4 j=0;j<errors.size();++j)
      cerr << errors[j] << endl;
    return false;
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x8(%rdx), %rbp
movq 0x10(%rdx), %r12
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x307b3(%rip), %rsi     # 0x626da
leaq 0x307bd(%rip), %rdx     # 0x626eb
leaq 0x30(%rsp), %rdi
callq 0x1183c
movq 0x20(%r14), %rax
movq %r14, 0xb8(%rsp)
subq 0x18(%r14), %rax
shrq $0x4, %rax
movq %rbx, 0x28(%rsp)
leaq 0x258(%rbx), %rcx
movq %rcx, 0xb0(%rsp)
movq %rax, 0x98(%rsp)
cltq
movl $0x1, %ecx
movq %rax, 0xa0(%rsp)
subq %rax, %rcx
movq %rcx, 0xa8(%rsp)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
leaq 0xd0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq $0x0, 0xc8(%rsp)
movb $0x0, 0xd0(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rdx
callq 0x2f144
leaq 0xc0(%rsp), %rdi
movq %rbx, %rsi
callq 0xf490
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x31fe8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
cmpq $0x0, 0xc8(%rsp)
jne 0x321f9
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
movq 0xb0(%rsp), %rdx
callq 0x31d26
testb %al, %al
jne 0x3206c
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x154be
movq %rbx, %rdi
leaq 0x306ae(%rip), %rsi     # 0x626ec
callq 0xf780
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x15792
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3206c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
movq %r13, %rdi
leaq 0x70(%rsp), %rbx
movq %rbx, %rsi
callq 0x4d1e4
movq 0x28(%rsp), %rax
movq 0x98(%rax), %rdx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x25052
movl %eax, %r15d
cmpl $0x2, %eax
je 0x3211b
cmpl $0x1, %r15d
jne 0x32177
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x154be
movq %rbx, %rdi
leaq 0x3061d(%rip), %rsi     # 0x62704
callq 0xf780
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x15792
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x32115
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
cmpl $0x2, %r15d
jne 0x32177
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x154be
movq %rbx, %rdi
leaq 0x305d6(%rip), %rsi     # 0x6271f
callq 0xf780
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x15792
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x32177
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movq %rbp, %rdi
callq 0x1e430
testb %al, %al
jne 0x321df
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x154be
movq %rbx, %rdi
leaq 0x2ee19(%rip), %rsi     # 0x60fca
callq 0xf780
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x15792
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x321df
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x321f9
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0xf380
testl %r14d, %r14d
js 0x3236b
cmpl $0x0, (%rbp)
je 0x322e6
movq 0x28(%rsp), %rax
movq 0x190(%rax), %rax
cmpq 0x8(%r13), %rax
je 0x322cb
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x30552(%rip), %rsi     # 0x6278d
leaq 0x3055d(%rip), %rdx     # 0x6279f
callq 0x1183c
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2e85a
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x32272
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movl $0x3, %edx
movq 0x5ad6a(%rip), %rdi     # 0x8cfe8
leaq 0x37e8d(%rip), %rsi     # 0x6a112
callq 0xf420
movq %r13, %rdi
movq 0x5ad54(%rip), %rsi     # 0x8cfe8
callq 0x4eac2
movq 0x5ad48(%rip), %rcx     # 0x8cfe8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0xf340
movsbl %al, %esi
movq 0x5ad2a(%rip), %rdi     # 0x8cfe8
callq 0xf040
movq %rax, %rdi
callq 0xf260
movl (%rbp), %eax
movq 0x28(%rsp), %rcx
cmpl 0x1d0(%rcx), %eax
jbe 0x322e6
movq 0x28(%rsp), %rcx
movl %eax, 0x1d0(%rcx)
incl %r14d
cmpl 0x98(%rsp), %r14d
setl %r15b
jge 0x3242f
movq 0xb8(%rsp), %rax
movq 0x18(%rax), %rcx
movslq %r14d, %rax
movq %rax, %rdx
shlq $0x4, %rdx
movq (%rcx,%rdx), %rbp
movq 0x8(%rcx,%rdx), %r12
testq %rbp, %rbp
jne 0x3242f
addq %rcx, %rdx
addq $0x18, %rdx
movq 0xa8(%rsp), %rcx
leaq (%rcx,%rax), %rsi
xorl %ecx, %ecx
cmpq %rcx, %rsi
je 0x3241f
movq -0x8(%rdx), %rbp
movq (%rdx), %r12
decq %rcx
addq $0x10, %rdx
testq %rbp, %rbp
je 0x32338
subq %rcx, %rax
cmpq 0xa0(%rsp), %rax
setl %r15b
subl %ecx, %r14d
jmp 0x3242f
movq 0x20(%rbp), %r15
testq %r15, %r15
je 0x32202
movq 0x8(%r13), %rax
movq 0x28(%rsp), %rcx
cmpq 0x190(%rcx), %rax
je 0x3253b
leaq 0x40(%r15), %rdi
callq 0x234bc
testb %al, %al
je 0x323ca
cmpl $0x0, 0x80(%r15)
jne 0x323ca
cmpq $0x0, 0x90(%r15)
jne 0x323ca
leaq 0x60(%r15), %rdi
movq %rbp, %rsi
callq 0x34528
testq %rax, %rax
je 0x3256f
subq $-0x80, %r15
jmp 0x32409
movq %r15, %rdi
callq 0x234bc
testb %al, %al
je 0x32202
cmpl $0x0, 0x20(%r15)
jne 0x32202
cmpq $0x0, 0x30(%r15)
jne 0x32202
leaq 0x60(%r15), %rdi
movq %rbp, %rsi
callq 0x34528
testq %rax, %rax
je 0x3256f
addq $0x20, %r15
movups 0x40(%rax), %xmm0
movups 0x4c(%rax), %xmm1
movups %xmm1, 0xc(%r15)
movups %xmm0, (%r15)
jmp 0x32202
xorl %r15d, %r15d
movq 0x98(%rsp), %rax
movl %eax, %r14d
xorl %ebp, %ebp
testb %r15b, %r15b
je 0x32508
movq %r13, %rbx
movslq %r14d, %rax
movq 0x28(%rsp), %rcx
movq 0x2a0(%rcx), %rcx
movq (%rcx,%rax,8), %rdx
addq $0x8, %rdx
leaq 0x70(%rsp), %r13
movq %r13, %rdi
leaq 0x37cb1(%rip), %rsi     # 0x6a112
callq 0x11754
movq %r13, %rdi
leaq 0x30271(%rip), %rsi     # 0x626e1
callq 0xf780
leaq 0x18(%rsp), %r13
movq %r13, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3249d
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x324a5
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xf490
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x324e3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
movq %rbx, %r13
je 0x32508
movq 0x80(%rsp), %rsi
incq %rsi
callq 0xf380
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x3252d
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0xf380
testb %r15b, %r15b
jne 0x31f88
jmp 0x325c6
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x301e8(%rip), %rsi     # 0x6273c
leaq 0x30214(%rip), %rdx     # 0x6276f
callq 0x1183c
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x15792
jmp 0x325a1
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x301e8(%rip), %rsi     # 0x62770
leaq 0x301fd(%rip), %rdx     # 0x6278c
callq 0x1183c
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x15792
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x32202
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
jmp 0x32202
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %r12
cmpq %r12, %r15
je 0x326e2
leaq 0xc0(%rsp), %rdi
callq 0xf530
leaq 0x3060c(%rip), %rsi     # 0x62bf9
leaq 0xc0(%rsp), %rdi
movl $0x3, %edx
callq 0xf420
leaq 0x18(%rsp), %r14
leaq 0xc0(%rsp), %rsi
movq %r13, %rdi
callq 0x4eac2
leaq 0xc8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0xf640
leaq 0x8(%rsp), %rsi
movq 0x28(%rsp), %rdi
xorl %edx, %edx
callq 0x2d276
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3264e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movq 0x50(%rsp), %rax
cmpq %rax, 0x58(%rsp)
je 0x326c1
movl $0x8, %r13d
xorl %ebp, %ebp
movq 0x5a97f(%rip), %rbx     # 0x8cfe8
movq -0x8(%rax,%r13), %rsi
movq (%rax,%r13), %rdx
movq %rbx, %rdi
callq 0xf420
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0xf340
movsbl %al, %esi
movq %r14, %rdi
callq 0xf040
movq %rax, %rdi
callq 0xf260
incq %rbp
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
addq $0x20, %r13
cmpq %rbp, %rcx
ja 0x32669
movq 0x5a8f0(%rip), %rsi     # 0x8cfb8
leaq 0xc0(%rsp), %rdi
callq 0xf1e0
leaq 0x130(%rsp), %rdi
callq 0xf150
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x326fe
movq 0x40(%rsp), %rsi
incq %rsi
callq 0xf380
cmpq %r12, %r15
sete %bl
leaq 0x50(%rsp), %rdi
callq 0x13962
movl %ebx, %eax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3280c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
jmp 0x3280c
jmp 0x32809
movq %rax, %rbx
jmp 0x3282d
jmp 0x327a9
jmp 0x32834
movq %rax, %rbx
jmp 0x32878
jmp 0x32809
jmp 0x327a9
jmp 0x32834
jmp 0x32784
jmp 0x32784
jmp 0x327e8
jmp 0x327a9
jmp 0x32784
jmp 0x327a9
jmp 0x32784
jmp 0x32834
jmp 0x327e8
jmp 0x32784
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x327eb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
jmp 0x327eb
jmp 0x327e8
jmp 0x327e8
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x32837
movq 0x18(%rsp), %rsi
jmp 0x327e3
jmp 0x32834
jmp 0x32834
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x32837
movq 0x80(%rsp), %rsi
incq %rsi
jmp 0x32800
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x32837
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0xf380
jmp 0x32837
jmp 0x32834
movq %rax, %rbx
movq 0x5a7a5(%rip), %rsi     # 0x8cfb8
leaq 0xc0(%rsp), %rdi
callq 0xf1e0
leaq 0x130(%rsp), %rdi
callq 0xf150
leaq 0x40(%rsp), %r14
jmp 0x32861
movq %rax, %rbx
leaq 0x40(%rsp), %r14
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x32861
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0xf380
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x32878
movq 0x40(%rsp), %rsi
incq %rsi
callq 0xf380
leaq 0x50(%rsp), %rdi
callq 0x13962
movq %rbx, %rdi
callq 0xf730