// File: /workspace/github_cpp_makefile_star2_O2/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
andq $0x0, 0x80(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
cmpb $0x1, 0x7a9(%rdi)
jne 0x55957
leaq 0x4316d(%rip), %rsi     # 0x98aa2
movq %rsp, %rdi
leaq 0x28(%rsp), %rdx
callq 0x6100
leaq 0x70(%rsp), %rdi
movq %rsp, %rsi
callq 0xcc8c
movq %rsp, %rdi
callq 0x6548
movq 0x20(%rbx), %r14
movq 0x28(%rbx), %r13
leaq 0x88(%rsp), %rbp
cmpq %r13, %r14
je 0x55b0b
cmpl $0x2, 0x8(%r14)
jne 0x55b02
movq %r14, %rdi
callq 0x9b30
movq %rax, %r12
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0x90a4
movq %rax, %r15
movl 0x10(%r12), %eax
orl $0x2, %eax
cmpl $0x3, %eax
jne 0x55b02
movq 0x38(%rbx), %rax
movl 0x8(%r15), %ecx
imulq $0x148, %rcx, %rcx      # imm = 0x148
testb $0x4, 0x60(%rax,%rcx)
je 0x55b02
movq %rbx, %rdi
movq %r12, %rsi
callq 0x10c60
testb %al, %al
jne 0x55b02
movl 0x8(%r12), %esi
movq %rbx, %rdi
callq 0x115ea
testb %al, %al
je 0x55b02
movl 0x10(%r12), %eax
cmpl $0x3, %eax
je 0x55a6d
cmpl $0x1, %eax
jne 0x55b02
movl 0x8(%r12), %edx
movq (%rbx), %rax
movq %rbp, %rdi
movq %rbx, %rsi
pushq $0x1
popq %rcx
callq *0x38(%rax)
leaq 0x50(%rsp), %r12
movq %r12, %rdi
leaq 0x430f5(%rip), %rsi     # 0x98b12
leaq 0x88(%rsp), %rdx
callq 0x448db
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq *0xc8(%rax)
movq %rsp, %r12
movq %r12, %rdi
leaq 0x3c636(%rip), %rsi     # 0x92087
leaq 0x28(%rsp), %rdx
callq 0x46816
movq %rbp, %r15
leaq 0x70(%rsp), %rdi
movq %r12, %rsi
callq 0xcc8c
jmp 0x55ade
movl 0x8(%r12), %edx
movq (%rbx), %rax
movq %rbp, %rdi
movq %rbx, %rsi
pushq $0x1
popq %rcx
callq *0x38(%rax)
leaq 0x50(%rsp), %r12
movq %r12, %rdi
leaq 0x3977e(%rip), %rsi     # 0x8f20e
leaq 0x88(%rsp), %rdx
callq 0x61b2a
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq *0xc8(%rax)
movq %rsp, %r12
movq %r12, %rdi
leaq 0x3fadf(%rip), %rsi     # 0x955a3
leaq 0x28(%rsp), %rdx
callq 0x61ac0
movq %rbp, %r15
leaq 0x70(%rsp), %rdi
movq %r12, %rsi
callq 0xcc8c
movq %r12, %rdi
callq 0x6548
leaq 0x28(%rsp), %rdi
callq 0x6548
leaq 0x50(%rsp), %rdi
callq 0x6548
movq %r15, %rdi
callq 0x6548
addq $0x10, %r14
jmp 0x55967
movq %rbx, %rdi
callq 0x12fa4
movq %rax, 0x20(%rsp)
leaq 0x50(%rsp), %r14
movq 0x20(%rsp), %rax
movl 0xb8(%rax), %eax
cmpl $0x4, %eax
je 0x55bf5
cmpl $0x5, %eax
jne 0x55c0f
movq %rsp, %rsi
leaq 0x28(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movq %rbx, %rdi
callq 0x12fd6
movq 0x20(%rsp), %rcx
movl 0xa0(%rcx), %eax
movl %eax, 0x88(%rsp)
movl 0xa4(%rcx), %eax
movl %eax, 0x4c(%rsp)
movl 0xa8(%rcx), %eax
movl %eax, 0x48(%rsp)
movl (%rsp), %esi
testl %esi, %esi
je 0x55b8e
movq %rbx, %rdi
callq 0x17bce
movl 0x10(%rax), %eax
movl %eax, 0x88(%rsp)
movl 0x28(%rsp), %esi
testl %esi, %esi
je 0x55ba5
movq %rbx, %rdi
callq 0x17bce
movl 0x10(%rax), %eax
movl %eax, 0x4c(%rsp)
movl 0x50(%rsp), %esi
testl %esi, %esi
je 0x55bbc
movq %rbx, %rdi
callq 0x17bce
movl 0x10(%rax), %eax
movl %eax, 0x48(%rsp)
leaq 0x42f0a(%rip), %rax     # 0x98acd
leaq 0x48(%rsp), %r10
leaq 0x42ef1(%rip), %rsi     # 0x98ac0
leaq 0x3f4b5(%rip), %rcx     # 0x9508b
leaq 0x88(%rsp), %rdx
leaq 0x4c(%rsp), %r8
movq %rbx, %rdi
movq %rcx, %r9
pushq %rax
pushq %r10
callq 0x61b94
popq %rax
popq %rcx
jmp 0x55c0f
movq 0x20(%rsp), %rax
testb $0x2, 0x61(%rax)
je 0x55c0f
leaq 0x42ec9(%rip), %rsi     # 0x98ad0
movq %rbx, %rdi
callq 0xa792
leaq 0x42ece(%rip), %rax     # 0x98ae4
cmpb $0x0, 0x7a8(%rbx)
leaq 0x42e34(%rip), %rcx     # 0x98a58
cmovneq %rax, %rcx
movq %rcx, 0x28(%rsp)
movq %rsp, %rdi
leaq 0x70(%rsp), %rsi
callq 0x41980
leaq 0x42eb7(%rip), %rdx     # 0x98af8
leaq 0x3fdad(%rip), %r8      # 0x959f5
leaq 0x28(%rsp), %rsi
movq %rsp, %rcx
movq %rbx, %rdi
callq 0x61cb0
movq %rsp, %rdi
callq 0x6548
movq %rbx, %rdi
callq 0x22d28
cmpl $0x1f, 0x788(%rbx)
setb 0x50(%rsp)
leaq 0x28(%rsp), %r15
movq %rbx, (%r15)
movq %r14, 0x8(%r15)
xorl %r14d, %r14d
cmpq $0x40, %r14
je 0x55ca6
movq 0x2d0(%rbx), %rax
btq %r14, %rax
jae 0x55ca1
movq %r15, %rdi
movl %r14d, %esi
callq 0x5e684
incq %r14
jmp 0x55c83
movq 0x2f0(%rbx), %rsi
testq %rsi, %rsi
je 0x55d1f
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
callq 0x64318
leaq 0x2e8(%rbx), %r15
movq %rsp, %r14
movq (%r15), %r15
testq %r15, %r15
je 0x55ce5
leaq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0x6c06
jmp 0x55ccf
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1cabb
movq (%rsp), %r15
movq 0x8(%rsp), %r13
leaq 0x28(%rsp), %r14
cmpq %r13, %r15
je 0x55d17
movl (%r15), %esi
movq %r14, %rdi
callq 0x5e684
addq $0x4, %r15
jmp 0x55d01
movq %rsp, %rdi
callq 0x6cf8
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %rbp
movq %rsp, %r12
cmpq %rbp, %r15
je 0x55ed1
cmpl $0x2, 0x8(%r15)
jne 0x55ea7
movq %r15, %rdi
callq 0x9b30
movq %rax, %r14
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0x90a4
cmpl $0x1, 0x10(%r14)
jne 0x55ea7
movq 0x38(%rbx), %rcx
movl 0x8(%rax), %edx
imulq $0x148, %rdx, %rdx      # imm = 0x148
testb $0x4, 0x60(%rcx,%rdx)
jne 0x55e4e
cmpb $0x0, 0x5b(%r14)
jne 0x55ea7
cmpb $0x1, 0x60(%rax)
jne 0x55ea7
movq 0x20(%rsp), %rax
movl 0xb8(%rax), %r13d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10c60
testb %al, %al
jne 0x55ea7
movl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0x115ea
testb %al, %al
je 0x55ea7
movl 0x8(%r14), %edx
movq (%rbx), %rax
movq %r12, %rdi
movq %rbx, %rsi
pushq $0x1
popq %rcx
callq *0x38(%rax)
movl 0xc(%r14), %esi
movq %rbx, %rdi
callq 0x90a4
testl %r13d, %r13d
jne 0x55eb0
movq %rax, %r14
movl 0x18(%rax), %eax
cmpl $0x2, %eax
jb 0x55eb0
xorl %ecx, %ecx
movq %r12, %r13
movl %ecx, 0x28(%rsp)
cmpl %eax, %ecx
jae 0x55ecc
subq $0x8, %rsp
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x47e8b(%rip), %rdx     # 0x9dca4
leaq 0x30(%rsp), %rcx
leaq 0x42cd9(%rip), %r8      # 0x98afe
movq %r13, %r9
leaq 0x43c52(%rip), %rax     # 0x99a81
pushq %rax
pushq %rcx
leaq 0x4310f(%rip), %rax     # 0x98f47
pushq %rax
callq 0x61d98
addq $0x20, %rsp
movl 0x28(%rsp), %ecx
incl %ecx
movl 0x18(%r14), %eax
jmp 0x55dfc
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10c60
testb %al, %al
jne 0x55ea7
movl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0x115ea
testb %al, %al
je 0x55ea7
movl 0x8(%r14), %edx
movq (%rbx), %rax
movq %r12, %r14
movq %r12, %rdi
movq %rbx, %rsi
pushq $0x1
popq %rcx
callq *0x38(%rax)
movq %rbx, %rdi
movq %r14, %rsi
leaq 0x42c7f(%rip), %rdx     # 0x98b0f
movq %r14, %rcx
leaq 0x43be7(%rip), %r8      # 0x99a81
callq 0x61fb8
movq %r14, %rdi
callq 0x6548
addq $0x10, %r15
jmp 0x55d2a
movq %rbx, %rdi
movq %r12, %rcx
movq %r12, %rsi
leaq 0x42c3f(%rip), %rdx     # 0x98aff
leaq 0x43bba(%rip), %r8      # 0x99a81
callq 0x61ed0
movq %r12, %rdi
jmp 0x55ea2
movq 0x20(%rsp), %rax
movl 0xb8(%rax), %eax
testl %eax, %eax
je 0x55f00
cmpl $0x4, %eax
je 0x55ef7
cmpl $0x5, %eax
jne 0x56232
leaq 0x42c43(%rip), %rsi     # 0x98b38
jmp 0x55f07
leaq 0x42c2d(%rip), %rsi     # 0x98b2b
jmp 0x55f07
leaq 0x42c17(%rip), %rsi     # 0x98b1e
movq %rbx, %rdi
callq 0x620a0
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %r14
movq %rsp, %r12
leaq 0x43b60(%rip), %rbp     # 0x99a81
cmpq %r14, %r15
je 0x55fcc
cmpl $0x2, 0x8(%r15)
jne 0x55fc3
movq %r15, %rdi
callq 0x9b30
movq %rax, %r13
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0x90a4
cmpl $0x3, 0x10(%r13)
jne 0x55fc3
movl 0x8(%rax), %eax
movq 0x38(%rbx), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
movq 0x60(%rcx,%rax), %rax
andl $0x4, %eax
je 0x55fc3
movq %rbx, %rdi
movq %r13, %rsi
callq 0x10c60
testb %al, %al
jne 0x55fc3
movl 0x8(%r13), %esi
movq %rbx, %rdi
callq 0x115ea
testb %al, %al
je 0x55fc3
movl 0x8(%r13), %edx
movq (%rbx), %rax
movq %r12, %rdi
movq %rbx, %rsi
pushq $0x1
popq %rcx
callq *0x38(%rax)
movq %rbx, %rdi
leaq 0x39268(%rip), %rsi     # 0x8f20e
movq %r12, %rdx
leaq 0x43a3a(%rip), %rcx     # 0x999ea
movq %r12, %r8
movq %rbp, %r9
callq 0x6215c
movq %r12, %rdi
callq 0x6548
addq $0x10, %r15
jmp 0x55f21
cmpb $0x0, 0x7a8(%rbx)
je 0x5620e
leaq 0x42b7f(%rip), %rsi     # 0x98b5f
movq %rbx, %rdi
callq 0x41386
leaq 0x28(%rsp), %r14
movq %rbx, (%r14)
xorl %r15d, %r15d
cmpq $0x40, %r15
je 0x56016
movq 0x310(%rbx), %rax
btq %r15, %rax
jae 0x56011
movq %r14, %rdi
movl %r15d, %esi
callq 0x5eade
incq %r15
jmp 0x55ff3
movq 0x330(%rbx), %rsi
testq %rsi, %rsi
je 0x5608f
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
callq 0x64318
leaq 0x328(%rbx), %r15
movq %rsp, %r14
movq (%r15), %r15
testq %r15, %r15
je 0x56055
leaq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0x6c06
jmp 0x5603f
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1cabb
movq (%rsp), %r15
movq 0x8(%rsp), %r12
leaq 0x28(%rsp), %r14
cmpq %r12, %r15
je 0x56087
movl (%r15), %esi
movq %r14, %rdi
callq 0x5eade
addq $0x4, %r15
jmp 0x56071
movq %rsp, %rdi
callq 0x6cf8
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %r13
movq %rsp, %rbp
cmpq %r13, %r15
je 0x561ff
cmpl $0x2, 0x8(%r15)
jne 0x561f6
movq %r15, %rdi
callq 0x9b30
movq %rax, %r12
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0x90a4
cmpl $0x3, 0x10(%r12)
jne 0x561f6
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 0x561f6
cmpb $0x0, 0x5b(%r12)
jne 0x561f6
cmpb $0x1, 0x60(%r14)
jne 0x561f6
movq %rbx, %rdi
movq %r12, %rsi
callq 0x10c60
testb %al, %al
jne 0x561f6
movl 0x8(%r12), %esi
movq %rbx, %rdi
callq 0x115ea
testb %al, %al
je 0x561f6
movl 0x8(%r12), %edx
movq (%rbx), %rax
movq %rbp, %r12
movq %rbp, %rdi
movq %rbx, %rsi
pushq $0x1
popq %rcx
callq *0x38(%rax)
cmpb $0x1, 0x50(%rsp)
jne 0x5618f
movq 0x20(%rsp), %rax
cmpl $0x4, 0xb8(%rax)
jne 0x5618f
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
andq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
movl 0x14(%r14), %r14d
cmpl $0x4, %r14d
jae 0x561b4
leaq 0x28(%rsp), %rdi
leaq 0x429fb(%rip), %rsi     # 0x98b80
callq 0x64d0
incl %r14d
jmp 0x56173
movq %rbx, %rdi
leaq 0x429ed(%rip), %rsi     # 0x98b86
movq %r12, %rdx
leaq 0x43847(%rip), %rcx     # 0x999ea
movq %r12, %r8
leaq 0x438d4(%rip), %r9      # 0x99a81
callq 0x6235c
jmp 0x561ee
subq $0x8, %rsp
movq %rbx, %rdi
leaq 0x429c4(%rip), %rsi     # 0x98b86
movq %r12, %rdx
leaq 0x429c8(%rip), %rcx     # 0x98b94
movq %r12, %r8
leaq 0x30(%rsp), %r14
movq %r14, %r9
leaq 0x438a2(%rip), %rax     # 0x99a80
pushq %rax
callq 0x62252
popq %rax
popq %rcx
movq %r14, %rdi
callq 0x6548
movq %r12, %rdi
callq 0x6548
addq $0x10, %r15
jmp 0x5609a
leaq 0x42999(%rip), %rsi     # 0x98b9f
movq %rbx, %rdi
callq 0xaf42
movq %rbx, %rdi
callq 0x3650a
leaq 0x70(%rsp), %rdi
callq 0xb98a
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r14
leaq 0x42901(%rip), %rsi     # 0x98b45
movq %rsp, %rdi
leaq 0x28(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
movq %rsp, %rsi
movq %r14, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x90b58(%rip), %rsi     # 0xe6dc0
movq 0x91d71(%rip), %rdx     # 0xe7fe0
movq %r14, %rdi
callq 0x6490
jmp 0x56347
jmp 0x5633c
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x56299
jmp 0x5638c
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0x5638c
jmp 0x56389
jmp 0x56389
jmp 0x56389
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6548
jmp 0x562c5
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x6548
jmp 0x562d4
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x6548
jmp 0x56318
movq %rax, %rbx
jmp 0x56318
jmp 0x56389
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6548
jmp 0x562fa
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x6548
jmp 0x56309
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x6548
jmp 0x56318
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
jmp 0x56357
jmp 0x56389
jmp 0x5633c
jmp 0x5633c
jmp 0x56389
jmp 0x5637c
jmp 0x56389
jmp 0x5633c
jmp 0x56389
jmp 0x5633c
jmp 0x56389
jmp 0x5637c
jmp 0x5633c
jmp 0x56389
movq %rax, %rbx
jmp 0x56354
jmp 0x56389
jmp 0x56389
jmp 0x56389
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x6548
movq %rsp, %rdi
callq 0x6548
jmp 0x5638c
jmp 0x56389
jmp 0x56389
jmp 0x56389
jmp 0x56389
jmp 0x5637c
jmp 0x5637c
jmp 0x56389
jmp 0x56389
jmp 0x56389
jmp 0x56389
jmp 0x56389
jmp 0x56389
jmp 0x56389
jmp 0x56389
jmp 0x5637c
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6cf8
jmp 0x5638c
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xb98a
movq %rbx, %rdi
callq 0x64b0