// File: /workspace/github_cpp_makefile_star2_O1/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 0x905b
cmpl $0x1, 0x8(%r14)
jne 0x9055
movq %r14, %rdi
callq 0xb08e
cmpl $0xc, 0xc(%rax)
jne 0x9055
movq 0x20(%rax), %rcx
cmpq 0x28(%rax), %rcx
jne 0x9055
cmpb $0x0, 0x60(%rax)
jne 0x9055
movl 0x8(%rax), %ecx
movq 0x38(%rbx), %rdx
imulq $0x148, %rcx, %rcx      # imm = 0x148
testb $0xc, 0x60(%rdx,%rcx)
jne 0x9055
movq %rbx, %rdi
movq %rax, %rsi
callq 0x285ee
addq $0x10, %r14
jmp 0x900b
leaq 0x7c0(%rbx), %r14
leaq 0xac2f1(%rip), %rsi     # 0xb535a
movq %rbx, %rdi
movq %r14, %rdx
callq 0xb1b6
movq %rbx, %rdi
callq 0x28804
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %rbp
cmpq %rbp, %r15
je 0x90fc
cmpl $0x2, 0x8(%r15)
jne 0x90ae
movq %r15, %rdi
callq 0xb2e2
movq %rax, %r12
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0xa426
cmpl $0x7, 0x10(%r12)
jne 0x90b4
addq $0x10, %r15
jmp 0x9084
movq %rax, %r13
cmpb $0x1, 0x60(%rax)
jne 0x90ae
cmpl $0x2, 0x64(%r13)
jne 0x90ae
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x1324c
testb %al, %al
jne 0x90ae
movl 0x8(%r13), %eax
movq 0x38(%rbx), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
testb $0xc, 0x60(%rcx,%rax)
je 0x90ae
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0xe8(%rax)
jmp 0x90ae
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %rbp
cmpq %rbp, %r15
je 0x9165
cmpl $0x2, 0x8(%r15)
jne 0x915f
movq %r15, %rdi
callq 0xb2e2
movq %rax, %r12
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0xa426
movq %rax, %r13
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x1324c
testb %al, %al
jne 0x915f
cmpl $0x7, 0x10(%r12)
je 0x915f
cmpb $0x1, 0x60(%r13)
jne 0x915f
cmpl $0x9, 0x64(%r13)
jne 0x915f
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0xf0(%rax)
addq $0x10, %r15
jmp 0x9104
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %rbp
cmpq %rbp, %r15
je 0x91e1
cmpl $0x2, 0x8(%r15)
jne 0x91db
movq %r15, %rdi
callq 0xb2e2
movq %rax, %r12
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0xa426
cmpl $0x7, 0x10(%r12)
je 0x91db
movq %rax, %r13
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x1324c
testb %al, %al
jne 0x91db
cmpb $0x1, 0x60(%r13)
jne 0x91db
movl 0x10(%r12), %eax
orl $0x2, %eax
cmpl $0x3, %eax
jne 0x91db
movl 0x8(%r12), %esi
movq %rbx, %rdi
callq 0x13f62
testb %al, %al
je 0x91db
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8534
addq $0x10, %r15
jmp 0x916d
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %rbp
cmpq %rbp, %r15
je 0x9250
cmpl $0x2, 0x8(%r15)
jne 0x924a
movq %r15, %rdi
callq 0xb2e2
movq %rax, %r12
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0xa426
cmpl $0x7, 0x10(%r12)
je 0x924a
movq %rax, %r13
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x1324c
testb %al, %al
jne 0x924a
cmpb $0x1, 0x60(%r13)
jne 0x924a
movl 0x64(%r13), %eax
cmpl $0xa, %eax
je 0x923b
testl %eax, %eax
jne 0x924a
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0xf8(%rax)
addq $0x10, %r15
jmp 0x91e9
movq 0x118(%rbx), %r15
movq 0x120(%rbx), %r12
cmpq %r12, %r15
je 0x92a2
xorl %ebp, %ebp
movl (%r15), %esi
movq %rbx, %rdi
callq 0xb40a
cmpl $0x4, 0x10(%rax)
jne 0x9284
movq %rbx, %rdi
movq %rax, %rsi
callq 0x889e
movb $0x1, %bpl
addq $0x4, %r15
cmpq %r12, %r15
jne 0x9265
testb $0x1, %bpl
je 0x92a2
leaq 0xac615(%rip), %rsi     # 0xb58af
movq %rbx, %rdi
callq 0xa700
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x180(%rax)
leaq 0xac0b9(%rip), %rsi     # 0xb536e
movq %rbx, %rdi
callq 0xb43e
movq %rbx, %rdi
callq 0x28804
leaq 0xac0ca(%rip), %rdx     # 0xb5396
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb544
leaq 0x788(%rbx), %r14
movq 0x788(%rbx), %r15
movq 0x790(%rbx), %r12
movq %rbx, %rdi
cmpq %r12, %r15
je 0x9302
movq %r15, %rsi
callq 0xb674
addq $0x20, %r15
jmp 0x92ec
callq 0x4358a
movq 0x788(%rbx), %rsi
movq %r14, %rdi
callq 0x10120
movq %rbx, %rdi
callq 0x2889c
leaq 0xac58a(%rip), %rsi     # 0xb58af
movq %rbx, %rdi
callq 0xa700
leaq 0xac06d(%rip), %rsi     # 0xb53a1
movq %rbx, %rdi
callq 0xb770
movq %rbx, %rdi
callq 0x16254
cmpl $0x5, 0xb8(%rax)
jne 0x935c
leaq 0xac05f(%rip), %rsi     # 0xb53b3
movq %rbx, %rdi
callq 0xb876
leaq 0xac54c(%rip), %rsi     # 0xb58af
movq %rbx, %rdi
callq 0xa700
movq 0x118(%rbx), %r12
movq 0x120(%rbx), %rbp
cmpq %rbp, %r12
je 0x93f8
xorl %r13d, %r13d
leaq 0x8(%rsp), %r14
leaq 0xb675c(%rip), %r15     # 0xbfae9
movl (%r12), %esi
movq %rbx, %rdi
callq 0xb40a
cmpl $0x6, 0x10(%rax)
jne 0x93da
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2ce16
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xaa50
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x93d7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movb $0x1, %r13b
addq $0x4, %r12
cmpq %rbp, %r12
jne 0x938d
testb $0x1, %r13b
je 0x93f8
leaq 0xac4bf(%rip), %rsi     # 0xb58af
movq %rbx, %rdi
callq 0xa700
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 0x9426
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0