// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movq %rsi, %r8
movq %rdi, %rbx
movq %rdi, 0x20(%rsi)
addq $0x30, %r8
movl %edx, -0x38(%rbp)
movq (%r8), %r8
testq %r8, %r8
je 0xc7fd
leaq 0x30(%r8), %r13
movq 0x30(%r8), %rsi
movl (%rsi), %eax
leal -0x3e(%rax), %ecx
cmpl $0x6, %ecx
movq %r8, -0x58(%rbp)
jbe 0xbf06
cmpl $0x34, %eax
je 0xc1d5
cmpl $0x50, %eax
je 0xc50c
cmpl $0x52, %eax
je 0xc251
cmpl $0x56, %eax
je 0xc0d6
cmpl $0x69, %eax
jne 0xc7f0
movq %rbx, %rdi
callq 0xd28f
jmp 0xc7f0
leaq 0x47ab(%rip), %rdx      # 0x106b8
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x38(%rsi), %r13
movq 0x38(%r13), %r15
addq $0x30, %r13
movq (%r13), %r13
testq %r13, %r13
je 0xc7f0
movq 0x8(%r13), %rax
movq 0x8(%rax), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xac19
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0xbf51
cmpq %rbx, 0x28(%rax)
je 0xbfcd
movq %r14, %rdi
movq %rbx, %rsi
pushq $0x3
popq %rdx
movl $0xffffd8f1, %ecx       # imm = 0xFFFFD8F1
callq 0xa95c
movq %rax, %r12
cmpl $0x1, 0x10(%r15)
jne 0xbf85
movl $0x3b, 0x8(%r12)
movq 0x18(%r15), %rax
movq (%rax), %rax
movq %rax, 0x10(%r12)
jmp 0xbf90
movq 0x18(%r15), %rax
movl (%rax), %eax
movl %eax, 0x8(%r12)
movq %r12, %rdi
callq 0xb793
testl %eax, %eax
jle 0xbfb1
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
pushq $0x2
popq %rdx
callq 0xaa65
addq $0x38, %r13
jmp 0xbf22
cmpl $0x0, 0x30(%rax)
je 0xbf51
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq %rax, -0x48(%rbp)
movq %rbx, %r14
movq 0x8(%r13), %rbx
movl 0x10(%rbx), %r12d
movq -0x30(%rbp), %rax
movl 0x30(%rax), %edi
callq 0xac67
movq 0x8(%rbx), %r8
movq %r14, %rbx
leaq 0x555b(%rip), %rdi      # 0x1156a
movq -0x48(%rbp), %rsi
movl %r12d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x10b0
movq 0x23ff1(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
jmp 0xbfc4
movq 0x38(%rsi), %r14
movq 0x8(%r14), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0xac19
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0xc779
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xbbf1
jmp 0xc7f0
movq %rbx, %rdi
xorl %edx, %edx
callq 0xb585
cmpl $-0x2, %eax
je 0xc7a4
cmpl $-0x1, %eax
jne 0xc7f0
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq (%r13), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
movq 0x8(%rcx), %rcx
leaq 0x57f3(%rip), %rdi      # 0x1189b
jmp 0xc7c9
movq 0x38(%rsi), %rsi
movl (%rsi), %eax
cmpl $0x72, %eax
je 0xc7e6
cmpl $0x40, %eax
jne 0xc7f0
movq %rbx, %rdi
leaq -0x30(%rbp), %rdx
callq 0xced0
jmp 0xc7f0
movq 0x38(%rsi), %rsi
movq %rbx, %rdi
callq 0xd08f
cmpl $0x39, %eax
je 0xc127
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq (%r13), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
leaq 0x54c7(%rip), %rdi      # 0x115d3
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x23efb(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
movq (%r13), %rax
movq 0x38(%rax), %rsi
movq %rbx, %rdi
callq 0xbe20
movq %r13, %r14
movq %rax, %r13
movq %rbx, %rdi
pushq $0x3
popq %rsi
callq 0xa90e
movq %rax, %r12
movq (%r14), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rsi
movq %r12, %rdi
movl -0x38(%rbp), %r15d
movl %r15d, %edx
callq 0xbe88
movq %r14, -0x50(%rbp)
movq (%r14), %rax
movq 0x38(%rax), %rsi
movq %rbx, %rdi
callq 0xbe20
cmpl $-0x1, (%r13)
leaq 0x54b7(%rip), %r14      # 0x1163b
je 0xc19c
movq %r13, %rdi
movq %rax, %rsi
callq 0xbe5f
leaq 0x54fa(%rip), %r14      # 0x11692
testl %eax, %eax
jne 0xc1ca
xorl %eax, %eax
callq 0xd68e
movq %rbx, %rdi
callq 0xb395
movq -0x50(%rbp), %rcx
movq (%rcx), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
movq %r14, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq %r12, %rdi
movl %r15d, %esi
jmp 0xc656
movq %rbx, %rdi
pushq $0x1
popq %rdx
callq 0xb585
leaq 0x56b4(%rip), %r14      # 0x1189b
cmpl $-0x1, %eax
je 0xc1f8
cmpl $-0x2, %eax
jne 0xc23c
leaq 0x5707(%rip), %r14      # 0x118ff
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq (%r13), %rcx
movq 0x38(%rcx), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
movq 0x8(%rcx), %rcx
movq %r14, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x23de6(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
movq (%r13), %rax
movq 0x30(%rax), %rsi
movq %rbx, %rdi
callq 0xbc64
jmp 0xc7f0
movq 0x38(%rsi), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0xac19
movq %rax, -0x30(%rbp)
leaq 0x5748(%rip), %r12      # 0x119b8
testq %rax, %rax
setne %r15b
je 0xc290
movl 0x8(%rax), %eax
xorl %r14d, %r14d
cmpl $0x37, %eax
je 0xc2d3
leaq 0x5797(%rip), %r12      # 0x11a22
cmpl $0x39, %eax
je 0xc2d3
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq (%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 0x23d52(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
movl %r15d, %r14d
movq %rbx, %rdi
pushq $0x4
popq %rsi
callq 0xa90e
movq %rax, %r12
movl $0x0, -0x48(%rbp)
movq %r13, -0x50(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x38(%rbp), %r15d
movq (%r13), %r13
movq 0x38(%r13), %rax
movq 0x38(%rax), %r13
movq -0x30(%rbp), %rax
testq %r13, %r13
je 0xc4ee
testq %rax, %rax
sete %cl
orb %r14b, %cl
movl (%r13), %ecx
je 0xc33a
cmpl $0x55, %ecx
jne 0xc43c
movq -0x30(%rbp), %rax
testq %rax, %rax
jne 0xc33f
jmp 0xc37d
cmpl $0x55, %ecx
jne 0xc38b
cmpl $0x39, 0x8(%rax)
jne 0xc37d
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq 0x8(%r13), %rcx
movl 0x10(%rcx), %edx
leaq 0x5825(%rip), %rdi      # 0x11b87
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x23ca5(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
movq %r13, %rax
pushq $0x1
popq %rcx
movl %ecx, -0x48(%rbp)
jmp 0xc4cb
movl 0x8(%rax), %eax
cmpl $0x39, %eax
je 0xc42f
cmpl $0x37, %eax
jne 0xc43c
movq 0x38(%r13), %rax
movl (%rax), %eax
andl $-0x2, %eax
cmpl $0x48, %eax
jne 0xc43c
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq -0x30(%rbp), %rcx
movl 0x8(%rcx), %edx
addl $-0x37, %edx
leaq 0x28ba(%rip), %rcx      # 0xec8c
cmpl $0x2, %edx
ja 0xc3e4
movl %edx, %ecx
leaq 0x9a00(%rip), %rdx      # 0x15de0
movq (%rdx,%rcx,8), %rcx
movq 0x38(%r13), %rdx
movq 0x8(%rdx), %rsi
cmpl $0x71, (%rdx)
movl 0x10(%rsi), %edx
leaq 0x3a2c(%rip), %r8       # 0xfe25
leaq 0x3a18(%rip), %rsi      # 0xfe18
cmoveq %rsi, %r8
leaq 0x56a8(%rip), %rdi      # 0x11ab3
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x23bfc(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
movl (%r13), %ecx
jmp 0xc326
movq 0x38(%r13), %rax
cmpl $0x71, (%rax)
je 0xc3b2
movq %r13, %rdi
callq 0xbb9b
testl %eax, %eax
je 0xc484
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq 0x38(%r13), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
leaq 0x56d7(%rip), %rdi      # 0x11b40
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x23b9e(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0xc4c7
cmpl $0x39, 0x8(%rax)
jne 0xc4c7
movq 0x38(%r13), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
cmpb $0x74, (%rax)
jne 0xc4ac
pushq $0x1
popq %rax
movl %eax, -0x3c(%rbp)
jmp 0xc4c7
movq 0x38(%r13), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
cmpb $0x66, (%rax)
pushq $0x1
popq %rax
movl -0x34(%rbp), %ecx
cmovel %eax, %ecx
movl %ecx, -0x34(%rbp)
movq 0x38(%r13), %rax
movq 0x38(%rax), %rsi
movq %r12, %rdi
movl %r15d, %edx
callq 0xbe88
cmpl $0x55, (%r13)
je 0xc302
addq $0x38, %r13
jmp 0xc2fe
testq %rax, %rax
sete %cl
cmpl $0x0, -0x48(%rbp)
setne %dl
orb %cl, %dl
je 0xc66b
movq -0x50(%rbp), %r14
jmp 0xc6b4
movq 0x38(%rsi), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0xac19
movq %rax, -0x30(%rbp)
leaq 0x51ee(%rip), %r12      # 0x11719
testq %rax, %rax
je 0xc53d
cmpl $0x37, 0x8(%rax)
leaq 0x5239(%rip), %r12      # 0x11774
je 0xc57d
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq (%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 0x23aa5(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
movq (%r13), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %r15
movq 0x8(%r15), %rax
movq 0x8(%rax), %rdi
callq 0x1130
movl %eax, %r14d
movq 0x38(%r15), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x1130
cmpl %eax, %r14d
jle 0xc5e7
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq 0x8(%r15), %rcx
movl 0x10(%rcx), %edx
leaq 0x521e(%rip), %rdi      # 0x117ea
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x23a3b(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
movq %rbx, %rdi
pushq $0x2
popq %rsi
callq 0xa90e
movq %rax, %r12
movq (%r13), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq %r12, %rsi
pushq $0x4
popq %rdx
pushq $0x37
popq %rcx
callq 0xa95c
movq -0x30(%rbp), %rdx
pushq $-0x2
popq %rcx
testq %rdx, %rdx
je 0xc628
movl 0x18(%rdx), %esi
movl 0x1c(%rdx), %ecx
movl %esi, 0x18(%rax)
movl %ecx, 0x1c(%rax)
movq %r12, %rdi
movq %rax, %rsi
pushq $0x2
popq %rdx
callq 0xaa65
movq 0x38(%r15), %rax
movq 0x38(%rax), %rsi
movq %r12, %rdi
movl -0x38(%rbp), %r14d
movl %r14d, %edx
callq 0xbe88
movq %r12, %rdi
movl %r14d, %esi
callq 0xad90
movq %rbx, %rdi
movq %r12, %rsi
callq 0xaa1a
jmp 0xc7f0
cmpl $0x37, 0x8(%rax)
movq -0x50(%rbp), %r14
jne 0xc6bd
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq (%r14), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
leaq 0x5579(%rip), %rdi      # 0x11c0e
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x23972(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0xc761
cmpl $0x39, 0x8(%rax)
jne 0xc761
cmpl $0x0, -0x3c(%rbp)
je 0xc6d7
cmpl $0x0, -0x34(%rbp)
jne 0xc761
cmpl $0x0, -0x3c(%rbp)
jne 0xc71c
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq (%r14), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
leaq 0x5566(%rip), %rdi      # 0x11c67
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x23906(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
cmpl $0x0, -0x34(%rbp)
jne 0xc761
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq (%r14), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
leaq 0x558d(%rip), %rdi      # 0x11cd3
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x238c1(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xaa1a
movq %r12, %rdi
movl %r15d, %esi
callq 0xad90
jmp 0xc7f0
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq (%r13), %rcx
movq 0x38(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
movq 0x8(%rcx), %rcx
leaq 0x50a3(%rip), %rdi      # 0x11845
jmp 0xc7c9
xorl %eax, %eax
callq 0xd671
movq %rbx, %rdi
callq 0xb395
movq (%r13), %rcx
movq 0x8(%rcx), %rcx
movl 0x10(%rcx), %edx
movq 0x8(%rcx), %rcx
leaq 0x518f(%rip), %rdi      # 0x11958
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movq 0x2383e(%rip), %rax     # 0x30018
movl $0x1, 0xd8(%rax)
jmp 0xc7f0
movl $0x1, 0x23824(%rip)     # 0x30014
movq -0x58(%rbp), %r8
addq $0x38, %r8
jmp 0xbeaa
movq 0x10(%rbx), %rcx
movl 0x10c(%rbx), %eax
cmpq 0x2380a(%rip), %rcx     # 0x30018
je 0xc816
subl 0x10c(%rcx), %eax
movl %eax, 0x110(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq