// File: /workspace/github_c_makefile_star2_O1/anuwu[P]ERPLAG-Compiler/symbolTable.c
// Function: printModuleST
void printModuleST ( moduleST * thisModuleST, int printParam ) 
{

	if (!printParam)
		return ;

	if( thisModuleST->tableType == DRIVER_ST || thisModuleST->tableType == MODULE_ST ){
		printf ("**************printModuleST( \"%s\" )***************\n",thisModuleST->lexeme ) ;
	}
	else {
		printf ("**************printModuleST(SCOPE : \"%s\" )***************\n",thisModuleST->lexeme ) ;
		//printf ("It's a ScopeST \n") ;
		printf ("Parent : %s\n" , thisModuleST->parent ? ((moduleST*)thisModuleST->parent)->lexeme : "NULL") ;
	}
	
	moduleSTentry * tt ;
	printf ("Modules :\n" ) ;
	for ( int i=0 ; i<MODULE_BIN_COUNT ; i++ )
	{
		
		tt = thisModuleST->scopeVars[i] ;
		while ( tt != NULL ) {
			printf ("\t%s --> Label\n",tt->thisModuleST->lexeme) ;
			tt = tt->next ;
		}
	}

	printf ("\nINPUT Variables :\n" ) ;
	for ( int i = 0 ; i<IO_BIN_COUNT ; i++ )
	{
		
		varSTentry * vv = thisModuleST->inputVars[i] ;

		while ( vv ) {
			printf ("\toffset: %d - \"%s\" ---- \"%s\" ",vv->thisVarST->offset,vv->thisVarST->lexeme , tokenIDToString(vv->thisVarST->datatype) ) ;
			if(vv->thisVarST->datatype == TK_ARRAY ) {
				printf ("%s(%s,%s)",tokenIDToString(vv->thisVarST->arrayIndices->type) ,vv->thisVarST->arrayIndices->tokLeft->lexeme , vv->thisVarST->arrayIndices->tokRight->lexeme ) ;
			}
			printf ("\n") ;


			vv = vv->next ;
		}
	}
	printf ("\nOUTPUT Variables :\n" ) ;
	for ( int i = 0 ; i<IO_BIN_COUNT ; i++ )
	{
		
		varSTentry * vv = thisModuleST->outputVars[i] ;

		while ( vv ) {
			printf ("\toffset: %d - \"%s\" ---- \"%s\" ",vv->thisVarST->offset,vv->thisVarST->lexeme , tokenIDToString(vv->thisVarST->datatype) ) ;
			if(vv->thisVarST->datatype == TK_ARRAY ) {
				printf ("%s(%s,%s)",tokenIDToString(vv->thisVarST->arrayIndices->type),vv->thisVarST->arrayIndices->tokLeft->lexeme , vv->thisVarST->arrayIndices->tokRight->lexeme ) ;
			}
			printf ("\n") ;


			vv = vv->next ;
		}
	}
	printf ("\nLOCAL Variables :\n" ) ;
	for ( int i = 0 ; i<LOCAL_BIN_COUNT ; i++ )
	{	
		varSTentry * vv = thisModuleST->localVars[i] ;

		while ( vv ) 
		{
			printf ("\toffset: %d - \"%s\" ---- \"%s\" ",vv->thisVarST->offset,vv->thisVarST->lexeme , tokenIDToString(vv->thisVarST->datatype) ) ;

			if(vv->thisVarST->datatype == TK_ARRAY ) 
			{
				printf ("%s(%s,%s)",tokenIDToString(vv->thisVarST->arrayIndices->type),vv->thisVarST->arrayIndices->tokLeft->lexeme , vv->thisVarST->arrayIndices->tokRight->lexeme ) ;
			}


			printf (" ---> %s" , varTypeToString (vv->thisVarST->varType)) ;

			printf ("\n") ;


			vv = vv->next ;
		}
	}
	
	printf ("\n**************************************\n") ;
}

// Assembly:
testl %esi, %esi
je 0xc5ac
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r12
cmpl $0x1, 0x8(%rdi)
movq (%rdi), %rsi
ja 0xc5ad
leaq 0x61a2(%rip), %rdi      # 0x1274c
jmp 0xc5d8
retq
leaq 0x61cc(%rip), %rdi      # 0x12780
xorl %eax, %eax
callq 0x10b0
movq 0x10(%r12), %rax
testq %rax, %rax
je 0xc5ca
movq (%rax), %rsi
jmp 0xc5d1
leaq 0x5621(%rip), %rsi      # 0x11bf2
leaq 0x61e3(%rip), %rdi      # 0x127bb
xorl %eax, %eax
callq 0x10b0
leaq 0x79f5(%rip), %rdi      # 0x13fdb
callq 0x1070
leaq 0x61d6(%rip), %r14      # 0x127c8
xorl %ebx, %ebx
movq 0x98(%r12,%rbx,8), %r15
testq %r15, %r15
je 0xc617
movq (%r15), %rax
movq (%rax), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
movq 0x8(%r15), %r15
jmp 0xc5fc
incq %rbx
cmpq $0xd, %rbx
jne 0xc5f4
leaq 0x79be(%rip), %rdi      # 0x13fe5
callq 0x1070
movq %r12, -0x30(%rbp)
movq 0x88(%r12), %rbx
testq %rbx, %rbx
je 0xc6bb
leaq 0x6193(%rip), %r14      # 0x127d7
leaq 0x61aa(%rip), %r15      # 0x127f5
movq (%rbx), %rax
movl 0x1c(%rax), %r12d
movq (%rax), %r13
movl 0x8(%rax), %edi
callq 0x9270
movq %r14, %rdi
movl %r12d, %esi
movq %r13, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x10b0
movq (%rbx), %rax
cmpl $0x3b, 0x8(%rax)
jne 0xc6a8
movq 0x10(%rax), %rax
movl (%rax), %edi
callq 0x9270
movq (%rbx), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
movq 0x8(%rdx), %rdx
movq 0x8(%rcx), %rcx
movq %r15, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movl $0xa, %edi
callq 0x1040
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0xc64b
leaq 0x7936(%rip), %rdi      # 0x13ff8
callq 0x1070
movq -0x30(%rbp), %rax
movq 0x90(%rax), %rbx
testq %rbx, %rbx
je 0xc755
leaq 0x60f9(%rip), %r14      # 0x127d7
leaq 0x6110(%rip), %r15      # 0x127f5
movq (%rbx), %rax
movl 0x1c(%rax), %r12d
movq (%rax), %r13
movl 0x8(%rax), %edi
callq 0x9270
movq %r14, %rdi
movl %r12d, %esi
movq %r13, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x10b0
movq (%rbx), %rax
cmpl $0x3b, 0x8(%rax)
jne 0xc742
movq 0x10(%rax), %rax
movl (%rax), %edi
callq 0x9270
movq (%rbx), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
movq 0x8(%rdx), %rdx
movq 0x8(%rcx), %rcx
movq %r15, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movl $0xa, %edi
callq 0x1040
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0xc6e5
leaq 0x78b0(%rip), %rdi      # 0x1400c
callq 0x1070
leaq 0x5fb3(%rip), %r15      # 0x1271b
leaq 0x6090(%rip), %r12      # 0x127ff
xorl %ecx, %ecx
movq -0x30(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq 0x18(%rax,%rcx,8), %r14
testq %r14, %r14
je 0xc823
movq (%r14), %rax
movl 0x1c(%rax), %r13d
movq (%rax), %rbx
movl 0x8(%rax), %edi
callq 0x9270
leaq 0x6037(%rip), %rdi      # 0x127d7
movl %r13d, %esi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x10b0
movq (%r14), %rax
cmpl $0x3b, 0x8(%rax)
jne 0xc7ec
movq 0x10(%rax), %rax
movl (%rax), %edi
callq 0x9270
movq (%r14), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
movq 0x8(%rdx), %rdx
movq 0x8(%rcx), %rcx
leaq 0x6013(%rip), %rdi      # 0x127f5
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq (%r14), %rax
movl 0x30(%rax), %eax
movq %r15, %rsi
cmpq $0x5, %rax
ja 0xc806
leaq 0xb5ae(%rip), %rcx      # 0x17db0
movq (%rcx,%rax,8), %rsi
movq %r12, %rdi
xorl %eax, %eax
callq 0x10b0
movl $0xa, %edi
callq 0x1040
movq 0x8(%r14), %r14
jmp 0xc77e
movq -0x38(%rbp), %rcx
incq %rcx
cmpq $0xd, %rcx
jne 0xc771
leaq 0x77e4(%rip), %rdi      # 0x1401f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1070