// File: /workspace/github_c_makefile_star2_O2/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 0xadba
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpl $0x1, 0x8(%rdi)
movq (%rdi), %rsi
ja 0xadbb
leaq 0x5994(%rip), %rdi      # 0x1074c
jmp 0xade5
retq
leaq 0x59be(%rip), %rdi      # 0x10780
xorl %eax, %eax
callq 0x10b0
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0xadd7
movq (%rax), %rsi
jmp 0xadde
leaq 0x4e14(%rip), %rsi      # 0xfbf2
leaq 0x59d6(%rip), %rdi      # 0x107bb
xorl %eax, %eax
callq 0x10b0
leaq 0x71e8(%rip), %rdi      # 0x11fdb
callq 0x1070
movq %rbx, -0x30(%rbp)
addq $0x98, %rbx
leaq 0x59be(%rip), %r14      # 0x107c8
xorl %r15d, %r15d
cmpq $0xd, %r15
je 0xae3c
leaq (%rbx,%r15,8), %r12
movq (%r12), %r12
testq %r12, %r12
je 0xae37
movq (%r12), %rax
movq (%rax), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
addq $0x8, %r12
jmp 0xae17
incq %r15
jmp 0xae0d
leaq 0x71a2(%rip), %rdi      # 0x11fe5
callq 0x1070
movq -0x30(%rbp), %rax
leaq 0x88(%rax), %rbx
leaq 0x597d(%rip), %r14      # 0x107d7
pushq $0xa
popq %r12
movq (%rbx), %rbx
testq %rbx, %rbx
je 0xaed5
movq (%rbx), %rax
movl 0x1c(%rax), %r13d
movq (%rax), %r15
movl 0x8(%rax), %edi
callq 0x81d3
movq %r14, %rdi
movl %r13d, %esi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x10b0
movq (%rbx), %rax
cmpl $0x3b, 0x8(%rax)
jne 0xaec7
movq 0x10(%rax), %rax
movl (%rax), %edi
callq 0x81d3
movq (%rbx), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
movq 0x8(%rdx), %rdx
movq 0x8(%rcx), %rcx
leaq 0x5938(%rip), %rdi      # 0x107f5
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movl %r12d, %edi
callq 0x1040
addq $0x8, %rbx
jmp 0xae5e
leaq 0x711c(%rip), %rdi      # 0x11ff8
callq 0x1070
movq -0x30(%rbp), %rax
leaq 0x90(%rax), %rbx
leaq 0x58e4(%rip), %r14      # 0x107d7
pushq $0xa
popq %r12
movq (%rbx), %rbx
testq %rbx, %rbx
je 0xaf6e
movq (%rbx), %rax
movl 0x1c(%rax), %r13d
movq (%rax), %r15
movl 0x8(%rax), %edi
callq 0x81d3
movq %r14, %rdi
movl %r13d, %esi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x10b0
movq (%rbx), %rax
cmpl $0x3b, 0x8(%rax)
jne 0xaf60
movq 0x10(%rax), %rax
movl (%rax), %edi
callq 0x81d3
movq (%rbx), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
movq 0x8(%rdx), %rdx
movq 0x8(%rcx), %rcx
leaq 0x589f(%rip), %rdi      # 0x107f5
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movl %r12d, %edi
callq 0x1040
addq $0x8, %rbx
jmp 0xaef7
leaq 0x7097(%rip), %rdi      # 0x1200c
callq 0x1070
movq -0x30(%rbp), %rax
addq $0x18, %rax
leaq 0x5876(%rip), %r12      # 0x107ff
pushq $0xa
popq %r13
xorl %ecx, %ecx
movq %rax, -0x30(%rbp)
cmpq $0xd, %rcx
je 0xb04d
movq %rcx, -0x38(%rbp)
leaq (%rax,%rcx,8), %r14
movq (%r14), %r14
testq %r14, %r14
je 0xb03d
movq (%r14), %rax
movl 0x1c(%rax), %ebx
movq (%rax), %r15
movl 0x8(%rax), %edi
callq 0x81d3
leaq 0x580e(%rip), %rdi      # 0x107d7
movl %ebx, %esi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x10b0
movq (%r14), %rax
cmpl $0x3b, 0x8(%rax)
jne 0xb017
movq 0x10(%rax), %rax
movl (%rax), %edi
callq 0x81d3
movq (%r14), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
movq 0x8(%rdx), %rdx
movq 0x8(%rcx), %rcx
leaq 0x57eb(%rip), %rdi      # 0x107f5
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq (%r14), %rax
movl 0x30(%rax), %edi
callq 0xac67
movq %r12, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movl %r13d, %edi
callq 0x1040
addq $0x8, %r14
jmp 0xafa5
movq -0x38(%rbp), %rcx
incq %rcx
movq -0x30(%rbp), %rax
jmp 0xaf93
leaq 0x6fcb(%rip), %rdi      # 0x1201f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1070