// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::access_chain_internal[abi:cxx11](unsigned int, unsigned int const*, unsigned int, bool, bool, bool*, bool*)
string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indices, uint32_t count,
                                           bool index_is_literal, bool chain_only, bool *need_transpose,
                                           bool *result_is_packed)
{
	string expr;
	if (!chain_only)
		expr = to_enclosed_expression(base);

	// Start traversing type hierarchy at the proper non-pointer types,
	// but keep type_id referencing the original pointer for use below.
	uint32_t type_id = expression_type_id(base);
	const auto *type = &get_non_pointer_type(type_id);

	bool access_chain_is_arrayed = expr.find_first_of('[') != string::npos;
	bool row_major_matrix_needs_conversion = is_non_native_row_major_matrix(base);
	bool is_packed = has_decoration(base, DecorationCPacked);
	bool pending_array_enclose = false;
	bool dimension_flatten = false;

	for (uint32_t i = 0; i < count; i++)
	{
		uint32_t index = indices[i];

		// Arrays
		if (!type->array.empty())
		{
			// If we are flattening multidimensional arrays, only create opening bracket on first
			// array index.
			if (options.flatten_multidimensional_arrays && !pending_array_enclose)
			{
				dimension_flatten = type->array.size() > 1;
				pending_array_enclose = dimension_flatten;
				if (pending_array_enclose)
					expr += "[";
			}

			assert(type->parent_type);

			const auto append_index = [&]() {
				expr += "[";
				if (index_is_literal)
					expr += convert_to_string(index);
				else
					expr += to_expression(index);
				expr += "]";
			};

			auto *var = maybe_get<SPIRVariable>(base);
			if (backend.force_gl_in_out_block && i == 0 && var && is_builtin_variable(*var) &&
			    !has_decoration(type->self, DecorationBlock))
			{
				// This deals with scenarios for tesc/geom where arrays of gl_Position[] are declared.
				// Normally, these variables live in blocks when compiled from GLSL,
				// but HLSL seems to just emit straight arrays here.
				// We must pretend this access goes through gl_in/gl_out arrays
				// to be able to access certain builtins as arrays.
				auto builtin = ir.meta[base].decoration.builtin_type;
				switch (builtin)
				{
				// case BuiltInCullDistance: // These are already arrays, need to figure out rules for these in tess/geom.
				// case BuiltInClipDistance:
				case BuiltInPosition:
				case BuiltInPointSize:
					if (var->storage == StorageClassInput)
						expr = join("gl_in[", to_expression(index), "].", expr);
					else if (var->storage == StorageClassOutput)
						expr = join("gl_out[", to_expression(index), "].", expr);
					else
						append_index();
					break;

				default:
					append_index();
					break;
				}
			}
			else if (options.flatten_multidimensional_arrays && dimension_flatten)
			{
				// If we are flattening multidimensional arrays, do manual stride computation.
				auto &parent_type = get<SPIRType>(type->parent_type);

				if (index_is_literal)
					expr += convert_to_string(index);
				else
					expr += to_enclosed_expression(index);

				for (auto j = uint32_t(parent_type.array.size()); j; j--)
				{
					expr += " * ";
					expr += enclose_expression(to_array_size(parent_type, j - 1));
				}

				if (parent_type.array.empty())
					pending_array_enclose = false;
				else
					expr += " + ";

				if (!pending_array_enclose)
					expr += "]";
			}
			else
			{
				append_index();
			}

			type_id = type->parent_type;
			type = &get<SPIRType>(type_id);

			access_chain_is_arrayed = true;
		}
		// For structs, the index refers to a constant, which indexes into the members.
		// We also check if this member is a builtin, since we then replace the entire expression with the builtin one.
		else if (type->basetype == SPIRType::Struct)
		{
			if (!index_is_literal)
				index = get<SPIRConstant>(index).scalar();

			if (index >= type->member_types.size())
				SPIRV_CROSS_THROW("Member index is out of bounds!");

			BuiltIn builtin;
			if (is_member_builtin(*type, index, &builtin))
			{
				// FIXME: We rely here on OpName on gl_in/gl_out to make this work properly.
				// To make this properly work by omitting all OpName opcodes,
				// we need to infer gl_in or gl_out based on the builtin, and stage.
				if (access_chain_is_arrayed)
				{
					expr += ".";
					expr += builtin_to_glsl(builtin, type->storage);
				}
				else
					expr = builtin_to_glsl(builtin, type->storage);
			}
			else
			{
				// If the member has a qualified name, use it as the entire chain
				string qual_mbr_name = get_member_qualified_name(type_id, index);
				if (!qual_mbr_name.empty())
					expr = qual_mbr_name;
				else
					expr += to_member_reference(maybe_get_backing_variable(base), *type, index);
			}

			is_packed = member_is_packed_type(*type, index);
			row_major_matrix_needs_conversion = member_is_non_native_row_major_matrix(*type, index);
			type = &get<SPIRType>(type->member_types[index]);
		}
		// Matrix -> Vector
		else if (type->columns > 1)
		{
			if (row_major_matrix_needs_conversion)
			{
				expr = convert_row_major_matrix(expr, *type, is_packed);
				row_major_matrix_needs_conversion = false;
				is_packed = false;
			}

			expr += "[";
			if (index_is_literal)
				expr += convert_to_string(index);
			else
				expr += to_expression(index);
			expr += "]";

			type_id = type->parent_type;
			type = &get<SPIRType>(type_id);
		}
		// Vector -> Scalar
		else if (type->vecsize > 1)
		{
			if (index_is_literal && !is_packed)
			{
				expr += ".";
				expr += index_to_swizzle(index);
			}
			else if (ir.ids[index].get_type() == TypeConstant && !is_packed)
			{
				auto &c = get<SPIRConstant>(index);
				expr += ".";
				expr += index_to_swizzle(c.scalar());
			}
			else if (index_is_literal)
			{
				// For packed vectors, we can only access them as an array, not by swizzle.
				expr += join("[", index, "]");
			}
			else
			{
				expr += "[";
				expr += to_expression(index);
				expr += "]";
			}

			is_packed = false;
			type_id = type->parent_type;
			type = &get<SPIRType>(type_id);
		}
		else if (!backend.allow_truncated_access_chain)
			SPIRV_CROSS_THROW("Cannot subdivide a scalar value!");
	}

	if (pending_array_enclose)
	{
		SPIRV_CROSS_THROW("Flattening of multidimensional arrays were enabled, "
		                  "but the access chain was terminated in the middle of a multidimensional array. "
		                  "This is not supported.");
	}

	if (need_transpose)
		*need_transpose = row_major_matrix_needs_conversion;

	if (result_is_packed)
		*result_is_packed = is_packed;

	return expr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x480, %rsp            # imm = 0x480
movl %r9d, %eax
movq %rcx, -0x398(%rbp)
movl %edx, %ecx
movq -0x398(%rbp), %rdx
movl %ecx, -0x38c(%rbp)
movq %rsi, %r9
movl -0x38c(%rbp), %esi
movq %rdi, -0x388(%rbp)
movb %al, %cl
movq %rdi, %rax
movq %rax, -0x380(%rbp)
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movb 0x10(%rbp), %al
movq %rdi, -0x8(%rbp)
movq %r9, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
andb $0x1, %cl
movb %cl, -0x25(%rbp)
andb $0x1, %al
movb %al, -0x26(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x378(%rbp)
movb $0x0, -0x27(%rbp)
callq 0x7530
testb $0x1, -0x26(%rbp)
jne 0x736d4
movq -0x378(%rbp), %rsi
movl -0x14(%rbp), %edx
leaq -0x48(%rbp), %rdi
callq 0x72630
jmp 0x736a8
movq -0x388(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x7430
leaq -0x48(%rbp), %rdi
callq 0x7708
jmp 0x736d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x74741
movq -0x378(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x20260
movl %eax, -0x39c(%rbp)
jmp 0x736eb
movq -0x378(%rbp), %rdi
movl -0x39c(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %esi
callq 0x22e80
movq %rax, -0x3a8(%rbp)
jmp 0x7370c
movq -0x388(%rbp), %rdi
movq -0x3a8(%rbp), %rax
movq %rax, -0x60(%rbp)
xorl %eax, %eax
movl %eax, %edx
movl $0x5b, %esi
callq 0x7230
movq -0x378(%rbp), %rdi
subq $-0x1, %rax
setne -0x61(%rbp)
movl -0x14(%rbp), %esi
movq (%rdi), %rax
movq 0x108(%rax), %rax
callq *%rax
movb %al, -0x3a9(%rbp)
jmp 0x73752
movq -0x378(%rbp), %rdi
movb -0x3a9(%rbp), %al
andb $0x1, %al
movb %al, -0x62(%rbp)
movl -0x14(%rbp), %esi
movl $0xa, %edx
callq 0x1f560
movb %al, -0x3aa(%rbp)
jmp 0x73779
movb -0x3aa(%rbp), %al
andb $0x1, %al
movb %al, -0x63(%rbp)
movb $0x0, -0x64(%rbp)
movb $0x0, -0x65(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jae 0x7461e
movq -0x20(%rbp), %rax
movl -0x6c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x70(%rbp)
movq -0x60(%rbp), %rdi
addq $0x20, %rdi
callq 0x8690
testb $0x1, %al
jne 0x73d36
movq -0x378(%rbp), %rax
testb $0x1, 0x440(%rax)
je 0x73817
testb $0x1, -0x64(%rbp)
jne 0x73817
movq -0x60(%rbp), %rdi
addq $0x20, %rdi
callq 0x8650
cmpq $0x1, %rax
seta %al
andb $0x1, %al
movb %al, -0x65(%rbp)
movb -0x65(%rbp), %al
andb $0x1, %al
movb %al, -0x64(%rbp)
testb $0x1, -0x64(%rbp)
je 0x73815
movq -0x388(%rbp), %rdi
leaq 0xd9b9c(%rip), %rsi     # 0x14d3a8
callq 0x7340
jmp 0x73813
jmp 0x73815
jmp 0x73817
movq -0x60(%rbp), %rax
cmpl $0x0, 0x9c(%rax)
je 0x73826
jmp 0x73845
leaq 0xcbcda(%rip), %rdi     # 0x13f507
leaq 0xcd9f8(%rip), %rsi     # 0x14122c
movl $0x14a6, %edx           # imm = 0x14A6
leaq 0xd015c(%rip), %rcx     # 0x14399c
callq 0x7260
movq -0x378(%rbp), %rdi
movq -0x388(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x25(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq %rdi, -0x78(%rbp)
movl -0x14(%rbp), %esi
callq 0x116b0
movq %rax, -0x3b8(%rbp)
jmp 0x73882
movq -0x378(%rbp), %rax
movq -0x3b8(%rbp), %rcx
movq %rcx, -0x98(%rbp)
testb $0x1, 0x62d(%rax)
je 0x73aae
cmpl $0x0, -0x6c(%rbp)
jne 0x73aae
cmpq $0x0, -0x98(%rbp)
je 0x73aae
movq -0x378(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x205a0
movb %al, -0x3b9(%rbp)
jmp 0x738d7
movb -0x3b9(%rbp), %al
testb $0x1, %al
jne 0x738e6
jmp 0x73aae
movq -0x378(%rbp), %rdi
movq -0x60(%rbp), %rax
movl 0x8(%rax), %esi
movl $0x2, %edx
callq 0x1f560
movb %al, -0x3ba(%rbp)
jmp 0x73906
movb -0x3ba(%rbp), %al
testb $0x1, %al
jne 0x73aae
jmp 0x73916
movq -0x378(%rbp), %rdi
addq $0x38, %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0xead0
movl 0xa0(%rax), %eax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
subl $0x1, %eax
ja 0x73a99
jmp 0x73948
movq -0x98(%rbp), %rax
cmpl $0x1, 0x10(%rax)
jne 0x739e8
movq -0x378(%rbp), %rsi
movl -0x70(%rbp), %edx
leaq -0xe0(%rbp), %rdi
callq 0x71b50
jmp 0x73971
movq -0x388(%rbp), %r8
leaq 0xd0097(%rip), %rsi     # 0x143a16
leaq 0xd0097(%rip), %rcx     # 0x143a1d
leaq -0xc0(%rbp), %rdi
leaq -0xe0(%rbp), %rdx
callq 0xa4430
jmp 0x7399b
movq -0x388(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x7430
leaq -0xc0(%rbp), %rdi
callq 0x7708
leaq -0xe0(%rbp), %rdi
callq 0x7708
jmp 0x73a97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x7708
jmp 0x74741
movq -0x98(%rbp), %rax
cmpl $0x3, 0x10(%rax)
jne 0x73a85
movq -0x378(%rbp), %rsi
movl -0x70(%rbp), %edx
leaq -0x120(%rbp), %rdi
callq 0x71b50
jmp 0x73a11
movq -0x388(%rbp), %r8
leaq 0xd0001(%rip), %rsi     # 0x143a20
leaq 0xcfff7(%rip), %rcx     # 0x143a1d
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rdx
callq 0xa44f0
jmp 0x73a3b
movq -0x388(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x7430
leaq -0x100(%rbp), %rdi
callq 0x7708
leaq -0x120(%rbp), %rdi
callq 0x7708
jmp 0x73a95
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x7708
jmp 0x74741
leaq -0x90(%rbp), %rdi
callq 0x85b10
jmp 0x73a93
jmp 0x73a95
jmp 0x73a97
jmp 0x73aa9
leaq -0x90(%rbp), %rdi
callq 0x85b10
jmp 0x73aa7
jmp 0x73aa9
jmp 0x73cfd
movq -0x378(%rbp), %rax
testb $0x1, 0x440(%rax)
je 0x73ceb
testb $0x1, -0x65(%rbp)
je 0x73ceb
movq -0x378(%rbp), %rdi
movq -0x60(%rbp), %rax
movl 0x9c(%rax), %esi
callq 0xea90
movq %rax, -0x3c8(%rbp)
jmp 0x73aeb
movq -0x3c8(%rbp), %rax
movq %rax, -0x128(%rbp)
testb $0x1, -0x25(%rbp)
je 0x73b51
leaq -0x148(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2f940
jmp 0x73b11
movq -0x388(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x7470
jmp 0x73b26
leaq -0x148(%rbp), %rdi
callq 0x7708
jmp 0x73ba9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x7708
jmp 0x74741
movq -0x378(%rbp), %rsi
movl -0x70(%rbp), %edx
leaq -0x168(%rbp), %rdi
callq 0x72630
jmp 0x73b69
movq -0x388(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x7470
jmp 0x73b7e
leaq -0x168(%rbp), %rdi
callq 0x7708
jmp 0x73ba9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x7708
jmp 0x74741
movq -0x128(%rbp), %rdi
addq $0x20, %rdi
callq 0x8650
movl %eax, -0x16c(%rbp)
cmpl $0x0, -0x16c(%rbp)
je 0x73c99
movq -0x388(%rbp), %rdi
leaq 0xcfe4e(%rip), %rsi     # 0x143a28
callq 0x7340
jmp 0x73be1
movq -0x378(%rbp), %rsi
movq -0x128(%rbp), %rdx
movl -0x16c(%rbp), %ecx
decl %ecx
leaq -0x1b0(%rbp), %rdi
callq 0x85c10
jmp 0x73c05
movq -0x378(%rbp), %rsi
leaq -0x190(%rbp), %rdi
leaq -0x1b0(%rbp), %rdx
callq 0x6ff50
jmp 0x73c21
movq -0x388(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x7470
jmp 0x73c36
leaq -0x190(%rbp), %rdi
callq 0x7708
leaq -0x1b0(%rbp), %rdi
callq 0x7708
movl -0x16c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x16c(%rbp)
jmp 0x73bbf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x73c88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x7708
leaq -0x1b0(%rbp), %rdi
callq 0x7708
jmp 0x74741
movq -0x128(%rbp), %rdi
addq $0x20, %rdi
callq 0x8690
testb $0x1, %al
jne 0x73caf
jmp 0x73cb5
movb $0x0, -0x64(%rbp)
jmp 0x73ccc
movq -0x388(%rbp), %rdi
leaq 0xd966e(%rip), %rsi     # 0x14d331
callq 0x7340
jmp 0x73cca
jmp 0x73ccc
testb $0x1, -0x64(%rbp)
jne 0x73ce9
movq -0x388(%rbp), %rdi
leaq 0xd43c5(%rip), %rsi     # 0x1480a5
callq 0x7340
jmp 0x73ce7
jmp 0x73ce9
jmp 0x73cfb
leaq -0x90(%rbp), %rdi
callq 0x85b10
jmp 0x73cf9
jmp 0x73cfb
jmp 0x73cfd
movq -0x378(%rbp), %rdi
movq -0x60(%rbp), %rax
movl 0x9c(%rax), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %esi
callq 0xea90
movq %rax, -0x3d0(%rbp)
jmp 0x73d22
movq -0x3d0(%rbp), %rax
movq %rax, -0x60(%rbp)
movb $0x1, -0x61(%rbp)
jmp 0x7460e
movq -0x60(%rbp), %rax
cmpl $0xc, 0xc(%rax)
jne 0x74115
testb $0x1, -0x25(%rbp)
jne 0x73d83
movq -0x378(%rbp), %rdi
movl -0x70(%rbp), %esi
callq 0x31910
movq %rax, -0x3d8(%rbp)
jmp 0x73d62
movq -0x3d8(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x2f560
movl %eax, -0x3dc(%rbp)
jmp 0x73d7a
movl -0x3dc(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
movq %rax, -0x3e8(%rbp)
movq -0x60(%rbp), %rdi
addq $0x68, %rdi
callq 0x8650
movq %rax, %rcx
movq -0x3e8(%rbp), %rax
cmpq %rcx, %rax
jb 0x73e7d
movb $0x1, -0x1d2(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x3f8(%rbp)
leaq -0x1d1(%rbp), %rdi
movq %rdi, -0x3f0(%rbp)
callq 0x7650
movq -0x3f0(%rbp), %rdx
leaq 0xcfc46(%rip), %rsi     # 0x143a2c
leaq -0x1d0(%rbp), %rdi
callq 0x7520
jmp 0x73df4
movq -0x3f8(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x9c50
jmp 0x73e09
movq -0x3f8(%rbp), %rdi
movb $0x0, -0x1d2(%rbp)
leaq 0x139fba(%rip), %rsi    # 0x1addd8
leaq -0x6a195(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x74756
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x73e55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x7708
leaq -0x1d1(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x1d2(%rbp)
jne 0x73e6c
jmp 0x73e78
movq -0x3f8(%rbp), %rdi
callq 0x72c0
jmp 0x74741
movq -0x378(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0x70(%rbp), %edx
leaq -0x1d8(%rbp), %rcx
callq 0x20760
movb %al, -0x3f9(%rbp)
jmp 0x73e9f
movb -0x3f9(%rbp), %al
testb $0x1, %al
jne 0x73eae
jmp 0x73f7f
testb $0x1, -0x61(%rbp)
je 0x73f32
movq -0x388(%rbp), %rdi
leaq 0xd0e6b(%rip), %rsi     # 0x144d2d
callq 0x7340
jmp 0x73ec9
movq -0x378(%rbp), %rsi
movl -0x1d8(%rbp), %edx
movq -0x60(%rbp), %rax
movl 0x64(%rax), %ecx
movq (%rsi), %rax
movq 0xa0(%rax), %rax
leaq -0x1f8(%rbp), %rdi
callq *%rax
jmp 0x73ef2
movq -0x388(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x7470
jmp 0x73f07
leaq -0x1f8(%rbp), %rdi
callq 0x7708
jmp 0x73f7a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x7708
jmp 0x74741
movq -0x378(%rbp), %rsi
movl -0x1d8(%rbp), %edx
movq -0x60(%rbp), %rax
movl 0x64(%rax), %ecx
movq (%rsi), %rax
movq 0xa0(%rax), %rax
leaq -0x218(%rbp), %rdi
callq *%rax
jmp 0x73f5b
movq -0x388(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x7430
leaq -0x218(%rbp), %rdi
callq 0x7708
jmp 0x74089
movq -0x378(%rbp), %rdi
movl -0x58(%rbp), %esi
movl -0x70(%rbp), %edx
callq 0x230d0
movq %rax, -0x408(%rbp)
jmp 0x73f9a
movq -0x408(%rbp), %rsi
leaq -0x238(%rbp), %rdi
callq 0x7170
jmp 0x73faf
leaq -0x238(%rbp), %rdi
callq 0x75f0
testb $0x1, %al
jne 0x73fea
movq -0x388(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x7050
jmp 0x73fd4
jmp 0x7406a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x74078
movq -0x378(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x1fa90
movq %rax, -0x410(%rbp)
jmp 0x74002
movq -0x410(%rbp), %rdx
movq -0x378(%rbp), %rsi
movq -0x60(%rbp), %rcx
movl -0x70(%rbp), %r8d
movq (%rsi), %rax
movq 0x120(%rax), %rax
leaq -0x258(%rbp), %rdi
callq *%rax
jmp 0x7402d
movq -0x388(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x7470
jmp 0x74042
leaq -0x258(%rbp), %rdi
callq 0x7708
jmp 0x7406a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x7708
jmp 0x74078
leaq -0x238(%rbp), %rdi
callq 0x7708
jmp 0x74089
leaq -0x238(%rbp), %rdi
callq 0x7708
jmp 0x74741
movq -0x378(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0x70(%rbp), %edx
callq 0x85e00
movb %al, -0x411(%rbp)
jmp 0x740a4
movq -0x378(%rbp), %rdi
movb -0x411(%rbp), %al
andb $0x1, %al
movb %al, -0x63(%rbp)
movq -0x60(%rbp), %rsi
movl -0x70(%rbp), %edx
movq (%rdi), %rax
movq 0x110(%rax), %rax
callq *%rax
movb %al, -0x412(%rbp)
jmp 0x740d1
movb -0x412(%rbp), %al
andb $0x1, %al
movb %al, -0x62(%rbp)
movq -0x60(%rbp), %rdi
addq $0x68, %rdi
movl -0x70(%rbp), %eax
movl %eax, %esi
callq 0x8570
movq -0x378(%rbp), %rdi
movl (%rax), %esi
callq 0xea90
movq %rax, -0x420(%rbp)
jmp 0x74105
movq -0x420(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x7460c
movq -0x60(%rbp), %rax
cmpl $0x1, 0x18(%rax)
jbe 0x742d3
testb $0x1, -0x62(%rbp)
je 0x741c4
movq -0x388(%rbp), %rsi
leaq -0x298(%rbp), %rdi
callq 0x7170
jmp 0x74142
movq -0x378(%rbp), %rsi
movq -0x60(%rbp), %rcx
movq (%rsi), %rax
movq 0x118(%rax), %rax
movzbl -0x63(%rbp), %r8d
andl $0x1, %r8d
leaq -0x278(%rbp), %rdi
leaq -0x298(%rbp), %rdx
callq *%rax
jmp 0x74172
movq -0x388(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x7430
leaq -0x278(%rbp), %rdi
callq 0x7708
leaq -0x298(%rbp), %rdi
callq 0x7708
movb $0x0, -0x62(%rbp)
movb $0x0, -0x63(%rbp)
jmp 0x741c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x7708
jmp 0x74741
movq -0x388(%rbp), %rdi
leaq 0xd91d6(%rip), %rsi     # 0x14d3a8
callq 0x7340
jmp 0x741d9
testb $0x1, -0x25(%rbp)
je 0x74231
leaq -0x2b8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2f940
jmp 0x741f1
movq -0x388(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
callq 0x7470
jmp 0x74206
leaq -0x2b8(%rbp), %rdi
callq 0x7708
jmp 0x74289
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x7708
jmp 0x74741
movq -0x378(%rbp), %rsi
movl -0x70(%rbp), %edx
leaq -0x2d8(%rbp), %rdi
callq 0x71b50
jmp 0x74249
movq -0x388(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0x7470
jmp 0x7425e
leaq -0x2d8(%rbp), %rdi
callq 0x7708
jmp 0x74289
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x7708
jmp 0x74741
movq -0x388(%rbp), %rdi
leaq 0xd3e0e(%rip), %rsi     # 0x1480a5
callq 0x7340
jmp 0x7429e
movq -0x378(%rbp), %rdi
movq -0x60(%rbp), %rax
movl 0x9c(%rax), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %esi
callq 0xea90
movq %rax, -0x428(%rbp)
jmp 0x742c3
movq -0x428(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x7460a
movq -0x60(%rbp), %rax
cmpl $0x1, 0x14(%rax)
jbe 0x74522
testb $0x1, -0x25(%rbp)
je 0x74334
testb $0x1, -0x63(%rbp)
jne 0x74334
movq -0x388(%rbp), %rdi
leaq 0xd0a32(%rip), %rsi     # 0x144d2d
callq 0x7340
jmp 0x74302
movq -0x378(%rbp), %rdi
movl -0x70(%rbp), %esi
callq 0x70100
movq %rax, -0x430(%rbp)
jmp 0x7431a
movq -0x430(%rbp), %rsi
movq -0x388(%rbp), %rdi
callq 0x7340
jmp 0x7432f
jmp 0x744e9
movq -0x378(%rbp), %rdi
addq $0x20, %rdi
movl -0x70(%rbp), %eax
movl %eax, %esi
callq 0xbdb0
movq %rax, %rdi
callq 0xfa00
movl %eax, -0x434(%rbp)
jmp 0x74359
movl -0x434(%rbp), %eax
cmpl $0x3, %eax
jne 0x743fa
testb $0x1, -0x63(%rbp)
jne 0x743fa
movq -0x378(%rbp), %rdi
movl -0x70(%rbp), %esi
callq 0x31910
movq %rax, -0x440(%rbp)
jmp 0x7438a
movq -0x388(%rbp), %rdi
movq -0x440(%rbp), %rax
movq %rax, -0x2e0(%rbp)
leaq 0xd0987(%rip), %rsi     # 0x144d2d
callq 0x7340
jmp 0x743ad
movq -0x2e0(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x2f560
movl %eax, -0x444(%rbp)
jmp 0x743c5
movl -0x444(%rbp), %esi
movq -0x378(%rbp), %rdi
callq 0x70100
movq %rax, -0x450(%rbp)
jmp 0x743e0
movq -0x450(%rbp), %rsi
movq -0x388(%rbp), %rdi
callq 0x7340
jmp 0x743f5
jmp 0x744e7
testb $0x1, -0x25(%rbp)
je 0x74463
leaq 0xd8fa1(%rip), %rsi     # 0x14d3a8
leaq 0xd3c97(%rip), %rcx     # 0x1480a5
leaq -0x300(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0xa45b0
jmp 0x74420
movq -0x388(%rbp), %rdi
leaq -0x300(%rbp), %rsi
callq 0x7470
jmp 0x74435
leaq -0x300(%rbp), %rdi
callq 0x7708
jmp 0x744e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x7708
jmp 0x74741
movq -0x388(%rbp), %rdi
leaq 0xd8f37(%rip), %rsi     # 0x14d3a8
callq 0x7340
jmp 0x74478
movq -0x378(%rbp), %rsi
movl -0x70(%rbp), %edx
leaq -0x320(%rbp), %rdi
callq 0x71b50
jmp 0x74490
movq -0x388(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x7470
jmp 0x744a5
leaq -0x320(%rbp), %rdi
callq 0x7708
movq -0x388(%rbp), %rdi
leaq 0xd3be6(%rip), %rsi     # 0x1480a5
callq 0x7340
jmp 0x744c6
jmp 0x744e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x7708
jmp 0x74741
jmp 0x744e7
jmp 0x744e9
movq -0x378(%rbp), %rdi
movb $0x0, -0x63(%rbp)
movq -0x60(%rbp), %rax
movl 0x9c(%rax), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %esi
callq 0xea90
movq %rax, -0x458(%rbp)
jmp 0x74512
movq -0x458(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x74608
movq -0x378(%rbp), %rax
testb $0x1, 0x62f(%rax)
jne 0x74606
movb $0x1, -0x342(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x468(%rbp)
leaq -0x341(%rbp), %rdi
movq %rdi, -0x460(%rbp)
callq 0x7650
movq -0x460(%rbp), %rdx
leaq 0xcf4dc(%rip), %rsi     # 0x143a4b
leaq -0x340(%rbp), %rdi
callq 0x7520
jmp 0x7457d
movq -0x468(%rbp), %rdi
leaq -0x340(%rbp), %rsi
callq 0x9c50
jmp 0x74592
movq -0x468(%rbp), %rdi
movb $0x0, -0x342(%rbp)
leaq 0x139831(%rip), %rsi    # 0x1addd8
leaq -0x6a91e(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x74756
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x745de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x340(%rbp), %rdi
callq 0x7708
leaq -0x341(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x342(%rbp)
jne 0x745f5
jmp 0x74601
movq -0x468(%rbp), %rdi
callq 0x72c0
jmp 0x74741
jmp 0x74608
jmp 0x7460a
jmp 0x7460c
jmp 0x7460e
jmp 0x74610
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x73793
testb $0x1, -0x64(%rbp)
je 0x746f5
movb $0x1, -0x36a(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x478(%rbp)
leaq -0x369(%rbp), %rdi
movq %rdi, -0x470(%rbp)
callq 0x7650
movq -0x470(%rbp), %rdx
leaq 0xcf40b(%rip), %rsi     # 0x143a6c
leaq -0x368(%rbp), %rdi
callq 0x7520
jmp 0x7466f
movq -0x478(%rbp), %rdi
leaq -0x368(%rbp), %rsi
callq 0x9c50
jmp 0x74684
movq -0x478(%rbp), %rdi
movb $0x0, -0x36a(%rbp)
leaq 0x13973f(%rip), %rsi    # 0x1addd8
leaq -0x6aa10(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x74756
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x746d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x368(%rbp), %rdi
callq 0x7708
leaq -0x369(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x36a(%rbp)
jne 0x746e7
jmp 0x746f3
movq -0x478(%rbp), %rdi
callq 0x72c0
jmp 0x74741
cmpq $0x0, 0x18(%rbp)
je 0x74708
movb -0x62(%rbp), %cl
movq 0x18(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
cmpq $0x0, 0x20(%rbp)
je 0x7471b
movb -0x63(%rbp), %cl
movq 0x20(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
movb $0x1, -0x27(%rbp)
testb $0x1, -0x27(%rbp)
jne 0x74731
movq -0x388(%rbp), %rdi
callq 0x7708
movq -0x380(%rbp), %rax
addq $0x480, %rsp            # imm = 0x480
popq %rbp
retq
movq -0x388(%rbp), %rdi
callq 0x7708
movq -0x50(%rbp), %rdi
callq 0x7640
nopw %cs:(%rax,%rax)