// File: /workspace/github_cpp_makefile_star2_O3/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), %r12
movq 0x28(%r15), %r14
cmpq %r14, %r12
je 0x13a68
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)
cmpl $0x2, 0x8(%r12)
jne 0x13a5b
movq %r12, %rdi
callq 0x1b66c
movq %rax, %r13
movl 0xc(%rax), %esi
movq %r15, %rdi
callq 0x1b382
cmpl $0x7, 0x10(%r13)
je 0x13a5b
movq %rax, %rbp
cmpb $0x1, 0x60(%rax)
jne 0x13a5b
movq %r15, %rdi
movq %r13, %rsi
callq 0x13330
testb %al, %al
jne 0x13a5b
cmpq $0x0, 0x48(%rsp)
je 0x135b2
movq %r13, %rsi
addq $0x8, %rsi
movq 0x48(%rsp), %rdi
callq 0x1f4b4
testq %rax, %rax
je 0x13a5b
movl 0x10(%r13), %eax
cmpl $0x1, %eax
jne 0x1362f
movl 0x8(%r13), %esi
movq %r15, %rdi
callq 0x13e3a
testb %al, %al
je 0x1362b
movl 0x8(%rbp), %ecx
movq 0x38(%r15), %rax
imulq $0x148, %rcx, %rdx      # imm = 0x148
testb $0x4, 0x60(%rax,%rdx)
jne 0x137ab
movq 0x8(%r13), %rdx
movq %rdx, (%rsp)
movl %ecx, 0x8(%rsp)
movl %edx, %ecx
imulq $0x148, %rcx, %rcx      # imm = 0x148
leaq 0x20(%rsp), %rdx
movq %rdx, 0x10(%rsp)
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0xe456
movq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
movl 0x10(%r13), %eax
testl %eax, %eax
jne 0x1368d
cmpl $0x6, 0x84(%rbp)
jne 0x1368d
movq 0x8(%r13), %rax
movq %rax, (%rsp)
movl 0x8(%rbp), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
movq 0x38(%r15), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
leaq 0x20(%rsp), %rdx
movq %rdx, 0x10(%rsp)
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0xe456
movq 0x80(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
cmpl $0x3, %eax
jne 0x13702
movl 0x8(%r13), %esi
movq %r15, %rdi
callq 0x13e3a
testb %al, %al
je 0x13702
movl 0x8(%rbp), %ecx
movq 0x38(%r15), %rax
imulq $0x148, %rcx, %rdx      # imm = 0x148
testb $0x4, 0x60(%rax,%rdx)
jne 0x1394b
movq 0x8(%r13), %rdx
movq %rdx, (%rsp)
movl %ecx, 0x8(%rsp)
movl %edx, %ecx
imulq $0x148, %rcx, %rcx      # imm = 0x148
leaq 0x20(%rsp), %rdx
movq %rdx, 0x10(%rsp)
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0xe456
movq 0x38(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
movl 0x64(%rbp), %eax
cmpl $0x8, %eax
jg 0x1376b
testl %eax, %eax
je 0x137d6
cmpl $0x2, %eax
jne 0x13833
movl 0x8(%rbp), %ecx
movq 0x38(%r15), %rdx
imulq $0x148, %rcx, %rsi      # imm = 0x148
movq 0x60(%rdx,%rsi), %rdx
testb $0x4, %dl
jne 0x13976
testb $0x8, %dl
je 0x13833
movq 0x8(%r13), %rdx
movq %rdx, (%rsp)
movl %ecx, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x13f3e
movq 0x30(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
cmpl $0x9, %eax
je 0x138a2
cmpl $0xc, %eax
jne 0x13833
movq 0x8(%r13), %rdx
movq %rdx, (%rsp)
movl 0x8(%rbp), %eax
movl %eax, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x13f3e
movq 0x30(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
movq 0x8(%r13), %rdx
movq %rdx, (%rsp)
movl %ecx, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x13f3e
movq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
cmpl $0xd, 0xc(%rbp)
jne 0x13833
cmpl $0x2, 0x8c(%rbp)
jne 0x13833
movq 0x8(%r13), %rax
movq %rax, (%rsp)
movl 0x8(%rbp), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
movq 0x38(%r15), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
leaq 0x20(%rsp), %rdx
movq %rdx, 0x10(%rsp)
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0xe456
movq 0x68(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
movl 0xc(%rbp), %ecx
testl %eax, %eax
jne 0x138f0
cmpl $0xd, %ecx
jne 0x138f0
cmpl $0x1, 0x8c(%rbp)
jne 0x138f0
movq 0x8(%r13), %rax
movq %rax, (%rsp)
movl 0x8(%rbp), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
movq 0x38(%r15), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
leaq 0x20(%rsp), %rdx
movq %rdx, 0x10(%rsp)
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0xe456
movq 0x70(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
movq 0x8(%r13), %rax
movq %rax, (%rsp)
movl 0x8(%rbp), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
movq 0x38(%r15), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
leaq 0x20(%rsp), %rdx
movq %rdx, 0x10(%rsp)
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0xe456
movq 0x78(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
movl %ecx, %edx
xorl $0xf, %edx
orl %eax, %edx
jne 0x1399f
movq 0x8(%r13), %rax
movq %rax, (%rsp)
movl 0x8(%rbp), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
movq 0x38(%r15), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
leaq 0x20(%rsp), %rdx
movq %rdx, 0x10(%rsp)
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0xe456
movq 0x60(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
movq 0x8(%r13), %rdx
movq %rdx, (%rsp)
movl %ecx, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x13f3e
movq 0x38(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
movq 0x8(%r13), %rdx
movq %rdx, (%rsp)
movl %ecx, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x13f3e
movq %rbx, %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
xorl $0xe, %ecx
orl %eax, %ecx
jne 0x139f1
movq 0x8(%r13), %rax
movq %rax, (%rsp)
movl 0x8(%rbp), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
movq 0x38(%r15), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
leaq 0x20(%rsp), %rdx
movq %rdx, 0x10(%rsp)
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0xe456
movq 0x58(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
jmp 0x13a3f
cmpl $0xa, %eax
jne 0x13a5b
movq 0x8(%r13), %rax
movq %rax, (%rsp)
movl 0x8(%rbp), %ecx
movl %ecx, 0x8(%rsp)
movl %eax, %eax
movq 0x38(%r15), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
leaq 0x20(%rsp), %rdx
movq %rdx, 0x10(%rsp)
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0xe456
movq 0x50(%rsp), %rdi
movq %rsp, %rsi
callq 0x204be
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x13a5b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6260
addq $0x10, %r12
cmpq %r14, %r12
jne 0x13543
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13ab1
jmp 0x13ad8
jmp 0x13ab1
jmp 0x13ad8
jmp 0x13ab1
jmp 0x13ad8
jmp 0x13ab1
jmp 0x13ad8
jmp 0x13ab1
jmp 0x13ad8
jmp 0x13ab1
jmp 0x13ad8
jmp 0x13ab1
jmp 0x13ad8
jmp 0x13ab1
jmp 0x13ad8
jmp 0x13ab1
jmp 0x13ad8
jmp 0x13ab1
jmp 0x13ad8
jmp 0x13ab1
jmp 0x13ad8
jmp 0x13ab1
jmp 0x13ad8
jmp 0x13ab1
jmp 0x13ad8
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x13adb
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x13adb
jmp 0x13ad8
jmp 0x13ad8
jmp 0x13ad8
movq %rax, %r14
movq %rbx, %rdi
callq 0x1b792
movq %r14, %rdi
callq 0x64a0
nop