// File: /workspace/github_c_makefile_star2_O0/anuwu[P]ERPLAG-Compiler/symbolTable.c
// Function: checkIP
varST * checkIP (moduleST * thisModule, moduleST * targetModule, astNode * inputNode)
{	
	varSTentry * varEntry = targetModule->inputVars[0] ;	
	astNode * inputIter = inputNode ;
	varST *searchedVar, *entryVar ;

	while(inputIter->next) 
		inputIter = inputIter->next ;

	while (varEntry != NULL && varEntry->thisVarST->varType == VAR_PLACEHOLDER)
		varEntry = varEntry->next ;

	int sameArgNoErr = 0 ;
	
	while(inputIter && varEntry)
	{
		searchedVar = searchVar (thisModule , inputIter->tok->lexeme ) ;
		entryVar = varEntry->thisVarST  ;

		if(searchedVar == NULL)
		{
			errSemantic () ;
			#ifdef _WIN64
				printf ("In module \"%s\" at line %d, variable \"%s\" is undeclared in the call to module \"%s\"\n", getParentModuleName (thisModule) ,inputIter->tok->lineNumber ,inputIter->tok->lexeme, thisModule->lexeme) ;
			#endif
			#if defined __linux__ || __MACH__
				printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", variable " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " is undeclared in the call to module " ANSI_BOLD "%s" ANSI_RESET "\n",getParentModuleName (thisModule) ,inputIter->tok->lineNumber ,inputIter->tok->lexeme, thisModule->lexeme) ;
			#endif
			realBase->semanticError = 1 ;
			sameArgNoErr = 1 ;
		}
		else 
		{
			if(entryVar->datatype == searchedVar->datatype)
			{
				if (entryVar->datatype == TK_ARRAY) 
				{
					if (entryVar->arrayIndices->type != searchedVar->arrayIndices->type)
					{
						errSemantic () ;
						#ifdef _WIN64
							printf ("In module \"%s\" at line %d,  input array variables \"%s\" and \"%s\" have conflicting base types in the call to module \"%s\"\n",  getParentModuleName (thisModule) ,inputIter->tok->lineNumber , inputIter->tok->lexeme , entryVar->lexeme, targetModule->lexeme) ;
						#endif
						#if defined __linux__ || __MACH__
							printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", " ANSI_BOLD ANSI_BLACK " input array " ANSI_RESET "variables " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " and " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " have conflicting base types in the call to module " ANSI_BOLD "%s" ANSI_RESET "\n" ,  getParentModuleName (thisModule) ,inputIter->tok->lineNumber , inputIter->tok->lexeme , entryVar->lexeme, targetModule->lexeme) ;
						#endif
						realBase->semanticError = 1 ;
					}

					if (isLeftLimStatic(entryVar) && isLeftLimStatic(searchedVar) && strcmp (entryVar->arrayIndices->tokLeft->lexeme, searchedVar->arrayIndices->tokLeft->lexeme))
					{
						errSemantic () ;
						#ifdef _WIN64
							printf ("In module \"%s\" at line %d, array variables \"%s\" and \"%s\" do not have matching left limits in the call to module \"%s\"\n", getParentModuleName (thisModule), inputIter->tok->lineNumber, entryVar->lexeme, searchedVar->lexeme, targetModule->lexeme) ;
						#endif
						#if defined __linux__ || __MACH__
							printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", " ANSI_BOLD ANSI_BLACK "array" ANSI_RESET " variables " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " and " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " do not have matching left limits in the call to module " ANSI_BOLD "%s" ANSI_RESET "\n", getParentModuleName (thisModule), inputIter->tok->lineNumber, entryVar->lexeme, searchedVar->lexeme, targetModule->lexeme) ;
						#endif
						realBase->semanticError = 1 ;
					}

					if (isRightLimStatic(entryVar) && isRightLimStatic(searchedVar) && strcmp (entryVar->arrayIndices->tokRight->lexeme, searchedVar->arrayIndices->tokRight->lexeme))
					{
						errSemantic () ;
						#ifdef _WIN64
							printf ("In module \"%s\" at line %d, array variables \"%s\" and \"%s\" do not have right limits in the call to module \"%s\"\n", getParentModuleName (thisModule), inputIter->tok->lineNumber, entryVar->lexeme, searchedVar->lexeme, targetModule->lexeme) ;
						#endif
						#if defined __linux__ || __MACH__
							printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", " ANSI_BOLD ANSI_BLACK "array" ANSI_RESET " variables " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " and " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " do not have right limits in the call to module " ANSI_BOLD "%s" ANSI_RESET "\n", getParentModuleName (thisModule), inputIter->tok->lineNumber, entryVar->lexeme, searchedVar->lexeme, targetModule->lexeme) ;
						#endif
						realBase->semanticError = 1 ;
					}
				}
			}
			else 
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, input variables \"%s\" and \"%s\" have conflicting types in the call to module \"%s\"\n",  getParentModuleName (thisModule) ,inputIter->tok->lineNumber , inputIter->tok->lexeme , entryVar->lexeme, targetModule->lexeme) ;
				#endif
				#if defined __linux__ || __MACH__
					printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", " ANSI_BOLD ANSI_BLACK "input" ANSI_RESET " variables " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " and " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " have conflicting types in the call to module " ANSI_BOLD "%s" ANSI_RESET "\n" ,  getParentModuleName (thisModule) ,inputIter->tok->lineNumber , inputIter->tok->lexeme , entryVar->lexeme, targetModule->lexeme) ;
				#endif
				realBase->semanticError = 1 ;
				sameArgNoErr = 1 ;
			}
		}
		
		varEntry = varEntry->next ;
		while (varEntry != NULL && varEntry->thisVarST->varType == VAR_PLACEHOLDER)
			varEntry = varEntry->next ;

		inputIter = inputIter->prev ;
	}


	if (varEntry == NULL && inputIter)
	{
		errSemantic () ;
		#ifdef _WIN64
			printf ("In module \"%s\" at line %d, extra actual parameters passed in the call to module \"%s\"\n", getParentModuleName (thisModule), inputIter->tok->lineNumber, targetModule->lexeme) ;
		#endif
		#if defined __linux__ || __MACH__
			printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", extra actual parameters passed in the call to module " ANSI_BOLD "%s" ANSI_RESET "\n", getParentModuleName (thisModule), inputIter->tok->lineNumber, targetModule->lexeme) ;
		#endif
		realBase->semanticError = 1 ;
		return (varST *) malloc (sizeof(varST)) ;
	}
	else if (varEntry && inputIter == NULL) 
	{
		errSemantic () ;
		#ifdef _WIN64
			printf ("In module \"%s\" at line %d, insufficient number of actual parameters in the call to module \"%s\"\n", getParentModuleName (thisModule), inputNode->tok->lineNumber, targetModule->lexeme) ;
		#endif
		#if defined __linux__ || __MACH__
			printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", insufficient number of actual parameters in the call to module " ANSI_BOLD "%s" ANSI_RESET "\n", getParentModuleName (thisModule), inputNode->tok->lineNumber, targetModule->lexeme) ;
		#endif
		realBase->semanticError = 1 ;

		return (varST *) malloc (sizeof(varST)) ;
	}
	else
	{
		if (sameArgNoErr)
			return (varST *) 1 ;
		else
			return NULL ;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x11294
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x1127b
jmp 0x11296
xorl %eax, %eax
cmpq $0x0, -0x28(%rbp)
movb %al, -0x45(%rbp)
je 0x112b3
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpl $0x1, 0x30(%rax)
sete %al
movb %al, -0x45(%rbp)
movb -0x45(%rbp), %al
testb $0x1, %al
jne 0x112bc
jmp 0x112ca
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x11296
movl $0x0, -0x44(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x30(%rbp)
movb %al, -0x46(%rbp)
je 0x112e8
cmpq $0x0, -0x28(%rbp)
setne %al
movb %al, -0x46(%rbp)
movb -0x46(%rbp), %al
testb $0x1, %al
jne 0x112f4
jmp 0x115f7
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x10ba0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1137b
movb $0x0, %al
callq 0x14d10
movq -0x10(%rbp), %rdi
callq 0x116e0
movq %rax, %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq (%rax), %r8
leaq 0x662b(%rip), %rdi      # 0x17982
movb $0x0, %al
callq 0x1090
movq 0x25ca3(%rip), %rax     # 0x37008
movl $0x1, 0xd8(%rax)
movl $0x1, -0x44(%rbp)
jmp 0x115a6
movq -0x40(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x38(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x11546
movq -0x40(%rbp), %rax
cmpl $0x3b, 0x8(%rax)
jne 0x11544
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
movq -0x38(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl (%rcx), %eax
je 0x1140a
movb $0x0, %al
callq 0x14d10
movq -0x10(%rbp), %rdi
callq 0x116e0
movq %rax, %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rcx
movq -0x40(%rbp), %rax
movq (%rax), %r8
movq -0x18(%rbp), %rax
movq (%rax), %r9
leaq 0x6607(%rip), %rdi      # 0x179f9
movb $0x0, %al
callq 0x1090
movq 0x25c08(%rip), %rax     # 0x37008
movl $0x1, 0xd8(%rax)
movq -0x40(%rbp), %rdi
callq 0x13f40
cmpl $0x0, %eax
je 0x114a6
movq -0x38(%rbp), %rdi
callq 0x13f40
cmpl $0x0, %eax
je 0x114a6
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x10c0
cmpl $0x0, %eax
je 0x114a6
movb $0x0, %al
callq 0x14d10
movq -0x10(%rbp), %rdi
callq 0x116e0
movq %rax, %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq -0x40(%rbp), %rax
movq (%rax), %rcx
movq -0x38(%rbp), %rax
movq (%rax), %r8
movq -0x18(%rbp), %rax
movq (%rax), %r9
leaq 0x661f(%rip), %rdi      # 0x17aad
movb $0x0, %al
callq 0x1090
movq 0x25b6c(%rip), %rax     # 0x37008
movl $0x1, 0xd8(%rax)
movq -0x40(%rbp), %rdi
callq 0x13f80
cmpl $0x0, %eax
je 0x11542
movq -0x38(%rbp), %rdi
callq 0x13f80
cmpl $0x0, %eax
je 0x11542
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x10c0
cmpl $0x0, %eax
je 0x11542
movb $0x0, %al
callq 0x14d10
movq -0x10(%rbp), %rdi
callq 0x116e0
movq %rax, %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq -0x40(%rbp), %rax
movq (%rax), %rcx
movq -0x38(%rbp), %rax
movq (%rax), %r8
movq -0x18(%rbp), %rax
movq (%rax), %r9
leaq 0x6635(%rip), %rdi      # 0x17b5f
movb $0x0, %al
callq 0x1090
movq 0x25ad0(%rip), %rax     # 0x37008
movl $0x1, 0xd8(%rax)
jmp 0x11544
jmp 0x115a4
movb $0x0, %al
callq 0x14d10
movq -0x10(%rbp), %rdi
callq 0x116e0
movq %rax, %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rcx
movq -0x40(%rbp), %rax
movq (%rax), %r8
movq -0x18(%rbp), %rax
movq (%rax), %r9
leaq 0x6684(%rip), %rdi      # 0x17c09
movb $0x0, %al
callq 0x1090
movq 0x25a75(%rip), %rax     # 0x37008
movl $0x1, 0xd8(%rax)
movl $0x1, -0x44(%rbp)
jmp 0x115a6
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x28(%rbp)
movb %al, -0x47(%rbp)
je 0x115cf
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpl $0x1, 0x30(%rax)
sete %al
movb %al, -0x47(%rbp)
movb -0x47(%rbp), %al
testb $0x1, %al
jne 0x115d8
jmp 0x115e6
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x115b2
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x112d1
cmpq $0x0, -0x28(%rbp)
jne 0x11659
cmpq $0x0, -0x30(%rbp)
je 0x11659
movb $0x0, %al
callq 0x14d10
movq -0x10(%rbp), %rdi
callq 0x116e0
movq %rax, %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq -0x18(%rbp), %rax
movq (%rax), %rcx
leaq 0x6680(%rip), %rdi      # 0x17cb1
movb $0x0, %al
callq 0x1090
movq 0x259c9(%rip), %rax     # 0x37008
movl $0x1, 0xd8(%rax)
movl $0x38, %edi
callq 0x10e0
movq %rax, -0x8(%rbp)
jmp 0x116d4
cmpq $0x0, -0x28(%rbp)
je 0x116bb
cmpq $0x0, -0x30(%rbp)
jne 0x116bb
movb $0x0, %al
callq 0x14d10
movq -0x10(%rbp), %rdi
callq 0x116e0
movq %rax, %rsi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq -0x18(%rbp), %rax
movq (%rax), %rcx
leaq 0x668d(%rip), %rdi      # 0x17d20
movb $0x0, %al
callq 0x1090
movq 0x25967(%rip), %rax     # 0x37008
movl $0x1, 0xd8(%rax)
movl $0x38, %edi
callq 0x10e0
movq %rax, -0x8(%rbp)
jmp 0x116d4
cmpl $0x0, -0x44(%rbp)
je 0x116cc
movl $0x1, %eax
movq %rax, -0x8(%rbp)
jmp 0x116d4
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nop