// File: /workspace/github_c_makefile_star2_O3/goodpaul6[P]generic/script.c
// Function: resolve_type_tags
static void resolve_type_tags(script_t* script, void* vexp)
{
	expr_t* exp = vexp;
	
	// NOTE: Pathetic attempt at providing proper
	// line information for type warnings
	g_file = exp->ctx.file;
	g_line = exp->ctx.line;
	
	switch(exp->type)
	{
		case EXP_ATOMIC:
		{
			exp->tag = create_type_tag(script, TAG_VOID);
			resolve_type_tags(script, exp->atomx);
		} break;

		case EXP_DOT: case EXP_COLON:
		{
			resolve_type_tags(script, exp->dotx.value);
			if (exp->dotx.value->tag->type != TAG_STRUCT)
				error_defer_e(exp->dotx.value, "Attempted to access members in non-struct type\n");
			else
			{
				char found = 0;

				type_tag_t* tag = exp->dotx.value->tag;
				for (int i = 0; i < tag->ds.members.length; ++i)
				{
					type_tag_member_t* mem = vec_get(&tag->ds.members, i);
					if (strcmp(mem->name, exp->dotx.name) == 0)
					{
						exp->tag = mem->type;
						found = 1;

						if (exp->type == EXP_COLON) error_defer_e(exp, "Attempted to use ':' operator to access member value; use '.' instead\n");
						break;
					}
				}

				if (!found)
				{
					func_decl_t* decl = get_struct_member_function(script, exp->dotx.value->tag->ds.name, exp->dotx.name);
					if (decl) found = 1;
					if (exp->type == EXP_DOT) error_defer_e(exp, "Attempted to use '.' operator to access member function; use ':' instead\n");

					if (!found)
						error_exit_e(exp, "Attempted to access non-existent member '%s' in struct %s\n", exp->dotx.name, tag->ds.name);
					else
						exp->tag = decl->tag;
				}
			}
		} break;
		
		case EXP_NULL:
		{
			exp->tag = create_type_tag(script, TAG_DYNAMIC);
		} break;
		
		case EXP_STRUCT_DECL:
		{
			exp->tag = create_type_tag(script, TAG_VOID);
			
			for(int i = 0; i < exp->struct_tag->ds.members.length; ++i)
			{
				type_tag_member_t* mem = vec_get(&exp->struct_tag->ds.members, i);
				if(mem->default_value)
				{	
					resolve_type_tags(script, mem->default_value);
					if(!compare_type_tags(mem->type, mem->default_value->tag))
						error_defer_e(mem->default_value, "Type of default value does not match type of member variable '%s'\n", mem->name);
				}
			}
		} break;
		
		case EXP_STRUCT_NEW:
		{
			exp->tag = exp->newx.type;
			
			for(int i = 0; i < exp->newx.init.length; ++i)
			{
				expr_t* init = vec_get_value(&exp->newx.init, i, expr_t*);
				
				int member_index = get_struct_type_member_index(exp->newx.type, init->binx.lhs->varx.name);
				resolve_type_tags(script, init->binx.rhs);
					
				type_tag_member_t* mem = vec_get(&exp->newx.type->ds.members, member_index);
				if(!compare_type_tags(init->binx.rhs->tag, mem->type))
					error_defer_e(init->binx.rhs, "Type of initializer does not match type of member '%s' being initialized\n", mem->name);
			}
		} break;
			
		case EXP_NUMBER:
		{
			exp->tag = create_type_tag(script, TAG_NUMBER);
		} break;
		
		case EXP_STRING:
		{
			exp->tag = create_type_tag(script, TAG_STRING);
		} break;
		
		case EXP_BOOL:
		{
			exp->tag = create_type_tag(script, TAG_BOOL);
		} break;
		
		case EXP_CHAR:
		{
			exp->tag = create_type_tag(script, TAG_CHAR);
		} break;
		
		case EXP_VAR:
		{
			if(!exp->varx.decl)
			{
				func_decl_t* decl = reference_function(script, exp->varx.name);
				if(decl) exp->tag = decl->tag;
				else error_exit_e(exp, "Referencing undeclared function/variable '%s'\n", exp->varx.name); 
			}
			else
				exp->tag = exp->varx.decl->tag;
		} break;
		
		case EXP_WRITE:
		{
			exp->tag = create_type_tag(script, TAG_VOID);
			resolve_type_tags(script, exp->write);
		} break;
		
		case EXP_UNARY:
		{
			resolve_type_tags(script, exp->unaryx.rhs);
			switch(exp->unaryx.op)
			{
				case TOK_NOT:
				{
					if(exp->unaryx.rhs->tag->type != TAG_BOOL)
						error_defer_e(exp->unaryx.rhs, "Attempted to use unary ! operator on non-boolean value\n");
					exp->tag = create_type_tag(script, TAG_BOOL);
				} break;
				
				case TOK_MINUS:
				{
					if(exp->unaryx.rhs->tag->type != TAG_NUMBER)
						error_defer_e(exp->unaryx.rhs, "Attempted to use unary - operator on non-numerical value\n");
					exp->tag = create_type_tag(script, TAG_NUMBER);
				} break;
				
				default:
					error_exit_e(exp, "No type resolution for %s operator\n", g_token_names[exp->unaryx.op]);
					break;
			}
		} break;
		
		case EXP_BINARY:
		{
			resolve_type_tags(script, exp->binx.lhs);
			resolve_type_tags(script, exp->binx.rhs);
		
			// NOTE: assignment operation lhs does not need to be
			// number
			if(exp->binx.op != TOK_ASSIGN)
			{ 
				if(!compare_type_tags(exp->binx.lhs->tag, exp->binx.rhs->tag) || !is_type_tag(exp->binx.lhs->tag, TAG_NUMBER))
				{	
					if(exp->binx.op != TOK_EQUALS && exp->binx.op != TOK_NOTEQUAL && 
						exp->binx.op != TOK_LAND && exp->binx.op != TOK_LOR)
						error_defer_e(exp->binx.lhs, "Invalid types in binary %s operation\n", g_token_names[exp->binx.op]);
				}
			}
			else
			{
				// NOTE: If the type of the lhs is unknown, set it to the type of the rhs
				// (since this is an assignment, after all)
				if (exp->binx.lhs->tag->type == TAG_UNKNOWN)
				{
					exp->binx.lhs->tag = exp->binx.rhs->tag;

					var_decl_t* decl = get_root_var_decl(exp->binx.lhs);
					if(decl)
						decl->tag = exp->binx.lhs->tag;
				}
				else if (!are_assignment_types_valid(exp->binx.lhs, exp->binx.rhs))
					error_defer_e(exp->binx.lhs, "Type of lhs in assignment operation does not match the type of rhs\n");
			}

			switch(exp->binx.op)
			{
				case TOK_PLUS:
				case TOK_MINUS:
				case TOK_MUL:
				case TOK_DIV: 
				case TOK_MOD: exp->tag = create_type_tag(script, TAG_NUMBER); break;
				
				case TOK_LTE:
				case TOK_GTE:
				case TOK_LT:
				case TOK_GT:
				case TOK_EQUALS:
				case TOK_NOTEQUAL:
				case TOK_LAND:
				case TOK_LOR: exp->tag = create_type_tag(script, TAG_BOOL); break;
				
				default: exp->tag = create_type_tag(script, TAG_VOID); break;
			}
		} break;
		
		case EXP_CALL:
		{
			resolve_type_tags(script, exp->callx.func);
			if(exp->callx.func->tag->type == TAG_DYNAMIC)
				warn_e(exp, WARN_CALL_DYNAMIC);
			
			if(exp->callx.func->tag->type != TAG_FUNC && exp->callx.func->tag->type != TAG_DYNAMIC)
				error_defer_e(exp, "Attempting to call something that is not a function\n");
			
			if(exp->callx.func->tag->type != TAG_DYNAMIC && exp->callx.args.length != exp->callx.func->tag->func.arg_types.length)
				error_defer_e(exp, "Passed %d argument(s) into function expecting %d argument(s)\n", 
				exp->callx.args.length, exp->callx.func->tag->func.arg_types.length);
			else
			{
				for(int i = 0; i < exp->callx.args.length; ++i)
				{
					expr_t* arg = vec_get_value(&exp->callx.args, i, expr_t*);
					resolve_type_tags(script, arg);
					
					if(exp->callx.func->tag->type != TAG_DYNAMIC)
					{
						type_tag_t* expected_tag = vec_get_value(&exp->callx.func->tag->func.arg_types, i, type_tag_t*);
						if(!compare_type_tags(arg->tag, expected_tag)) 
							error_defer_e(arg, "Type of argument %i does not match expected type\n", i + 1);
					}
				}
			}
			
			exp->tag = exp->callx.func->tag->func.return_type;
		} break;
		
		case EXP_PAREN:
		{
			resolve_type_tags(script, exp->paren);
			exp->tag = exp->paren->tag;
		} break;
		
		case EXP_BLOCK:
		{
			exp->tag = create_type_tag(script, TAG_VOID);
			for(int i = 0; i < exp->block.length; ++i)
			{
				expr_t* e = vec_get_value(&exp->block, i, expr_t*);
				resolve_type_tags(script, e);
			}
		} break;
		
		case EXP_ARRAY_INDEX:
		{
			resolve_type_tags(script, exp->array_index.array);
			resolve_type_tags(script, exp->array_index.index);

			if(!is_type_tag(exp->array_index.index->tag, TAG_NUMBER))
				error_defer_e(exp->array_index.index, "Attempting to index array with non-number value\n");
			
			switch(exp->array_index.array->tag->type)
			{
				case TAG_STRING: exp->tag = create_type_tag(script, TAG_CHAR); break;
				case TAG_ARRAY: exp->tag = exp->array_index.array->tag->contained; break;
				default:
					error_defer_e(exp->array_index.array, "Attempting to index non-indexable type\n");
					break;
			}
		} break;
		
		case EXP_EXTERN:
		case EXP_EXTERN_LIST: break;
		
		case EXP_ARRAY_LITERAL:
		{
			for(int i = 0; i < exp->array_literal.values.length; ++i)
				resolve_type_tags(script, vec_get_value(&exp->array_literal.values, i, expr_t*));
			
			type_tag_t* tag = create_type_tag(script, TAG_ARRAY);
			if(exp->array_literal.contained) tag->contained = exp->array_literal.contained;
			else
			{
				expr_t* first = vec_get_value(&exp->array_literal.values, 0, expr_t*);
				tag->contained = first->tag;
				
				for(int i = 1; i < exp->array_literal.values.length; ++i)
				{
					expr_t* e = vec_get_value(&exp->array_literal.values, i, expr_t*);
					if(!compare_type_tags(e->tag, tag->contained))
					{
						warn_e(e, WARN_DYNAMIC_ARRAY_LITERAL);
						tag = create_type_tag(script, TAG_DYNAMIC);			// NOTE: okay, so it must be a dynamic literal
						break;										// NOTE: also, we don't care about the types anymore
					}
					// error_defer_e(e, "Array literal value type does not match the array's contained type\n");
				}
			}
			
			exp->tag = tag;
		} break;
		
		case EXP_LEN:
		{
			exp->tag = create_type_tag(script, TAG_NUMBER);
			resolve_type_tags(script, exp->len);
			
			if(exp->len->tag->type != TAG_STRING && exp->len->tag->type != TAG_ARRAY)
				error_defer_e(exp->len, "Attempted to find the length of non-measurable type\n");
		} break;
		
		case EXP_IF:
		{
			exp->tag = create_type_tag(script, TAG_VOID);
			resolve_type_tags(script, exp->ifx.cond);
			
			if(!is_type_tag(exp->ifx.cond->tag, TAG_BOOL))
				error_defer_e(exp->ifx.cond, "Condition does not evaluate to a boolean value\n");
			
			resolve_type_tags(script, exp->ifx.body);
			if(exp->ifx.alt)
				resolve_type_tags(script, exp->ifx.alt);
		} break;
		
		case EXP_WHILE:
		{
			exp->tag = create_type_tag(script, TAG_VOID);
			resolve_type_tags(script, exp->whilex.cond);
			
			if(!is_type_tag(exp->whilex.cond->tag, TAG_BOOL)) 
				error_defer_e(exp->whilex.cond, "Condition does not evaluate to a boolean value\n");
			
			resolve_type_tags(script, exp->whilex.body);
		} break;

		case EXP_FOR:
		{
			exp->tag = create_type_tag(script, TAG_VOID);

			resolve_type_tags(script, exp->forx.init);
			resolve_type_tags(script, exp->forx.cond);
			resolve_type_tags(script, exp->forx.step);

			if (!is_type_tag(exp->forx.cond->tag, TAG_BOOL))
				error_defer_e(exp->forx.cond, "Condition does not evaluate to a boolean value\n");

			resolve_type_tags(script, exp->forx.body);
		} break;
		
		case EXP_RETURN:
		{
			exp->tag = create_type_tag(script, TAG_VOID);
			resolve_type_tags(script, exp->retx.value);
	
			if(!compare_type_tags(exp->retx.value->tag, exp->retx.parent->tag->func.return_type))
				error_defer_e(exp, "Returned value's type does not match the return type of the enclosing function.\n");
		} break;
		
		case EXP_FUNC:
		{
			exp->tag = create_type_tag(script, TAG_VOID);
			resolve_type_tags(script, exp->funcx.body);
		} break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x657a(%rip), %r15      # 0xf304
movq 0x10(%rbx), %rax
movq %rax, 0xd3c3(%rip)      # 0x16158
movl 0x8(%rbx), %eax
movl %eax, 0xd3b2(%rip)      # 0x16150
movl 0x28(%rbx), %eax
cmpq $0x1a, %rax
ja 0x956f
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movq %r14, %rdi
xorl %esi, %esi
callq 0x8156
movq %rax, 0x30(%rbx)
movl $0x38, %r12d
jmp 0x8e5c
movq %r14, %rdi
xorl %esi, %esi
callq 0x8156
movq %rax, 0x30(%rbx)
movl $0x40, %r12d
jmp 0x8e5c
movq %r14, %rdi
xorl %esi, %esi
callq 0x8156
movq %rax, 0x30(%rbx)
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x40(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x48(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x40(%rbx), %rdi
movq 0x30(%rdi), %rax
movl 0x20(%rax), %eax
decl %eax
movl $0x50, %r12d
jmp 0x8e57
movq %r14, %rdi
xorl %esi, %esi
callq 0x8156
movq %rax, 0x30(%rbx)
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x38(%rbx), %rdi
movq 0x30(%rdi), %rax
movl 0x20(%rax), %eax
decl %eax
movl $0x40, %r12d
cmpl $0x2, %eax
jae 0x8eaf
movq (%rbx,%r12), %rbx
jmp 0x8d8a
movq %r14, %rdi
xorl %esi, %esi
callq 0x8156
movq %rax, 0x30(%rbx)
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x38(%rbx), %rdi
movq 0x30(%rdi), %rax
movl 0x20(%rax), %eax
decl %eax
cmpl $0x2, %eax
jae 0x8ebf
movq 0x40(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x48(%rbx), %rbx
testq %rbx, %rbx
jne 0x8d8a
jmp 0x956f
leaq 0x7cd0(%rip), %rsi      # 0x10b86
xorl %eax, %eax
callq 0x22b3
jmp 0x8e5c
leaq 0x7cc0(%rip), %rsi      # 0x10b86
xorl %eax, %eax
callq 0x22b3
jmp 0x8e91
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x38(%rbx), %rdi
movq 0x30(%rdi), %r12
cmpl $0xa, 0x20(%r12)
jne 0x957e
cmpq $0x0, 0x70(%r12)
je 0x93a8
movq %r14, -0x38(%rbp)
leaq 0x60(%r12), %rax
movq %rax, -0x30(%rbp)
xorl %r13d, %r13d
movq %r12, %r14
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0xdcf3
movq %rax, %r12
movq (%rax), %rdi
movq 0x40(%rbx), %r15
movq %r15, %rsi
callq 0x2160
testl %eax, %eax
je 0x93dd
incq %r13
movq %r14, %r12
cmpq %r13, 0x70(%r14)
ja 0x8f0b
movq 0x38(%rbx), %rax
movq 0x30(%rax), %rax
movq -0x38(%rbp), %r14
jmp 0x93af
leaq 0x40(%rbx), %r15
cmpq $0x0, 0x50(%rbx)
je 0x8f7e
xorl %r12d, %r12d
movq %r15, %rdi
movq %r12, %rsi
callq 0xdcf3
movq (%rax), %rsi
movq %r14, %rdi
callq 0x8d6c
incq %r12
cmpq %r12, 0x50(%rbx)
ja 0x8f5f
movq %r14, %rdi
movl $0x7, %esi
callq 0x8156
movq %rax, %r12
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0x948e
movq %rax, 0x28(%r12)
jmp 0x95a3
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x40(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
cmpl $0x24, 0x48(%rbx)
movq 0x38(%rbx), %rax
movq 0x30(%rax), %rdi
jne 0x93ff
cmpl $0xb, 0x20(%rdi)
movq 0x40(%rbx), %rcx
movq 0x30(%rcx), %rsi
jne 0x950e
movq %rsi, 0x30(%rax)
movq 0x38(%rbx), %rax
movq %rax, %rcx
movl 0x28(%rcx), %edx
cmpl $0x6, %edx
je 0x8ffd
cmpl $0xf, %edx
jne 0x952b
movq 0x38(%rcx), %rcx
jmp 0x8fec
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x38(%rbx), %rax
movq 0x30(%rax), %rax
jmp 0x956b
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movslq 0x40(%rbx), %rax
cmpq $0x26, %rax
je 0x9460
cmpl $0x23, %eax
jne 0x9652
movq 0x38(%rbx), %rdi
movq 0x30(%rdi), %rax
cmpl $0x2, 0x20(%rax)
je 0x954c
leaq 0x78fb(%rip), %rsi      # 0x10953
xorl %eax, %eax
callq 0x22b3
jmp 0x954c
movq 0x38(%rbx), %rax
movq %rax, 0x30(%rbx)
cmpq $0x0, 0x50(%rbx)
je 0x956f
leaq 0x40(%rbx), %rax
movq %rax, -0x30(%rbp)
xorl %r13d, %r13d
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0xdcf3
movq (%rax), %r15
movq 0x38(%rbx), %rdi
movq 0x38(%r15), %rax
movq 0x38(%rax), %rsi
callq 0x9812
movl %eax, %r12d
movq 0x40(%r15), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x38(%rbx), %rdi
addq $0x60, %rdi
movslq %r12d, %rsi
callq 0xdcf3
movq %rax, %r12
movq 0x40(%r15), %rax
movq 0x30(%rax), %rdi
movq 0x10(%r12), %rsi
callq 0x8250
testb %al, %al
je 0x90e8
incq %r13
cmpq %r13, 0x50(%rbx)
ja 0x9082
jmp 0x956f
movq 0x40(%r15), %rdi
movq (%r12), %rdx
leaq 0x77e3(%rip), %rsi      # 0x108da
xorl %eax, %eax
callq 0x22b3
jmp 0x90da
movq %r14, %rdi
movl $0x1, %esi
jmp 0x9566
movq %r14, %rdi
movl $0x5, %esi
jmp 0x9566
movq %r14, %rdi
xorl %esi, %esi
callq 0x8156
movq %rax, 0x30(%rbx)
movq 0x38(%rbx), %rdi
cmpq $0x0, 0x70(%rdi)
je 0x956f
leaq 0x7759(%rip), %r15      # 0x10897
xorl %r12d, %r12d
addq $0x60, %rdi
movq %r12, %rsi
callq 0xdcf3
movq 0x18(%rax), %rsi
testq %rsi, %rsi
je 0x9176
movq %rax, %r13
movq %r14, %rdi
callq 0x8d6c
movq 0x10(%r13), %rdi
movq 0x18(%r13), %rax
movq 0x30(%rax), %rsi
callq 0x8250
testb %al, %al
je 0x9188
incq %r12
movq 0x38(%rbx), %rdi
cmpq %r12, 0x70(%rdi)
ja 0x9141
jmp 0x956f
movq (%r13), %rdx
movq 0x18(%r13), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x22b3
jmp 0x9176
movq %r14, %rdi
xorl %esi, %esi
callq 0x8156
movq %rax, 0x30(%rbx)
cmpq $0x0, 0x48(%rbx)
je 0x956f
leaq 0x38(%rbx), %r15
xorl %r12d, %r12d
movq %r15, %rdi
movq %r12, %rsi
callq 0xdcf3
movq (%rax), %rsi
movq %r14, %rdi
callq 0x8d6c
incq %r12
cmpq %r12, 0x48(%rbx)
ja 0x91bc
jmp 0x956f
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x40(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x40(%rbx), %rdi
movq 0x30(%rdi), %rax
movl 0x20(%rax), %eax
cmpl $0x1, %eax
je 0x9211
cmpl $0x4, %eax
jne 0x95c6
movq 0x38(%rbx), %rdi
movq 0x30(%rdi), %rax
movl 0x20(%rax), %ecx
cmpl $0x7, %ecx
je 0x9485
cmpl $0x5, %ecx
jne 0x95d9
movq %r14, %rdi
movl $0x3, %esi
jmp 0x9566
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0x94f3
movq 0x8(%rax), %rax
jmp 0x956b
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x38(%rbx), %rax
movq 0x30(%rax), %rax
movl 0x20(%rax), %ecx
cmpl $0x1, %ecx
jne 0x9287
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x9881
movq 0x38(%rbx), %rax
movq 0x30(%rax), %rax
movl 0x20(%rax), %ecx
cmpl $0x1, %ecx
je 0x9295
cmpl $0x6, %ecx
jne 0x95f5
movq 0x50(%rbx), %rdx
cmpl $0x1, %ecx
je 0x92ab
movq 0x38(%rax), %rcx
cmpq %rcx, %rdx
jne 0x9616
testq %rdx, %rdx
je 0x9627
leaq 0x40(%rbx), %r15
xorl %r13d, %r13d
movq %r15, %rdi
movq %r13, %rsi
callq 0xdcf3
movq (%rax), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x8d6c
movq 0x38(%rbx), %rax
movq 0x30(%rax), %rdi
cmpl $0x1, 0x20(%rdi)
je 0x92ff
addq $0x28, %rdi
movq %r13, %rsi
callq 0xdcf3
movq (%rax), %rsi
movq 0x30(%r12), %rdi
callq 0x8250
testb %al, %al
je 0x930d
incq %r13
cmpq %r13, 0x50(%rbx)
ja 0x92bb
jmp 0x9627
leal 0x1(%r13), %edx
movq %r12, %rdi
leaq 0x77ab(%rip), %rsi      # 0x10ac6
xorl %eax, %eax
callq 0x22b3
jmp 0x92ff
movq %r14, %rdi
movl $0x4, %esi
callq 0x8156
movq %rax, 0x30(%rbx)
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x38(%rbx), %rdi
movq 0x30(%rdi), %rax
movl 0x20(%rax), %eax
orl $0x2, %eax
cmpl $0x7, %eax
je 0x956f
leaq 0x77f2(%rip), %rsi      # 0x10b51
jmp 0x95e0
movq %r14, %rdi
xorl %esi, %esi
callq 0x8156
movq %rax, 0x30(%rbx)
movq 0x40(%rbx), %rsi
movq %r14, %rdi
callq 0x8d6c
movq 0x38(%rbx), %rax
movq 0x40(%rbx), %rcx
movq 0x30(%rcx), %rdi
movq 0x10(%rax), %rax
movq 0x48(%rax), %rsi
callq 0x8250
testb %al, %al
jne 0x956f
leaq 0x7810(%rip), %rsi      # 0x10bb6
jmp 0x93f7
movq 0x40(%rbx), %r15
movq %r12, %rax
movq 0x30(%rax), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x967b
movq %rax, %r14
cmpl $0x4, 0x28(%rbx)
je 0x95a9
testq %r14, %r14
je 0x9638
movq 0x10(%r14), %rax
jmp 0x956b
movq 0x10(%r12), %rax
movq %rax, 0x30(%rbx)
cmpl $0x3, 0x28(%rbx)
jne 0x956f
leaq 0x73d4(%rip), %rsi      # 0x107cb
movq %rbx, %rdi
jmp 0x95e0
movq 0x40(%rbx), %rax
movq 0x30(%rax), %rsi
callq 0x8250
testb %al, %al
je 0x942d
movq 0x38(%rbx), %rax
movq 0x30(%rax), %rax
movl 0x20(%rax), %eax
cmpl $0x1, %eax
je 0x9541
cmpl $0x4, %eax
je 0x9541
movl 0x48(%rbx), %eax
leal -0x2e(%rax), %ecx
cmpl $0x4, %ecx
jb 0x9544
cltq
movq 0x38(%rbx), %rdi
leaq 0xc7f7(%rip), %rcx      # 0x15c40
movq (%rcx,%rax,8), %rdx
leaq 0x7595(%rip), %rsi      # 0x109e9
xorl %eax, %eax
callq 0x22b3
jmp 0x9541
movq 0x38(%rbx), %rdi
movq 0x30(%rdi), %rax
cmpl $0x4, 0x20(%rax)
je 0x955e
leaq 0x7512(%rip), %rsi      # 0x1098b
xorl %eax, %eax
callq 0x22b3
jmp 0x955e
movq 0x28(%rax), %rax
jmp 0x956b
movq %r15, %rdi
xorl %esi, %esi
callq 0xdcf3
movq (%rax), %rax
movq 0x30(%rax), %rax
movq %rax, 0x28(%r12)
cmpq $0x2, 0x50(%rbx)
jb 0x95a3
movq %r12, -0x30(%rbp)
movl $0x1, %r13d
movq %r15, %rdi
movq %r13, %rsi
callq 0xdcf3
movq (%rax), %r12
movq 0x30(%r12), %rdi
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x8250
testb %al, %al
je 0x9587
incq %r13
cmpq %r13, 0x50(%rbx)
ja 0x94b9
movq -0x30(%rbp), %r12
jmp 0x95a3
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x846c
testq %rax, %rax
je 0x9666
movq 0x10(%rax), %rax
jmp 0x956b
callq 0x8250
testb %al, %al
jne 0x9541
movq 0x38(%rbx), %rdi
leaq 0x74ed(%rip), %rsi      # 0x10a0f
xorl %eax, %eax
callq 0x22b3
jmp 0x9541
cmpl $0x5, %edx
jne 0x9541
movq 0x40(%rcx), %rcx
testq %rcx, %rcx
je 0x9541
movq 0x30(%rax), %rax
movq %rax, 0x8(%rcx)
movl 0x48(%rbx), %eax
leal -0x2a(%rax), %ecx
cmpl $0x8, %ecx
jae 0x9556
movq %r14, %rdi
movl $0x2, %esi
jmp 0x9566
addl $-0x25, %eax
cmpl $0x4, %eax
ja 0x95bf
movq %r14, %rdi
movl $0x4, %esi
callq 0x8156
movq %rax, 0x30(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7216(%rip), %rsi      # 0x1079b
jmp 0x95e0
movq %r12, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x9881
movq %r14, %rdi
movl $0x1, %esi
callq 0x8156
movq %rax, %r12
movq %r12, 0x30(%rbx)
jmp 0x956f
leaq 0x7262(%rip), %rsi      # 0x10812
movq %rbx, %rdi
xorl %eax, %eax
callq 0x22b3
jmp 0x93cb
movq %r14, %rdi
xorl %esi, %esi
jmp 0x9566
leaq 0x752b(%rip), %rsi      # 0x10af8
xorl %eax, %eax
callq 0x22b3
jmp 0x9211
leaq 0x7549(%rip), %rsi      # 0x10b29
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22b3
leaq 0x7457(%rip), %rsi      # 0x10a53
movq %rbx, %rdi
xorl %eax, %eax
callq 0x22b3
movq 0x38(%rbx), %rax
movq 0x30(%rax), %rax
movl 0x20(%rax), %ecx
jmp 0x9295
leaq 0x746b(%rip), %rsi      # 0x10a88
movq %rbx, %rdi
xorl %eax, %eax
callq 0x22b3
movq 0x38(%rbx), %rax
movq 0x30(%rax), %rax
movq 0x48(%rax), %rax
jmp 0x956b
movq 0x40(%rbx), %rdx
movq 0x30(%r12), %rcx
leaq 0x7214(%rip), %rsi      # 0x1085c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9767
leaq 0xc5e7(%rip), %rcx      # 0x15c40
movq (%rcx,%rax,8), %rdx
leaq 0x7361(%rip), %rsi      # 0x109c5
jmp 0x9671
movq 0x38(%rbx), %rdx
leaq 0x72b3(%rip), %rsi      # 0x10924
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9767