// File: /workspace/github_cpp_makefile_star2_O3/rossy[P]crossc/SPIRV-Cross/spirv_cpp.cpp
// Function: spirv_cross::CompilerCPP::emit_resources()
void CompilerCPP::emit_resources()
{
	// 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);
			}
		}
	}

	statement("struct Resources : ", resource_type);
	begin_scope();

	// 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);

			if (var.storage != StorageClassFunction && type.pointer && type.storage == StorageClassUniform &&
			    !is_hidden_variable(var) &&
			    (ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock) ||
			     ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock)))
			{
				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 (!is_hidden_variable(var) && var.storage != StorageClassFunction && type.pointer &&
			    type.storage == StorageClassPushConstant)
			{
				emit_push_constant_block(var);
			}
		}
	}

	// 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 && !is_hidden_variable(var) && type.pointer &&
			    (var.storage == StorageClassInput || var.storage == StorageClassOutput) &&
			    interface_variable_exists_in_entry_point(var.self))
			{
				emit_interface_block(var);
			}
		}
	}

	// 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 (var.storage != StorageClassFunction && !is_hidden_variable(var) && type.pointer &&
			    (type.storage == StorageClassUniformConstant || type.storage == StorageClassAtomicCounter))
			{
				emit_uniform(var);
			}
		}
	}

	// Global variables.
	bool emitted = false;
	for (auto global : global_variables)
	{
		auto &var = get<SPIRVariable>(global);
		if (var.storage == StorageClassWorkgroup)
		{
			emit_shared(var);
			emitted = true;
		}
	}

	if (emitted)
		statement("");

	declare_undefined_values();

	statement("inline void init(spirv_cross_shader& s)");
	begin_scope();
	statement(resource_type, "::init(s);");
	for (auto &reg : resource_registrations)
		statement(reg);
	end_scope();
	resource_registrations.clear();

	end_scope_decl();

	statement("");
	statement("Resources* __res;");
	if (get_entry_point().model == ExecutionModelGLCompute)
		statement("ComputePrivateResources __priv_res;");
	statement("");

	// Emit regular globals which are allocated per invocation.
	emitted = false;
	for (auto global : global_variables)
	{
		auto &var = get<SPIRVariable>(global);
		if (var.storage == StorageClassPrivate)
		{
			if (var.storage == StorageClassWorkgroup)
				emit_shared(var);
			else
				statement(CompilerGLSL::variable_decl(var), ";");
			emitted = true;
		}
	}

	if (emitted)
		statement("");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x20(%rdi), %r14
movq 0x28(%rdi), %r15
cmpq %r15, %r14
je 0x8fdd
cmpl $0x1, 0x8(%r14)
jne 0x8fd7
movq %r14, %rdi
callq 0xb052
cmpl $0xc, 0xc(%rax)
jne 0x8fd7
movq 0x20(%rax), %rcx
cmpq 0x28(%rax), %rcx
jne 0x8fd7
cmpb $0x0, 0x60(%rax)
jne 0x8fd7
movl 0x8(%rax), %ecx
movq 0x38(%rbx), %rdx
imulq $0x148, %rcx, %rcx      # imm = 0x148
testb $0xc, 0x60(%rdx,%rcx)
jne 0x8fd7
movq %rbx, %rdi
movq %rax, %rsi
callq 0x27fa4
addq $0x10, %r14
jmp 0x8f8d
leaq 0x7c0(%rbx), %r14
leaq 0xab36f(%rip), %rsi     # 0xb435a
movq %rbx, %rdi
movq %r14, %rdx
callq 0xb178
movq %rbx, %rdi
callq 0x281d8
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %rbp
cmpq %rbp, %r15
je 0x91e5
cmpl $0x2, 0x8(%r15)
jne 0x9034
movq %r15, %rdi
callq 0xb2a4
movq %rax, %r12
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0xa3ea
cmpl $0x7, 0x10(%r12)
jne 0x903f
addq $0x10, %r15
cmpq %rbp, %r15
jne 0x900f
jmp 0x9087
movq %rax, %r13
cmpb $0x1, 0x60(%rax)
jne 0x9034
cmpl $0x2, 0x64(%r13)
jne 0x9034
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x13202
testb %al, %al
jne 0x9034
movl 0x8(%r13), %eax
movq 0x38(%rbx), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
testb $0xc, 0x60(%rcx,%rax)
je 0x9034
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0xe8(%rax)
jmp 0x9034
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %rbp
cmpq %rbp, %r15
je 0x90fb
cmpl $0x2, 0x8(%r15)
jne 0x90ea
movq %r15, %rdi
callq 0xb2a4
movq %rax, %r12
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0xa3ea
movq %rax, %r13
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x13202
testb %al, %al
jne 0x90ea
cmpl $0x7, 0x10(%r12)
je 0x90ea
cmpb $0x1, 0x60(%r13)
jne 0x90ea
cmpl $0x9, 0x64(%r13)
jne 0x90ea
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0xf0(%rax)
addq $0x10, %r15
cmpq %rbp, %r15
jne 0x9094
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %rbp
cmpq %rbp, %r15
je 0x91e0
cmpl $0x2, 0x8(%r15)
jne 0x916d
movq %r15, %rdi
callq 0xb2a4
movq %rax, %r12
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0xa3ea
cmpl $0x7, 0x10(%r12)
je 0x916d
movq %rax, %r13
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x13202
testb %al, %al
jne 0x916d
cmpb $0x1, 0x60(%r13)
jne 0x916d
movl 0x10(%r12), %eax
orl $0x2, %eax
cmpl $0x3, %eax
jne 0x916d
movl 0x8(%r12), %esi
movq %rbx, %rdi
callq 0x13e3a
testb %al, %al
je 0x916d
movq %rbx, %rdi
movq %r12, %rsi
callq 0x84b8
addq $0x10, %r15
cmpq %rbp, %r15
jne 0x9104
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %rbp
jmp 0x91e0
cmpl $0x2, 0x8(%r15)
jne 0x91dc
movq %r15, %rdi
callq 0xb2a4
movq %rax, %r12
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0xa3ea
cmpl $0x7, 0x10(%r12)
je 0x91dc
movq %rax, %r13
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x13202
testb %al, %al
jne 0x91dc
cmpb $0x1, 0x60(%r13)
jne 0x91dc
movl 0x64(%r13), %eax
cmpl $0xa, %eax
je 0x91cd
testl %eax, %eax
jne 0x91dc
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0xf8(%rax)
addq $0x10, %r15
cmpq %rbp, %r15
jne 0x9180
movq 0x118(%rbx), %r15
movq 0x120(%rbx), %r12
cmpq %r12, %r15
je 0x9244
xorl %ebp, %ebp
movl (%r15), %esi
movq %rbx, %rdi
callq 0xb3ca
cmpl $0x4, 0x10(%rax)
je 0x9216
addq $0x4, %r15
cmpq %r12, %r15
jne 0x91fa
jmp 0x922f
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8822
addq $0x4, %r15
movb $0x1, %bpl
cmpq %r12, %r15
jne 0x91fa
jmp 0x9235
testb $0x1, %bpl
je 0x9244
leaq 0xab673(%rip), %rsi     # 0xb48af
movq %rbx, %rdi
callq 0xa6c4
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x180(%rax)
leaq 0xab117(%rip), %rsi     # 0xb436e
movq %rbx, %rdi
callq 0xb3fe
movq %rbx, %rdi
callq 0x281d8
leaq 0xab128(%rip), %rdx     # 0xb4396
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb504
leaq 0x788(%rbx), %r14
movq 0x788(%rbx), %r15
movq 0x790(%rbx), %r12
movq %rbx, %rdi
cmpq %r12, %r15
je 0x92a4
movq %r15, %rsi
callq 0xb634
addq $0x20, %r15
jmp 0x928e
callq 0x42d5a
movq 0x788(%rbx), %rsi
movq %r14, %rdi
callq 0x100fc
movq %rbx, %rdi
callq 0x28270
leaq 0xab5e8(%rip), %rsi     # 0xb48af
movq %rbx, %rdi
callq 0xa6c4
leaq 0xab0cb(%rip), %rsi     # 0xb43a1
movq %rbx, %rdi
callq 0xb730
movq %rbx, %rdi
callq 0x15f76
cmpl $0x5, 0xb8(%rax)
jne 0x92fe
leaq 0xab0bd(%rip), %rsi     # 0xb43b3
movq %rbx, %rdi
callq 0xb836
leaq 0xab5aa(%rip), %rsi     # 0xb48af
movq %rbx, %rdi
callq 0xa6c4
movq 0x118(%rbx), %r12
movq 0x120(%rbx), %rbp
cmpq %rbp, %r12
je 0x93ab
xorl %r13d, %r13d
leaq 0x8(%rsp), %r14
leaq 0xb57be(%rip), %r15     # 0xbeaf1
movl (%r12), %esi
movq %rbx, %rdi
callq 0xb3ca
cmpl $0x6, 0x10(%rax)
je 0x9350
addq $0x4, %r12
cmpq %rbp, %r12
jne 0x9333
jmp 0x9396
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2c7ac
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xaa14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9388
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
addq $0x4, %r12
movb $0x1, %r13b
cmpq %rbp, %r12
jne 0x9333
jmp 0x939c
testb $0x1, %r13b
je 0x93ab
leaq 0xab50c(%rip), %rsi     # 0xb48af
movq %rbx, %rdi
callq 0xa6c4
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x93d9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0
nop