// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_cross.cpp
// Function: spirv_cross::Compiler::get_shader_resources(std::unordered_set<unsigned int, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<unsigned int>> const*) const
ShaderResources Compiler::get_shader_resources(const unordered_set<uint32_t> *active_variables) const
{
	ShaderResources res;

	for (auto &id : ir.ids)
	{
		if (id.get_type() != TypeVariable)
			continue;

		auto &var = id.get<SPIRVariable>();
		auto &type = get<SPIRType>(var.basetype);

		// It is possible for uniform storage classes to be passed as function parameters, so detect
		// that. To detect function parameters, check of StorageClass of variable is function scope.
		if (var.storage == StorageClassFunction || !type.pointer || is_builtin_variable(var))
			continue;

		if (active_variables && active_variables->find(var.self) == end(*active_variables))
			continue;

		// Input
		if (var.storage == StorageClassInput && interface_variable_exists_in_entry_point(var.self))
		{
			if (ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock))
				res.stage_inputs.push_back(
				    { var.self, var.basetype, type.self, get_remapped_declared_block_name(var.self) });
			else
				res.stage_inputs.push_back({ var.self, var.basetype, type.self, ir.meta[var.self].decoration.alias });
		}
		// Subpass inputs
		else if (var.storage == StorageClassUniformConstant && type.image.dim == DimSubpassData)
		{
			res.subpass_inputs.push_back({ var.self, var.basetype, type.self, ir.meta[var.self].decoration.alias });
		}
		// Outputs
		else if (var.storage == StorageClassOutput && interface_variable_exists_in_entry_point(var.self))
		{
			if (ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock))
				res.stage_outputs.push_back(
				    { var.self, var.basetype, type.self, get_remapped_declared_block_name(var.self) });
			else
				res.stage_outputs.push_back({ var.self, var.basetype, type.self, ir.meta[var.self].decoration.alias });
		}
		// UBOs
		else if (type.storage == StorageClassUniform &&
		         (ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock)))
		{
			res.uniform_buffers.push_back(
			    { var.self, var.basetype, type.self, get_remapped_declared_block_name(var.self) });
		}
		// Old way to declare SSBOs.
		else if (type.storage == StorageClassUniform &&
		         (ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock)))
		{
			res.storage_buffers.push_back(
			    { var.self, var.basetype, type.self, get_remapped_declared_block_name(var.self) });
		}
		// Modern way to declare SSBOs.
		else if (type.storage == StorageClassStorageBuffer)
		{
			res.storage_buffers.push_back(
			    { var.self, var.basetype, type.self, get_remapped_declared_block_name(var.self) });
		}
		// Push constant blocks
		else if (type.storage == StorageClassPushConstant)
		{
			// There can only be one push constant block, but keep the vector in case this restriction is lifted
			// in the future.
			res.push_constant_buffers.push_back(
			    { var.self, var.basetype, type.self, ir.meta[var.self].decoration.alias });
		}
		// Images
		else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::Image &&
		         type.image.sampled == 2)
		{
			res.storage_images.push_back({ var.self, var.basetype, type.self, ir.meta[var.self].decoration.alias });
		}
		// Separate images
		else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::Image &&
		         type.image.sampled == 1)
		{
			res.separate_images.push_back({ var.self, var.basetype, type.self, ir.meta[var.self].decoration.alias });
		}
		// Separate samplers
		else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::Sampler)
		{
			res.separate_samplers.push_back({ var.self, var.basetype, type.self, ir.meta[var.self].decoration.alias });
		}
		// Textures
		else if (type.storage == StorageClassUniformConstant && type.basetype == SPIRType::SampledImage)
		{
			res.sampled_images.push_back({ var.self, var.basetype, type.self, ir.meta[var.self].decoration.alias });
		}
		// Atomic counters
		else if (type.storage == StorageClassAtomicCounter)
		{
			res.atomic_counters.push_back({ var.self, var.basetype, type.self, ir.meta[var.self].decoration.alias });
		}
	}

	return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, 0x48(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
movl $0x108, %edx            # imm = 0x108
xorl %esi, %esi
callq 0x6180
movq 0x20(%r15), %rbp
movq 0x28(%r15), %r14
leaq 0x78(%rbx), %rax
movq %rax, 0x68(%rsp)
leaq 0xc0(%rbx), %rax
movq %rax, 0x78(%rsp)
leaq 0x18(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0xa8(%rbx), %rax
movq %rax, 0x50(%rsp)
leaq 0x90(%rbx), %rax
movq %rax, 0x58(%rsp)
leaq 0xf0(%rbx), %rax
movq %rax, 0x60(%rsp)
leaq 0xd8(%rbx), %rax
movq %rax, 0x70(%rsp)
leaq 0x48(%rbx), %rax
movq %rax, 0x38(%rsp)
leaq 0x60(%rbx), %rax
movq %rax, 0x80(%rsp)
leaq 0x30(%rbx), %rax
movq %rax, 0x40(%rsp)
cmpq %r14, %rbp
je 0x1128a
cmpl $0x2, 0x8(%rbp)
jne 0x11281
movq %rbp, %rdi
callq 0x1715c
movq %rax, %r12
movl 0xc(%rax), %esi
movq %r15, %rdi
callq 0x16fc8
cmpl $0x7, 0x10(%r12)
je 0x11281
movq %rax, %r13
cmpb $0x1, 0x60(%rax)
jne 0x11281
movq %r15, %rdi
movq %r12, %rsi
callq 0x10c60
testb %al, %al
jne 0x11281
cmpq $0x0, 0x48(%rsp)
je 0x10e9b
movq %r12, %rsi
addq $0x8, %rsi
movq 0x48(%rsp), %rdi
callq 0x1aefe
testq %rax, %rax
je 0x11281
movl 0x10(%r12), %eax
cmpl $0x1, %eax
jne 0x10f0a
movl 0x8(%r12), %esi
movq %r15, %rdi
callq 0x115ea
testb %al, %al
je 0x10f05
movl 0x8(%r13), %eax
movq 0x38(%r15), %rsi
imulq $0x148, %rax, %rcx      # imm = 0x148
testb $0x4, 0x60(%rsi,%rcx)
jne 0x11033
movq 0x8(%r12), %rcx
movq %rcx, (%rsp)
movl %eax, 0x8(%rsp)
movl %ecx, %eax
imulq $0x148, %rax, %rax      # imm = 0x148
addq %rax, %rsi
leaq 0x10(%rsp), %rdi
callq 0x63c0
movq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
movl 0x10(%r12), %eax
testl %eax, %eax
jne 0x10f55
cmpl $0x6, 0x84(%r13)
jne 0x10f55
movq 0x8(%r12), %rax
movq %rax, (%rsp)
movl 0x8(%r13), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
imulq $0x148, %rax, %rsi      # imm = 0x148
addq 0x38(%r15), %rsi
leaq 0x10(%rsp), %rdi
callq 0x63c0
movq 0x80(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
cmpl $0x3, %eax
jne 0x10fba
movl 0x8(%r12), %esi
movq %r15, %rdi
callq 0x115ea
testb %al, %al
je 0x10fba
movl 0x8(%r13), %eax
movq 0x38(%r15), %rsi
imulq $0x148, %rax, %rcx      # imm = 0x148
testb $0x4, 0x60(%rsi,%rcx)
jne 0x111ac
movq 0x8(%r12), %rcx
movq %rcx, (%rsp)
movl %eax, 0x8(%rsp)
movl %ecx, %eax
imulq $0x148, %rax, %rax      # imm = 0x148
addq %rax, %rsi
leaq 0x10(%rsp), %rdi
callq 0x63c0
movq 0x38(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
movl 0x64(%r13), %eax
testl %eax, %eax
je 0x110c9
cmpl $0xc, %eax
je 0x1105f
cmpl $0x9, %eax
je 0x1108f
cmpl $0x2, %eax
jne 0x11114
movl 0x8(%r13), %ecx
movq 0x38(%r15), %rdx
imulq $0x148, %rcx, %rsi      # imm = 0x148
movq 0x60(%rdx,%rsi), %rdx
testb $0x4, %dl
jne 0x111d8
testb $0x8, %dl
je 0x11114
movq 0x8(%r12), %rdx
movq %rdx, (%rsp)
movl %ecx, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x116b4
movq 0x30(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
movq 0x8(%r12), %rdx
movq %rdx, (%rsp)
movl %eax, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x116b4
movq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
movq 0x8(%r12), %rdx
movq %rdx, (%rsp)
movl 0x8(%r13), %eax
movl %eax, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x116b4
movq 0x30(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
movq 0x8(%r12), %rax
movq %rax, (%rsp)
movl 0x8(%r13), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
imulq $0x148, %rax, %rsi      # imm = 0x148
addq 0x38(%r15), %rsi
leaq 0x10(%rsp), %rdi
callq 0x63c0
movq 0x78(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
cmpl $0xd, 0xc(%r13)
jne 0x11114
cmpl $0x2, 0x8c(%r13)
jne 0x11114
movq 0x8(%r12), %rax
movq %rax, (%rsp)
movl 0x8(%r13), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
imulq $0x148, %rax, %rsi      # imm = 0x148
addq 0x38(%r15), %rsi
leaq 0x10(%rsp), %rdi
callq 0x63c0
movq 0x68(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
movl 0xc(%r13), %ecx
testl %eax, %eax
jne 0x11165
cmpl $0xd, %ecx
jne 0x11165
cmpl $0x1, 0x8c(%r13)
jne 0x11165
movq 0x8(%r12), %rax
movq %rax, (%rsp)
movl 0x8(%r13), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
imulq $0x148, %rax, %rsi      # imm = 0x148
addq 0x38(%r15), %rsi
leaq 0x10(%rsp), %rdi
callq 0x63c0
movq 0x70(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
movl %ecx, %edx
xorl $0xf, %edx
orl %eax, %edx
jne 0x111ff
movq 0x8(%r12), %rax
movq %rax, (%rsp)
movl 0x8(%r13), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
imulq $0x148, %rax, %rsi      # imm = 0x148
addq 0x38(%r15), %rsi
leaq 0x10(%rsp), %rdi
callq 0x63c0
movq 0x60(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
movq 0x8(%r12), %rdx
movq %rdx, (%rsp)
movl %eax, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x116b4
movq 0x38(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
movq 0x8(%r12), %rdx
movq %rdx, (%rsp)
movl %ecx, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x116b4
movq %rbx, %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
xorl $0xe, %ecx
orl %eax, %ecx
jne 0x1123d
movq 0x8(%r12), %rax
movq %rax, (%rsp)
movl 0x8(%r13), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
imulq $0x148, %rax, %rsi      # imm = 0x148
addq 0x38(%r15), %rsi
leaq 0x10(%rsp), %rdi
callq 0x63c0
movq 0x58(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
jmp 0x11277
cmpl $0xa, %eax
jne 0x11281
movq 0x8(%r12), %rax
movq %rax, (%rsp)
movl 0x8(%r13), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
imulq $0x148, %rax, %rsi      # imm = 0x148
addq 0x38(%r15), %rsi
leaq 0x10(%rsp), %rdi
callq 0x63c0
movq 0x50(%rsp), %rdi
movq %rsp, %rsi
callq 0x1bc16
leaq 0x10(%rsp), %rdi
callq 0x6548
addq $0x10, %rbp
jmp 0x10e24
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x112d3
jmp 0x112e8
jmp 0x112d3
jmp 0x112e8
jmp 0x112d3
jmp 0x112e8
jmp 0x112d3
jmp 0x112e8
jmp 0x112d3
jmp 0x112e8
jmp 0x112d3
jmp 0x112e8
jmp 0x112d3
jmp 0x112e8
jmp 0x112d3
jmp 0x112e8
jmp 0x112d3
jmp 0x112e8
jmp 0x112d3
jmp 0x112e8
jmp 0x112d3
jmp 0x112e8
jmp 0x112d3
jmp 0x112e8
jmp 0x112d3
jmp 0x112e8
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x6548
jmp 0x112eb
jmp 0x112e8
jmp 0x112e8
jmp 0x112e8
movq %rax, %r14
movq %rbx, %rdi
callq 0x1723a
movq %r14, %rdi
callq 0x64b0
nop