// File: /workspace/github_cpp_makefile_star2_O3/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::emit_hlsl_entry_point()
void CompilerHLSL::emit_hlsl_entry_point()
{
	vector<string> arguments;

	if (require_input)
		arguments.push_back("SPIRV_Cross_Input stage_input");

	// Add I/O blocks as separate arguments with appropriate storage qualifier.
	for (auto &id : ir.ids)
	{
		if (id.get_type() == TypeVariable)
		{
			auto &var = id.get<SPIRVariable>();
			auto &type = get<SPIRType>(var.basetype);
			bool block = ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock);

			if (var.storage != StorageClassInput && var.storage != StorageClassOutput)
				continue;

			if (block && !is_builtin_variable(var) && interface_variable_exists_in_entry_point(var.self))
			{
				if (var.storage == StorageClassInput)
				{
					arguments.push_back(join("in ", variable_decl(type, join("stage_input", to_name(var.self)))));
				}
				else if (var.storage == StorageClassOutput)
				{
					arguments.push_back(join("out ", variable_decl(type, join("stage_output", to_name(var.self)))));
				}
			}
		}
	}

	auto &execution = get_entry_point();

	switch (execution.model)
	{
	case ExecutionModelGLCompute:
	{
		SpecializationConstant wg_x, wg_y, wg_z;
		get_work_group_size_specialization_constants(wg_x, wg_y, wg_z);

		uint32_t x = execution.workgroup_size.x;
		uint32_t y = execution.workgroup_size.y;
		uint32_t z = execution.workgroup_size.z;

		if (wg_x.id)
			x = get<SPIRConstant>(wg_x.id).scalar();
		if (wg_y.id)
			y = get<SPIRConstant>(wg_y.id).scalar();
		if (wg_z.id)
			z = get<SPIRConstant>(wg_z.id).scalar();

		statement("[numthreads(", x, ", ", y, ", ", z, ")]");
		break;
	}
	case ExecutionModelFragment:
		if (execution.flags.get(ExecutionModeEarlyFragmentTests))
			statement("[earlydepthstencil]");
		break;
	default:
		break;
	}

	statement(require_output ? "SPIRV_Cross_Output " : "void ", "main(", merge(arguments), ")");
	begin_scope();
	bool legacy = hlsl_options.shader_model <= 30;

	// Copy builtins from entry point arguments to globals.
	active_input_builtins.for_each_bit([&](uint32_t i) {
		auto builtin = builtin_to_glsl(static_cast<BuiltIn>(i), StorageClassInput);
		switch (static_cast<BuiltIn>(i))
		{
		case BuiltInFragCoord:
			// VPOS in D3D9 is sampled at integer locations, apply half-pixel offset to be consistent.
			// TODO: Do we need an option here? Any reason why a D3D9 shader would be used
			// on a D3D10+ system with a different rasterization config?
			if (legacy)
				statement(builtin, " = stage_input.", builtin, " + float4(0.5f, 0.5f, 0.0f, 0.0f);");
			else
				statement(builtin, " = stage_input.", builtin, ";");
			break;

		case BuiltInVertexId:
		case BuiltInVertexIndex:
		case BuiltInInstanceId:
		case BuiltInInstanceIndex:
			// D3D semantics are uint, but shader wants int.
			statement(builtin, " = int(stage_input.", builtin, ");");
			break;

		case BuiltInNumWorkgroups:
		case BuiltInPointCoord:
		case BuiltInSubgroupSize:
		case BuiltInSubgroupLocalInvocationId:
			break;

		case BuiltInSubgroupEqMask:
			// Emulate these ...
			// No 64-bit in HLSL, so have to do it in 32-bit and unroll.
			statement("gl_SubgroupEqMask = 1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96));");
			statement("if (WaveGetLaneIndex() >= 32) gl_SubgroupEqMask.x = 0;");
			statement("if (WaveGetLaneIndex() >= 64 || WaveGetLaneIndex() < 32) gl_SubgroupEqMask.y = 0;");
			statement("if (WaveGetLaneIndex() >= 96 || WaveGetLaneIndex() < 64) gl_SubgroupEqMask.z = 0;");
			statement("if (WaveGetLaneIndex() < 96) gl_SubgroupEqMask.w = 0;");
			break;

		case BuiltInSubgroupGeMask:
			// Emulate these ...
			// No 64-bit in HLSL, so have to do it in 32-bit and unroll.
			statement("gl_SubgroupGeMask = ~((1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96))) - 1u);");
			statement("if (WaveGetLaneIndex() >= 32) gl_SubgroupGeMask.x = 0u;");
			statement("if (WaveGetLaneIndex() >= 64) gl_SubgroupGeMask.y = 0u;");
			statement("if (WaveGetLaneIndex() >= 96) gl_SubgroupGeMask.z = 0u;");
			statement("if (WaveGetLaneIndex() < 32) gl_SubgroupGeMask.y = ~0u;");
			statement("if (WaveGetLaneIndex() < 64) gl_SubgroupGeMask.z = ~0u;");
			statement("if (WaveGetLaneIndex() < 96) gl_SubgroupGeMask.w = ~0u;");
			break;

		case BuiltInSubgroupGtMask:
			// Emulate these ...
			// No 64-bit in HLSL, so have to do it in 32-bit and unroll.
			statement("uint gt_lane_index = WaveGetLaneIndex() + 1;");
			statement("gl_SubgroupGtMask = ~((1u << (gt_lane_index - uint4(0, 32, 64, 96))) - 1u);");
			statement("if (gt_lane_index >= 32) gl_SubgroupGtMask.x = 0u;");
			statement("if (gt_lane_index >= 64) gl_SubgroupGtMask.y = 0u;");
			statement("if (gt_lane_index >= 96) gl_SubgroupGtMask.z = 0u;");
			statement("if (gt_lane_index >= 128) gl_SubgroupGtMask.w = 0u;");
			statement("if (gt_lane_index < 32) gl_SubgroupGtMask.y = ~0u;");
			statement("if (gt_lane_index < 64) gl_SubgroupGtMask.z = ~0u;");
			statement("if (gt_lane_index < 96) gl_SubgroupGtMask.w = ~0u;");
			break;

		case BuiltInSubgroupLeMask:
			// Emulate these ...
			// No 64-bit in HLSL, so have to do it in 32-bit and unroll.
			statement("uint le_lane_index = WaveGetLaneIndex() + 1;");
			statement("gl_SubgroupLeMask = (1u << (le_lane_index - uint4(0, 32, 64, 96))) - 1u;");
			statement("if (le_lane_index >= 32) gl_SubgroupLeMask.x = ~0u;");
			statement("if (le_lane_index >= 64) gl_SubgroupLeMask.y = ~0u;");
			statement("if (le_lane_index >= 96) gl_SubgroupLeMask.z = ~0u;");
			statement("if (le_lane_index >= 128) gl_SubgroupLeMask.w = ~0u;");
			statement("if (le_lane_index < 32) gl_SubgroupLeMask.y = 0u;");
			statement("if (le_lane_index < 64) gl_SubgroupLeMask.z = 0u;");
			statement("if (le_lane_index < 96) gl_SubgroupLeMask.w = 0u;");
			break;

		case BuiltInSubgroupLtMask:
			// Emulate these ...
			// No 64-bit in HLSL, so have to do it in 32-bit and unroll.
			statement("gl_SubgroupLtMask = (1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96))) - 1u;");
			statement("if (WaveGetLaneIndex() >= 32) gl_SubgroupLtMask.x = ~0u;");
			statement("if (WaveGetLaneIndex() >= 64) gl_SubgroupLtMask.y = ~0u;");
			statement("if (WaveGetLaneIndex() >= 96) gl_SubgroupLtMask.z = ~0u;");
			statement("if (WaveGetLaneIndex() < 32) gl_SubgroupLtMask.y = 0u;");
			statement("if (WaveGetLaneIndex() < 64) gl_SubgroupLtMask.z = 0u;");
			statement("if (WaveGetLaneIndex() < 96) gl_SubgroupLtMask.w = 0u;");
			break;

		case BuiltInClipDistance:
			for (uint32_t clip = 0; clip < clip_distance_count; clip++)
				statement("gl_ClipDistance[", clip, "] = stage_input.gl_ClipDistance", clip / 4, ".", "xyzw"[clip & 3],
				          ";");
			break;

		case BuiltInCullDistance:
			for (uint32_t cull = 0; cull < cull_distance_count; cull++)
				statement("gl_CullDistance[", cull, "] = stage_input.gl_CullDistance", cull / 4, ".", "xyzw"[cull & 3],
				          ";");
			break;

		default:
			statement(builtin, " = stage_input.", builtin, ";");
			break;
		}
	});

	// Copy from stage input struct to globals.
	for (auto &id : ir.ids)
	{
		if (id.get_type() == TypeVariable)
		{
			auto &var = id.get<SPIRVariable>();
			auto &type = get<SPIRType>(var.basetype);
			bool block = ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock);

			if (var.storage != StorageClassInput)
				continue;

			bool need_matrix_unroll = var.storage == StorageClassInput && execution.model == ExecutionModelVertex;

			if (!block && !var.remapped_variable && type.pointer && !is_builtin_variable(var) &&
			    interface_variable_exists_in_entry_point(var.self))
			{
				auto name = to_name(var.self);
				auto &mtype = get<SPIRType>(var.basetype);
				if (need_matrix_unroll && mtype.columns > 1)
				{
					// Unroll matrices.
					for (uint32_t col = 0; col < mtype.columns; col++)
						statement(name, "[", col, "] = stage_input.", name, "_", col, ";");
				}
				else
				{
					statement(name, " = stage_input.", name, ";");
				}
			}

			// I/O blocks don't use the common stage input/output struct, but separate outputs.
			if (block && !is_builtin_variable(var) && interface_variable_exists_in_entry_point(var.self))
			{
				auto name = to_name(var.self);
				statement(name, " = stage_input", name, ";");
			}
		}
	}

	// Run the shader.
	if (execution.model == ExecutionModelVertex)
		statement("vert_main();");
	else if (execution.model == ExecutionModelFragment)
		statement("frag_main();");
	else if (execution.model == ExecutionModelGLCompute)
		statement("comp_main();");
	else
		SPIRV_CROSS_THROW("Unsupported shader stage.");

	// Copy block outputs.
	for (auto &id : ir.ids)
	{
		if (id.get_type() == TypeVariable)
		{
			auto &var = id.get<SPIRVariable>();
			auto &type = get<SPIRType>(var.basetype);
			bool block = ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock);

			if (var.storage != StorageClassOutput)
				continue;

			// I/O blocks don't use the common stage input/output struct, but separate outputs.
			if (block && !is_builtin_variable(var) && interface_variable_exists_in_entry_point(var.self))
			{
				auto name = to_name(var.self);
				statement("stage_output", name, " = ", name, ";");
			}
		}
	}

	// Copy stage outputs.
	if (require_output)
	{
		statement("SPIRV_Cross_Output stage_output;");

		// Copy builtins from globals to return struct.
		active_output_builtins.for_each_bit([&](uint32_t i) {
			// PointSize doesn't exist in HLSL.
			if (i == BuiltInPointSize)
				return;

			switch (static_cast<BuiltIn>(i))
			{
			case BuiltInClipDistance:
				for (uint32_t clip = 0; clip < clip_distance_count; clip++)
					statement("stage_output.gl_ClipDistance", clip / 4, ".", "xyzw"[clip & 3], " = gl_ClipDistance[",
					          clip, "];");
				break;

			case BuiltInCullDistance:
				for (uint32_t cull = 0; cull < cull_distance_count; cull++)
					statement("stage_output.gl_CullDistance", cull / 4, ".", "xyzw"[cull & 3], " = gl_CullDistance[",
					          cull, "];");
				break;

			default:
			{
				auto builtin_expr = builtin_to_glsl(static_cast<BuiltIn>(i), StorageClassOutput);
				statement("stage_output.", builtin_expr, " = ", builtin_expr, ";");
				break;
			}
			}
		});

		for (auto &id : ir.ids)
		{
			if (id.get_type() == TypeVariable)
			{
				auto &var = id.get<SPIRVariable>();
				auto &type = get<SPIRType>(var.basetype);
				bool block = ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock);

				if (var.storage != StorageClassOutput)
					continue;

				if (!block && var.storage != StorageClassFunction && !var.remapped_variable && type.pointer &&
				    !is_builtin_variable(var) && interface_variable_exists_in_entry_point(var.self))
				{
					auto name = to_name(var.self);

					if (legacy && execution.model == ExecutionModelFragment)
					{
						string output_filler;
						for (uint32_t size = type.vecsize; size < 4; ++size)
							output_filler += ", 0.0";

						statement("stage_output.", name, " = float4(", name, output_filler, ");");
					}
					else
					{
						statement("stage_output.", name, " = ", name, ";");
					}
				}
			}
		}

		statement("return stage_output;");
	}

	end_scope();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
cmpb $0x1, 0x7a9(%rdi)
jne 0x695d3
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x54576(%rip), %rsi     # 0xbdb12
leaq 0x5458c(%rip), %rdx     # 0xbdb2f
callq 0x7be0
leaq 0x90(%rsp), %rdi
movq %rsp, %rsi
callq 0xebc2
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x695d3
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x20(%rbx), %r14
movq 0x28(%rbx), %rbp
cmpq %rbp, %r14
je 0x697d1
cmpl $0x2, 0x8(%r14)
jne 0x697c8
movq %r14, %rdi
callq 0xb2a4
movq %rax, %r13
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0xa3ea
movq %rax, %r15
movl 0x10(%r13), %eax
orl $0x2, %eax
cmpl $0x3, %eax
jne 0x697c8
movq 0x38(%rbx), %rax
movl 0x8(%r15), %ecx
imulq $0x148, %rcx, %rcx      # imm = 0x148
testb $0x4, 0x60(%rax,%rcx)
je 0x697c8
movq %rbx, %rdi
movq %r13, %rsi
callq 0x13330
testb %al, %al
jne 0x697c8
movl 0x8(%r13), %esi
movq %rbx, %rdi
callq 0x13e3a
testb %al, %al
je 0x697c8
movl 0x10(%r13), %eax
cmpl $0x3, %eax
je 0x696e0
cmpl $0x1, %eax
jne 0x697c8
movl 0x8(%r13), %edx
movq (%rbx), %rax
leaq 0x70(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
callq *0x38(%rax)
leaq 0x50(%rsp), %r12
movq %r12, %rdi
leaq 0x544ee(%rip), %rsi     # 0xbdb82
movq %r13, %rdx
callq 0x5554d
movq (%rbx), %rax
leaq 0x20(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq *0xc8(%rax)
movq %rsp, %r15
movq %r15, %rdi
leaq 0x4d9e1(%rip), %rsi     # 0xb70a7
movq %r13, %rdx
callq 0x5819d
leaq 0x90(%rsp), %rdi
movq %r15, %rsi
callq 0xebc2
jmp 0x69753
movl 0x8(%r13), %edx
movq (%rbx), %rax
leaq 0x70(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
callq *0x38(%rax)
leaq 0x50(%rsp), %r12
movq %r12, %rdi
leaq 0x4ab2d(%rip), %rsi     # 0xb4236
movq %r13, %rdx
callq 0x792a5
movq (%rbx), %rax
leaq 0x20(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq *0xc8(%rax)
movq %rsp, %r15
movq %r15, %rdi
leaq 0x50e88(%rip), %rsi     # 0xba5c3
movq %r13, %rdx
callq 0x79219
leaq 0x90(%rsp), %rdi
movq %r15, %rsi
callq 0xebc2
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x6976e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x6978a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x697a6
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x697c8
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x6260
addq $0x10, %r14
jmp 0x695db
movq %rbx, %rdi
callq 0x15f76
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movl 0xb8(%rax), %eax
cmpl $0x4, %eax
je 0x698af
cmpl $0x5, %eax
jne 0x698c9
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movq %rbx, %rdi
callq 0x15fe4
movq 0x40(%rsp), %rcx
movl 0xa0(%rcx), %eax
movl %eax, 0x70(%rsp)
movl 0xa4(%rcx), %eax
movl %eax, 0x4c(%rsp)
movl 0xa8(%rcx), %eax
movl %eax, 0x48(%rsp)
movl (%rsp), %esi
testl %esi, %esi
je 0x69849
movq %rbx, %rdi
callq 0x1c036
movl 0x10(%rax), %eax
movl %eax, 0x70(%rsp)
movl 0x20(%rsp), %esi
testl %esi, %esi
je 0x69860
movq %rbx, %rdi
callq 0x1c036
movl 0x10(%rax), %eax
movl %eax, 0x4c(%rsp)
movl 0x50(%rsp), %esi
testl %esi, %esi
je 0x69877
movq %rbx, %rdi
callq 0x1c036
movl 0x10(%rax), %eax
movl %eax, 0x48(%rsp)
leaq 0x542bf(%rip), %rax     # 0xbdb3d
leaq 0x48(%rsp), %r10
leaq 0x542a6(%rip), %rsi     # 0xbdb30
leaq 0x5081a(%rip), %rcx     # 0xba0ab
leaq 0x70(%rsp), %rdx
leaq 0x4c(%rsp), %r8
movq %rbx, %rdi
movq %rcx, %r9
pushq %rax
pushq %r10
callq 0x79332
addq $0x10, %rsp
jmp 0x698c9
movq 0x40(%rsp), %rax
testb $0x2, 0x61(%rax)
je 0x698c9
leaq 0x5427f(%rip), %rsi     # 0xbdb40
movq %rbx, %rdi
callq 0xc446
leaq 0x54284(%rip), %rax     # 0xbdb54
leaq 0x541f1(%rip), %rcx     # 0xbdac8
cmpb $0x0, 0x7a8(%rbx)
cmovneq %rax, %rcx
movq %rcx, 0x20(%rsp)
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq 0x90(%rsp), %r12
movq 0x98(%rsp), %r13
cmpq %r13, %r12
je 0x69953
movq %rsp, %r14
leaq 0x5078e(%rip), %r15     # 0xba0ab
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r14, %rdi
callq 0x60b0
movq 0x98(%rsp), %rax
addq $-0x20, %rax
cmpq %rax, %r12
je 0x6994a
movq %r14, %rdi
movq %r15, %rsi
callq 0x64e0
addq $0x20, %r12
cmpq %r13, %r12
jne 0x6991d
leaq 0x5420e(%rip), %rdx     # 0xbdb68
leaq 0x510b4(%rip), %r8      # 0xbaa15
leaq 0x20(%rsp), %rsi
movq %rsp, %rcx
movq %rbx, %rdi
callq 0x7946e
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x6998c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x281d8
cmpl $0x1f, 0x788(%rbx)
leaq 0x50(%rsp), %rax
setb (%rax)
leaq 0x20(%rsp), %r15
movq %rbx, (%r15)
movq %rax, 0x8(%r15)
xorl %r14d, %r14d
movq 0x2d0(%rbx), %rax
btq %r14, %rax
jae 0x699ca
movq %r15, %rdi
movl %r14d, %esi
callq 0x74a8c
incq %r14
cmpq $0x40, %r14
jne 0x699b2
movq 0x2f0(%rbx), %rsi
testq %rsi, %rsi
je 0x69ab4
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x7c9e4
movq 0x2e8(%rbx), %r12
testq %r12, %r12
je 0x69a39
movq %rsp, %r14
leaq 0x8(%r12), %rdx
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x69a28
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x69a30
movq %r14, %rdi
callq 0x797e
movq (%r12), %r12
testq %r12, %r12
jne 0x69a08
movq (%rsp), %r14
movq 0x8(%rsp), %r12
cmpq %r12, %r14
je 0x69a9f
movq %r12, %rax
subq %r14, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x214b1
movq %r14, %rdi
movq %r12, %rsi
callq 0x21594
movq (%rsp), %r14
movq 0x8(%rsp), %r13
cmpq %r13, %r14
je 0x69a9f
leaq 0x20(%rsp), %r12
movl (%r14), %esi
movq %r12, %rdi
callq 0x74a8c
addq $0x4, %r14
cmpq %r13, %r14
jne 0x69a87
movq (%rsp), %r14
testq %r14, %r14
je 0x69ab4
movq 0x10(%rsp), %rsi
subq %r14, %rsi
movq %r14, %rdi
callq 0x6260
movq 0x20(%rbx), %r12
movq 0x28(%rbx), %rbp
cmpq %rbp, %r12
je 0x69c75
cmpl $0x2, 0x8(%r12)
jne 0x69c4e
movq %r12, %rdi
callq 0xb2a4
movq %rax, %r14
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0xa3ea
cmpl $0x1, 0x10(%r14)
jne 0x69c4e
movq 0x38(%rbx), %rcx
movl 0x8(%rax), %edx
imulq $0x148, %rdx, %rdx      # imm = 0x148
testb $0x4, 0x60(%rcx,%rdx)
jne 0x69be0
cmpb $0x0, 0x5b(%r14)
jne 0x69c4e
cmpb $0x1, 0x60(%rax)
jne 0x69c4e
movq 0x40(%rsp), %rax
movl 0xb8(%rax), %r13d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x13330
testb %al, %al
jne 0x69c4e
movl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0x13e3a
testb %al, %al
je 0x69c4e
movl 0x8(%r14), %edx
movq (%rbx), %rax
movq %rsp, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
callq *0x38(%rax)
movl 0xc(%r14), %esi
movq %rbx, %rdi
callq 0xa3ea
testl %r13d, %r13d
jne 0x69c57
movq %rax, %r14
cmpl $0x2, 0x18(%rax)
jb 0x69c57
movl $0x0, 0x20(%rsp)
movq %rsp, %r13
subq $0x8, %rsp
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x59146(%rip), %rdx     # 0xc2cec
movq %r15, %rcx
leaq 0x53fbe(%rip), %r8      # 0xbdb6e
movq %r13, %r9
leaq 0x54f37(%rip), %rax     # 0xbeaf1
pushq %rax
pushq %r15
leaq 0x543f3(%rip), %rax     # 0xbdfb7
pushq %rax
callq 0x79586
addq $0x20, %rsp
movl 0x20(%rsp), %eax
incl %eax
movl %eax, 0x20(%rsp)
cmpl 0x18(%r14), %eax
jb 0x69b95
jmp 0x69c33
movq %rbx, %rdi
movq %r14, %rsi
callq 0x13330
testb %al, %al
jne 0x69c4e
movl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0x13e3a
testb %al, %al
je 0x69c4e
movl 0x8(%r14), %edx
movq (%rbx), %rax
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
callq *0x38(%rax)
movq %rbx, %rdi
movq %r14, %rsi
leaq 0x53f5b(%rip), %rdx     # 0xbdb7f
movq %r14, %rcx
leaq 0x54ec3(%rip), %r8      # 0xbeaf1
callq 0x79880
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x69c4e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
addq $0x10, %r12
jmp 0x69abc
movq %rbx, %rdi
movq %rsp, %rcx
movq %rcx, %rsi
leaq 0x53f08(%rip), %rdx     # 0xbdb6f
leaq 0x54e83(%rip), %r8      # 0xbeaf1
callq 0x796fa
jmp 0x69c33
movq 0x40(%rsp), %rax
movl 0xb8(%rax), %eax
testl %eax, %eax
je 0x69ca4
cmpl $0x4, %eax
je 0x69c9b
cmpl $0x5, %eax
jne 0x6a086
leaq 0x53f0f(%rip), %rsi     # 0xbdba8
jmp 0x69cab
leaq 0x53ef9(%rip), %rsi     # 0xbdb9b
jmp 0x69cab
leaq 0x53ee3(%rip), %rsi     # 0xbdb8e
movq %rbx, %rdi
callq 0x79a06
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %rbp
cmpq %rbp, %r15
je 0x69d8d
movq %rsp, %r12
leaq 0x54e23(%rip), %r14     # 0xbeaf1
cmpl $0x2, 0x8(%r15)
jne 0x69d80
movq %r15, %rdi
callq 0xb2a4
movq %rax, %r13
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0xa3ea
cmpl $0x3, 0x10(%r13)
jne 0x69d80
movl 0x8(%rax), %eax
movq 0x38(%rbx), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
movq 0x60(%rcx,%rax), %rax
andl $0x4, %eax
je 0x69d80
movq %rbx, %rdi
movq %r13, %rsi
callq 0x13330
testb %al, %al
jne 0x69d80
movl 0x8(%r13), %esi
movq %rbx, %rdi
callq 0x13e3a
testb %al, %al
je 0x69d80
movl 0x8(%r13), %edx
movq (%rbx), %rax
movq %r12, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
callq *0x38(%rax)
movq %rbx, %rdi
leaq 0x4a4e6(%rip), %rsi     # 0xb4236
movq %r12, %rdx
leaq 0x54d00(%rip), %rcx     # 0xbea5a
movq %r12, %r8
movq %r14, %r9
callq 0x79b0c
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x69d80
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
addq $0x10, %r15
cmpq %rbp, %r15
jne 0x69cce
cmpb $0x0, 0x7a8(%rbx)
je 0x6a05f
leaq 0x53e2e(%rip), %rsi     # 0xbdbcf
movq %rbx, %rdi
callq 0x50be8
xorl %r14d, %r14d
movq 0x310(%rbx), %rax
btq %r14, %rax
jae 0x69dc4
movq %rbx, %rdi
movl %r14d, %esi
callq 0x74f34
incq %r14
cmpq $0x40, %r14
jne 0x69dac
movq 0x330(%rbx), %rsi
testq %rsi, %rsi
je 0x69ea7
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x7c9e4
movq 0x328(%rbx), %r15
testq %r15, %r15
je 0x69e31
movq %rsp, %r14
leaq 0x8(%r15), %rdx
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x69e21
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x69e29
movq %r14, %rdi
callq 0x797e
movq (%r15), %r15
testq %r15, %r15
jne 0x69e02
movq (%rsp), %r14
movq 0x8(%rsp), %r15
cmpq %r15, %r14
je 0x69e92
movq %r15, %rax
subq %r14, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x214b1
movq %r14, %rdi
movq %r15, %rsi
callq 0x21594
movq (%rsp), %r14
movq 0x8(%rsp), %r15
cmpq %r15, %r14
je 0x69e92
movl (%r14), %esi
movq %rbx, %rdi
callq 0x74f34
addq $0x4, %r14
cmpq %r15, %r14
jne 0x69e7a
movq (%rsp), %r14
testq %r14, %r14
je 0x69ea7
movq 0x10(%rsp), %rsi
subq %r14, %rsi
movq %r14, %rdi
callq 0x6260
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %r13
cmpq %r13, %r15
je 0x6a050
leaq 0x20(%rsp), %rbp
cmpl $0x2, 0x8(%r15)
jne 0x6a043
movq %r15, %rdi
callq 0xb2a4
movq %rax, %r12
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0xa3ea
cmpl $0x3, 0x10(%r12)
jne 0x6a043
movq %rax, %r14
movl 0x8(%rax), %eax
movq 0x38(%rbx), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
movq 0x60(%rcx,%rax), %rax
andl $0x4, %eax
jne 0x6a043
cmpb $0x0, 0x5b(%r12)
jne 0x6a043
cmpb $0x1, 0x60(%r14)
jne 0x6a043
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13330
testb %al, %al
jne 0x6a043
movl 0x8(%r12), %esi
movq %rbx, %rdi
callq 0x13e3a
testb %al, %al
je 0x6a043
movl 0x8(%r12), %edx
movq (%rbx), %rax
movq %rsp, %r12
movq %r12, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
callq *0x38(%rax)
cmpb $0x1, 0x50(%rsp)
jne 0x6a005
movq 0x40(%rsp), %rax
cmpl $0x4, 0xb8(%rax)
jne 0x6a005
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movb $0x0, 0x30(%rsp)
movl 0x14(%r14), %r14d
cmpl $0x3, %r14d
ja 0x69fb8
addl $-0x4, %r14d
movq %rbp, %rdi
leaq 0x53c42(%rip), %rsi     # 0xbdbf0
callq 0x64e0
incl %r14d
jne 0x69fa4
subq $0x8, %rsp
movq %rbx, %rdi
leaq 0x53c30(%rip), %rsi     # 0xbdbf6
movq %r12, %rdx
leaq 0x53c34(%rip), %rcx     # 0xbdc04
movq %r12, %r8
movq %rbp, %r9
leaq 0x54b13(%rip), %rax     # 0xbeaf0
pushq %rax
callq 0x79cc4
addq $0x10, %rsp
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x6a028
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x6a028
movq %rbx, %rdi
leaq 0x53be7(%rip), %rsi     # 0xbdbf6
movq %r12, %rdx
leaq 0x54a41(%rip), %rcx     # 0xbea5a
movq %r12, %r8
leaq 0x54ace(%rip), %r9      # 0xbeaf1
callq 0x79e9c
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x6a043
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
addq $0x10, %r15
cmpq %r13, %r15
jne 0x69ebd
leaq 0x53bb8(%rip), %rsi     # 0xbdc0f
movq %rbx, %rdi
callq 0xceb8
movq %rbx, %rdi
callq 0x42d5a
leaq 0x90(%rsp), %rdi
callq 0xda2c
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x6140
movq %rax, %r14
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x53b10(%rip), %rsi     # 0xbdbb5
leaq 0x53b22(%rip), %rdx     # 0xbdbce
callq 0x7be0
movb $0x1, %bpl
movq %rsp, %rsi
movq %r14, %rdi
callq 0x6320
leaq 0x91d02(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0x91cda(%rip), %rsi     # 0xfbdb0
movq 0x92efb(%rip), %rdx     # 0xfcfd8
movq %r14, %rdi
callq 0x6470
jmp 0x6a1e7
jmp 0x6a25e
jmp 0x6a246
jmp 0x6a246
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x6a117
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x6a124
jmp 0x6a249
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0x6a249
jmp 0x6a13e
jmp 0x6a15e
jmp 0x6a17f
jmp 0x6a1a0
jmp 0x6a246
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x6a161
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x6a161
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x6a182
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x6a182
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x6a1a3
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x6a1a3
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x6a249
movq 0x80(%rsp), %rsi
jmp 0x6a274
jmp 0x6a246
jmp 0x6a25e
jmp 0x6a246
jmp 0x6a25e
jmp 0x6a246
jmp 0x6a25e
jmp 0x6a246
jmp 0x6a222
jmp 0x6a246
jmp 0x6a25e
jmp 0x6a246
jmp 0x6a25e
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x6a261
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x6a261
jmp 0x6a25e
jmp 0x6a246
jmp 0x6a222
jmp 0x6a246
jmp 0x6a222
jmp 0x6a246
jmp 0x6a222
jmp 0x6a246
jmp 0x6a222
jmp 0x6a246
jmp 0x6a246
jmp 0x6a246
jmp 0x6a246
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x6a249
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
jmp 0x6a277
jmp 0x6a246
jmp 0x6a246
jmp 0x6a246
jmp 0x6a246
jmp 0x6a246
jmp 0x6a246
jmp 0x6a246
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xda2c
movq %rbx, %rdi
callq 0x64a0
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x6a249
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x6a249