// File: /workspace/github_cpp_makefile_star2_O3/AshOlogn[P]ash-language-interpreter/src/parser.cpp
// Function: evalLiteralGroup()
AbstractExpressionNode* evalLiteralGroup() {

  AbstractExpressionNode* next;
 
  //if grouped expression
  if(peek()->type == LEFT_PAREN) {

    Token* startGroupToken = consume(); //consume left parenthesis
    Token* endGroupToken;
    
    next = evalExpression();

		//throw error if ')' is not found
    if(peek()->type != RIGHT_PAREN) {
      throw ParseSyntaxError(startGroupToken->line+1, codeLines->at(startGroupToken->line), "(", "The parenthesized expression is missing a ')'");
    } else {
      endGroupToken = consume(); //consume right parenthesis
    }

    return new GroupedExpressionNode(next, startGroupToken->line+1, endGroupToken->line+1);

	} else if(peek()->type == LEFT_BRACKET) {

		//initialized array
		Token* leftBracketToken = consume();

		//insert the initial values into a list
		vector<AbstractExpressionNode*> initValues;

		//keep track of last line for error-handling purposes
		uint32_t currEndLine = leftBracketToken->line+1;

		while(peek()->type != RIGHT_BRACKET) {

			//if code ends without a closing ']', throw an error
			if(peek()->type == END) {
				throw ParseSyntaxError(leftBracketToken->line+1, currEndLine, getCodeLineBlock(leftBracketToken->line, currEndLine-1), "Expected ']' to terminate array initializer list");
			}

			//add element to the array and update end line
			AbstractExpressionNode* arrayElement = evalExpression();
			currEndLine = arrayElement->endLine;
			initValues.push_back(arrayElement);

			if(peek()->type == COMMA) {
				//consume , token and update end line
				Token* commaToken = consume(); 
				currEndLine = commaToken->line+1;
			} else if(peek()->type == RIGHT_BRACKET) {
				//do nothing, deal with it outside the while loop
			} else {
				//throw error if initializer list is not terminated
				throw ParseSyntaxError(leftBracketToken->line+1, peek()->line+1, getCodeLineBlock(leftBracketToken->line, peek()->line), 
																	"Expected ']' to terminate array initializer list");
			}
		}

		Token* rightBracketToken = consume(); //consume ']'

		uint32_t length = (uint32_t) initValues.size();
		AbstractExpressionNode** values = (AbstractExpressionNode**) malloc(sizeof(AbstractExpressionNode*) * length);

		//determine overall type of initialized array
		ParseDataType arrayType = arrayListType(&initValues);

		//copy references out of list into array, casting to overall type
		for(uint32_t i = 0; i < length; i++) {
			values[i] = new CastNode(initValues[i], arrayType, initValues[i]->startLine);
		}

		//convert fixed length into a LiteralNode
		ParseData len;
		len.type = UINT32_T;
		len.value.integer = length;

		return new ArrayNode(arrayType, true, new LiteralNode(len, -1), values, leftBracketToken->line+1, rightBracketToken->line+1);

	} else if(peek()->type == NEW) {

		//array or object instantiation
		Token* newToken = consume();

		if(!isTypeTokenType(peek()->type)) {
			throw ParseSyntaxError(newToken->line+1, getCodeLineBlock(newToken->line, newToken->line), "Expected type specifier as part of array instantiation");
		}

		ParseDataType type = ARRAY_T;
		Token* subtypeToken = consume();
		ParseDataType subtype = typeTokenConversion(subtypeToken->type);

		if(peek()->type != LEFT_BRACKET) {
			throw ParseSyntaxError(newToken->line+1, subtypeToken->line+1, getCodeLineBlock(newToken->line, subtypeToken->line), "Expected '[' as part of array instantiation");
		}

		Token* leftBracketToken = consume();
		AbstractExpressionNode* length = evalExpression();

		//make sure length expression is an integer
		if(!isIntParseDataType(length->evalType)) {

			string message = "Expected integer/char type for array length specifier, not ";
			message.append(toStringParseDataType(length->evalType));

			throw StaticTypeError(leftBracketToken->line+1, length->endLine+1, getCodeLineBlock(leftBracketToken->line, length->endLine), 
														copyString(message.c_str()));
		}


		if(peek()->type != RIGHT_BRACKET) {
			throw ParseSyntaxError(newToken->line+1, length->endLine+1, getCodeLineBlock(newToken->line, length->endLine), "Expected ']' as part of array instantiation");
		}

		Token* rightBracketToken = consume();

		//now return ArrayNode with appropriate information
		return new ArrayNode(subtype, false, length, NULL, newToken->line, rightBracketToken->line);

  } else if(peek()->type == VARIABLE) {

		Token* variable = consume();

		//make sure variable is already declared
		string variableName((char*) variable->lexeme);
		if(!symbolTable->isDeclared(variableName)) {
			throw StaticVariableScopeError(variable->line+1, variable->lexeme, getCodeLineBlock(variable->line, variable->line), false);
		}

		//get variable type
		ParseDataType varType = symbolTable->get(variableName).type;

		if(peek()->type == LEFT_PAREN) {

			//function call case
			Token* leftParenToken = consume(); //consume (

			//make sure this variable is of function type
			if(varType != FUN_T) {
				throw StaticTypeError(variable->line+1, leftParenToken->line+1, getCodeLineBlock(variable->line, leftParenToken->line), "function call", varType);
			}
			
			//get function information
			Function* function = (Function*) (symbolTable->get(variableName).value.allocated);

			uint32_t numArgs = function->numArgs;
			ParseDataType* argTypes = function->argTypes;
			ParseDataType* argSubTypes = function->argSubTypes;

			//read in arguments
			AbstractExpressionNode** arguments = (AbstractExpressionNode**) malloc(sizeof(AbstractExpressionNode*) * numArgs);
			Token* lastCommaToken;

			for(uint32_t i = 0; i < numArgs; i++) {

				//if next item is not an argument, throw error
				if(peek()->type == END) {
					uint32_t startLine = variable->line+1;
					uint32_t endLine = (i > 0) ? arguments[i-1]->endLine+1 : leftParenToken->line+1;
					throw ParseSyntaxError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), "Too few arguments provided to this function call");
				}

				//get next argument
				arguments[i] = evalExpression();

				//make sure argument is of the right type
				if(argTypes[i] == ARRAY_T && arguments[i]->evalType == ARRAY_T) {

					//both args are arrays, so check member types
					if(!typecheckImplicitCastExpression(arguments[i]->subType, argSubTypes[i])) {
						
						uint32_t startLine = variable->line+1;
						uint32_t endLine = arguments[i]->endLine+1;

						string message = "Cannot implicitly convert a ";
						message.append(toStringParseDataType(arguments[i]->subType));
						message.append(" array argument to ");
						message.append(toStringParseDataType(argSubTypes[i]));
						message.append(" array type");

						throw StaticTypeError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), copyString(message.c_str()));
					}

				} else {

					//regular type check
					if(!typecheckImplicitCastExpression(arguments[i]->evalType, argTypes[i])) {

						uint32_t startLine = variable->line+1;
						uint32_t endLine = arguments[i]->endLine+1;

						string message = "Cannot implicitly convert a ";
						message.append(toStringParseDataType(arguments[i]->evalType));
						message.append(" argument to ");
						message.append(toStringParseDataType(argTypes[i]));
						message.append(" type");

						throw StaticTypeError(startLine, endLine, getCodeLineBlock(startLine-1, endLine-1), copyString(message.c_str()));
					}
				}

				if(i < numArgs-1) {
					if(peek()->type != COMMA) {
						throw ParseSyntaxError(variable->line+1, arguments[i]->endLine+1, getCodeLineBlock(variable->line, arguments[i]->endLine),
																	"Expected comma to separate function arguments");
					}
					lastCommaToken = consume(); //consume ,
				}
			}

			if(peek()->type != RIGHT_PAREN) {
				throw ParseSyntaxError(variable->line+1, lastCommaToken->line+1, getCodeLineBlock(variable->line, lastCommaToken->line),
															"Expected ')' to terminate argument list");
			}
			Token* rightParenToken = consume(); //consume )

			//now return FunctionExpressionNode
			return new FunctionExpressionNode(numArgs, arguments, function, symbolTable, variable->line+1, rightParenToken->line+1);

		} else {

			//simple value substitution case
			return new VariableNode(variableName, symbolTable, variable->line+1);
		}
  
  } else {

    Token* literal = consume();
    ParseData p = {typeTokenConversion(literal->type), literal->value};
    return new LiteralNode(p, literal->line+1);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
callq 0x1781b
cmpl $0x0, (%rax)
je 0x1a60f
callq 0x1781b
cmpl $0x2, (%rax)
jne 0x1a65e
callq 0x177cc
movq %rax, %rbx
xorps %xmm0, %xmm0
leaq -0x50(%rbp), %r14
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movl 0x10(%rax), %r12d
incl %r12d
leaq -0x88(%rbp), %r15
callq 0x1781b
cmpl $0x3, (%rax)
je 0x1a70e
callq 0x1781b
cmpl $0x4e, (%rax)
je 0x1ab10
callq 0x1ce62
movq %rax, -0x88(%rbp)
movl 0xc(%rax), %r12d
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x1a564
movq %rax, (%rsi)
addq $0x8, -0x48(%rbp)
jmp 0x1a56f
movq %r14, %rdi
movq %r15, %rdx
callq 0x1db58
callq 0x1781b
cmpl $0x2b, (%rax)
jne 0x1a587
callq 0x177cc
movl 0x10(%rax), %r12d
incl %r12d
jmp 0x1a524
callq 0x1781b
cmpl $0x3, (%rax)
je 0x1a524
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movq %rbx, %r13
movl 0x10(%rbx), %r15d
callq 0x1781b
movl 0x10(%rax), %r12d
movl 0x10(%r13), %ebx
callq 0x1781b
movl 0x10(%rax), %esi
movl %ebx, %edi
callq 0x17891
incl %r15d
incl %r12d
leaq 0x11002(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
leaq 0x8bb9(%rip), %rax      # 0x231a1
movq %rax, 0x18(%r14)
movl %r15d, 0x20(%r14)
movl %r12d, 0x24(%r14)
leaq 0x10ffd(%rip), %rsi     # 0x2b5f8
movq 0x119d6(%rip), %rdx     # 0x2bfd8
movq %r14, %rdi
callq 0x4350
jmp 0x1b1d7
callq 0x177cc
movq %rax, %rbx
callq 0x1ce62
movq %rax, %r15
callq 0x1781b
cmpl $0x1, (%rax)
jne 0x1ab94
callq 0x177cc
movq %rax, %r12
movl $0x20, %edi
callq 0x4210
movq %rax, %r14
movl 0x10(%rbx), %edx
incl %edx
movl 0x10(%r12), %ecx
incl %ecx
movq %rax, %rdi
movq %r15, %rsi
callq 0x95b8
jmp 0x1aafb
callq 0x1781b
cmpl $0x49, (%rax)
jne 0x1a7fa
callq 0x177cc
movq %rax, %r15
callq 0x1781b
movl (%rax), %edi
callq 0x633a
testb %al, %al
je 0x1aedc
callq 0x177cc
movq %rax, %rbx
movl (%rax), %edi
callq 0x812a
movl %eax, %r12d
callq 0x1781b
cmpl $0x2, (%rax)
jne 0x1af26
callq 0x177cc
movq %rax, %r14
callq 0x1ce62
movq %rax, %rbx
movl 0x10(%rax), %edi
callq 0x7fdb
testb %al, %al
je 0x1af6f
callq 0x1781b
cmpl $0x3, (%rax)
jne 0x1b019
callq 0x177cc
movq %rax, %r13
movl $0x30, %edi
callq 0x4210
movq %rax, %r14
movl 0x10(%r15), %r9d
movl 0x10(%r13), %eax
movl %eax, (%rsp)
movq %r14, %rdi
movl %r12d, %esi
xorl %edx, %edx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x91da
jmp 0x1aafb
movq %rbx, -0x58(%rbp)
callq 0x177cc
movq %rax, -0x68(%rbp)
leaq -0x50(%rbp), %r14
movq 0x8(%r14), %r15
subq (%r14), %r15
movq %r15, %rbx
sarq $0x3, %rbx
movl %ebx, %eax
movq %rax, -0x60(%rbp)
leaq (,%rax,8), %rdi
callq 0x4290
movq %rax, %r12
movq %r14, %rdi
callq 0x1772c
movl %eax, %r13d
shrq $0x3, %r15
testl %r15d, %r15d
je 0x1a78b
movl %ebx, %r15d
xorl %ebx, %ebx
movl $0x28, %edi
callq 0x4210
movq %rax, %r14
movq -0x50(%rbp), %rax
movq (%rax,%rbx,8), %rsi
movl 0x8(%rsi), %ecx
movq %r14, %rdi
movl %r13d, %edx
callq 0x8efa
movq %r14, (%r12,%rbx,8)
incq %rbx
cmpq %rbx, %r15
jne 0x1a75c
movl $0x30, %edi
callq 0x4210
movq %rax, %r14
movl $0x28, %edi
callq 0x4210
movq %rax, %r15
movq %rax, %rdi
movl $0x6, %esi
movq -0x60(%rbp), %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x9542
movq -0x58(%rbp), %rax
movl 0x10(%rax), %r9d
incl %r9d
movq -0x68(%rbp), %rax
movl 0x10(%rax), %eax
incl %eax
movl %eax, (%rsp)
movq %r14, %rdi
movl %r13d, %esi
movl $0x1, %edx
movq %r15, %rcx
movq %r12, %r8
callq 0x91da
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
jne 0x1aaf6
jmp 0x1aafb
callq 0x1781b
movl (%rax), %ebx
callq 0x177cc
cmpl $0x3b, %ebx
jne 0x1a93e
movq %rax, -0x30(%rbp)
movq 0x18(%rax), %rsi
leaq -0x50(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x40c0
movq 0x11a62(%rip), %r14     # 0x2c290
leaq -0x108(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0x118(%rbp), %rdi
callq 0x897a
leaq -0x118(%rbp), %rsi
movq %r14, %rdi
callq 0x16598
movl %eax, %r14d
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x1a873
callq 0x41e0
testb %r14b, %r14b
je 0x1b07f
movq 0x11a0d(%rip), %r14     # 0x2c290
leaq -0xe8(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0xf8(%rbp), %rdi
callq 0x897a
leaq -0xf8(%rbp), %rsi
movq %r14, %rdi
callq 0x165ec
movl %eax, %r14d
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
je 0x1a8c8
callq 0x41e0
callq 0x1781b
cmpl $0x0, (%rax)
je 0x1a974
movl $0x40, %edi
callq 0x4210
movq %rax, %r14
leaq -0xa8(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0xb8(%rbp), %rdi
callq 0x897a
movq 0x11984(%rip), %rdx     # 0x2c290
movq -0x30(%rbp), %rax
movl 0x10(%rax), %ecx
incl %ecx
leaq -0xb8(%rbp), %rsi
movq %r14, %rdi
callq 0x92ee
movq -0xb8(%rbp), %rdi
cmpq %r15, %rdi
je 0x1aae9
callq 0x41e0
jmp 0x1aae9
movl (%rax), %edi
movq %rax, %rbx
callq 0x812a
movl %eax, %r15d
movq 0x8(%rbx), %r12
movl $0x28, %edi
callq 0x4210
movq %rax, %r14
movl 0x10(%rbx), %ecx
incl %ecx
movq %rax, %rdi
movl %r15d, %esi
movq %r12, %rdx
callq 0x9542
jmp 0x1aafb
callq 0x177cc
movq %rax, %rbx
cmpl $0xd, %r14d
jne 0x1b0f5
movq 0x11903(%rip), %r14     # 0x2c290
leaq -0xc8(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %rdi
callq 0x897a
leaq -0xd8(%rbp), %rsi
movq %r14, %rdi
callq 0x165ec
movq %rdx, %r14
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0x1a9d2
callq 0x41e0
movl (%r14), %r13d
movq 0x8(%r14), %rax
movq %rax, -0x68(%rbp)
movq %r14, -0x98(%rbp)
movq 0x10(%r14), %rax
movq %rax, -0x60(%rbp)
leaq (,%r13,8), %rdi
callq 0x4290
movq %rax, -0x58(%rbp)
testq %r13, %r13
je 0x1aa95
movq %rbx, -0x90(%rbp)
leal -0x1(%r13), %r12d
xorl %ebx, %ebx
callq 0x1781b
cmpl $0x4e, (%rax)
je 0x1ab76
callq 0x1ce62
movq %rax, %r15
movq -0x58(%rbp), %rax
movq %r15, (%rax,%rbx,8)
movq -0x68(%rbp), %rax
movl (%rax,%rbx,4), %esi
movl %esi, %eax
xorl $0xc, %eax
movl 0x10(%r15), %edi
movl %edi, %ecx
xorl $0xc, %ecx
orl %eax, %ecx
jne 0x1aa63
movl 0x14(%r15), %edi
movq -0x60(%rbp), %rax
movl (%rax,%rbx,4), %esi
callq 0x15ff7
testb %al, %al
jne 0x1aa70
jmp 0x1addf
callq 0x15ff7
testb %al, %al
je 0x1ac5d
cmpq %r12, %rbx
jae 0x1aa8b
callq 0x1781b
cmpl $0x2b, (%rax)
jne 0x1abed
callq 0x177cc
movq %rax, %r14
incq %rbx
cmpq %rbx, %r13
jne 0x1aa13
jmp 0x1aa95
callq 0x1781b
cmpl $0x1, (%rax)
jne 0x1b16c
callq 0x177cc
movq %rax, %r15
movl $0x48, %edi
callq 0x4210
movq %rax, %r14
movq 0x117d1(%rip), %r8      # 0x2c290
movq -0x30(%rbp), %rax
movl 0x10(%rax), %r9d
incl %r9d
movl 0x10(%r15), %eax
incl %eax
movl %eax, (%rsp)
movq %r14, %rdi
movl %r13d, %esi
movq -0x58(%rbp), %rdx
movq -0x98(%rbp), %rcx
callq 0x94ca
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1aafb
callq 0x41e0
movq %r14, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movl 0x10(%rbx), %ebx
leal -0x1(%r12), %esi
movl %ebx, %edi
callq 0x17891
incl %ebx
leaq 0x10a9b(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
leaq 0x8652(%rip), %rax      # 0x231a1
movq %rax, 0x18(%r14)
movl %ebx, 0x20(%r14)
movl %r12d, 0x24(%r14)
leaq 0x10a96(%rip), %rsi     # 0x2b5f8
movq 0x1146f(%rip), %rdx     # 0x2bfd8
movq %r14, %rdi
callq 0x4350
jmp 0x1b1d7
movq -0x30(%rbp), %rax
movl 0x10(%rax), %r13d
testq %rbx, %rbx
jne 0x1ad5a
addq $0x10, -0x90(%rbp)
jmp 0x1ad6f
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movl 0x10(%rbx), %ebx
movq 0x116dd(%rip), %rdi     # 0x2c288
movq %rbx, %rsi
callq 0x1d5e0
incl %ebx
movq (%rax), %rax
leaq 0x10a11(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
leaq 0x3dbf(%rip), %rax      # 0x1e990
movq %rax, 0x10(%r14)
leaq 0x8597(%rip), %rax      # 0x23173
movq %rax, 0x18(%r14)
movl %ebx, 0x20(%r14)
movl %ebx, 0x24(%r14)
jmp 0x1b069
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movq -0x30(%rbp), %rax
movl 0x10(%rax), %r12d
movl 0xc(%r15), %ebx
movl %r12d, %edi
movl %ebx, %esi
callq 0x17891
incl %ebx
incl %r12d
leaq 0x109b4(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
leaq 0x86c9(%rip), %rax      # 0x232ff
movq %rax, 0x18(%r14)
movl %r12d, 0x20(%r14)
movl %ebx, 0x24(%r14)
leaq 0x109af(%rip), %rsi     # 0x2b5f8
movq 0x11388(%rip), %rdx     # 0x2bfd8
movq %r14, %rdi
callq 0x4350
jmp 0x1b1d7
movq -0x30(%rbp), %rax
movl 0x10(%rax), %r13d
movl 0xc(%r15), %r14d
leaq -0x78(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x8655(%rip), %rsi      # 0x232ce
leaq 0x866a(%rip), %rdx      # 0x232ea
leaq -0x88(%rbp), %rdi
callq 0x5cb8
movl 0x10(%r15), %edi
callq 0x817c
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x43a0
leaq 0x8646(%rip), %rsi      # 0x232f1
leaq -0x88(%rbp), %rdi
callq 0x43a0
movq -0x68(%rbp), %rax
movl (%rax,%rbx,4), %edi
callq 0x817c
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x43a0
leaq 0x846d(%rip), %rsi      # 0x23146
leaq -0x88(%rbp), %rdi
callq 0x43a0
movl $0x38, %edi
callq 0x4110
movq %rax, %r15
movl %r13d, %edi
movl %r14d, %esi
callq 0x17891
movq %rax, %rbx
movq -0x88(%rbp), %rdi
callq 0x175e8
incl %r13d
incl %r14d
leaq 0x108f7(%rip), %rcx     # 0x2b610
addq $0x10, %rcx
movq %rcx, (%r15)
movw $0x100, 0x8(%r15)       # imm = 0x100
movq %rbx, 0x10(%r15)
movq $0x0, 0x18(%r15)
movq %rax, 0x20(%r15)
movl %r13d, 0x28(%r15)
movl %r14d, 0x2c(%r15)
leaq 0x108f2(%rip), %rsi     # 0x2b638
movq 0x1128b(%rip), %rdx     # 0x2bfd8
movq %r15, %rdi
callq 0x4350
jmp 0x1b1d7
decl %ebx
movq -0x58(%rbp), %rax
movq (%rax,%rbx,8), %rax
addq $0xc, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movl (%rax), %r15d
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movl %r13d, %edi
movl %r15d, %esi
callq 0x17891
incl %r13d
incl %r15d
leaq 0x10832(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
leaq 0x84e5(%rip), %rax      # 0x2329d
movq %rax, 0x18(%r14)
movl %r13d, 0x20(%r14)
movl %r15d, 0x24(%r14)
leaq 0x1082d(%rip), %rsi     # 0x2b5f8
movq 0x11206(%rip), %rdx     # 0x2bfd8
movq %r14, %rdi
callq 0x4350
jmp 0x1b1d7
movq -0x30(%rbp), %rax
movl 0x10(%rax), %r13d
movl 0xc(%r15), %r14d
leaq -0x78(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x84d3(%rip), %rsi      # 0x232ce
leaq 0x84e8(%rip), %rdx      # 0x232ea
leaq -0x88(%rbp), %rdi
callq 0x5cb8
movl 0x14(%r15), %edi
callq 0x817c
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x43a0
leaq 0x84be(%rip), %rsi      # 0x232eb
leaq -0x88(%rbp), %rdi
callq 0x43a0
movq -0x60(%rbp), %rax
movl (%rax,%rbx,4), %edi
callq 0x817c
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x43a0
leaq 0x823f(%rip), %rsi      # 0x2309a
leaq -0x88(%rbp), %rdi
callq 0x43a0
movl $0x38, %edi
callq 0x4110
movq %rax, %r15
movl %r13d, %edi
movl %r14d, %esi
callq 0x17891
movq %rax, %rbx
movq -0x88(%rbp), %rdi
callq 0x175e8
incl %r13d
incl %r14d
leaq 0x10775(%rip), %rcx     # 0x2b610
addq $0x10, %rcx
movq %rcx, (%r15)
movw $0x100, 0x8(%r15)       # imm = 0x100
movq %rbx, 0x10(%r15)
movq $0x0, 0x18(%r15)
movq %rax, 0x20(%r15)
movl %r13d, 0x28(%r15)
movl %r14d, 0x2c(%r15)
leaq 0x10770(%rip), %rsi     # 0x2b638
movq 0x11109(%rip), %rdx     # 0x2bfd8
movq %r15, %rdi
callq 0x4350
jmp 0x1b1d7
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movl 0x10(%r15), %ebx
movl %ebx, %edi
movl %ebx, %esi
callq 0x17891
incl %ebx
leaq 0x106d1(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
leaq 0x82b9(%rip), %rax      # 0x231d2
movq %rax, 0x18(%r14)
movl %ebx, 0x20(%r14)
jmp 0x1b065
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movl 0x10(%r15), %r15d
movl 0x10(%rbx), %ebx
movl %r15d, %edi
movl %ebx, %esi
callq 0x17891
incl %ebx
incl %r15d
leaq 0x10680(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
leaq 0x829f(%rip), %rax      # 0x23209
jmp 0x1b05d
leaq -0x40(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x82b7(%rip), %rsi      # 0x23235
leaq 0x82eb(%rip), %rdx      # 0x23270
leaq -0x50(%rbp), %rdi
callq 0x5cb8
movl 0x10(%rbx), %edi
callq 0x817c
leaq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0x43a0
movl $0x38, %edi
callq 0x4110
movq %rax, %r15
movl 0x10(%r14), %r14d
movl 0xc(%rbx), %ebx
movl %r14d, %edi
movl %ebx, %esi
callq 0x17891
movq %rax, %r12
movq -0x50(%rbp), %rdi
callq 0x175e8
incl %r14d
incl %ebx
leaq 0x10638(%rip), %rcx     # 0x2b610
addq $0x10, %rcx
movq %rcx, (%r15)
movw $0x100, 0x8(%r15)       # imm = 0x100
movq %r12, 0x10(%r15)
movq $0x0, 0x18(%r15)
movq %rax, 0x20(%r15)
movl %r14d, 0x28(%r15)
movl %ebx, 0x2c(%r15)
leaq 0x10633(%rip), %rsi     # 0x2b638
movq 0x10fcc(%rip), %rdx     # 0x2bfd8
movq %r15, %rdi
callq 0x4350
jmp 0x1b1d7
movl $0x28, %edi
callq 0x4110
movq %rax, %r14
movl 0x10(%r15), %r15d
movl 0xc(%rbx), %ebx
movl %r15d, %edi
movl %ebx, %esi
callq 0x17891
incl %ebx
incl %r15d
leaq 0x1058d(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
leaq 0x8214(%rip), %rax      # 0x23271
movq %rax, 0x18(%r14)
movl %r15d, 0x20(%r14)
movl %ebx, 0x24(%r14)
leaq 0x10588(%rip), %rsi     # 0x2b5f8
movq 0x10f61(%rip), %rdx     # 0x2bfd8
movq %r14, %rdi
callq 0x4350
movl $0x38, %edi
callq 0x4110
movq %rax, %r14
movq -0x30(%rbp), %rax
movl 0x10(%rax), %r15d
movq 0x18(%rax), %rsi
leaq -0x138(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x40c0
movq -0x30(%rbp), %rax
movl 0x10(%rax), %edi
movb $0x1, %r12b
movl %edi, %esi
callq 0x17891
incl %r15d
leaq -0x138(%rbp), %rdx
movq %r14, %rdi
movl %r15d, %esi
movq %rax, %rcx
xorl %r8d, %r8d
callq 0x1d60a
xorl %r12d, %r12d
leaq 0x10597(%rip), %rsi     # 0x2b678
leaq -0x1552e(%rip), %rdx    # 0x5bba
movq %r14, %rdi
callq 0x4350
jmp 0x1b1d7
movl $0x38, %edi
callq 0x4110
movq %rax, %r15
movq -0x30(%rbp), %rax
movl 0x10(%rax), %r12d
movl 0x10(%rbx), %ebx
movl %r12d, %edi
movl %ebx, %esi
callq 0x17891
incl %ebx
incl %r12d
leaq 0x104ed(%rip), %rcx     # 0x2b610
addq $0x10, %rcx
movq %rcx, (%r15)
movw $0x0, 0x8(%r15)
movq %rax, 0x10(%r15)
leaq 0x8184(%rip), %rax      # 0x232c0
movq %rax, 0x18(%r15)
movq $0x0, 0x20(%r15)
movl %r12d, 0x28(%r15)
movl %ebx, 0x2c(%r15)
movl %r14d, 0x30(%r15)
leaq 0x104dd(%rip), %rsi     # 0x2b638
movq 0x10e76(%rip), %rdx     # 0x2bfd8
movq %r15, %rdi
callq 0x4350
jmp 0x1b1d7
movl $0x28, %edi
callq 0x4110
movq %rax, %r15
movq -0x30(%rbp), %rax
movl 0x10(%rax), %r12d
movl 0x10(%r14), %ebx
movl %r12d, %edi
movl %ebx, %esi
callq 0x17891
incl %ebx
incl %r12d
leaq 0x10435(%rip), %rcx     # 0x2b5d0
addq $0x10, %rcx
movq %rcx, (%r15)
movq %rax, 0x8(%r15)
movq $0x0, 0x10(%r15)
leaq 0x8178(%rip), %rax      # 0x2332d
movq %rax, 0x18(%r15)
movl %r12d, 0x20(%r15)
movl %ebx, 0x24(%r15)
leaq 0x10430(%rip), %rsi     # 0x2b5f8
movq 0x10e09(%rip), %rdx     # 0x2bfd8
movq %r15, %rdi
callq 0x4350
jmp 0x1b1d9
movq %rax, %rbx
movq %r15, %rdi
callq 0x4190
jmp 0x1b2c3
jmp 0x1b1eb
movq %rax, %rbx
movq %r15, %rdi
jmp 0x1b2f5
movq %rax, %rbx
movq %r15, %rdi
callq 0x4190
jmp 0x1b274
jmp 0x1b264
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
jmp 0x1b2a5
jmp 0x1b31b
movq %rax, %rbx
leaq -0x128(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1b231
callq 0x41e0
testb %r12b, %r12b
jne 0x1b2f2
jmp 0x1b31e
jmp 0x1b2ef
jmp 0x1b31b
jmp 0x1b31b
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r15, %rdi
je 0x1b267
callq 0x41e0
jmp 0x1b267
movq %rax, %rbx
movq %r14, %rdi
jmp 0x1b2cf
jmp 0x1b31b
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
jne 0x1b35d
jmp 0x1b362
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
jmp 0x1b2a5
jmp 0x1b31b
jmp 0x1b2e0
jmp 0x1b2b4
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
jne 0x1b2cf
jmp 0x1b31e
jmp 0x1b2e0
jmp 0x1b31b
jmp 0x1b2e0
jmp 0x1b30f
movq %rax, %rbx
jmp 0x1b362
jmp 0x1b31b
jmp 0x1b2c0
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0x1b31e
callq 0x41e0
jmp 0x1b31e
jmp 0x1b31b
jmp 0x1b31b
jmp 0x1b31b
jmp 0x1b2ef
jmp 0x1b30f
movq %rax, %rbx
movq %r14, %rdi
callq 0x4190
jmp 0x1b362
jmp 0x1b31b
movq %rax, %rbx
movq %r14, %rdi
callq 0x4190
jmp 0x1b31e
movq %rax, %rbx
movq %r15, %rdi
callq 0x41e0
jmp 0x1b345
jmp 0x1b351
jmp 0x1b351
jmp 0x1b351
movq %rax, %rbx
movq %r14, %rdi
jmp 0x1b35d
jmp 0x1b351
jmp 0x1b342
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x1b35d
jmp 0x1b362
jmp 0x1b331
jmp 0x1b351
movq %rax, %rbx
movq %r14, %rdi
callq 0x4190
jmp 0x1b354
jmp 0x1b351
jmp 0x1b351
movq %rax, %rbx
movq %r14, %rdi
callq 0x41e0
jmp 0x1b354
jmp 0x1b351
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x1b362
callq 0x41e0
movq %rbx, %rdi
callq 0x4380