// File: /workspace/github_c_makefile_star2_O3/anuwu[P]ERPLAG-Compiler/symbolTable.c
// Function: fillModuleST
void fillModuleST (moduleST* baseModule , astNode * statementsAST , int depthSTPrint) 
{
	int retSize = 0 ;
	varST *searchedVar ;
	statementsAST->localST = baseModule ;
	astNode * statementAST = statementsAST->child ;

	while (statementAST) 
	{
		if(statementAST->child->id == TK_DECLARE) 
		{
			// declare statement
			astNode * idAST = statementAST->child->next->child ;
			astNode * dataTypeAST = statementAST->child->next->next ;

			while (idAST) 
			{
				searchedVar = searchVar (baseModule, idAST->tok->lexeme) ;

				if (searchedVar != NULL && searchedVar->scope == baseModule && searchedVar->varType != VAR_INPUT)
				{
					errSemantic () ;
					#ifdef _WIN64
						printf ("In module \"%s\" at line %d, %s variable \"%s\" already declared\n", getParentModuleName (baseModule) ,idAST->tok->lineNumber, varTypeToString(searchedVar->varType) , idAST->tok->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 "%s" ANSI_RESET " variable " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " already declared\n", getParentModuleName (baseModule) ,idAST->tok->lineNumber, varTypeToString(searchedVar->varType) , idAST->tok->lexeme) ;
					#endif
					realBase->semanticError = 1 ;
				}
				else		// if input variable, or a local variable in some parent scope, or not found at all
				{
					varST * tmp = createVarST (idAST->tok->lexeme , baseModule , VAR_LOCAL, -9999) ;

					if (dataTypeAST->dtTag == ARRAY)
					{
						tmp->datatype = TK_ARRAY ;
						tmp->arrayIndices = dataTypeAST->dt->arrType ; 
					}
					else 
						tmp->datatype = dataTypeAST->dt->pType ;
					

					// filling offset
					retSize = getSize(tmp) ;

					if (retSize > 0)
					{
						tmp->offset = baseModule->currOffset + retSize ;
						tmp->size = retSize ;
						baseModule->currOffset += retSize ;
					}
					else	// correct dynamic array, or invalid static/dynamic array
						tmp->offset = retSize ;

					insertVar (baseModule , tmp, INSERT_LOCAL) ;
				}

				idAST = idAST->next ;
			}

		}
		else if ( statementAST->child->id == TK_WHILE) 
		{
			guardTinkerNode *tinkerHeadBefore, *tinkerHeadAfter ;

			if (getExpressionType (baseModule, statementAST->child->next) != TK_BOOLEAN)
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, the guard condition must be of type boolean\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber) ;
				#endif
				#if defined __linux__ || __MACH__
					printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", the guard condition must be of type " ANSI_BOLD ANSI_GREEN "boolean" ANSI_RESET "\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber) ;
				#endif
				realBase->semanticError = 1 ;
			}

			tinkerHeadBefore = getGuardTinkerList (baseModule, statementAST->child->next) ;
			moduleST * tmp = createScopeST (baseModule, WHILE_ST) ;
			fillModuleST (tmp , statementAST->child->next->next, depthSTPrint) ;
			tinkerHeadAfter = getGuardTinkerList (baseModule, statementAST->child->next) ;
			
			if (tinkerHeadBefore->tinker == -1)
			{
				errWarning () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, guard condition of while loop is static\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber) ;
				#endif
				#if defined __linux__ || __MACH__
					printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", guard condition of while loop is static\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber) ;
				#endif
			}
			else if (!hasTinkerListChanged (tinkerHeadBefore, tinkerHeadAfter))
			{
				errWarning () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, none of the identifiers of the guard condition are being changed in the while loop body\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber) ;
				#endif
				#if defined __linux__ || __MACH__
					printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", none of the identifiers of the guard condition are being changed in the while loop body\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber) ;
				#endif
			}

			printModuleST (tmp,  depthSTPrint) ;
			insertScopeST ( baseModule , tmp ) ;
		}
		else if ( statementAST->child->id == TK_FOR) 
		{
			searchedVar = searchVar (baseModule, statementAST->child->next->tok->lexeme) ;
			if (searchedVar == NULL)
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, loop variable \"%s\" is undeclared\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber, statementAST->child->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 ", loop variable " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " is undeclared\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber, statementAST->child->next->tok->lexeme) ;
				#endif
				realBase->semanticError = 1 ;
			}
			else if (searchedVar->datatype != TK_INTEGER)
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, loop variable \"%s\" needs to be of integer type\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber, statementAST->child->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 ", loop variable " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " needs to be of " ANSI_BOLD ANSI_GREEN "integer" ANSI_RESET " type\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber, statementAST->child->next->tok->lexeme) ;
				#endif
				realBase->semanticError = 1 ;
			}

			astNode *loopLim; 
			loopLim = statementAST->child->next->next ;

			if (atoi(loopLim->tok->lexeme) > atoi(loopLim->next->tok->lexeme))
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, left loop limit must be <= right loop limit\n", getParentModuleName (baseModule), loopLim->tok->lineNumber) ;
				#endif
				#if defined __linux__ || __MACH__
					printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", left loop limit must be <= right loop limit\n", getParentModuleName (baseModule), loopLim->tok->lineNumber) ;
				#endif
				realBase->semanticError = 1 ;
			}

			moduleST *forScope = createScopeST (baseModule, FOR_ST) ;
			varST *loopVar = createVarST (statementAST->child->next->tok->lexeme, forScope, VAR_LOOP, TK_INTEGER) ;

			if (searchedVar == NULL)
				loopVar->offset = -2 ;		// VAR_LOOP with offset of -2 is undeclared loop counter
			else
			{
				loopVar->offset = searchedVar->offset ;
				loopVar->size = searchedVar->size ;
			}

			insertVar (forScope, loopVar, INSERT_LOCAL) ;
			fillModuleST (forScope, loopLim->next->next, depthSTPrint) ;

			printModuleST (forScope, depthSTPrint) ;
			insertScopeST (baseModule , forScope) ;
		}
 		else if (statementAST->child->id == TK_GET_VALUE) 
 		{
			searchedVar = searchVar (baseModule , statementAST->child->next->tok->lexeme) ;

			if (searchedVar == NULL)
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, variable \"%s\" is undeclared\n" ,  getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber , statementAST->child->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 ", variable " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " is undeclared\n" ,  getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber , statementAST->child->next->tok->lexeme ) ;
				#endif
				realBase->semanticError = 1 ;
			}
			else
				tinkerVar (baseModule, searchedVar, statementAST->child->next) ;

		}
 		else if ( statementAST->child->id == TK_PRINT)
 		{
 			if (statementAST->child->next->id == TK_ID)
 				validateVar (baseModule, statementAST->child->next, &searchedVar) ;
 			else if (statementAST->child->next->id == TK_RNUM)
 				realPresent = 1 ;
 		} 
		else if ( statementAST->child->id == TK_ASSIGNOP) 
			assignmentTypeCheck (baseModule, statementAST->child) ;
 		else if (statementAST->child->id == idList) 
 		{
			// [a] = use module with parameters [ d ] ;
			int validCallFlag = isValidCall (baseModule, statementAST->child, 1) ;

			if (validCallFlag == -1 )	
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, \"%s\" Module neither declared nor defined \n", getParentModuleName (baseModule), statementAST->child->next->next->tok->lineNumber, statementAST->child->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 ", " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " Module neither declared nor defined \n", getParentModuleName (baseModule), statementAST->child->next->next->tok->lineNumber, statementAST->child->next->next->tok->lexeme) ;
				#endif
				realBase->semanticError = 1 ;
			}
			else if( validCallFlag == -2 ) 
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, \"%s\" declared but not defined \n", getParentModuleName (baseModule), statementAST->child->next->next->tok->lineNumber, statementAST->child->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 ", " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " declared but not defined \n", getParentModuleName (baseModule), statementAST->child->next->next->tok->lineNumber, statementAST->child->next->next->tok->lexeme) ;
				#endif
				realBase->semanticError = 1 ;
			}
			// else error messages is printed in internal functions

			idListTinker (baseModule, statementAST->child->child) ;
		}
		else if (statementAST->child->id == TK_ID) 
		{
			// use module with parameters ... (no return)
			int validCallFlag = isValidCall (baseModule, statementAST->child, 0) ;
			if (validCallFlag == -1 )	
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, \"%s\" Module neither declared nor defined \n", getParentModuleName (baseModule), statementAST->child->tok->lineNumber , statementAST->child->tok->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_RED "%s" ANSI_RESET " Module neither declared nor defined \n", getParentModuleName (baseModule), statementAST->child->tok->lineNumber , statementAST->child->tok->lexeme) ;
				#endif
				realBase->semanticError = 1 ;
			}
			else if( validCallFlag == -2 ) 
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, \"%s\" Module declared but not defined \n", getParentModuleName (baseModule),statementAST->child->tok->lineNumber , statementAST->child->tok->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_RED "%s" ANSI_RESET " Module declared but not defined \n", getParentModuleName (baseModule),statementAST->child->tok->lineNumber , statementAST->child->tok->lexeme) ;
				#endif
				realBase->semanticError = 1 ;
			}
		}
 		else if (statementAST->child->id == TK_SWITCH)
		{
			int switchTypeError = 0 ;

			searchedVar = searchVar (baseModule , statementAST->child->next->tok->lexeme) ;
			if (searchedVar == NULL)
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, switch variable \"%s\" is undeclared\n",  getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber ,  statementAST->child->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 ", " ANSI_BOLD ANSI_BLACK "switch" ANSI_RESET " variable " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " is undeclared\n",  getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber ,  statementAST->child->next->tok->lexeme) ;
				#endif
				realBase->semanticError = 1 ;
			}
			else
			{
				if (!(searchedVar->datatype == TK_INTEGER || searchedVar->datatype == TK_BOOLEAN))
				{
					errSemantic () ;
					#ifdef _WIN64
						printf ("In module \"%s\" at line %d, switch variable \"%s\" must be integer or boolean\n",  getParentModuleName (baseModule),statementAST->child->next->tok->lineNumber ,  statementAST->child->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 ", " ANSI_BOLD ANSI_BLACK "switch" ANSI_RESET " variable " ANSI_BOLD ANSI_RED "%s" ANSI_RESET " must be " ANSI_BOLD ANSI_GREEN "integer" ANSI_RESET " or " ANSI_BOLD ANSI_GREEN "boolean" ANSI_RESET "\n",  getParentModuleName (baseModule),statementAST->child->next->tok->lineNumber ,  statementAST->child->next->tok->lexeme) ;
					#endif
					realBase->semanticError = 1 ;
					switchTypeError = 1 ;
				}
			}

			moduleST *switchST = createScopeST (baseModule, SWITCH_ST) ;
			astNode *caseAstNode = statementAST->child->next->next ;

			int hasDefault = 0 ;
			int hasTrue = 0, hasFalse = 0 ;
			while (caseAstNode != NULL)
			{
				// case value mismatch
				if (searchedVar != NULL && !switchTypeError && caseAstNode->id != TK_DEFAULT)
				{
					if ((searchedVar->datatype == TK_INTEGER && (caseAstNode->next->id == TK_TRUE || caseAstNode->next->id == TK_FALSE)) || (searchedVar->datatype == TK_BOOLEAN && caseAstNode->next->id == TK_NUM)) 
					{
						errSemantic () ;
						#ifdef _WIN64
							printf ("In module \"%s\" at line %d, switch variable has type \"%s\" and case value has type \"%s\"\n", getParentModuleName (baseModule), caseAstNode->next->tok->lineNumber, typeIDToString (searchedVar->datatype) , (caseAstNode->next->id == TK_NUM)?"integer":"boolean") ;
						#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 "switch" ANSI_RESET " variable has type " ANSI_BOLD ANSI_GREEN "%s" ANSI_RESET " and case value has type " ANSI_BOLD ANSI_GREEN "%s" ANSI_RESET "\n", getParentModuleName (baseModule), caseAstNode->next->tok->lineNumber, typeIDToString (searchedVar->datatype) , (caseAstNode->next->id == TK_NUM)?"integer":"boolean") ;
						#endif
						realBase->semanticError = 1 ;
					}
				}
				
				if (caseAstNode->id != TK_DEFAULT)
				{
					if (caseValRepeat (caseAstNode))
					{
						errSemantic () ;
						#ifdef _WIN64
							printf ("In module \"%s\" at line %d, case value is repeating\n", getParentModuleName (baseModule), caseAstNode->next->tok->lineNumber) ;
						#endif
						#if defined __linux__ || __MACH__
							printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", case value is repeating\n", getParentModuleName (baseModule), caseAstNode->next->tok->lineNumber) ;
						#endif
						realBase->semanticError = 1 ;
					}

					if (searchedVar != NULL && searchedVar->datatype == TK_BOOLEAN && caseAstNode->next->tok->lexeme[0] == 't')
						hasTrue = 1 ;
					else if (searchedVar != NULL && searchedVar->datatype == TK_BOOLEAN && caseAstNode->next->tok->lexeme[0] == 'f')
						hasFalse = 1 ;

					fillModuleST (switchST, caseAstNode->next->next, depthSTPrint) ;
				}
				else
				{
					hasDefault = 1 ;
					if (searchedVar != NULL && searchedVar->datatype == TK_BOOLEAN)
					{
						errSemantic () ;
						#ifdef _WIN64
							printf ("In module \"%s\" at line %d, switch variable has type \"boolean\", default case is not allowed\n", getParentModuleName (baseModule), caseAstNode->tok->lineNumber) ;
						#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 "switch" ANSI_RESET " variable has type " ANSI_BOLD ANSI_GREEN "boolean" ANSI_RESET ", default case is not allowed\n", getParentModuleName (baseModule), caseAstNode->tok->lineNumber) ;
						#endif
						realBase->semanticError = 1 ;
					}

					fillModuleST (switchST, caseAstNode->next, depthSTPrint) ;
				}

				if (caseAstNode->id != TK_DEFAULT)
					caseAstNode = caseAstNode->next->next->next ;
				else
					caseAstNode = caseAstNode->next->next ;
			}

			if (searchedVar != NULL && !hasDefault && searchedVar->datatype == TK_INTEGER)
			{
				errSemantic () ;
				#ifdef _WIN64
					printf ("In module \"%s\" at line %d, default case expected in switch statement\n",  getParentModuleName (baseModule), statementAST->child->tok->lineNumber) ;
				#endif
				#if defined __linux__ || __MACH__
					printf ("In module " ANSI_BOLD "%s" ANSI_RESET " at line " ANSI_BOLD ANSI_CYAN "%d" ANSI_RESET ", default case expected in switch statement\n",  getParentModuleName (baseModule), statementAST->child->tok->lineNumber) ;
				#endif
				realBase->semanticError = 1 ;
			}

			if (searchedVar != NULL && searchedVar->datatype == TK_BOOLEAN && (!hasTrue || !hasFalse))
			{
				if (!hasTrue)
				{
					errSemantic () ;
					#ifdef _WIN64
						printf ("In module \"%s\" at line %d, boolean switch statement is missing 'true' case\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber) ;
					#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_GREEN "boolean" ANSI_RESET " switch statement is missing 'true' case\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber) ;
					#endif
					realBase->semanticError = 1 ;
				}

				if (!hasFalse)
				{
					errSemantic () ;
					#ifdef _WIN64
						printf ("In module \"%s\" at line %d, boolean switch statement is missing 'false' case\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber) ;
					#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_GREEN "boolean" ANSI_RESET " switch statement is missing 'false' case\n", getParentModuleName (baseModule), statementAST->child->next->tok->lineNumber) ;
					#endif
					realBase->semanticError = 1 ;
				}
			}

			insertScopeST (baseModule , switchST) ;
			printModuleST (switchST, depthSTPrint) ;
		}
		statementAST = statementAST->next ;
	}

	if (baseModule->parent != realBase)
		baseModule->scopeSize = baseModule->currOffset - ((moduleST *)baseModule->parent)->currOffset ;
	else
		baseModule->scopeSize = baseModule->currOffset ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, -0x3c(%rbp)
movq %rdi, %rbx
movq %rdi, 0x20(%rsi)
movq 0x30(%rsi), %r13
testq %r13, %r13
je 0xd94c
movq 0x30(%r13), %rsi
movl (%rsi), %eax
cmpl $0x4f, %eax
movq %r13, -0x30(%rbp)
jg 0xcf00
leal -0x3e(%rax), %ecx
cmpl $0x6, %ecx
ja 0xcfa0
leaq 0x493d(%rip), %rdx      # 0x116e0
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x38(%rsi), %rax
movq 0x30(%rax), %r13
testq %r13, %r13
je 0xd93f
movq 0x38(%rax), %r14
movq 0x8(%r13), %rax
movq 0x8(%rax), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb8e8
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0xcde7
cmpq %rbx, 0x28(%rax)
je 0xce88
movl $0x38, %edi
callq 0x1120
movq %rax, %r12
movq %r15, (%rax)
movl $0xffffd8f1, 0x8(%rax)  # imm = 0xFFFFD8F1
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movl $0x0, 0x20(%rax)
movq %rbx, 0x28(%rax)
movl $0x3, 0x30(%rax)
cmpl $0x1, 0x10(%r14)
jne 0xce35
movl $0x3b, 0x8(%r12)
movq 0x18(%r14), %rax
movq (%rax), %rax
movq %rax, 0x10(%r12)
jmp 0xce40
movq 0x18(%r14), %rax
movl (%rax), %eax
movl %eax, 0x8(%r12)
movq %r12, %rdi
callq 0xc569
testl %eax, %eax
jle 0xce61
movl 0x10c(%rbx), %ecx
addl %eax, %ecx
movl %eax, 0x18(%r12)
movl %ecx, 0x10c(%rbx)
movl %ecx, %eax
movl %eax, 0x1c(%r12)
movq %rbx, %rdi
movq %r12, %rsi
movl $0x2, %edx
callq 0xb68b
movq 0x38(%r13), %r13
testq %r13, %r13
jne 0xcdc1
jmp 0xd93f
cmpl $0x0, 0x30(%rax)
je 0xcde7
xorl %eax, %eax
callq 0xe989
movq 0x24188(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xcea3
movq (%rcx), %rsi
movq 0x8(%r13), %rax
movl 0x10(%rax), %edx
movq -0x38(%rbp), %rcx
movl 0x30(%rcx), %edi
leaq 0x4864(%rip), %rcx      # 0x1172b
cmpq $0x5, %rdi
ja 0xced8
leaq 0x9edc(%rip), %rcx      # 0x16db0
movq (%rcx,%rdi,8), %rcx
movq 0x8(%rax), %r8
leaq 0x5697(%rip), %rdi      # 0x1257a
xorl %eax, %eax
callq 0x10b0
movq 0x24137(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
jmp 0xce76
cmpl $0x55, %eax
jg 0xcf81
cmpl $0x50, %eax
je 0xd0ad
cmpl $0x52, %eax
jne 0xd93f
movq 0x38(%rsi), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0xb8e8
movq %rax, -0x38(%rbp)
testq %rax, %rax
setne %r14b
je 0xd28c
movl 0x8(%rax), %eax
xorl %r15d, %r15d
cmpl $0x37, %eax
je 0xd58c
cmpl $0x39, %eax
movq -0x30(%rbp), %r13
je 0xd590
xorl %eax, %eax
callq 0xe989
movq 0x240c2(%rip), %rcx     # 0x31028
movq %rbx, %rdx
movq %rdx, %rax
movq 0x10(%rdx), %rdx
cmpq %rcx, %rdx
jne 0xcf69
leaq 0x5ab6(%rip), %rdi      # 0x12a32
jmp 0xd2b4
cmpl $0x56, %eax
je 0xd101
cmpl $0x69, %eax
jne 0xd93f
movq %rbx, %rdi
callq 0xe583
jmp 0xd93f
cmpl $0x34, %eax
jne 0xd93f
movq %rbx, %rdi
movl $0x1, %edx
callq 0xc323
cmpl $-0x2, %eax
je 0xd51d
cmpl $-0x1, %eax
movq -0x30(%rbp), %r14
jne 0xd577
xorl %eax, %eax
callq 0xe989
movq 0x2404e(%rip), %rcx     # 0x31028
movq %rbx, %rdx
movq %rdx, %rax
movq 0x10(%rdx), %rdx
cmpq %rcx, %rdx
jne 0xcfdd
leaq 0x58bb(%rip), %rdi      # 0x128ab
jmp 0xd545
movq 0x38(%rsi), %rsi
movl (%rsi), %eax
cmpl $0x72, %eax
je 0xd4b7
cmpl $0x40, %eax
jne 0xd93f
movq %rbx, %rdi
leaq -0x38(%rbp), %rdx
callq 0xe1a5
jmp 0xd93f
movq %rbx, %rdi
xorl %edx, %edx
callq 0xc323
cmpl $-0x2, %eax
je 0xd4c6
cmpl $-0x1, %eax
jne 0xd93f
xorl %eax, %eax
callq 0xe989
movq 0x23fe0(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xd04b
movq (%rcx), %rsi
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq 0x8(%rax), %rcx
leaq 0x5837(%rip), %rdi      # 0x128ab
jmp 0xd500
movq 0x38(%rsi), %r15
movq 0x8(%r15), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0xb8e8
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0xd249
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0xca24
jmp 0xd93f
movq 0x38(%rsi), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0xb8e8
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0xd2ea
cmpl $0x37, 0x8(%rax)
je 0xd33c
xorl %eax, %eax
callq 0xe989
movq 0x23f42(%rip), %rcx     # 0x31028
movq %rbx, %rdx
movq %rdx, %rax
movq 0x10(%rdx), %rdx
cmpq %rcx, %rdx
jne 0xd0e9
leaq 0x5688(%rip), %rdi      # 0x12784
jmp 0xd30e
movq 0x38(%rsi), %rsi
movq %rbx, %rdi
callq 0xe366
cmpl $0x39, %eax
je 0xd160
xorl %eax, %eax
callq 0xe989
movq 0x23f08(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xd123
movq (%rcx), %rsi
movq 0x30(%r13), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
leaq 0x549b(%rip), %rdi      # 0x125e3
xorl %eax, %eax
callq 0x10b0
movq 0x23ed2(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
movq 0x30(%r13), %rax
movq 0x38(%rax), %r15
movl $0x10, %edi
callq 0x1120
movq %r13, %r14
movq %rax, %r13
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, (%r13)
xorl %eax, %eax
movq %rax, 0x8(%r13)
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xcbce
movq %rbx, %rdi
movl $0x3, %esi
callq 0xb3cc
movq %rax, %rdi
movq 0x30(%r14), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rsi
movq %rdi, -0x48(%rbp)
movl -0x3c(%rbp), %edx
callq 0xcd55
movq 0x30(%r14), %rax
movq 0x38(%rax), %r12
movl $0x10, %edi
callq 0x1120
movq %rax, %r15
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, (%rax)
xorl %eax, %eax
movq %rax, 0x8(%r15)
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xcbce
cmpl %r14d, (%r13)
je 0xd415
movq -0x48(%rbp), %r14
movl (%r15), %eax
cmpl (%r13), %eax
jg 0xd45a
movq 0x8(%r13), %r13
testq %r13, %r13
je 0xd21c
movq 0x8(%r15), %r15
testq %r15, %r15
jne 0xd1fd
xorl %eax, %eax
callq 0xe9b8
movq 0x23dfe(%rip), %rcx     # 0x31028
movq %rbx, %rdx
movq %rdx, %rax
movq 0x10(%rdx), %rdx
cmpq %rcx, %rdx
jne 0xd22d
leaq 0x5462(%rip), %rdi      # 0x126a2
movq -0x30(%rbp), %rcx
jmp 0xd441
xorl %eax, %eax
callq 0xe989
movq 0x23dd1(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xd25a
movq (%rcx), %rsi
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq 0x8(%rax), %rcx
leaq 0x55ce(%rip), %rdi      # 0x12855
jmp 0xd500
xorl %eax, %eax
callq 0xe989
movq 0x23d8e(%rip), %rcx     # 0x31028
movq %rbx, %rdx
movq %rdx, %rax
movq 0x10(%rdx), %rdx
cmpq %rcx, %rdx
jne 0xd29d
leaq 0x5718(%rip), %rdi      # 0x129c8
movq -0x30(%rbp), %r13
movq (%rax), %rsi
movq 0x30(%r13), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq 0x8(%rax), %rcx
xorl %eax, %eax
callq 0x10b0
movq 0x23d50(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
movl %r14d, %r15d
jmp 0xd590
xorl %eax, %eax
callq 0xe989
movq 0x23d30(%rip), %rcx     # 0x31028
movq %rbx, %rdx
movq %rdx, %rax
movq 0x10(%rdx), %rdx
cmpq %rcx, %rdx
jne 0xd2fb
leaq 0x541b(%rip), %rdi      # 0x12729
movq (%rax), %rsi
movq 0x30(%r13), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq 0x8(%rax), %rcx
xorl %eax, %eax
callq 0x10b0
movq 0x23cf6(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
movq 0x30(%r13), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %r14
movq 0x8(%r14), %rax
movq 0x8(%rax), %rdi
callq 0x1140
movl %eax, %r15d
movq 0x38(%r14), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x1140
cmpl %eax, %r15d
jle 0xd3b4
xorl %eax, %eax
callq 0xe989
movq 0x23cac(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xd37f
movq (%rcx), %rsi
movq 0x8(%r14), %rax
movl 0x10(%rax), %edx
leaq 0x545e(%rip), %rdi      # 0x127fa
xorl %eax, %eax
callq 0x10b0
movq 0x23c7e(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
movq %rbx, %rdi
movl $0x2, %esi
callq 0xb3cc
movq %rax, %r12
movq 0x30(%r13), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %r15
movl $0x38, %edi
callq 0x1120
movq %r15, (%rax)
movl $0x37, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movl $0x0, 0x20(%rax)
movq %r12, 0x28(%rax)
movl $0x4, 0x30(%rax)
movq -0x38(%rbp), %rcx
testq %rcx, %rcx
je 0xd46d
movl 0x18(%rcx), %edx
movl 0x1c(%rcx), %ecx
movl %edx, 0x18(%rax)
jmp 0xd472
xorl %eax, %eax
callq 0xe9b8
movq 0x23c05(%rip), %rcx     # 0x31028
movq %rbx, %rdx
movq %rdx, %rax
movq 0x10(%rdx), %rdx
cmpq %rcx, %rdx
jne 0xd426
leaq 0x5212(%rip), %rdi      # 0x1264b
movq -0x30(%rbp), %rcx
movq -0x48(%rbp), %r14
movq (%rax), %rsi
movq 0x30(%rcx), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
xorl %eax, %eax
callq 0x10b0
movq %r14, %rdi
movl -0x3c(%rbp), %esi
callq 0xba4c
movq %rbx, %rdi
movq %r14, %rsi
jmp 0xd4ad
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
movl %ecx, 0x1c(%rax)
movq %r12, %rdi
movq %rax, %rsi
movl $0x2, %edx
callq 0xb68b
movq 0x38(%r14), %rax
movq 0x38(%rax), %rsi
movq %r12, %rdi
movl -0x3c(%rbp), %r14d
movl %r14d, %edx
callq 0xcd55
movq %r12, %rdi
movl %r14d, %esi
callq 0xba4c
movq %rbx, %rdi
movq %r12, %rsi
callq 0xb605
jmp 0xd93f
movl $0x1, 0x23b63(%rip)     # 0x31024
jmp 0xd93f
xorl %eax, %eax
callq 0xe989
movq 0x23b54(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xd4d7
movq (%rcx), %rsi
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq 0x8(%rax), %rcx
leaq 0x5468(%rip), %rdi      # 0x12968
xorl %eax, %eax
callq 0x10b0
movq 0x23b1a(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
jmp 0xd93f
xorl %eax, %eax
callq 0xe989
movq 0x23afd(%rip), %rcx     # 0x31028
movq %rbx, %rdx
movq %rdx, %rax
movq 0x10(%rdx), %rdx
cmpq %rcx, %rdx
jne 0xd52e
leaq 0x53ce(%rip), %rdi      # 0x1290f
movq -0x30(%rbp), %r14
movq (%rax), %rsi
movq 0x30(%r14), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
movq 0x8(%rax), %rcx
xorl %eax, %eax
callq 0x10b0
movq 0x23abb(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
movq 0x30(%r14), %rax
movq 0x30(%rax), %rsi
movq %rbx, %rdi
callq 0xcab0
jmp 0xd93f
movq -0x30(%rbp), %r13
movq %rbx, %rdi
movl $0x4, %esi
callq 0xb3cc
movq %rax, %r12
movq 0x30(%r13), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %r13
xorl %r14d, %r14d
testq %r13, %r13
je 0xd7f3
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x38(%rbp), %rax
testq %rax, %rax
sete %cl
orb %r15b, %cl
movl (%r13), %ecx
je 0xd5f4
cmpl $0x55, %ecx
jne 0xd713
movq -0x38(%rbp), %rax
testq %rax, %rax
jne 0xd5f9
movl $0x1, -0x48(%rbp)
jmp 0xd64c
cmpl $0x55, %ecx
jne 0xd654
movl $0x1, -0x48(%rbp)
cmpl $0x39, 0x8(%rax)
jne 0xd64c
xorl %eax, %eax
callq 0xe989
movq 0x23a14(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xd617
movq (%rcx), %rsi
movq 0x8(%r13), %rax
movl 0x10(%rax), %edx
leaq 0x5563(%rip), %rdi      # 0x12b97
xorl %eax, %eax
callq 0x10b0
movq 0x239e6(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
movq %r13, %rax
jmp 0xd7ae
movl 0x8(%rax), %eax
cmpl $0x39, %eax
je 0xd706
cmpl $0x37, %eax
jne 0xd713
movq 0x38(%r13), %rax
movl (%rax), %eax
andl $-0x2, %eax
cmpl $0x48, %eax
jne 0xd713
xorl %eax, %eax
callq 0xe989
movq 0x2399f(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xd68c
movq (%rcx), %rsi
movq 0x38(%r13), %rax
movq 0x8(%rax), %rcx
movl 0x10(%rcx), %edx
movq -0x38(%rbp), %rcx
movl 0x8(%rcx), %edi
addl $-0x37, %edi
leaq 0x25d5(%rip), %rcx      # 0xfc8c
cmpl $0x2, %edi
ja 0xd6c9
movl %edi, %ecx
leaq 0x971b(%rip), %rdi      # 0x16de0
movq (%rdi,%rcx,8), %rcx
cmpl $0x71, (%rax)
leaq 0x3752(%rip), %r8       # 0x10e25
leaq 0x373e(%rip), %rax      # 0x10e18
cmoveq %rax, %r8
leaq 0x53de(%rip), %rdi      # 0x12ac3
xorl %eax, %eax
callq 0x10b0
movq 0x23935(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
movl (%r13), %ecx
jmp 0xd5d9
movq 0x38(%r13), %rax
cmpl $0x71, (%rax)
je 0xd67b
movq %r13, %rdi
callq 0xc9d7
testl %eax, %eax
je 0xd769
xorl %eax, %eax
callq 0xe989
movq 0x238fb(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xd730
movq (%rcx), %rsi
movq 0x38(%r13), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
leaq 0x53ff(%rip), %rdi      # 0x12b50
xorl %eax, %eax
callq 0x10b0
movq 0x238c9(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
movq -0x38(%rbp), %rax
testq %rax, %rax
je 0xd7aa
cmpl $0x39, 0x8(%rax)
jne 0xd7aa
movq 0x38(%r13), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
cmpb $0x74, (%rax)
jne 0xd792
movl $0x1, -0x4c(%rbp)
jmp 0xd7aa
movq 0x38(%r13), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
cmpb $0x66, (%rax)
movl $0x1, %eax
cmovel %eax, %r14d
movq 0x38(%r13), %rax
movq 0x38(%rax), %rsi
movq %r12, %rdi
movl -0x3c(%rbp), %edx
callq 0xcd55
cmpl $0x55, (%r13)
je 0xd7c8
movq 0x38(%r13), %r13
movq 0x38(%r13), %rax
movq 0x38(%rax), %r13
testq %r13, %r13
jne 0xd5c6
cmpl $0x0, -0x48(%rbp)
setne %al
cmpl $0x0, -0x4c(%rbp)
setne %r15b
testl %r14d, %r14d
setne %r14b
movl %eax, %edx
jmp 0xd7fb
xorl %r15d, %r15d
xorl %edx, %edx
xorl %r14d, %r14d
movq -0x38(%rbp), %rax
testq %rax, %rax
sete %cl
orb %dl, %cl
testb $0x1, %cl
movq -0x30(%rbp), %r13
jne 0xd864
cmpl $0x37, 0x8(%rax)
jne 0xd86d
xorl %eax, %eax
callq 0xe989
movq 0x23804(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xd827
movq (%rcx), %rsi
movq 0x30(%r13), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
leaq 0x53d6(%rip), %rdi      # 0x12c1e
xorl %eax, %eax
callq 0x10b0
movq 0x237d2(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
movq -0x38(%rbp), %rax
testq %rax, %rax
je 0xd929
cmpl $0x39, 0x8(%rax)
jne 0xd929
movl %r15d, %eax
andb %r14b, %al
jne 0xd929
testb %r15b, %r15b
jne 0xd8d6
xorl %eax, %eax
callq 0xe989
movq 0x23792(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xd899
movq (%rcx), %rsi
movq 0x30(%r13), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
leaq 0x53b9(%rip), %rdi      # 0x12c77
xorl %eax, %eax
callq 0x10b0
movq 0x2375c(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
testb %r14b, %r14b
jne 0xd929
xorl %eax, %eax
callq 0xe989
movq 0x2373f(%rip), %rax     # 0x31028
movq %rbx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0xd8ec
movq (%rcx), %rsi
movq 0x30(%r13), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %edx
leaq 0x53d2(%rip), %rdi      # 0x12ce3
xorl %eax, %eax
callq 0x10b0
movq 0x23709(%rip), %rax     # 0x31028
movl $0x1, 0xd8(%rax)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xb605
movq %r12, %rdi
movl -0x3c(%rbp), %esi
callq 0xba4c
movq -0x30(%rbp), %r13
movq 0x38(%r13), %r13
jmp 0xcd74
movq 0x10(%rbx), %rcx
movl 0x10c(%rbx), %eax
cmpq 0x236cb(%rip), %rcx     # 0x31028
je 0xd965
subl 0x10c(%rcx), %eax
movl %eax, 0x110(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq