// File: /workspace/github_c_makefile_star2_O3/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 0xba76
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 0xba77
leaq 0x5ce8(%rip), %rdi      # 0x1175c
jmp 0xbaa2
retq
leaq 0x5d12(%rip), %rdi      # 0x11790
xorl %eax, %eax
callq 0x10b0
movq 0x10(%r12), %rax
testq %rax, %rax
je 0xba94
movq (%rax), %rsi
jmp 0xba9b
leaq 0x5157(%rip), %rsi      # 0x10bf2
leaq 0x5d29(%rip), %rdi      # 0x117cb
xorl %eax, %eax
callq 0x10b0
leaq 0x753b(%rip), %rdi      # 0x12feb
callq 0x1070
leaq 0x5d1c(%rip), %r14      # 0x117d8
xorl %ebx, %ebx
movq 0x98(%r12,%rbx,8), %r15
testq %r15, %r15
je 0xbae1
movq (%r15), %rax
movq (%rax), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
movq 0x8(%r15), %r15
jmp 0xbac6
incq %rbx
cmpq $0xd, %rbx
jne 0xbabe
leaq 0x7504(%rip), %rdi      # 0x12ff5
callq 0x1070
movq %r12, -0x30(%rbp)
movq 0x88(%r12), %rbx
testq %rbx, %rbx
je 0xbb85
leaq 0x5cd9(%rip), %r14      # 0x117e7
leaq 0x5cf0(%rip), %r15      # 0x11805
movq (%rbx), %rax
movl 0x1c(%rax), %r12d
movq (%rax), %r13
movl 0x8(%rax), %edi
callq 0x87b8
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 0xbb72
movq 0x10(%rax), %rax
movl (%rax), %edi
callq 0x87b8
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 0xbb15
leaq 0x747c(%rip), %rdi      # 0x13008
callq 0x1070
movq -0x30(%rbp), %rax
movq 0x90(%rax), %rbx
testq %rbx, %rbx
je 0xbc1f
leaq 0x5c3f(%rip), %r14      # 0x117e7
leaq 0x5c56(%rip), %r15      # 0x11805
movq (%rbx), %rax
movl 0x1c(%rax), %r12d
movq (%rax), %r13
movl 0x8(%rax), %edi
callq 0x87b8
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 0xbc0c
movq 0x10(%rax), %rax
movl (%rax), %edi
callq 0x87b8
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 0xbbaf
leaq 0x73f6(%rip), %rdi      # 0x1301c
callq 0x1070
leaq 0x5af9(%rip), %r15      # 0x1172b
leaq 0x5bd6(%rip), %r12      # 0x1180f
xorl %ecx, %ecx
movq -0x30(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq 0x18(%rax,%rcx,8), %r14
testq %r14, %r14
je 0xbced
movq (%r14), %rax
movl 0x1c(%rax), %r13d
movq (%rax), %rbx
movl 0x8(%rax), %edi
callq 0x87b8
leaq 0x5b7d(%rip), %rdi      # 0x117e7
movl %r13d, %esi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x10b0
movq (%r14), %rax
cmpl $0x3b, 0x8(%rax)
jne 0xbcb9
movq 0x10(%rax), %rax
movl (%rax), %edi
callq 0x87b8
movq (%r14), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
movq 0x8(%rdx), %rdx
movq 0x8(%rcx), %rcx
leaq 0x5b59(%rip), %rdi      # 0x11805
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq (%r14), %rax
movl 0x30(%rax), %eax
movq %r15, %rsi
cmpq $0x5, %rax
ja 0xbcd0
leaq 0xb0e4(%rip), %rcx      # 0x16db0
movq (%rcx,%rax,8), %rsi
movq %r12, %rdi
xorl %eax, %eax
callq 0x10b0
movl $0xa, %edi
callq 0x1040
movq 0x8(%r14), %r14
jmp 0xbc48
movq -0x38(%rbp), %rcx
incq %rcx
cmpq $0xd, %rcx
jne 0xbc3b
leaq 0x732a(%rip), %rdi      # 0x1302f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1070