// File: /workspace/github_c_makefile_star2_O0/taeguk[P]Compiler-Proj-Cminus/src/symtab.c
// Function: printSymTab
void printSymTab(FILE * listing)
{
  if(!TraceAnalyze) return;
  int i;
  fprintf(listing,
          "Name\t\tScope\tLoc\tV/P/F\tArray?\tArrSize\tType\tLine Numbers\n"
          "----------------------------------------------------------------------------\n");

  for (i=0;i<SIZE;++i)
    {
      BucketList l;

      // skip symbols in deeper scopes.
      for (l = hashTable[i]; 
           l && l->scope_level > cur_scope_level;
           l = l->next);

      for (; 
           l && l->scope_level == cur_scope_level; 
           l = l->next)
        {
          SymbolInfo* symbolInfo = l->symbolInfo;
          int is_arr, size_arr = 0;


          /* print name */
          fprintf(listing, "%-15s ", l->name);

          /* print scope */
          fprintf(listing, "%-8d", l->scope_level);

          /* print Memory Location */
          fprintf(listing, "%-6d  ", l->memloc);

          /* print ID Type, V/P/F = 0,1,2 */
          switch (symbolInfo->nodeType)
            {
            case IntT:
              if (symbolInfo->attr.intInfo.isParam)
                fprintf(listing, "%-8s", "Par");
              else
                fprintf(listing, "%-8s", "Var");

              fprintf(listing, "%-8s%-8c%-5s", "No", '-', "int");
              break;
            case IntArrayT:
              if (symbolInfo->attr.arrInfo.isParam)
                fprintf(listing, "%-8s", "Par");
              else
                fprintf(listing, "%-8s", "Var");

              fprintf(listing, "%-8s%-8d%-8s",
                      "Array", symbolInfo->attr.arrInfo.arrLen, "array");
              break;
            case FuncT: /* Function */
              fprintf(listing, "%-8s%-8s%-8c", "Func", "No", '-');
              if (symbolInfo->attr.funcInfo.retType == IntT)
                fprintf(listing, "%-5s", "int");
              else if (symbolInfo->attr.funcInfo.retType == VoidT)
                fprintf(listing, "%-5s", "void");
              else
                DONT_OCCUR_PRINT;
              break;
            default:
              DONT_OCCUR_PRINT;
              break;
            }

          /* line numbers */
          LineList t = l->lines;
          while (t != NULL)
            {
              fprintf(listing,"%8d",t->lineno);
              t = t->next;
            }
          fprintf(listing, "\n");
        }
    }
  fprintf(listing, "\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x7119(%rip), %rax      # 0xe11c
cmpl $0x0, (%rax)
jne 0x700d
jmp 0x72fe
movq -0x8(%rbp), %rdi
leaq 0x3a63(%rip), %rsi      # 0xaa7b
movb $0x0, %al
callq 0x1120
movl $0x0, -0xc(%rbp)
cmpl $0xd3, -0xc(%rbp)
jge 0x72ec
movslq -0xc(%rbp), %rcx
leaq 0x1ac02(%rip), %rax     # 0x21c40
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x18(%rbp)
movb %al, -0x31(%rbp)
je 0x7065
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
cmpl 0x71c1(%rip), %eax      # 0xe220
setg %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x706e
jmp 0x707e
jmp 0x7070
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x7046
jmp 0x7080
xorl %eax, %eax
cmpq $0x0, -0x18(%rbp)
movb %al, -0x32(%rbp)
je 0x709f
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
cmpl 0x7187(%rip), %eax      # 0xe220
sete %al
movb %al, -0x32(%rbp)
movb -0x32(%rbp), %al
testb $0x1, %al
jne 0x70ab
jmp 0x72dc
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq 0x3a30(%rip), %rsi      # 0xab00
xorl %eax, %eax
movb %al, -0x39(%rbp)
callq 0x1120
movb -0x39(%rbp), %al
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl 0x20(%rcx), %edx
leaq 0x3a18(%rip), %rsi      # 0xab07
callq 0x1120
movb -0x39(%rbp), %al
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl 0x24(%rcx), %edx
leaq 0x3a03(%rip), %rsi      # 0xab0c
callq 0x1120
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x38(%rbp)
subl $0x4, %eax
je 0x7139
jmp 0x711e
movl -0x38(%rbp), %eax
subl $0x5, %eax
je 0x71a1
jmp 0x7128
movl -0x38(%rbp), %eax
subl $0x6, %eax
je 0x7208
jmp 0x727e
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x715e
movq -0x8(%rbp), %rdi
leaq 0x39e9(%rip), %rsi      # 0xab37
leaq 0x39be(%rip), %rdx      # 0xab13
movb $0x0, %al
callq 0x1120
jmp 0x7177
movq -0x8(%rbp), %rdi
leaq 0x39ce(%rip), %rsi      # 0xab37
leaq 0x39a7(%rip), %rdx      # 0xab17
movb $0x0, %al
callq 0x1120
movq -0x8(%rbp), %rdi
leaq 0x3999(%rip), %rsi      # 0xab1b
leaq 0x399f(%rip), %rdx      # 0xab28
movl $0x2d, %ecx
leaq 0x3996(%rip), %r8       # 0xab2b
movb $0x0, %al
callq 0x1120
jmp 0x7280
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x71c6
movq -0x8(%rbp), %rdi
leaq 0x3981(%rip), %rsi      # 0xab37
leaq 0x3956(%rip), %rdx      # 0xab13
movb $0x0, %al
callq 0x1120
jmp 0x71df
movq -0x8(%rbp), %rdi
leaq 0x3966(%rip), %rsi      # 0xab37
leaq 0x393f(%rip), %rdx      # 0xab17
movb $0x0, %al
callq 0x1120
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x14(%rax), %ecx
leaq 0x393e(%rip), %rsi      # 0xab2f
leaq 0x3944(%rip), %rdx      # 0xab3c
leaq 0x3943(%rip), %r8       # 0xab42
movb $0x0, %al
callq 0x1120
jmp 0x7280
movq -0x8(%rbp), %rdi
leaq 0x3935(%rip), %rsi      # 0xab48
leaq 0x393b(%rip), %rdx      # 0xab55
leaq 0x3907(%rip), %rcx      # 0xab28
movl $0x2d, %r8d
movb $0x0, %al
callq 0x1120
movq -0x20(%rbp), %rax
cmpl $0x4, 0x8(%rax)
jne 0x7253
movq -0x8(%rbp), %rdi
leaq 0x38e0(%rip), %rsi      # 0xab23
leaq 0x38e1(%rip), %rdx      # 0xab2b
movb $0x0, %al
callq 0x1120
jmp 0x727c
movq -0x20(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x7278
movq -0x8(%rbp), %rdi
leaq 0x38bb(%rip), %rsi      # 0xab23
leaq 0x2335(%rip), %rdx      # 0x95a4
movb $0x0, %al
callq 0x1120
jmp 0x727a
jmp 0x727a
jmp 0x727c
jmp 0x7280
jmp 0x7280
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x72b9
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movl (%rax), %edx
leaq 0x38b6(%rip), %rsi      # 0xab5a
movb $0x0, %al
callq 0x1120
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x728c
movq -0x8(%rbp), %rdi
leaq 0x2524(%rip), %rsi      # 0x97e8
movb $0x0, %al
callq 0x1120
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x7080
jmp 0x72de
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x7026
movq -0x8(%rbp), %rdi
leaq 0x24f1(%rip), %rsi      # 0x97e8
movb $0x0, %al
callq 0x1120
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop