// File: /workspace/github_cpp_makefile_star2_O1/AshOlogn[P]ash-language-interpreter/src/parser.cpp
// Function: parseFunction(unsigned int, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Function* parseFunction(uint32_t startLine, uint32_t secondStartLine, string functionName) {

	//now create a Function struct
	Function* function = (Function*) malloc(sizeof(Function));
	function->returnFlag = (bool*) malloc(sizeof(bool));
	function->returnValue = (ParseData*) malloc(sizeof(ParseData));

	//assign the global returnFlag and returnValue pointers to this function
	returnFlag.push_back(function->returnFlag);
	returnValue.push_back(function->returnValue);

	//now read in arguments enclosed in parentheses
	Token* leftParenToken = consume(); //consume (

	//if the next token is not a parenthesis, throw an error
	if(leftParenToken->type != LEFT_PAREN) {

		uint32_t endLine = (leftParenToken->type == END) ? secondStartLine : leftParenToken->line+1;

		if(leftParenToken->type == END) {
			throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), "Expected '(' to begin function parameter list"); 
		} else {
			throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), leftParenToken->lexeme, "Expected '(' to begin function parameter list");
		}
	}

	//first scan to figure out how many arguments must be allocated in Function
	uint32_t currentIndex = 0;
	uint32_t argCount = 0;

	uint32_t currentErrorLine = leftParenToken->line+1;
	while(peekAhead(currentIndex)->type != RIGHT_PAREN) {

		//make sure you have a type then variable
		if(!isTypeTokenType(peekAhead(currentIndex)->type)) {

			Token* tempTypeToken = peekAhead(currentIndex);	
			uint32_t endLine = (tempTypeToken->type == END) ? currentErrorLine : tempTypeToken->line+1;

			if(tempTypeToken->type == END) {
				throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), "Expected function parameter type");
			} else {
				throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), tempTypeToken->lexeme, "Expected function parameter type");
			}
		}
		currentErrorLine = peekAhead(currentIndex)->line+1;
		currentIndex++;

		//could be an array type
		if(peekAhead(currentIndex)->type == LEFT_BRACKET) {

			currentErrorLine = peekAhead(currentIndex)->line+1;
			currentIndex++;

			//next token must be ']'
			if(peekAhead(currentIndex)->type != RIGHT_BRACKET) {

				uint32_t endLine = (peekAhead(currentIndex)->type == END) ? currentErrorLine : peekAhead(currentIndex)->line+1;

				if(peekAhead(currentIndex)->type == END) {
					throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), "Expected closing ']' in array type");		
				} else {
					throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), peekAhead(currentIndex)->lexeme, "Expected closing ']' in array type");						
				}
			}

			currentErrorLine = peekAhead(currentIndex)->line+1;
			currentIndex++;
		}

		//make sure parameter name follows type
		if(peekAhead(currentIndex)->type != VARIABLE) {

			Token* tempVariableToken = peekAhead(currentIndex);
			uint32_t endLine = (tempVariableToken->type == END) ? currentErrorLine : tempVariableToken->line+1;

			if(tempVariableToken->type == END) {
				throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), "Expected function parameter name");
			} else {
				throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), tempVariableToken->lexeme, "Expected function parameter name");
			}
		}
		currentErrorLine = peekAhead(currentIndex)->line+1;
		currentIndex++;
		argCount++;

		//if next token is not closing parenthesis, it must be a comma
		Token* nextToken = peekAhead(currentIndex);				
		if(nextToken->type != RIGHT_PAREN && nextToken->type != COMMA) {

			uint32_t endLine = (nextToken->type == END) ? currentErrorLine : nextToken->line+1;

			if(nextToken->type == END) {
				throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), "Expected ',' separating arguments or ')' terminating argument list");
			} else {
				throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), nextToken->lexeme, "Expected ',' separating arguments or ')' terminating argument list"); 
			} 

		} else if(nextToken->type == COMMA) {
			currentErrorLine = nextToken->line+1;
			currentIndex++; //"consume" COMMA token
		}
	}

	//now allocate memory for argument names and types
	function->numArgs = argCount;
	ParseDataType* argTypes = new ParseDataType[argCount];
	ParseDataType* argSubTypes = new ParseDataType[argCount];
	char** argNames = (char**) malloc(sizeof(char*) * argCount);

	//keep track of variable line numbers
	uint32_t typeLines[argCount];
	uint32_t varLines[argCount];

	//now read in arguments for real
	uint32_t argIndex = 0;
	while(peek()->type != RIGHT_PAREN) {

		//read in parameter type
		Token* currTypeToken = consume();

		//could be an array type
		if(peek()->type == LEFT_BRACKET) {

			argTypes[argIndex] = ARRAY_T;
			argSubTypes[argIndex] = typeTokenConversion(currTypeToken->type);

			consume(); //consume '['
			typeLines[argIndex] = consume()->line+1;

		} else {

			argTypes[argIndex] = typeTokenConversion(currTypeToken->type);
			argSubTypes[argIndex] = INVALID_T;
			typeLines[argIndex] = currTypeToken->line+1;
		}

		//read in parameter name
		Token* currVarToken = consume();
		const char* aName = currVarToken->lexeme;
		argNames[argIndex] = copyString(aName);
		varLines[argIndex] = currVarToken->line+1;

		argIndex++;
		if(argIndex < argCount)
			consume(); //consume ,
	}
	leftParenToken = consume(); //consume ')' token

	function->argTypes = argTypes;
	function->argSubTypes = argSubTypes;
	function->argNames = argNames;

	//now get the return type
	Token* rightArrowToken = consume(); //consume ->
	if(rightArrowToken->type != RIGHTARROW) {
		
		uint32_t endLine = (rightArrowToken->line == END) ? leftParenToken->line+1 : rightArrowToken->line+1;

		if(rightArrowToken->line == END) {
			throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), "Expected -> followed by return type");
		} else {
			throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), rightArrowToken->lexeme, "Expected -> followed by return type");
		}
	}

	//make sure following token is a return type
	Token* returnTypeToken = consume();
	if(!isTypeTokenType(returnTypeToken->type)) {

		uint32_t endLine = (returnTypeToken->type == END) ? rightArrowToken->line+1 : returnTypeToken->line+1;

		if(returnTypeToken->type == END) {
			throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), "Expected function return type"); 
		} else {
			throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), returnTypeToken->lexeme, "Expected function return type"); 
		}
	}

	returnType.push_back(typeTokenConversion(returnTypeToken->type));
	function->returnType = typeTokenConversion(returnTypeToken->type);

	//just declare function up front with dummy data and Function public interface data
	//(to allow for recursive definitions)
	ParseData dummyFunctionData;
	dummyFunctionData.type = FUN_T;
	dummyFunctionData.value.allocated = function;
	symbolTable->declare(functionName, dummyFunctionData);

	//now declare the variables just for scope-checking purposes
	//and enter a new scope (in both tables) for function body
	symbolTable->enterNewScope();
	NewAssignmentStatementNode* dummy;

	for(uint32_t i = 0; i < argCount; i++) {
		//this construction declares variable as well
		string argName(argNames[i]);
		dummy = new NewAssignmentStatementNode(argName, argTypes[i], symbolTable, typeLines[i], varLines[i]);
	}

	//now store AbstractStatementNode* vector representing function body
	//make sure the body is braced
	Token* leftBraceToken = consume(); //consume {
	if(leftBraceToken->type != LEFT_BRACE) {

		uint32_t endLine = (leftBraceToken->type == END) ? returnTypeToken->line+1 : leftBraceToken->line+1;

		if(leftBraceToken->type == END) {
			throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), "Expected '{' followed by function body");
		} else {
			throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), leftBraceToken->lexeme, "Expected '{' followed by function body");
		}
	}

	//represents statements in body
	vector<AbstractStatementNode*>* body = new vector<AbstractStatementNode*>();

	while(peek()->type != RIGHT_BRACE) {
		body->push_back(addStatement());  
	}
	consume(); //consume }

	//leave scope
	symbolTable->leaveScope();
	function->body = body;

	//reset global pointers
	returnFlag.pop_back();
	returnValue.pop_back();
	returnType.pop_back();

	return function;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdx, -0x90(%rbp)
movl %esi, %ebx
movq %rdi, -0x30(%rbp)
movl $0x40, %edi
callq 0x4290
movq %rax, %r15
movl $0x1, %edi
callq 0x4290
movq %rax, %r14
movq %rax, 0x38(%r15)
movl $0x10, %edi
callq 0x4290
movq %rax, 0x30(%r15)
movq 0x147b6(%rip), %rsi     # 0x2c238
cmpq 0x147b7(%rip), %rsi     # 0x2c240
je 0x17a98
movq %r14, (%rsi)
addq $0x8, 0x147a2(%rip)     # 0x2c238
jmp 0x17aa8
leaq 0x38(%r15), %rdx
leaq 0x1478d(%rip), %rdi     # 0x2c230
callq 0x1d6c2
leaq 0x30(%r15), %rdx
movq 0x1479d(%rip), %rsi     # 0x2c250
cmpq 0x1479e(%rip), %rsi     # 0x2c258
je 0x17acc
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x14786(%rip)     # 0x2c250
jmp 0x17ad8
leaq 0x14775(%rip), %rdi     # 0x2c248
callq 0x1d7fc
movq %r15, -0x50(%rbp)
callq 0x1789c
movq %rax, %r12
movl (%rax), %r15d
testl %r15d, %r15d
jne 0x18208
movl 0x10(%r12), %r14d
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x17925
cmpl $0x1, (%rax)
jne 0x17ca8
movq -0x50(%rbp), %rax
movl %r15d, (%rax)
movl %r15d, %r14d
leaq (,%r14,4), %rbx
movq %rbx, %rdi
callq 0x4030
movq %rax, -0x58(%rbp)
movq %rbx, %rdi
callq 0x4030
movq %rax, -0x48(%rbp)
leaq (,%r14,8), %rdi
callq 0x4290
movq %rax, -0x38(%rbp)
movq %rsp, %rcx
movq %r14, -0x98(%rbp)
leaq 0xf(,%r14,4), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0x68(%rbp)
movq %rcx, %rsp
movq %rsp, %r13
subq %rax, %r13
movq %r13, %rsp
callq 0x178eb
cmpl $0x1, (%rax)
je 0x17c24
xorl %ebx, %ebx
callq 0x1789c
movq %rax, %r14
callq 0x178eb
cmpl $0x2, (%rax)
movl %ebx, %r12d
jne 0x17bbc
movq -0x58(%rbp), %rax
movl $0xc, (%rax,%r12,4)
movl (%r14), %edi
callq 0x8256
movq -0x48(%rbp), %rcx
movl %eax, (%rcx,%r12,4)
callq 0x1789c
callq 0x1789c
movq %rax, %r14
jmp 0x17bd8
movl (%r14), %edi
callq 0x8256
movq -0x58(%rbp), %rcx
movl %eax, (%rcx,%r12,4)
movq -0x48(%rbp), %rax
movl $0x11, (%rax,%r12,4)
movl 0x10(%r14), %eax
incl %eax
movq -0x68(%rbp), %rcx
movl %eax, (%rcx,%r12,4)
callq 0x1789c
movq %rax, %r14
movq 0x18(%rax), %rdi
callq 0x176b0
movq -0x38(%rbp), %rcx
movq %rax, (%rcx,%r12,8)
movl 0x10(%r14), %eax
incl %eax
movl %eax, (%r13,%r12,4)
incl %ebx
cmpl %r15d, %ebx
jae 0x17c16
callq 0x1789c
callq 0x178eb
cmpl $0x1, (%rax)
jne 0x17b7c
callq 0x1789c
movq %rax, %r14
movq -0x50(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rcx
movq %rcx, 0x18(%rax)
callq 0x1789c
movq %rax, %rbx
cmpl $0x2d, (%rax)
jne 0x182ed
callq 0x1789c
movq %rax, %r14
movl (%rax), %edi
callq 0x636c
testb %al, %al
je 0x18347
movl (%r14), %edi
callq 0x8256
movl %eax, -0x88(%rbp)
movq 0x145e3(%rip), %rsi     # 0x2c268
cmpq 0x145e4(%rip), %rsi     # 0x2c270
movl %r15d, -0x5c(%rbp)
je 0x17e10
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x145c5(%rip)     # 0x2c268
jmp 0x17e23
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x17925
movl (%rax), %edi
callq 0x636c
testb %al, %al
je 0x183cc
xorl %ebx, %ebx
movl $0x1, %r15d
movl %ebx, %edi
callq 0x17925
movl 0x10(%rax), %r12d
leal 0x1(%rbx), %r14d
movl %r14d, %edi
callq 0x17925
cmpl $0x2, (%rax)
jne 0x17d20
movl %r14d, %edi
callq 0x17925
movl 0x10(%rax), %r13d
leal 0x2(%rbx), %r12d
movl %r12d, %edi
callq 0x17925
movl (%rax), %r14d
movl %r12d, %edi
callq 0x17925
cmpl $0x3, %r14d
jne 0x180bb
movl %r15d, %r13d
movl 0x10(%rax), %r12d
addl $0x3, %ebx
movl %ebx, %r14d
jmp 0x17d23
movl %r15d, %r13d
movl %r14d, %edi
callq 0x17925
movl (%rax), %r15d
movl %r14d, %edi
callq 0x17925
movq %rax, %rbx
cmpl $0x3b, %r15d
jne 0x18064
movl 0x10(%rbx), %eax
incl %eax
movq %rax, -0x38(%rbp)
leal 0x1(%r14), %ebx
movl %ebx, %edi
callq 0x17925
movl (%rax), %r15d
cmpl $0x1, %r15d
je 0x17d7f
movq %rax, %r12
cmpl $0x2b, %r15d
jne 0x1800a
movl 0x10(%r12), %eax
incl %eax
movq %rax, -0x38(%rbp)
addl $0x2, %r14d
movl %r14d, %ebx
movl %ebx, %edi
callq 0x17925
cmpl $0x1, (%rax)
movl %r13d, %r15d
je 0x17b08
movl %ebx, %edi
callq 0x17925
movl (%rax), %edi
callq 0x636c
incl %r15d
testb %al, %al
jne 0x17cc8
movl %ebx, %edi
callq 0x17925
movq %rax, %rbx
movl (%rax), %r15d
cmpl $0x4e, %r15d
je 0x17dc7
movl 0x10(%rbx), %eax
incl %eax
movq %rax, -0x38(%rbp)
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movq -0x30(%rbp), %rax
leal -0x1(%rax), %edi
movq -0x38(%rbp), %rax
leal -0x1(%rax), %esi
cmpl $0x4e, %r15d
jne 0x1811e
callq 0x17961
leaq 0x137d8(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
jmp 0x1813d
leaq 0x14449(%rip), %rdi     # 0x2c260
leaq -0x88(%rbp), %rdx
callq 0x1d936
movq %r14, -0x48(%rbp)
movl (%r14), %edi
callq 0x8256
movq -0x50(%rbp), %r12
movl %eax, 0x28(%r12)
movq 0x14451(%rip), %rbx     # 0x2c290
leaq -0xc8(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x90(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %r14
movq %r14, %rdi
callq 0x8ac2
movq %rbx, %rdi
movq %r14, %rsi
movl $0xd, %edx
movq %r12, %rcx
callq 0x16598
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0x17e8e
callq 0x41e0
movq 0x143fb(%rip), %rdi     # 0x2c290
callq 0x1650a
cmpl $0x0, -0x5c(%rbp)
je 0x17f54
leaq -0xa8(%rbp), %rbx
xorl %r12d, %r12d
leaq -0xb8(%rbp), %r14
movq -0x38(%rbp), %rax
movq (%rax,%r12,8), %rsi
leaq -0x88(%rbp), %rdi
leaq -0x39(%rbp), %rdx
callq 0x40c0
movl $0x48, %edi
callq 0x4210
movq %rax, %r15
movq %rbx, -0xb8(%rbp)
movq -0x88(%rbp), %rsi
movq -0x80(%rbp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x8ac2
movq -0x58(%rbp), %rax
movl (%rax,%r12,4), %edx
movq 0x1438a(%rip), %rcx     # 0x2c290
movq -0x68(%rbp), %rax
movl (%rax,%r12,4), %r8d
movl (%r13,%r12,4), %r9d
movq %r15, %rdi
movq %r14, %rsi
callq 0x15b62
movq -0xb8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x17f2f
callq 0x41e0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x17f44
callq 0x41e0
incq %r12
cmpq %r12, -0x98(%rbp)
jne 0x17eb5
callq 0x1789c
movl (%rax), %r13d
cmpl $0x4, %r13d
jne 0x18253
movl $0x18, %edi
callq 0x4210
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
callq 0x178eb
cmpl $0x5, (%rax)
movq -0x50(%rbp), %r15
je 0x17fcb
leaq -0x88(%rbp), %r14
callq 0x184c7
movq %rax, -0x88(%rbp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x17fb6
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0x17fc1
movq %rbx, %rdi
movq %r14, %rdx
callq 0x1da6e
callq 0x178eb
cmpl $0x5, (%rax)
jne 0x17f96
callq 0x1789c
movq 0x142b9(%rip), %rdi     # 0x2c290
callq 0x16586
addq $-0x8, 0x14254(%rip)    # 0x2c238
movq %rbx, 0x20(%r15)
addq $-0x8, 0x14260(%rip)    # 0x2c250
addq $-0x4, 0x14270(%rip)    # 0x2c268
movq %r15, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x4e, %r15d
je 0x1801b
movl 0x10(%r12), %eax
incl %eax
movq %rax, -0x38(%rbp)
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movq -0x30(%rbp), %rax
leal -0x1(%rax), %edi
movq -0x38(%rbp), %rax
leal -0x1(%rax), %esi
cmpl $0x4e, %r15d
jne 0x18146
callq 0x17961
leaq 0x13584(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
jmp 0x18166
movl (%rbx), %r13d
cmpl $0x4e, %r13d
je 0x18071
movl 0x10(%rbx), %r12d
leal 0x1(%r12), %r15d
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movq -0x30(%rbp), %rax
leal -0x1(%rax), %edi
cmpl $0x4e, %r13d
jne 0x18183
movl %r12d, %esi
callq 0x17961
leaq 0x1352d(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
jmp 0x181a5
cmpl $0x4e, (%rax)
je 0x180cc
movl %r12d, %edi
callq 0x17925
movl 0x10(%rax), %r13d
leal 0x1(%r13), %r15d
movl %r12d, %edi
callq 0x17925
movl (%rax), %ebx
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movq -0x30(%rbp), %rax
leal -0x1(%rax), %edi
cmpl $0x4e, %ebx
jne 0x181ae
movl %r13d, %esi
callq 0x17961
leaq 0x134ca(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
jmp 0x181db
callq 0x17961
movq 0x18(%rbx), %rcx
leaq 0x134a2(%rip), %rdx     # 0x2b5d0
addq $0x10, %rdx
movq %rdx, (%r14)
movq %rax, 0x8(%r14)
movq %rcx, 0x10(%r14)
leaq 0xaf2a(%rip), %rax      # 0x2306e
jmp 0x1816d
callq 0x17961
movq 0x18(%r12), %rcx
leaq 0x13479(%rip), %rdx     # 0x2b5d0
addq $0x10, %rdx
movq %rdx, (%r14)
movq %rax, 0x8(%r14)
movq %rcx, 0x10(%r14)
leaq 0xaf66(%rip), %rax      # 0x230d3
movq %rax, 0x18(%r14)
movq -0x30(%rbp), %rax
movl %eax, 0x20(%r14)
movq -0x38(%rbp), %rax
movl %eax, 0x24(%r14)
jmp 0x181f2
movl %r12d, %esi
callq 0x17961
movq 0x18(%rbx), %rcx
leaq 0x1343a(%rip), %rdx     # 0x2b5d0
addq $0x10, %rdx
movq %rdx, (%r14)
movq %rax, 0x8(%r14)
movq %rcx, 0x10(%r14)
leaq 0xaf06(%rip), %rax      # 0x230b2
jmp 0x181e2
movl %r13d, %esi
callq 0x17961
movq %rax, %rbx
movl %r12d, %edi
callq 0x17925
movq 0x18(%rax), %rax
leaq 0x13404(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rbx, 0x8(%r14)
movq %rax, 0x10(%r14)
leaq 0xaead(%rip), %rax      # 0x2308f
movq %rax, 0x18(%r14)
movq -0x30(%rbp), %rax
movl %eax, 0x20(%r14)
movl %r15d, 0x24(%r14)
leaq 0x133ff(%rip), %rsi     # 0x2b5f8
movq 0x13dd8(%rip), %rdx     # 0x2bfd8
movq %r14, %rdi
callq 0x4350
cmpl $0x4e, %r15d
je 0x18215
movl 0x10(%r12), %ebx
incl %ebx
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movq -0x30(%rbp), %rax
leal -0x1(%rax), %edi
leal -0x1(%rbx), %esi
cmpl $0x4e, %r15d
jne 0x182b1
callq 0x17961
leaq 0x13392(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
jmp 0x182d1
movq %rax, %rbx
cmpl $0x4e, %r13d
je 0x18260
movq %rbx, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl 0x10(%rax), %r15d
leal 0x1(%r15), %r12d
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movq -0x30(%rbp), %rax
leal -0x1(%rax), %edi
cmpl $0x4e, %r13d
jne 0x183a1
movl %r15d, %esi
callq 0x17961
leaq 0x13337(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
jmp 0x183c3
callq 0x17961
movq 0x18(%r12), %rcx
leaq 0x1330e(%rip), %rdx     # 0x2b5d0
addq $0x10, %rdx
movq %rdx, (%r14)
movq %rax, 0x8(%r14)
movq %rcx, 0x10(%r14)
leaq 0xad68(%rip), %rax      # 0x23040
movq %rax, 0x18(%r14)
movq -0x30(%rbp), %rax
movl %eax, 0x20(%r14)
movl %ebx, 0x24(%r14)
jmp 0x181f2
movl 0x10(%rbx), %r13d
movl %r13d, %r15d
cmpl $0x4e, %r13d
jne 0x182fe
movl 0x10(%r14), %r15d
leal 0x1(%r15), %r12d
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movq -0x30(%rbp), %rax
leal -0x1(%rax), %edi
cmpl $0x4e, %r13d
jne 0x183d8
movl %r15d, %esi
callq 0x17961
leaq 0x132a1(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
jmp 0x183fa
movl (%r14), %r12d
cmpl $0x4e, %r12d
movq %r14, %r13
cmoveq %rbx, %r14
movl 0x10(%r14), %ebx
leal 0x1(%rbx), %r15d
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movq -0x30(%rbp), %rax
leal -0x1(%rax), %edi
cmpl $0x4e, %r12d
jne 0x18416
movl %ebx, %esi
callq 0x17961
leaq 0x13247(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
jmp 0x18437
movl %r15d, %esi
callq 0x17961
movq 0x18(%rbx), %rcx
leaq 0x1321c(%rip), %rdx     # 0x2b5d0
addq $0x10, %rdx
movq %rdx, (%r14)
movq %rax, 0x8(%r14)
movq %rcx, 0x10(%r14)
leaq 0xad8e(%rip), %rax      # 0x23158
jmp 0x18401
incl %r14d
movq %r14, -0x38(%rbp)
jmp 0x17dab
movl %r15d, %esi
callq 0x17961
movq 0x18(%rbx), %rcx
leaq 0x131e5(%rip), %rdx     # 0x2b5d0
addq $0x10, %rdx
movq %rdx, (%r14)
movq %rax, 0x8(%r14)
movq %rcx, 0x10(%r14)
leaq 0xad15(%rip), %rax      # 0x23116
movq %rax, 0x18(%r14)
movq -0x30(%rbp), %rax
movl %eax, 0x20(%r14)
movl %r12d, 0x24(%r14)
jmp 0x181f2
movl %ebx, %esi
callq 0x17961
movq 0x18(%r13), %rcx
leaq 0x131a8(%rip), %rdx     # 0x2b5d0
addq $0x10, %rdx
movq %rdx, (%r14)
movq %rax, 0x8(%r14)
movq %rcx, 0x10(%r14)
leaq 0xacfc(%rip), %rax      # 0x2313a
jmp 0x181e2
jmp 0x18472
jmp 0x18472
jmp 0x18472
jmp 0x18472
jmp 0x18472
jmp 0x18472
jmp 0x18472
jmp 0x18472
movq %rax, %r12
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
jne 0x184ba
jmp 0x184bf
jmp 0x18472
jmp 0x18472
jmp 0x18472
jmp 0x18472
jmp 0x18472
jmp 0x18472
jmp 0x18472
movq %rax, %r12
movq %r14, %rdi
callq 0x4190
jmp 0x184bf
movq %rax, %r12
jmp 0x184bf
movq %rax, %r12
jmp 0x184aa
movq %rax, %r12
jmp 0x184a2
movq %rax, %r12
movq -0xb8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x184a2
callq 0x41e0
movq %r15, %rdi
callq 0x41e0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x184bf
callq 0x41e0
movq %r12, %rdi
callq 0x4380