// File: /workspace/github_c_makefile_star2_O3/anuwu[P]ERPLAG-Compiler/symbolTable.c
// Function: isValidCall
int isValidCall (moduleST * thisModule , astNode * funcNode , int haveReturns) 
{
	if(haveReturns == 0) 
	{
		varST * varPtr = searchVarInbaseST(funcNode->tok->lexeme) ;
		moduleST * modPtr = searchModuleInbaseST (funcNode->tok->lexeme) ;

		if (modPtr != NULL)
		{
			if (varPtr == NULL && !modPtr->filledMod)
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, module \"%s\" has not been declared before its call\n", getParentModuleName (thisModule), funcNode->tok->lineNumber, funcNode->tok->lexeme) ;
				#endif
				#if defined __linux__ || __MACH__
					printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", module " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " has not been declared before its call\n", getParentModuleName (thisModule), funcNode->tok->lineNumber, funcNode->tok->lexeme) ;
				#endif
				realBase->semanticError = 1 ;
			}

			if (modPtr->outputVars[0] != NULL)
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, call to function \"%s\" has return data but no receiving variables\n", getParentModuleName (thisModule), funcNode->tok->lineNumber, modPtr->lexeme) ;
				#endif
				#if defined __linux__ || __MACH__
					printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", call to function " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " has return data but no receiving variables\n", getParentModuleName (thisModule), funcNode->tok->lineNumber, modPtr->lexeme) ;
				#endif
				realBase->semanticError = 1 ;
			}

			if (checkIP(thisModule, modPtr, funcNode->next->child) !=NULL)
				return -3 ;		// Errors printed in checkIP
			else
				return 1 ;
		}
		else
		{
			if (varPtr == NULL)
				return -1 ;
			else
				return -2 ;
		}
	}
	else
	{
		varST * varPtr = searchVarInbaseST(funcNode->next->next->tok->lexeme ) ;
		moduleST * modPtr = searchModuleInbaseST (funcNode->next->next->tok->lexeme) ;

		if (modPtr != NULL)
		{
			if (varPtr == NULL && !modPtr->filledMod)
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, module \"%s\" has not been declared before its call\n", getParentModuleName (thisModule), funcNode->next->next->tok->lineNumber, funcNode->next->next->tok->lexeme) ;
				#endif
				#if defined __linux__ || __MACH__
					printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", module " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " has not been declared before its call\n", getParentModuleName (thisModule), funcNode->next->next->tok->lineNumber, funcNode->next->next->tok->lexeme) ;
				#endif
				realBase->semanticError = 1 ;
			}

			if (modPtr->outputVars[0] == NULL)
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, call to function \"%s\" has no return data but receiving variables are present\n", getParentModuleName (thisModule), funcNode->next->next->tok->lineNumber, modPtr->lexeme) ;
				#endif
				#if defined __linux__ || __MACH__
					printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", call to function " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " has no return data but receiving variables are present\n", getParentModuleName (thisModule), funcNode->next->next->tok->lineNumber, modPtr->lexeme) ;
				#endif
				realBase->semanticError = 1 ;
			}
			
			if (checkIP(thisModule, modPtr, funcNode->next->next->next->child) !=NULL | checkOP(thisModule, modPtr, funcNode->child) !=NULL )
				return -3 ;		// Errors printed in checkIP and checkOP
			else
				return 1 ;
		}
		else
		{
			if (varPtr == NULL)
				return -1 ;
			else
				return -2 ;
		}
	}
	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
testl %edx, %edx
je 0xc45e
movq 0x38(%r14), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0xb709
movq %rax, %r12
movq %r15, %rdi
callq 0xb792
testq %rax, %rax
je 0xc555
movq %rax, %r15
testq %r12, %r12
jne 0xc3cc
cmpl $0x0, 0x100(%r15)
jne 0xc3cc
xorl %eax, %eax
callq 0xe989
movq 0x24ca0(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xc38b
movq (%rcx), %rsi
movq 0x38(%r14), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq 0x8(%rax), %rcx
leaq 0x59e3(%rip), %rdi      # 0x11d97
xorl %eax, %eax
callq 0x10b0
movq 0x24c66(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
cmpq $0x0, 0x90(%r15)
jne 0xc427
xorl %eax, %eax
callq 0xe989
movq 0x24c44(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xc3e7
movq (%rcx), %rsi
movq 0x38(%r14), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq (%r15), %rcx
leaq 0x5a6f(%rip), %rdi      # 0x11e7e
xorl %eax, %eax
callq 0x10b0
movq 0x24c0b(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
movq 0x38(%r14), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rax
movq 0x30(%rax), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xbd18
movq %rax, %r12
movq 0x30(%r14), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc108
xorl %ecx, %ecx
orq %r12, %rax
jmp 0xc549
movq 0x8(%r14), %rax
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0xb709
movq %rax, %r12
movq %r15, %rdi
callq 0xb792
testq %rax, %rax
je 0xc555
movq %rax, %r15
testq %r12, %r12
jne 0xc4de
cmpl $0x0, 0x100(%r15)
jne 0xc4de
xorl %eax, %eax
callq 0xe989
movq 0x24b86(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xc4a5
movq (%rcx), %rsi
movq 0x8(%r14), %rax
movl 0x10(%rax), %edx
movq 0x8(%rax), %rcx
leaq 0x58d1(%rip), %rdi      # 0x11d97
xorl %eax, %eax
callq 0x10b0
movq 0x24b54(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
cmpq $0x0, 0x90(%r15)
je 0xc531
xorl %eax, %eax
callq 0xe989
movq 0x24b32(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xc4f9
movq (%rcx), %rsi
movq 0x8(%r14), %rax
movl 0x10(%rax), %edx
movq (%r15), %rcx
leaq 0x58ea(%rip), %rdi      # 0x11e03
xorl %eax, %eax
callq 0x10b0
movq 0x24b01(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
movq 0x38(%r14), %rax
movq 0x30(%rax), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xbd18
xorl %ecx, %ecx
testq %rax, %rax
sete %cl
leal -0x3(,%rcx,4), %eax
jmp 0xc560
xorl %eax, %eax
testq %r12, %r12
sete %al
orl $-0x2, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq