// File: /workspace/github_c_makefile_star2_O1/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, -0x34(%rbp)
movq %rdi, %rbx
movq %rdi, 0x20(%rsi)
movq 0x30(%rsi), %r13
testq %r13, %r13
je 0xe1af
movq 0x30(%r13), %rsi
movl (%rsi), %eax
cmpl $0x4f, %eax
movq %r13, -0x40(%rbp)
jg 0xd8da
leal -0x3e(%rax), %ecx
cmpl $0x6, %ecx
ja 0xdbdd
leaq 0x4f47(%rip), %rdx      # 0x126d0
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x38(%rsi), %rax
movq 0x30(%rax), %r13
testq %r13, %r13
je 0xe1a2
movq 0x38(%rax), %r14
movq 0x8(%r13), %rax
movq 0x8(%rax), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc430
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0xd7cd
cmpq %rbx, 0x28(%rax)
je 0xd873
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 0xd81b
movl $0x3b, 0x8(%r12)
movq 0x18(%r14), %rax
movq (%rax), %rax
movq %rax, 0x10(%r12)
jmp 0xd826
movq 0x18(%r14), %rax
movl (%rax), %eax
movl %eax, 0x8(%r12)
movq %r12, %rdi
callq 0xcf9f
testl %eax, %eax
jle 0xd84c
movl 0x10c(%rbx), %ecx
addl %eax, %ecx
movl %ecx, 0x1c(%r12)
movl %eax, 0x18(%r12)
movl %ecx, 0x10c(%rbx)
jmp 0xd851
movl %eax, 0x1c(%r12)
movq %rbx, %rdi
movq %r12, %rsi
movl $0x2, %edx
callq 0xc1d3
movq 0x38(%r13), %r13
testq %r13, %r13
jne 0xd7a7
jmp 0xe1a2
cmpl $0x0, 0x30(%rax)
je 0xd7cd
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq -0x30(%rbp), %rcx
movl 0x30(%rcx), %edx
leaq 0x4e81(%rip), %rcx      # 0x1271b
cmpq $0x5, %rdx
ja 0xd8ab
leaq 0xa509(%rip), %rcx      # 0x17db0
movq (%rcx,%rdx,8), %rcx
movq 0x8(%r13), %rsi
movl 0x10(%rsi), %edx
movq 0x8(%rsi), %r8
leaq 0x5cad(%rip), %rdi      # 0x1356a
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x2475a(%rip), %rax     # 0x32028
movl $0x1, 0xd8(%rax)
jmp 0xd861
cmpl $0x55, %eax
jg 0xdbbe
cmpl $0x50, %eax
je 0xdd0f
cmpl $0x52, %eax
jne 0xe1a2
movq 0x38(%rsi), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0xc430
movq %rax, -0x30(%rbp)
leaq 0x60a4(%rip), %r12      # 0x139b8
testq %rax, %rax
setne %r14b
movq -0x40(%rbp), %r13
je 0xd938
movl 0x8(%rax), %eax
xorl %r15d, %r15d
cmpl $0x37, %eax
je 0xd97b
leaq 0x60ef(%rip), %r12      # 0x13a22
cmpl $0x39, %eax
je 0xd97b
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq 0x30(%r13), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
movq 0x8(%rcx), %rcx
movq %r12, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x246ba(%rip), %rax     # 0x32028
movl $0x1, 0xd8(%rax)
movl %r14d, %r15d
movq %rbx, %rdi
movl $0x4, %esi
callq 0xbf0d
movq %rax, %r12
movq 0x30(%r13), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %r13
xorl %r14d, %r14d
testq %r13, %r13
je 0xdfe5
movl $0x0, -0x38(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x30(%rbp), %rax
testq %rax, %rax
sete %cl
orb %r15b, %cl
jne 0xda70
cmpl $0x55, (%r13)
je 0xda70
movl 0x8(%rax), %eax
cmpl $0x39, %eax
je 0xd9f3
cmpl $0x37, %eax
jne 0xda70
movq 0x38(%r13), %rcx
movl (%rcx), %ecx
andl $-0x2, %ecx
cmpl $0x48, %ecx
je 0xd9fc
cmpl $0x39, %eax
jne 0xda70
movq 0x38(%r13), %rax
cmpl $0x71, (%rax)
jne 0xda70
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq -0x30(%rbp), %rcx
movl 0x8(%rcx), %edx
addl $-0x37, %edx
leaq 0x3270(%rip), %rcx      # 0x10c8c
cmpl $0x2, %edx
ja 0xda2e
movl %edx, %ecx
leaq 0xa3b6(%rip), %rdx      # 0x17de0
movq (%rdx,%rcx,8), %rcx
movq 0x38(%r13), %rdx
movq 0x8(%rdx), %rsi
cmpl $0x71, (%rdx)
movl 0x10(%rsi), %edx
leaq 0x43e2(%rip), %r8       # 0x11e25
leaq 0x43ce(%rip), %rsi      # 0x11e18
cmoveq %rsi, %r8
leaq 0x605e(%rip), %rdi      # 0x13ab3
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x245c2(%rip), %rax     # 0x32028
movl $0x1, 0xd8(%rax)
cmpl $0x55, (%r13)
jne 0xdacd
movq -0x30(%rbp), %rax
movl $0x1, -0x48(%rbp)
testq %rax, %rax
je 0xdac5
cmpl $0x39, 0x8(%rax)
jne 0xdac5
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq 0x8(%r13), %rcx
movl 0x10(%rcx), %edx
leaq 0x60dd(%rip), %rdi      # 0x13b87
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x2456d(%rip), %rax     # 0x32028
movl $0x1, 0xd8(%rax)
movq %r13, %rax
jmp 0xdb76
movq %r13, %rdi
callq 0xd3e3
testl %eax, %eax
je 0xdb15
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq 0x38(%r13), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
leaq 0x6046(%rip), %rdi      # 0x13b40
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x2451d(%rip), %rax     # 0x32028
movl $0x1, 0xd8(%rax)
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0xdb72
cmpl $0x39, 0x8(%rax)
jne 0xdb4f
movq 0x38(%r13), %rcx
movq 0x8(%rcx), %rcx
movq 0x8(%rcx), %rcx
movb (%rcx), %dl
cmpb $0x74, %dl
movl -0x38(%rbp), %ecx
movl $0x1, %esi
cmovel %esi, %ecx
testq %rax, %rax
je 0xdb4a
cmpb $0x74, %dl
jne 0xdb54
movl %ecx, -0x38(%rbp)
jmp 0xdb72
testq %rax, %rax
je 0xdb72
cmpl $0x39, 0x8(%rax)
jne 0xdb72
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 -0x34(%rbp), %edx
callq 0xd73b
cmpl $0x55, (%r13)
je 0xdb90
movq 0x38(%r13), %r13
movq 0x38(%r13), %rax
movq 0x38(%rax), %r13
testq %r13, %r13
jne 0xd9b1
cmpl $0x0, -0x48(%rbp)
setne %al
cmpl $0x0, -0x38(%rbp)
setne %r15b
testl %r14d, %r14d
setne %r14b
movl %eax, %edx
jmp 0xdfed
cmpl $0x56, %eax
je 0xde55
cmpl $0x69, %eax
jne 0xe1a2
movq %rbx, %rdi
callq 0xedf9
jmp 0xe1a2
cmpl $0x34, %eax
jne 0xe1a2
movq %rbx, %rdi
movl $0x1, %edx
callq 0xcd91
leaq 0x5ca1(%rip), %r15      # 0x1389b
cmpl $-0x1, %eax
movq -0x40(%rbp), %r14
je 0xdc0f
cmpl $-0x2, %eax
jne 0xdc53
leaq 0x5cf0(%rip), %r15      # 0x138ff
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq 0x30(%r14), %rcx
movq 0x38(%rcx), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
movq 0x8(%rcx), %rcx
movq %r15, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x243df(%rip), %rax     # 0x32028
movl $0x1, 0xd8(%rax)
movq 0x30(%r14), %rax
movq 0x30(%rax), %rsi
movq %rbx, %rdi
callq 0xd4a3
jmp 0xe1a2
movq 0x38(%rsi), %rsi
movl (%rsi), %eax
cmpl $0x72, %eax
je 0xe152
cmpl $0x40, %eax
jne 0xe1a2
movq %rbx, %rdi
leaq -0x30(%rbp), %rdx
callq 0xea15
jmp 0xe1a2
movq %rbx, %rdi
xorl %edx, %edx
callq 0xcd91
cmpl $-0x2, %eax
je 0xe15e
cmpl $-0x1, %eax
jne 0xe1a2
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq -0x40(%rbp), %rcx
movq 0x30(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
movq 0x8(%rcx), %rcx
leaq 0x5bc5(%rip), %rdi      # 0x1389b
jmp 0xe187
movq 0x38(%rsi), %r15
movq 0x8(%r15), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0xc430
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0xdfb3
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0xd430
jmp 0xe1a2
movq 0x38(%rsi), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0xc430
movq %rax, -0x30(%rbp)
leaq 0x59eb(%rip), %r15      # 0x13719
testq %rax, %rax
je 0xdd40
cmpl $0x37, 0x8(%rax)
leaq 0x5a36(%rip), %r15      # 0x13774
je 0xdd80
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq 0x30(%r13), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
movq 0x8(%rcx), %rcx
movq %r15, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x242b2(%rip), %rax     # 0x32028
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 0xddea
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq 0x8(%r14), %rcx
movl 0x10(%rcx), %edx
leaq 0x5a1b(%rip), %rdi      # 0x137ea
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x24248(%rip), %rax     # 0x32028
movl $0x1, 0xd8(%rax)
movq %rbx, %rdi
movl $0x2, %esi
callq 0xbf0d
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 -0x30(%rbp), %rcx
testq %rcx, %rcx
je 0xe10c
movl 0x1c(%rcx), %edx
movl %edx, 0x1c(%rax)
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
jmp 0xe113
movq 0x38(%rsi), %rsi
movq %rbx, %rdi
callq 0xebd3
cmpl $0x39, %eax
je 0xdea6
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq 0x30(%r13), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
leaq 0x5748(%rip), %rdi      # 0x135d3
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x2418c(%rip), %rax     # 0x32028
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 0xd5bc
movq %rbx, %rdi
movl $0x3, %esi
callq 0xbf0d
movq %rax, %rdi
movq 0x30(%r14), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rsi
movq %rdi, -0x48(%rbp)
movl -0x34(%rbp), %edx
callq 0xd73b
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 0xd5bc
leaq 0x56ff(%rip), %r12      # 0x1363b
cmpl %r14d, (%r13)
je 0xdf6a
movl (%r15), %eax
movl (%r13), %ecx
cmpl %ecx, %eax
jg 0xdf99
movq 0x8(%r13), %r13
testq %r13, %r13
je 0xdf5f
movq 0x8(%r15), %r15
testq %r15, %r15
jne 0xdf42
leaq 0x572c(%rip), %r12      # 0x13692
cmpl %ecx, %eax
jg 0xdf99
xorl %eax, %eax
callq 0xf234
movq %rbx, %rdi
callq 0xcb84
movq -0x40(%rbp), %rcx
movq 0x30(%rcx), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
movq %r12, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq -0x48(%rbp), %r14
movq %r14, %rdi
movl -0x34(%rbp), %esi
callq 0xc582
movq %rbx, %rdi
movq %r14, %rsi
jmp 0xe14b
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq -0x40(%rbp), %rcx
movq 0x30(%rcx), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
movq 0x8(%rcx), %rcx
leaq 0x5865(%rip), %rdi      # 0x13845
jmp 0xe187
xorl %r15d, %r15d
xorl %edx, %edx
xorl %r14d, %r14d
movq -0x30(%rbp), %rax
testq %rax, %rax
sete %cl
orb %dl, %cl
testb $0x1, %cl
movq -0x40(%rbp), %r13
jne 0xe044
cmpl $0x37, 0x8(%rax)
jne 0xe044
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq 0x30(%r13), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
leaq 0x5be5(%rip), %rdi      # 0x13c0e
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x23fee(%rip), %rax     # 0x32028
movl $0x1, 0xd8(%rax)
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0xe0f1
cmpl $0x39, 0x8(%rax)
jne 0xe0f1
movl %r15d, %eax
andb %r14b, %al
jne 0xe0f1
testb %r15b, %r15b
jne 0xe0ac
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq 0x30(%r13), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
leaq 0x5bd6(%rip), %rdi      # 0x13c67
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x23f86(%rip), %rax     # 0x32028
movl $0x1, 0xd8(%rax)
testb %r14b, %r14b
jne 0xe0f1
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq 0x30(%r13), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
leaq 0x5bfd(%rip), %rdi      # 0x13cd3
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x23f41(%rip), %rax     # 0x32028
movl $0x1, 0xd8(%rax)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc14d
movq %r12, %rdi
movl -0x34(%rbp), %esi
callq 0xc582
jmp 0xe1a2
movl $0xfffffffe, 0x1c(%rax) # imm = 0xFFFFFFFE
movq %r12, %rdi
movq %rax, %rsi
movl $0x2, %edx
callq 0xc1d3
movq 0x38(%r14), %rax
movq 0x38(%rax), %rsi
movq %r12, %rdi
movl -0x34(%rbp), %r14d
movl %r14d, %edx
callq 0xd73b
movq %r12, %rdi
movl %r14d, %esi
callq 0xc582
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc14d
jmp 0xe1a2
movl $0x1, 0x23ec8(%rip)     # 0x32024
jmp 0xe1a2
xorl %eax, %eax
callq 0xf205
movq %rbx, %rdi
callq 0xcb84
movq -0x40(%rbp), %rcx
movq 0x30(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
movq 0x8(%rcx), %rcx
leaq 0x57d1(%rip), %rdi      # 0x13958
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x23e90(%rip), %rax     # 0x32028
movl $0x1, 0xd8(%rax)
movq -0x40(%rbp), %r13
movq 0x38(%r13), %r13
jmp 0xd75a
movq 0x10(%rbx), %rcx
movl 0x10c(%rbx), %eax
cmpq 0x23e68(%rip), %rcx     # 0x32028
je 0xe1c8
subl 0x10c(%rcx), %eax
movl %eax, 0x110(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq