// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::emit_resources()
void CompilerGLSL::emit_resources()
{
	auto &execution = get_entry_point();

	replace_illegal_names();

	// Legacy GL uses gl_FragData[], redeclare all fragment outputs
	// with builtins.
	if (execution.model == ExecutionModelFragment && is_legacy())
		replace_fragment_outputs();

	// Emit PLS blocks if we have such variables.
	if (!pls_inputs.empty() || !pls_outputs.empty())
		emit_pls();

	// Emit custom gl_PerVertex for SSO compatibility.
	if (options.separate_shader_objects && !options.es && execution.model != ExecutionModelFragment)
	{
		switch (execution.model)
		{
		case ExecutionModelGeometry:
		case ExecutionModelTessellationControl:
		case ExecutionModelTessellationEvaluation:
			emit_declared_builtin_block(StorageClassInput, execution.model);
			emit_declared_builtin_block(StorageClassOutput, execution.model);
			break;

		case ExecutionModelVertex:
			emit_declared_builtin_block(StorageClassOutput, execution.model);
			break;

		default:
			break;
		}
	}
	else
	{
		// Need to redeclare clip/cull distance with explicit size to use them.
		// SPIR-V mandates these builtins have a size declared.
		const char *storage = execution.model == ExecutionModelFragment ? "in" : "out";
		if (clip_distance_count != 0)
			statement(storage, " float gl_ClipDistance[", clip_distance_count, "];");
		if (cull_distance_count != 0)
			statement(storage, " float gl_CullDistance[", cull_distance_count, "];");
		if (clip_distance_count != 0 || cull_distance_count != 0)
			statement("");
	}

	if (position_invariant)
	{
		statement("invariant gl_Position;");
		statement("");
	}

	bool emitted = false;

	// If emitted Vulkan GLSL,
	// emit specialization constants as actual floats,
	// spec op expressions will redirect to the constant name.
	//
	// TODO: If we have the fringe case that we create a spec constant which depends on a struct type,
	// we'll have to deal with that, but there's currently no known way to express that.
	for (auto &id : ir.ids)
	{
		if (id.get_type() == TypeConstant)
		{
			auto &c = id.get<SPIRConstant>();

			bool needs_declaration = (c.specialization && options.vulkan_semantics) || c.is_used_as_lut;

			if (needs_declaration)
			{
				emit_constant(c);
				emitted = true;
			}
		}
		else if (options.vulkan_semantics && id.get_type() == TypeConstantOp)
		{
			emit_specialization_constant_op(id.get<SPIRConstantOp>());
			emitted = true;
		}
	}

	if (emitted)
		statement("");
	emitted = false;

	// Output all basic struct types which are not Block or BufferBlock as these are declared inplace
	// when such variables are instantiated.
	for (auto &id : ir.ids)
	{
		if (id.get_type() == TypeType)
		{
			auto &type = id.get<SPIRType>();
			if (type.basetype == SPIRType::Struct && type.array.empty() && !type.pointer &&
			    (!ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock) &&
			     !ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock)))
			{
				emit_struct(type);
			}
		}
	}

	// Output UBOs and SSBOs
	for (auto &id : ir.ids)
	{
		if (id.get_type() == TypeVariable)
		{
			auto &var = id.get<SPIRVariable>();
			auto &type = get<SPIRType>(var.basetype);

			bool is_block_storage = type.storage == StorageClassStorageBuffer || type.storage == StorageClassUniform;
			bool has_block_flags = ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock) ||
			                       ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock);

			if (var.storage != StorageClassFunction && type.pointer && is_block_storage && !is_hidden_variable(var) &&
			    has_block_flags)
			{
				emit_buffer_block(var);
			}
		}
	}

	// Output push constant blocks
	for (auto &id : ir.ids)
	{
		if (id.get_type() == TypeVariable)
		{
			auto &var = id.get<SPIRVariable>();
			auto &type = get<SPIRType>(var.basetype);
			if (var.storage != StorageClassFunction && type.pointer && type.storage == StorageClassPushConstant &&
			    !is_hidden_variable(var))
			{
				emit_push_constant_block(var);
			}
		}
	}

	bool skip_separate_image_sampler = !combined_image_samplers.empty() || !options.vulkan_semantics;

	// Output Uniform Constants (values, samplers, images, etc).
	for (auto &id : ir.ids)
	{
		if (id.get_type() == TypeVariable)
		{
			auto &var = id.get<SPIRVariable>();
			auto &type = get<SPIRType>(var.basetype);

			// If we're remapping separate samplers and images, only emit the combined samplers.
			if (skip_separate_image_sampler)
			{
				// Sampler buffers are always used without a sampler, and they will also work in regular GL.
				bool sampler_buffer = type.basetype == SPIRType::Image && type.image.dim == DimBuffer;
				bool separate_image = type.basetype == SPIRType::Image && type.image.sampled == 1;
				bool separate_sampler = type.basetype == SPIRType::Sampler;
				if (!sampler_buffer && (separate_image || separate_sampler))
					continue;
			}

			if (var.storage != StorageClassFunction && type.pointer &&
			    (type.storage == StorageClassUniformConstant || type.storage == StorageClassAtomicCounter) &&
			    !is_hidden_variable(var))
			{
				emit_uniform(var);
				emitted = true;
			}
		}
	}

	if (emitted)
		statement("");
	emitted = false;

	// Output in/out interfaces.
	for (auto &id : ir.ids)
	{
		if (id.get_type() == TypeVariable)
		{
			auto &var = id.get<SPIRVariable>();
			auto &type = get<SPIRType>(var.basetype);

			if (var.storage != StorageClassFunction && type.pointer &&
			    (var.storage == StorageClassInput || var.storage == StorageClassOutput) &&
			    interface_variable_exists_in_entry_point(var.self) && !is_hidden_variable(var))
			{
				emit_interface_block(var);
				emitted = true;
			}
			else if (is_builtin_variable(var))
			{
				// For gl_InstanceIndex emulation on GLES, the API user needs to
				// supply this uniform.
				if (options.vertex.support_nonzero_base_instance &&
				    ir.meta[var.self].decoration.builtin_type == BuiltInInstanceIndex && !options.vulkan_semantics)
				{
					statement("uniform int SPIRV_Cross_BaseInstance;");
					emitted = true;
				}
			}
		}
	}

	// Global variables.
	for (auto global : global_variables)
	{
		auto &var = get<SPIRVariable>(global);
		if (var.storage != StorageClassOutput)
		{
			add_resource_name(var.self);
			statement(variable_decl(var), ";");
			emitted = true;
		}
	}

	if (emitted)
		statement("");

	declare_undefined_values();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
callq 0x25150
movq -0x1b0(%rbp), %rdi
movq %rax, -0x10(%rbp)
movq (%rdi), %rax
callq *0x170(%rax)
movq -0x10(%rbp), %rax
cmpl $0x4, 0xb8(%rax)
jne 0x58eee
movq -0x1b0(%rbp), %rdi
callq 0x9f610
testb $0x1, %al
jne 0x58ee2
jmp 0x58eee
movq -0x1b0(%rbp), %rdi
callq 0x6fc20
movq -0x1b0(%rbp), %rdi
addq $0x758, %rdi            # imm = 0x758
callq 0x9e330
testb $0x1, %al
jne 0x58f07
jmp 0x58f1e
movq -0x1b0(%rbp), %rdi
addq $0x770, %rdi            # imm = 0x770
callq 0x9e330
testb $0x1, %al
jne 0x58f2a
movq -0x1b0(%rbp), %rdi
callq 0x70630
movq -0x1b0(%rbp), %rax
testb $0x1, 0x43f(%rax)
je 0x58fe4
movq -0x1b0(%rbp), %rax
testb $0x1, 0x43c(%rax)
jne 0x58fe4
movq -0x10(%rbp), %rax
cmpl $0x4, 0xb8(%rax)
je 0x58fe4
movq -0x10(%rbp), %rax
movl 0xb8(%rax), %eax
movl %eax, -0x1b4(%rbp)
testl %eax, %eax
je 0x58fc0
jmp 0x58f79
movl -0x1b4(%rbp), %eax
decl %eax
subl $0x2, %eax
ja 0x58fdd
jmp 0x58f88
movq -0x1b0(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xb8(%rax), %edx
movl $0x1, %esi
callq 0x70d50
movq -0x1b0(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xb8(%rax), %edx
movl $0x3, %esi
callq 0x70d50
jmp 0x58fdf
movq -0x1b0(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xb8(%rax), %edx
movl $0x3, %esi
callq 0x70d50
jmp 0x58fdf
jmp 0x58fdf
jmp 0x590ac
movq -0x1b0(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0xb8(%rcx), %esi
leaq 0xe9424(%rip), %rcx     # 0x142420
leaq 0xf4aa3(%rip), %rdx     # 0x14daa6
cmpl $0x4, %esi
cmoveq %rdx, %rcx
movq %rcx, -0x18(%rbp)
cmpl $0x0, 0x350(%rax)
je 0x5903f
movq -0x1b0(%rbp), %rdi
movq %rdi, %rcx
addq $0x350, %rcx            # imm = 0x350
leaq -0x18(%rbp), %rsi
leaq 0xe9410(%rip), %rdx     # 0x142443
leaq 0xee00f(%rip), %r8      # 0x147049
callq 0xa0f60
movq -0x1b0(%rbp), %rax
cmpl $0x0, 0x354(%rax)
je 0x59077
movq -0x1b0(%rbp), %rdi
movq %rdi, %rcx
addq $0x354, %rcx            # imm = 0x354
leaq -0x18(%rbp), %rsi
leaq 0xe93f0(%rip), %rdx     # 0x14245b
leaq 0xedfd7(%rip), %r8      # 0x147049
callq 0xa0f60
movq -0x1b0(%rbp), %rax
cmpl $0x0, 0x350(%rax)
jne 0x59097
movq -0x1b0(%rbp), %rax
cmpl $0x0, 0x354(%rax)
je 0x590aa
movq -0x1b0(%rbp), %rdi
leaq 0xe57f9(%rip), %rsi     # 0x13e89e
callq 0xedf0
jmp 0x590ac
movq -0x1b0(%rbp), %rax
testb $0x1, 0x358(%rax)
je 0x590e2
movq -0x1b0(%rbp), %rdi
leaq 0xe93a9(%rip), %rsi     # 0x142473
callq 0x10fd0
movq -0x1b0(%rbp), %rdi
leaq 0xe57c1(%rip), %rsi     # 0x13e89e
callq 0xedf0
movq -0x1b0(%rbp), %rax
movb $0x0, -0x19(%rbp)
addq $0x8, %rax
addq $0x18, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xf940
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0xf970
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xf9a0
testb $0x1, %al
jne 0x59129
jmp 0x591f9
leaq -0x30(%rbp), %rdi
callq 0xf9e0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0xfa00
cmpl $0x3, %eax
jne 0x591ad
movq -0x40(%rbp), %rdi
callq 0x2f2f0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
testb $0x1, 0x108(%rax)
je 0x59176
movq -0x1b0(%rbp), %rcx
movb $0x1, %al
testb $0x1, 0x43e(%rcx)
movb %al, -0x1b5(%rbp)
jne 0x59186
movq -0x48(%rbp), %rax
movb 0x10a(%rax), %al
movb %al, -0x1b5(%rbp)
movb -0x1b5(%rbp), %al
andb $0x1, %al
movb %al, -0x49(%rbp)
testb $0x1, -0x49(%rbp)
je 0x591ab
movq -0x1b0(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x648e0
movb $0x1, -0x19(%rbp)
jmp 0x591e9
movq -0x1b0(%rbp), %rax
testb $0x1, 0x43e(%rax)
je 0x591e7
movq -0x40(%rbp), %rdi
callq 0xfa00
cmpl $0xa, %eax
jne 0x591e7
movq -0x40(%rbp), %rdi
callq 0x57610
movq -0x1b0(%rbp), %rdi
movq %rax, %rsi
callq 0x633d0
movb $0x1, -0x19(%rbp)
jmp 0x591e9
jmp 0x591eb
leaq -0x30(%rbp), %rdi
callq 0xfbd0
jmp 0x59113
testb $0x1, -0x19(%rbp)
je 0x59212
movq -0x1b0(%rbp), %rdi
leaq 0xe5691(%rip), %rsi     # 0x13e89e
callq 0xedf0
movq -0x1b0(%rbp), %rax
movb $0x0, -0x19(%rbp)
addq $0x8, %rax
addq $0x18, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0xf940
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
callq 0xf970
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xf9a0
testb $0x1, %al
jne 0x59259
jmp 0x59336
leaq -0x60(%rbp), %rdi
callq 0xf9e0
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
callq 0xfa00
cmpl $0x1, %eax
jne 0x59326
movq -0x70(%rbp), %rdi
callq 0xfa20
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpl $0xc, 0xc(%rax)
jne 0x59324
movq -0x78(%rbp), %rdi
addq $0x20, %rdi
callq 0x8690
testb $0x1, %al
jne 0x592a6
jmp 0x59324
movq -0x78(%rbp), %rax
testb $0x1, 0x60(%rax)
jne 0x59324
movq -0x1b0(%rbp), %rdi
addq $0x8, %rdi
addq $0x30, %rdi
movq -0x78(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %esi
callq 0xead0
movq %rax, %rdi
addq $0x60, %rdi
movl $0x2, %esi
callq 0xef50
testb $0x1, %al
jne 0x59324
movq -0x1b0(%rbp), %rdi
addq $0x8, %rdi
addq $0x30, %rdi
movq -0x78(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %esi
callq 0xead0
movq %rax, %rdi
addq $0x60, %rdi
movl $0x3, %esi
callq 0xef50
testb $0x1, %al
jne 0x59324
movq -0x1b0(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x5bf00
jmp 0x59326
jmp 0x59328
leaq -0x60(%rbp), %rdi
callq 0xfbd0
jmp 0x59243
movq -0x1b0(%rbp), %rax
addq $0x8, %rax
addq $0x18, %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0xf940
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
callq 0xf970
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xf9a0
testb $0x1, %al
jne 0x59385
jmp 0x5950a
leaq -0x88(%rbp), %rdi
callq 0xf9e0
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
callq 0xfa00
cmpl $0x2, %eax
jne 0x594f7
movq -0x98(%rbp), %rdi
callq 0xfd10
movq -0x1b0(%rbp), %rdi
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movl 0xc(%rax), %esi
callq 0xea90
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rcx
movb $0x1, %al
cmpl $0xc, 0x64(%rcx)
movb %al, -0x1b6(%rbp)
je 0x59406
movq -0xa8(%rbp), %rax
cmpl $0x2, 0x64(%rax)
sete %al
movb %al, -0x1b6(%rbp)
movq -0x1b0(%rbp), %rdi
movb -0x1b6(%rbp), %al
andb $0x1, %al
movb %al, -0xa9(%rbp)
addq $0x8, %rdi
addq $0x30, %rdi
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %esi
callq 0xead0
movq %rax, %rdi
addq $0x60, %rdi
movl $0x2, %esi
callq 0xef50
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x1b7(%rbp)
jne 0x5948b
movq -0x1b0(%rbp), %rdi
addq $0x8, %rdi
addq $0x30, %rdi
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %esi
callq 0xead0
movq %rax, %rdi
addq $0x60, %rdi
movl $0x3, %esi
callq 0xef50
movb %al, -0x1b7(%rbp)
movb -0x1b7(%rbp), %al
andb $0x1, %al
movb %al, -0xaa(%rbp)
movq -0xa0(%rbp), %rax
cmpl $0x7, 0x10(%rax)
je 0x594f5
movq -0xa8(%rbp), %rax
testb $0x1, 0x60(%rax)
je 0x594f5
testb $0x1, -0xa9(%rbp)
je 0x594f5
movq -0x1b0(%rbp), %rdi
movq -0xa0(%rbp), %rsi
xorl %edx, %edx
callq 0x20460
testb $0x1, %al
jne 0x594f5
testb $0x1, -0xaa(%rbp)
je 0x594f5
movq -0x1b0(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movq (%rdi), %rax
callq *0xe8(%rax)
jmp 0x594f7
jmp 0x594f9
leaq -0x88(%rbp), %rdi
callq 0xfbd0
jmp 0x59369
movq -0x1b0(%rbp), %rax
addq $0x8, %rax
addq $0x18, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rdi
callq 0xf940
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rdi
callq 0xf970
movq %rax, -0xc8(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xf9a0
testb $0x1, %al
jne 0x59562
jmp 0x59626
leaq -0xc0(%rbp), %rdi
callq 0xf9e0
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rdi
callq 0xfa00
cmpl $0x2, %eax
jne 0x59613
movq -0xd0(%rbp), %rdi
callq 0xfd10
movq -0x1b0(%rbp), %rdi
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movl 0xc(%rax), %esi
callq 0xea90
movq %rax, -0xe0(%rbp)
movq -0xd8(%rbp), %rax
cmpl $0x7, 0x10(%rax)
je 0x59611
movq -0xe0(%rbp), %rax
testb $0x1, 0x60(%rax)
je 0x59611
movq -0xe0(%rbp), %rax
cmpl $0x9, 0x64(%rax)
jne 0x59611
movq -0x1b0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
xorl %edx, %edx
callq 0x20460
testb $0x1, %al
jne 0x59611
movq -0x1b0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
movq (%rdi), %rax
callq *0xf0(%rax)
jmp 0x59613
jmp 0x59615
leaq -0xc0(%rbp), %rdi
callq 0xfbd0
jmp 0x59546
movq -0x1b0(%rbp), %rdi
addq $0x1d8, %rdi            # imm = 0x1D8
callq 0xa10a0
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x1b8(%rbp)
jne 0x5964a
jmp 0x5965f
movq -0x1b0(%rbp), %rax
movb 0x43e(%rax), %al
xorb $-0x1, %al
movb %al, -0x1b8(%rbp)
movq -0x1b0(%rbp), %rax
movb -0x1b8(%rbp), %cl
andb $0x1, %cl
movb %cl, -0xe1(%rbp)
addq $0x8, %rax
addq $0x18, %rax
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rdi
callq 0xf940
movq %rax, -0xf8(%rbp)
movq -0xf0(%rbp), %rdi
callq 0xf970
movq %rax, -0x100(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0xf9a0
testb $0x1, %al
jne 0x596c6
jmp 0x59851
leaq -0xf8(%rbp), %rdi
callq 0xf9e0
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rdi
callq 0xfa00
cmpl $0x2, %eax
jne 0x5983e
movq -0x108(%rbp), %rdi
callq 0xfd10
movq -0x1b0(%rbp), %rdi
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rax
movl 0xc(%rax), %esi
callq 0xea90
movq %rax, -0x118(%rbp)
testb $0x1, -0xe1(%rbp)
je 0x597d4
movq -0x118(%rbp), %rcx
xorl %eax, %eax
cmpl $0xd, 0xc(%rcx)
movb %al, -0x1b9(%rbp)
jne 0x59757
movq -0x118(%rbp), %rax
cmpl $0x5, 0x84(%rax)
sete %al
movb %al, -0x1b9(%rbp)
movb -0x1b9(%rbp), %al
andb $0x1, %al
movb %al, -0x119(%rbp)
movq -0x118(%rbp), %rcx
xorl %eax, %eax
cmpl $0xd, 0xc(%rcx)
movb %al, -0x1ba(%rbp)
jne 0x59791
movq -0x118(%rbp), %rax
cmpl $0x1, 0x8c(%rax)
sete %al
movb %al, -0x1ba(%rbp)
movb -0x1ba(%rbp), %al
andb $0x1, %al
movb %al, -0x11a(%rbp)
movq -0x118(%rbp), %rax
cmpl $0xf, 0xc(%rax)
sete %al
andb $0x1, %al
movb %al, -0x11b(%rbp)
testb $0x1, -0x119(%rbp)
jne 0x597d2
testb $0x1, -0x11a(%rbp)
jne 0x597d0
testb $0x1, -0x11b(%rbp)
je 0x597d2
jmp 0x59840
jmp 0x597d4
movq -0x110(%rbp), %rax
cmpl $0x7, 0x10(%rax)
je 0x5983c
movq -0x118(%rbp), %rax
testb $0x1, 0x60(%rax)
je 0x5983c
movq -0x118(%rbp), %rax
cmpl $0x0, 0x64(%rax)
je 0x59808
movq -0x118(%rbp), %rax
cmpl $0xa, 0x64(%rax)
jne 0x5983c
movq -0x1b0(%rbp), %rdi
movq -0x110(%rbp), %rsi
xorl %edx, %edx
callq 0x20460
testb $0x1, %al
jne 0x5983c
movq -0x1b0(%rbp), %rdi
movq -0x110(%rbp), %rsi
movq (%rdi), %rax
callq *0xf8(%rax)
movb $0x1, -0x19(%rbp)
jmp 0x5983e
jmp 0x59840
leaq -0xf8(%rbp), %rdi
callq 0xfbd0
jmp 0x596aa
testb $0x1, -0x19(%rbp)
je 0x5986a
movq -0x1b0(%rbp), %rdi
leaq 0xe5039(%rip), %rsi     # 0x13e89e
callq 0xedf0
movq -0x1b0(%rbp), %rax
movb $0x0, -0x19(%rbp)
addq $0x8, %rax
addq $0x18, %rax
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rdi
callq 0xf940
movq %rax, -0x130(%rbp)
movq -0x128(%rbp), %rdi
callq 0xf970
movq %rax, -0x138(%rbp)
leaq -0x130(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0xf9a0
testb $0x1, %al
jne 0x598c6
jmp 0x59a32
leaq -0x130(%rbp), %rdi
callq 0xf9e0
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rdi
callq 0xfa00
cmpl $0x2, %eax
jne 0x59a1f
movq -0x140(%rbp), %rdi
callq 0xfd10
movq -0x1b0(%rbp), %rdi
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rax
movl 0xc(%rax), %esi
callq 0xea90
movq %rax, -0x150(%rbp)
movq -0x148(%rbp), %rax
cmpl $0x7, 0x10(%rax)
je 0x599a0
movq -0x150(%rbp), %rax
testb $0x1, 0x60(%rax)
je 0x599a0
movq -0x148(%rbp), %rax
cmpl $0x1, 0x10(%rax)
je 0x59952
movq -0x148(%rbp), %rax
cmpl $0x3, 0x10(%rax)
jne 0x599a0
movq -0x1b0(%rbp), %rdi
movq -0x148(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x21c10
testb $0x1, %al
jne 0x5996e
jmp 0x599a0
movq -0x1b0(%rbp), %rdi
movq -0x148(%rbp), %rsi
xorl %edx, %edx
callq 0x20460
testb $0x1, %al
jne 0x599a0
movq -0x1b0(%rbp), %rdi
movq -0x148(%rbp), %rsi
callq 0x622f0
movb $0x1, -0x19(%rbp)
jmp 0x59a1d
movq -0x1b0(%rbp), %rdi
movq -0x148(%rbp), %rsi
callq 0x205a0
testb $0x1, %al
jne 0x599b9
jmp 0x59a1b
movq -0x1b0(%rbp), %rax
testb $0x1, 0x444(%rax)
je 0x59a19
movq -0x1b0(%rbp), %rdi
addq $0x8, %rdi
addq $0x30, %rdi
movq -0x148(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %esi
callq 0xead0
cmpl $0x2b, 0xa0(%rax)
jne 0x59a19
movq -0x1b0(%rbp), %rax
testb $0x1, 0x43e(%rax)
jne 0x59a19
movq -0x1b0(%rbp), %rdi
leaq 0xe8a7a(%rip), %rsi     # 0x14248a
callq 0xa10e0
movb $0x1, -0x19(%rbp)
jmp 0x59a1b
jmp 0x59a1d
jmp 0x59a1f
jmp 0x59a21
leaq -0x130(%rbp), %rdi
callq 0xfbd0
jmp 0x598aa
movq -0x1b0(%rbp), %rax
addq $0x118, %rax            # imm = 0x118
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rdi
callq 0x86d0
movq %rax, -0x160(%rbp)
movq -0x158(%rbp), %rdi
callq 0x8700
movq %rax, -0x168(%rbp)
leaq -0x160(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x8730
testb $0x1, %al
jne 0x59a88
jmp 0x59b5e
leaq -0x160(%rbp), %rdi
callq 0x8770
movq -0x1b0(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x16c(%rbp)
movl -0x16c(%rbp), %esi
callq 0xfec0
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rax
cmpl $0x3, 0x10(%rax)
je 0x59b4b
movq -0x1b0(%rbp), %rdi
movq -0x178(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x5c1d0
movq -0x1b0(%rbp), %rsi
movq -0x178(%rbp), %rdx
leaq -0x198(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x62d60
movq -0x1b0(%rbp), %rdi
movq -0x1c8(%rbp), %rsi
leaq 0xef594(%rip), %rdx     # 0x1490a6
callq 0xf270
jmp 0x59b19
leaq -0x198(%rbp), %rdi
callq 0x7708
movb $0x1, -0x19(%rbp)
jmp 0x59b4b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a0(%rbp)
movl %eax, -0x1a4(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x7708
jmp 0x59b90
jmp 0x59b4d
leaq -0x160(%rbp), %rdi
callq 0x8790
jmp 0x59a6c
testb $0x1, -0x19(%rbp)
je 0x59b77
movq -0x1b0(%rbp), %rdi
leaq 0xe4d2c(%rip), %rsi     # 0x13e89e
callq 0xedf0
movq -0x1b0(%rbp), %rdi
movq (%rdi), %rax
callq *0x180(%rax)
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
movq -0x1a0(%rbp), %rdi
callq 0x7640
nopl (%rax)