// File: /workspace/github_cpp_makefile_star2_O2/jstaursky[P]hutch/src/Sleigh/slgh_compile.cc
// Function: ConsistencyChecker::checkSubtable(SubtableSymbol*)
bool ConsistencyChecker::checkSubtable(SubtableSymbol *sym)

{
  int4 tablesize = 0;
  int4 numconstruct = sym->getNumConstructors();
  Constructor *ct;
  bool testresult = true;
  bool seenemptyexport = false;
  bool seennonemptyexport = false;

  for(int4 i=0;i<numconstruct;++i) {
    ct = sym->getConstructor(i);
    if (!checkConstructorSection(ct,ct->getTempl()))
      testresult = false;
    int4 numsection = ct->getNumSections();
    for(int4 j=0;j<numsection;++j) {
      if (!checkConstructorSection(ct,ct->getNamedTempl(j)))
	testresult = false;
    }

    if (ct->getTempl() == (ConstructTpl *)0) continue;	// Unimplemented
    HandleTpl *exportres = ct->getTempl()->getResult();
    if (exportres != (HandleTpl *)0) {
      if (seenemptyexport && (!seennonemptyexport)) {
	cerr << "Table " << sym->getName() << " exports inconsistently" << endl;
	cerr << "Constructor starting at line " << dec << ct->getLineno() << " is first inconsistency" << endl;
	testresult = false;
      }
      seennonemptyexport = true;
      int4 exsize = recoverSize(exportres->getSize(),ct);
      if (tablesize == 0)
	tablesize = exsize;
      if ((exsize!=0)&&(exsize != tablesize)) {
	cerr << "Table " << sym->getName() << " has inconsistent export size." << endl;
	cerr << "Constructor starting at line " << dec << ct->getLineno() << " is first conflict" << endl;
	testresult = false;
      }
    }
    else {
      if (seennonemptyexport && (!seenemptyexport)) {
	cerr << "Table " << sym->getName() << " exports inconsistently" << endl;
	cerr << "Constructor starting at line " << dec << ct->getLineno() << " is first inconsistency" << endl;
	testresult = false;
      }
      seenemptyexport = true;
    }
  }
  if (seennonemptyexport) {
    if (tablesize == 0)
      cerr << "Warning: Table " << sym->getName() << " exports size 0" << endl;
    sizemap[sym] = tablesize;	// Remember recovered size
  }
  else
    sizemap[sym] = -1;
  
  return testresult;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq %rsi, 0x30(%rsp)
movq 0x48(%rsi), %rax
subq 0x40(%rsi), %rax
shrq $0x3, %rax
xorl %r15d, %r15d
testl %eax, %eax
cmovlel %r15d, %eax
movq %rax, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
leaq 0x8(%rsi), %rax
movq %rax, 0x18(%rsp)
movb $0x1, %r12b
movq $0x0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
cmpq 0x28(%rsp), %r15
je 0x28630
movq 0x20(%rsp), %rax
movq 0x40(%rax), %rax
movq (%rax,%r15,8), %r13
movq 0x60(%r13), %rdx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x28174
andb %r12b, %al
movq 0x70(%r13), %r14
subq 0x68(%r13), %r14
shrq $0x3, %r14
xorl %ebp, %ebp
testl %r14d, %r14d
cmovlel %ebp, %r14d
movl %eax, %r12d
cmpl %ebp, %r14d
je 0x28479
movq %r13, %rdi
movl %ebp, %esi
callq 0x4443a
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x28174
andb %al, %r12b
incl %ebp
jmp 0x28455
movq 0x60(%r13), %rax
testq %rax, %rax
je 0x28628
movq 0x20(%rax), %r14
testq %r14, %r14
je 0x28575
testb $0x1, 0x8(%rsp)
je 0x28530
testb $0x1, 0x10(%rsp)
jne 0x28530
movq 0x5fb40(%rip), %r12     # 0x87ff0
movq %r12, %rdi
leaq 0x2eb69(%rip), %rsi     # 0x57023
callq 0xf350
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0xf320
movq %rax, %rdi
leaq 0x2eac4(%rip), %rsi     # 0x56f9a
callq 0xf350
movq %rax, %rdi
callq 0xf1c0
movq %r12, %rdi
leaq 0x2eac5(%rip), %rsi     # 0x56fb2
callq 0xf350
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
movl 0x90(%r13), %esi
movq %rax, %rdi
callq 0xf6a0
movq %rax, %rdi
leaq 0x2eab0(%rip), %rsi     # 0x56fd0
callq 0xf350
movq %rax, %rdi
callq 0xf1c0
xorl %r12d, %r12d
addq $0x20, %r14
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x26c7e
movl 0x4(%rsp), %ecx
testl %ecx, %ecx
cmovel %eax, %ecx
movb $0x1, %dl
movq %rdx, 0x10(%rsp)
testl %eax, %eax
movl %ecx, 0x4(%rsp)
je 0x28628
leaq 0x2ea83(%rip), %rbp     # 0x56fe8
leaq 0x2ea9b(%rip), %r14     # 0x57007
cmpl %ecx, %eax
jne 0x285a0
jmp 0x28628
testb $0x1, 0x10(%rsp)
je 0x28621
leaq 0x2ea13(%rip), %rbp     # 0x56f9a
leaq 0x2ea42(%rip), %r14     # 0x56fd0
testb $0x1, 0x8(%rsp)
movb $0x1, %al
movq %rax, 0x8(%rsp)
jne 0x28628
movq 0x5fa49(%rip), %r12     # 0x87ff0
movq %r12, %rdi
leaq 0x2ea72(%rip), %rsi     # 0x57023
callq 0xf350
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0xf320
movq %rax, %rdi
movq %rbp, %rsi
callq 0xf350
movq %rax, %rdi
callq 0xf1c0
movq %r12, %rdi
leaq 0x2e9d2(%rip), %rsi     # 0x56fb2
callq 0xf350
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
movl 0x90(%r13), %esi
movq %rax, %rdi
callq 0xf6a0
movq %rax, %rdi
movq %r14, %rsi
callq 0xf350
movq %rax, %rdi
callq 0xf1c0
xorl %r12d, %r12d
jmp 0x28628
movb $0x1, %al
movq %rax, 0x8(%rsp)
incq %r15
jmp 0x28413
testb $0x1, 0x10(%rsp)
je 0x28678
movl 0x4(%rsp), %ebp
testl %ebp, %ebp
jne 0x2867b
movq 0x5f9aa(%rip), %rdi     # 0x87ff0
leaq 0x2e9cd(%rip), %rsi     # 0x5701a
callq 0xf350
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0xf320
leaq 0x2e9c4(%rip), %rsi     # 0x5702a
movq %rax, %rdi
callq 0xf350
movq %rax, %rdi
callq 0xf1c0
jmp 0x2867b
pushq $-0x1
popq %rbp
addq $0x30, %rbx
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x2ea26
movl %ebp, (%rax)
andb $0x1, %r12b
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq