// File: /workspace/github_cpp_makefile_star2_O3/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, %rbp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x8(%rdx), %r12
movq 0x10(%rdx), %rax
movq %rax, 0x70(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x30af0(%rip), %rsi     # 0x6272a
leaq 0x30afa(%rip), %rdx     # 0x6273b
leaq 0x30(%rsp), %rdi
callq 0x117f6
movq 0x20(%r14), %rax
movq %r14, 0xb8(%rsp)
subq 0x18(%r14), %rax
shrq $0x4, %rax
leaq 0x18(%rsp), %r15
movq %rbx, 0x28(%rsp)
leaq 0x258(%rbx), %rcx
movq %rcx, 0xb0(%rsp)
movq %rax, 0xa8(%rsp)
cltq
movl $0x2, %ecx
movq %rax, 0xa0(%rsp)
subl %eax, %ecx
movl %ecx, 0x7c(%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 0x70(%rsp), %rdx
callq 0x2ee9c
leaq 0xc0(%rsp), %rdi
movq %rbx, %rsi
callq 0xf490
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x31cf8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movq %r15, %r13
cmpq $0x0, 0xc8(%rsp)
jne 0x31ed1
movq 0x28(%rsp), %rdi
movq %r12, %rsi
movq 0xb0(%rsp), %rdx
callq 0x31a42
testb %al, %al
movq %r13, %r15
jne 0x31d78
movq %r15, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x15420
movq %rbx, %rdi
leaq 0x309ed(%rip), %rsi     # 0x6273c
callq 0xf780
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x156c2
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x31d78
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
movq %rbp, %rdi
leaq 0x80(%rsp), %rbx
movq %rbx, %rsi
callq 0x4cd7c
movq 0x28(%rsp), %rax
movq 0x98(%rax), %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x24f06
cmpl $0x2, %eax
je 0x31e04
cmpl $0x1, %eax
jne 0x31e56
movq %r15, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x15420
movq %rbx, %rdi
leaq 0x30964(%rip), %rsi     # 0x62754
callq 0xf780
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x156c2
jmp 0x31e3f
movq %r15, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x15420
movq %rbx, %rdi
leaq 0x30942(%rip), %rsi     # 0x6276f
callq 0xf780
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x156c2
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x31e56
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movq %r12, %rdi
callq 0x1e500
testb %al, %al
jne 0x31eb4
movq %r15, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x15420
movq %rbx, %rdi
leaq 0x2f18f(%rip), %rsi     # 0x6101a
callq 0xf780
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x156c2
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x31eb4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x31ed1
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0xf380
testl %r14d, %r14d
js 0x320ad
movl (%r12), %eax
testl %eax, %eax
je 0x31fba
movq 0x28(%rsp), %rcx
movq 0x190(%rcx), %rcx
cmpq 0x8(%rbp), %rcx
je 0x31fa2
movq %r13, %r15
movq %r13, 0x8(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x308ca(%rip), %rsi     # 0x627dd
leaq 0x308d5(%rip), %rdx     # 0x627ef
callq 0x117f6
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2e5f0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x31f45
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movl $0x3, %edx
movq 0x5b097(%rip), %rdi     # 0x8cfe8
leaq 0x3821a(%rip), %rsi     # 0x6a172
callq 0xf420
movq %rbp, %rdi
movq 0x5b081(%rip), %rsi     # 0x8cfe8
callq 0x4e696
movq 0x5b075(%rip), %rcx     # 0x8cfe8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0xf340
movsbl %al, %esi
movq 0x5b057(%rip), %rdi     # 0x8cfe8
callq 0xf040
movq %rax, %rdi
callq 0xf260
movl (%r12), %eax
movq 0x28(%rsp), %rcx
cmpl 0x1d0(%rcx), %eax
jbe 0x31fba
movq 0x28(%rsp), %rcx
movl %eax, 0x1d0(%rcx)
leal 0x1(%r14), %eax
cmpl 0xa8(%rsp), %eax
jge 0x320a2
movq %rbp, %rbx
movq 0xb8(%rsp), %rcx
movq 0x18(%rcx), %rcx
cltq
movq %rax, %rdx
shlq $0x4, %rdx
movq (%rcx,%rdx), %r12
movb $0x1, %r15b
testq %r12, %r12
leaq 0x80(%rsp), %rbp
jne 0x3202c
addq %rcx, %rdx
addq $0x10, %rdx
addl 0x7c(%rsp), %r14d
xorl %esi, %esi
cmpl %esi, %r14d
je 0x321e4
movq (%rdx), %r12
addq $0x10, %rdx
decq %rsi
testq %r12, %r12
je 0x32005
subq %rsi, %rax
cmpq 0xa0(%rsp), %rax
setl %r15b
movq %rax, %rdx
shlq $0x4, %rdx
movq 0x8(%rcx,%rdx), %rcx
movq %rcx, 0x70(%rsp)
movl %eax, %r14d
movq 0x28(%rsp), %rax
movq 0x2a0(%rax), %rax
movslq %r14d, %rcx
movq (%rax,%rcx,8), %rdx
addq $0x8, %rdx
movq %rbp, %rdi
leaq 0x38111(%rip), %rsi     # 0x6a172
callq 0x1170e
movq %rbp, %rdi
leaq 0x306c1(%rip), %rsi     # 0x62731
callq 0xf780
movq %r13, %rbp
movq %r13, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3211c
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x32123
xorl %r15d, %r15d
movl %eax, %r14d
jmp 0x3220d
movq 0x20(%r12), %r15
testq %r15, %r15
je 0x31eda
movq 0x8(%rbp), %rax
movq 0x28(%rsp), %rcx
cmpq 0x190(%rcx), %rax
je 0x32243
leaq 0x40(%r15), %rdi
callq 0x233c4
testb %al, %al
je 0x3218f
cmpl $0x0, 0x80(%r15)
jne 0x3218f
cmpq $0x0, 0x90(%r15)
jne 0x3218f
leaq 0x60(%r15), %rdi
movq %r12, %rsi
callq 0x34170
testq %rax, %rax
je 0x32275
subq $-0x80, %r15
jmp 0x321ce
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
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 %rbp, %rdi
je 0x32161
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
movq %rbx, %rbp
je 0x3220d
movq 0x90(%rsp), %rsi
incq %rsi
callq 0xf380
jmp 0x3220d
movq %r15, %rdi
callq 0x233c4
testb %al, %al
je 0x31eda
cmpl $0x0, 0x20(%r15)
jne 0x31eda
cmpq $0x0, 0x30(%r15)
jne 0x31eda
leaq 0x60(%r15), %rdi
movq %r12, %rsi
callq 0x34170
testq %rax, %rax
je 0x32275
addq $0x20, %r15
movups 0x40(%rax), %xmm0
movups 0x4c(%rax), %xmm1
movups %xmm1, 0xc(%r15)
movups %xmm0, (%r15)
jmp 0x31eda
subq %rsi, %rax
incq %rax
cmpq 0xa0(%rsp), %rax
setl %r15b
movq -0x8(%rdx), %rax
movq %rax, 0x70(%rsp)
movq 0xa8(%rsp), %r14
xorl %r12d, %r12d
movq %rbx, %rbp
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x32232
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0xf380
testb %r15b, %r15b
movq %r13, %r15
jne 0x31c9b
jmp 0x322c5
movq %r13, %r15
movq %r13, 0x8(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x30532(%rip), %rsi     # 0x6278c
leaq 0x3055e(%rip), %rdx     # 0x627bf
callq 0x117f6
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x156c2
jmp 0x322a5
movq %r13, %r15
movq %r13, 0x8(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x30534(%rip), %rsi     # 0x627c0
leaq 0x30549(%rip), %rdx     # 0x627dc
callq 0x117f6
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x156c2
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x31eda
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
jmp 0x31eda
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %r12
cmpq %r12, %r15
je 0x323dc
leaq 0xc0(%rsp), %rdi
callq 0xf530
leaq 0x3095d(%rip), %rsi     # 0x62c49
leaq 0xc0(%rsp), %rdi
movl $0x3, %edx
callq 0xf420
leaq 0xc0(%rsp), %rsi
movq %rbp, %rdi
callq 0x4e696
leaq 0xc8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0xf640
leaq 0x8(%rsp), %rsi
movq 0x28(%rsp), %rdi
xorl %edx, %edx
callq 0x2d000
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x32348
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movq 0x50(%rsp), %rax
cmpq %rax, 0x58(%rsp)
je 0x323bb
movl $0x8, %r13d
xorl %ebp, %ebp
movq 0x5ac85(%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 0x32363
movq 0x5abf6(%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 0x323f8
movq 0x40(%rsp), %rsi
incq %rsi
callq 0xf380
cmpq %r12, %r15
sete %bl
leaq 0x50(%rsp), %rdi
callq 0x138c4
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 %r13, %rdi
je 0x32506
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
jmp 0x32506
jmp 0x32503
movq %rax, %rbx
jmp 0x32527
jmp 0x3249e
jmp 0x3252e
movq %rax, %rbx
jmp 0x32572
jmp 0x32503
jmp 0x3249e
jmp 0x3252e
jmp 0x3247e
jmp 0x3247e
jmp 0x324df
jmp 0x3247e
jmp 0x3247e
jmp 0x324df
jmp 0x3249e
jmp 0x3249e
jmp 0x3247e
jmp 0x3252e
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x324e2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
jmp 0x324e2
jmp 0x324df
jmp 0x324df
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x32531
movq 0x18(%rsp), %rsi
jmp 0x324d8
jmp 0x3252e
movq %rax, %rbx
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x32531
movq 0x90(%rsp), %rsi
incq %rsi
jmp 0x324fa
jmp 0x3252e
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x32531
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0xf380
jmp 0x32531
jmp 0x3252e
movq %rax, %rbx
movq 0x5aaab(%rip), %rsi     # 0x8cfb8
leaq 0xc0(%rsp), %rdi
callq 0xf1e0
leaq 0x130(%rsp), %rdi
callq 0xf150
leaq 0x40(%rsp), %r14
jmp 0x3255b
movq %rax, %rbx
leaq 0x40(%rsp), %r14
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x3255b
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0xf380
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x32572
movq 0x40(%rsp), %rsi
incq %rsi
callq 0xf380
leaq 0x50(%rsp), %rdi
callq 0x138c4
movq %rbx, %rdi
callq 0xf730