// File: /workspace/github_cpp_makefile_star2_O3/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::emit_flattened_io_block(spirv_cross::SPIRVariable const&, char const*)
void CompilerGLSL::emit_flattened_io_block(const SPIRVariable &var, const char *qual)
{
	auto &type = get<SPIRType>(var.basetype);
	if (!type.array.empty())
		SPIRV_CROSS_THROW("Array of varying structs cannot be flattened to legacy-compatible varyings.");

	auto old_flags = ir.meta[type.self].decoration.decoration_flags;
	// Emit the members as if they are part of a block to get all qualifiers.
	ir.meta[type.self].decoration.decoration_flags.set(DecorationBlock);

	type.member_name_cache.clear();

	uint32_t i = 0;
	for (auto &member : type.member_types)
	{
		add_member_name(type, i);
		auto &membertype = get<SPIRType>(member);

		if (membertype.basetype == SPIRType::Struct)
			SPIRV_CROSS_THROW("Cannot flatten struct inside structs in I/O variables.");

		// Pass in the varying qualifier here so it will appear in the correct declaration order.
		// Replace member name while emitting it so it encodes both struct name and member name.
		// Sanitize underscores because joining the two identifiers might create more than 1 underscore in a row,
		// which is not allowed.
		auto backup_name = get_member_name(type.self, i);
		auto member_name = to_member_name(type, i);
		set_member_name(type.self, i, sanitize_underscores(join(to_name(var.self), "_", member_name)));
		emit_struct_member(type, member, i, qual);
		// Restore member name.
		set_member_name(type.self, i, member_name);
		i++;
	}

	ir.meta[type.self].decoration.decoration_flags = old_flags;

	// Treat this variable as flattened from now on.
	flattened_structs.insert(var.self);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdx, 0xc0(%rsp)
movq %rdi, %r13
movq %rsi, 0x48(%rsp)
movl 0xc(%rsi), %esi
callq 0xa3ea
movq %rax, %r12
movq 0x20(%rax), %rax
cmpq 0x28(%r12), %rax
jne 0x2be8c
movl 0x8(%r12), %eax
movq 0x38(%r13), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
leaq (%rcx,%rax), %rsi
addq $0x68, %rsi
movq -0x8(%rsi), %rax
leaq 0x80(%rsp), %rdi
movq %rax, -0x8(%rdi)
xorl %ebp, %ebp
movq %rbp, (%rdi)
movq 0x8(%rsi), %rax
movq %rax, 0x8(%rdi)
movq %rbp, 0x10(%rdi)
movq 0x18(%rsi), %rax
movq %rax, 0x18(%rdi)
movups 0x20(%rsi), %xmm0
movups %xmm0, 0x20(%rdi)
movq %rbp, 0x30(%rdi)
movq %rsp, %rdx
movq %rdi, (%rdx)
callq 0xd3c2
movl 0x8(%r12), %eax
movq 0x38(%r13), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
orq $0x4, 0x60(%rcx,%rax)
movq %r12, %rdi
addq $0xa0, %rdi
callq 0xd940
movq 0x68(%r12), %r14
movq 0x70(%r12), %rax
movq %rax, 0xb8(%rsp)
cmpq %rax, %r14
je 0x2bdb7
leaq 0xc8(%rsp), %rbx
movq %r12, 0x20(%rsp)
movq %r13, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x281f0
movl (%r14), %esi
movq %r13, %rdi
callq 0xa3ea
movq %r14, 0x50(%rsp)
cmpl $0xc, 0xc(%rax)
je 0x2be2b
movl 0x8(%r12), %esi
movq %r13, %r15
movq %r13, %rdi
movl %ebp, %edx
callq 0x14b5c
leaq 0x10(%rsp), %rcx
movq %rcx, (%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %rsp, %rdi
callq 0xe456
movq %rbx, %r13
leaq 0x58(%rsp), %rdi
movq %r15, %r14
movq %r15, %rsi
movq 0x20(%rsp), %rbx
movq %rbx, %rdx
movl %ebp, %ecx
callq 0x2c088
movl 0x8(%rbx), %ebx
movq 0x48(%rsp), %rax
movl 0x8(%rax), %edx
movq (%r14), %rax
movq %r13, %r12
movq %r13, %rdi
movq %r14, %rsi
movl $0x1, %ecx
callq *0x38(%rax)
leaq 0xe8(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
leaq 0x92354(%rip), %rdx     # 0xbdfb7
leaq 0x58(%rsp), %rcx
callq 0x51f10
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x25974
movq %r15, %rdi
movl %ebx, %esi
movl %ebp, %edx
movq %r12, %rcx
callq 0x14b52
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2bca8
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x2bccd
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x2bcf2
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x50(%rsp), %rax
movl (%rax), %ebx
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq 0xc0(%rsp), %rsi
movq %r14, %rdx
callq 0x6100
movq %r15, %rdi
movq (%r15), %rax
movq 0x20(%rsp), %rsi
movl %ebx, %edx
movl %ebp, %ecx
movq %r12, %r8
xorl %r9d, %r9d
callq *0xa8(%rax)
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
movq %r13, %rbx
je 0x2bd4b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x20(%rsp), %r12
movl 0x8(%r12), %esi
movq %r15, %r13
movq %r15, %rdi
movl %ebp, %edx
leaq 0x58(%rsp), %rcx
callq 0x14b52
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
movq 0x50(%rsp), %r14
je 0x2bd88
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x6260
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2bda3
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
addq $0x4, %r14
incl %ebp
cmpq 0xb8(%rsp), %r14
jne 0x2bbbe
movl 0x8(%r12), %eax
movq 0x38(%r13), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
leaq (%rcx,%rax), %rdi
addq $0x60, %rdi
leaq 0x78(%rsp), %rax
movq (%rax), %rcx
movq %rcx, (%rdi)
cmpq %rdi, %rax
leaq 0x80(%rsp), %r12
je 0x2bdf3
addq $0x8, %rdi
movq %r12, %rsi
callq 0x1d5b4
addq $0x6b0, %r13            # imm = 0x6B0
movq 0x48(%rsp), %rsi
addq $0x8, %rsi
movq %rsp, %rdx
movq %r13, (%rdx)
movq %r13, %rdi
callq 0x1f510
movq %r12, %rdi
callq 0xd570
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x6140
movq %rax, %r14
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x8b2ad(%rip), %rsi     # 0xb70f7
leaq 0x8b2dc(%rip), %rdx     # 0xb712d
callq 0x7be0
movb $0x1, %bpl
movq %rsp, %rsi
movq %r14, %rdi
callq 0x6320
leaq 0xcff5d(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0xcff35(%rip), %rsi     # 0xfbdb0
movq 0xd1156(%rip), %rdx     # 0xfcfd8
movq %r14, %rdi
callq 0x6470
jmp 0x2bef3
movl $0x10, %edi
callq 0x6140
movq %rax, %r14
leaq 0x88(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x8b1ff(%rip), %rsi     # 0xb70ab
leaq 0x8b243(%rip), %rdx     # 0xb70f6
leaq 0x78(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x78(%rsp), %rsi
movq %r14, %rdi
callq 0x6320
leaq 0xcfef4(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0xcfecc(%rip), %rsi     # 0xfbdb0
movq 0xd10ed(%rip), %rdx     # 0xfcfd8
movq %r14, %rdi
callq 0x6470
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x2bf10
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x2bf1d
jmp 0x2c080
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0x2c080
movq %rax, %rbx
jmp 0x2c078
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2bf50
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
leaq 0x80(%rsp), %r12
jne 0x2bf6d
jmp 0x2c078
movq %rax, %rbx
leaq 0x80(%rsp), %r12
movq %r14, %rdi
callq 0x6200
jmp 0x2c078
jmp 0x2c06d
jmp 0x2c06d
movq %rax, %rbx
leaq 0x80(%rsp), %r12
jmp 0x2c050
jmp 0x2c029
movq %rax, %rbx
jmp 0x2bfe7
movq %rax, %rbx
jmp 0x2bfc2
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2bfc2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x2bfe7
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x2c02c
movq 0xd8(%rsp), %rsi
jmp 0x2c01f
jmp 0x2c029
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2c02c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x2c02c
movq %rax, %rbx
leaq 0x80(%rsp), %r12
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2c050
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x6260
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2c078
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x2c078
movq %rax, %rbx
leaq 0x80(%rsp), %r12
movq %r12, %rdi
callq 0xd570
movq %rbx, %rdi
callq 0x64a0