// File: /workspace/github_c_makefile_star2_O0/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
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x11af7
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x10930
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x109b0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x11ad8
cmpq $0x0, -0x28(%rbp)
jne 0x11a4f
movq -0x30(%rbp), %rax
cmpl $0x0, 0x100(%rax)
jne 0x11a4f
movb $0x0, %al
callq 0x14d10
movq -0x10(%rbp), %rdi
callq 0x116e0
movq %rax, %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rcx
leaq 0x64ca(%rip), %rdi      # 0x17f01
movb $0x0, %al
callq 0x1090
movq 0x255c3(%rip), %rax     # 0x37008
movl $0x1, 0xd8(%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x90(%rax)
je 0x11aa1
movb $0x0, %al
callq 0x14d10
movq -0x10(%rbp), %rdi
callq 0x116e0
movq %rax, %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq -0x30(%rbp), %rax
movq (%rax), %rcx
leaq 0x64e4(%rip), %rdi      # 0x17f6d
movb $0x0, %al
callq 0x1090
movq 0x25571(%rip), %rax     # 0x37008
movl $0x1, 0xd8(%rax)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x30(%rax), %rdx
callq 0x11250
cmpq $0x0, %rax
je 0x11acc
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x11c8b
movl $0x1, -0x4(%rbp)
jmp 0x11c8b
cmpq $0x0, -0x28(%rbp)
jne 0x11aeb
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x11c8b
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x11c8b
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x10930
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x109b0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x11c74
cmpq $0x0, -0x38(%rbp)
jne 0x11ba9
movq -0x40(%rbp), %rax
cmpl $0x0, 0x100(%rax)
jne 0x11ba9
movb $0x0, %al
callq 0x14d10
movq -0x10(%rbp), %rdi
callq 0x116e0
movq %rax, %rsi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rcx
leaq 0x6370(%rip), %rdi      # 0x17f01
movb $0x0, %al
callq 0x1090
movq 0x25469(%rip), %rax     # 0x37008
movl $0x1, 0xd8(%rax)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x90(%rax)
jne 0x11c03
movb $0x0, %al
callq 0x14d10
movq -0x10(%rbp), %rdi
callq 0x116e0
movq %rax, %rsi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq -0x40(%rbp), %rax
movq (%rax), %rcx
leaq 0x63fd(%rip), %rdi      # 0x17fe8
movb $0x0, %al
callq 0x1090
movq 0x2540f(%rip), %rax     # 0x37008
movl $0x1, 0xd8(%rax)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rax
movq 0x30(%rax), %rdx
callq 0x11250
cmpq $0x0, %rax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rdx
callq 0x11730
movq %rax, %rcx
movl -0x44(%rbp), %eax
cmpq $0x0, %rcx
setne %cl
andb $0x1, %cl
movzbl %cl, %ecx
orl %ecx, %eax
cmpl $0x0, %eax
je 0x11c6b
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x11c8b
movl $0x1, -0x4(%rbp)
jmp 0x11c8b
cmpq $0x0, -0x38(%rbp)
jne 0x11c84
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x11c8b
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)