// File: /workspace/github_cpp_makefile_star2_O3/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 %rsi, 0x30(%rsp)
movq 0x48(%rsi), %r14
movq %rsi, 0x28(%rsp)
subq 0x40(%rsi), %r14
movq %rdi, %rbx
shrq $0x3, %r14
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %r14d, %r14d
jle 0x2c113
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movb $0x1, %r12b
xorl %ecx, %ecx
movl $0x0, 0xc(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movq %r14, %r15
movl %r12d, %ebp
movq 0x28(%rsp), %rax
movq 0x40(%rax), %rax
movq %rcx, 0x10(%rsp)
movq (%rax,%rcx,8), %r13
movq 0x60(%r13), %rdx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2b9fe
movl %eax, %r12d
andb %bpl, %r12b
movq 0x70(%r13), %r14
subq 0x68(%r13), %r14
shrq $0x3, %r14
testl %r14d, %r14d
jle 0x2bd4f
xorl %ebp, %ebp
movq %r13, %rdi
movl %ebp, %esi
callq 0x4cae0
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x2b9fe
andb %al, %r12b
incl %ebp
cmpl %ebp, %r14d
jne 0x2bd2d
movq 0x60(%r13), %rax
testq %rax, %rax
je 0x2bf6f
movq 0x20(%rax), %rbp
testq %rbp, %rbp
movq %r15, %r14
je 0x2bf77
testb $0x1, 0x18(%rsp)
je 0x2be6d
testb $0x1, 0x20(%rsp)
jne 0x2be6d
movl $0x6, %edx
movq 0x6125a(%rip), %r15     # 0x8cfe8
movq %r15, %rdi
leaq 0x362bb(%rip), %rsi     # 0x62053
callq 0xf420
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %r15, %rdi
callq 0xf420
movq %rax, %r12
movl $0x17, %edx
movq %rax, %rdi
leaq 0x36206(%rip), %rsi     # 0x61fca
callq 0xf420
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0xf340
movsbl %al, %esi
movq %r12, %rdi
callq 0xf040
movq %rax, %rdi
callq 0xf260
movl $0x1d, %edx
movq %r15, %rdi
leaq 0x361e2(%rip), %rsi     # 0x61fe2
callq 0xf420
movq (%r15), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%r15,%rax)
movl 0x90(%r13), %esi
movq %r15, %rdi
callq 0xf6e0
movq %rax, %r12
movl $0x17, %edx
movq %rax, %rdi
leaq 0x361c3(%rip), %rsi     # 0x62000
callq 0xf420
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0xf340
movsbl %al, %esi
movq %r12, %rdi
callq 0xf040
movq %rax, %rdi
callq 0xf260
xorl %r12d, %r12d
addq $0x20, %rbp
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x2a106
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
cmovel %eax, %ecx
movb $0x1, %dl
movq %rdx, 0x20(%rsp)
testl %eax, %eax
movl %ecx, 0xc(%rsp)
je 0x2c083
cmpl %ecx, %eax
je 0x2c083
movl $0x6, %edx
movq 0x61139(%rip), %r15     # 0x8cfe8
movq %r15, %rdi
leaq 0x3619a(%rip), %rsi     # 0x62053
callq 0xf420
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %r15, %rdi
callq 0xf420
movq %rax, %r12
movl $0x1e, %edx
movq %rax, %rdi
leaq 0x36133(%rip), %rsi     # 0x62018
callq 0xf420
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0xf340
movsbl %al, %esi
movq %r12, %rdi
callq 0xf040
movq %rax, %rdi
callq 0xf260
movl $0x1d, %edx
movq %r15, %rdi
leaq 0x360c1(%rip), %rsi     # 0x61fe2
callq 0xf420
movq (%r15), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%r15,%rax)
movl 0x90(%r13), %esi
movq %r15, %rdi
callq 0xf6e0
movq %rax, %r12
movl $0x12, %edx
movq %rax, %rdi
leaq 0x360d9(%rip), %rsi     # 0x62037
callq 0xf420
movb $0x1, %al
movq %rax, 0x20(%rsp)
jmp 0x2c058
movq %r15, %r14
jmp 0x2c083
testb $0x1, 0x20(%rsp)
je 0x2bf85
testb $0x1, 0x18(%rsp)
je 0x2bf91
movb $0x1, %al
movq %rax, 0x18(%rsp)
jmp 0x2c083
movl $0x6, %edx
movq 0x6104b(%rip), %r15     # 0x8cfe8
movq %r15, %rdi
leaq 0x360ac(%rip), %rsi     # 0x62053
callq 0xf420
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %r15, %rdi
callq 0xf420
movq %rax, %r12
movl $0x17, %edx
movq %rax, %rdi
leaq 0x35ff7(%rip), %rsi     # 0x61fca
callq 0xf420
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0xf340
movsbl %al, %esi
movq %r12, %rdi
callq 0xf040
movq %rax, %rdi
callq 0xf260
movl $0x1d, %edx
movq %r15, %rdi
leaq 0x35fd3(%rip), %rsi     # 0x61fe2
callq 0xf420
movq (%r15), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%r15,%rax)
movl 0x90(%r13), %esi
movq %r15, %rdi
callq 0xf6e0
movq %rax, %r12
movl $0x17, %edx
movq %rax, %rdi
leaq 0x35fb4(%rip), %rsi     # 0x62000
callq 0xf420
movb $0x1, %al
movq %rax, 0x18(%rsp)
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0xf340
movsbl %al, %esi
movq %r12, %rdi
callq 0xf040
movq %rax, %rdi
callq 0xf260
xorl %r12d, %r12d
movq 0x10(%rsp), %rcx
incq %rcx
cmpq %r14, %rcx
jne 0x2bced
testb $0x1, 0x20(%rsp)
je 0x2c118
movl 0xc(%rsp), %ebp
testl %ebp, %ebp
jne 0x2c11d
movq 0x60f3e(%rip), %r13     # 0x8cfe8
leaq 0x35f99(%rip), %rsi     # 0x6204a
movl $0xf, %edx
movq %r13, %rdi
callq 0xf420
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %r13, %rdi
callq 0xf420
movq %rax, %r14
leaq 0x35f7d(%rip), %rsi     # 0x6205a
movl $0xf, %edx
movq %rax, %rdi
callq 0xf420
movq (%r14), %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
jmp 0x2c11d
movb $0x1, %r12b
jmp 0x2c11d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
addq $0x30, %rbx
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x3423a
movl %ebp, (%rax)
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq