// File: /workspace/github_cpp_makefile_star2_O1/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 0xa426
movq %rax, %r12
movq 0x20(%rax), %rax
cmpq 0x28(%r12), %rax
jne 0x2c4a8
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 0xd402
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 0xd978
movq 0x68(%r12), %r14
movq 0x70(%r12), %rax
movq %rax, 0xb8(%rsp)
cmpq %rax, %r14
je 0x2c3d3
leaq 0xc8(%rsp), %rbx
movq %r12, 0x20(%rsp)
movq %r13, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x2881c
movl (%r14), %esi
movq %r13, %rdi
callq 0xa426
movq %r14, 0x50(%rsp)
cmpl $0xc, 0xc(%rax)
je 0x2c447
movl 0x8(%r12), %esi
movq %r13, %r15
movq %r13, %rdi
movl %ebp, %edx
callq 0x14cea
leaq 0x10(%rsp), %rcx
movq %rcx, (%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %rsp, %rdi
callq 0xe480
movq %rbx, %r13
leaq 0x58(%rsp), %rdi
movq %r15, %r14
movq %r15, %rsi
movq 0x20(%rsp), %rbx
movq %rbx, %rdx
movl %ebp, %ecx
callq 0x2c69c
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 0x92d30(%rip), %rdx     # 0xbefaf
leaq 0x58(%rsp), %rcx
callq 0x52708
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x26038
movq %r15, %rdi
movl %ebx, %esi
movl %ebp, %edx
movq %r12, %rcx
callq 0x14ce0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2c2c4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x2c2e9
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x2c30e
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 0x2c367
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 0x14ce0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
movq 0x50(%rsp), %r14
je 0x2c3a4
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x6260
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2c3bf
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
addq $0x4, %r14
incl %ebp
cmpq 0xb8(%rsp), %r14
jne 0x2c1da
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), %r14
je 0x2c40f
addq $0x8, %rdi
movq %r14, %rsi
callq 0x1dcd0
addq $0x6b0, %r13            # imm = 0x6B0
movq 0x48(%rsp), %rsi
addq $0x8, %rsi
movq %rsp, %rdx
movq %r13, (%rdx)
movq %r13, %rdi
callq 0x1fc02
movq %r14, %rdi
callq 0xd5b0
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 0x8bca1(%rip), %rsi     # 0xb8107
leaq 0x8bcd0(%rip), %rdx     # 0xb813d
callq 0x7c64
movb $0x1, %bpl
movq %rsp, %rsi
movq %r14, %rdi
callq 0x6320
leaq 0xd0911(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0xd08e9(%rip), %rsi     # 0xfcd80
movq 0xd1b3a(%rip), %rdx     # 0xfdfd8
movq %r14, %rdi
callq 0x6470
jmp 0x2c50f
movl $0x10, %edi
callq 0x6140
movq %rax, %r14
leaq 0x88(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x8bbf3(%rip), %rsi     # 0xb80bb
leaq 0x8bc37(%rip), %rdx     # 0xb8106
leaq 0x78(%rsp), %rdi
callq 0x7c64
movb $0x1, %bpl
leaq 0x78(%rsp), %rsi
movq %r14, %rdi
callq 0x6320
leaq 0xd08a8(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0xd0880(%rip), %rsi     # 0xfcd80
movq 0xd1ad1(%rip), %rdx     # 0xfdfd8
movq %r14, %rdi
callq 0x6470
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x2c534
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x2c534
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x2c694
movq %r14, %rdi
callq 0x6200
jmp 0x2c694
movq %rax, %rbx
jmp 0x2c68c
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2c578
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x2c578
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x2c684
movq %r14, %rdi
callq 0x6200
jmp 0x2c684
jmp 0x2c681
jmp 0x2c681
movq %rax, %rbx
leaq 0x80(%rsp), %r14
jmp 0x2c664
jmp 0x2c63d
movq %rax, %rbx
jmp 0x2c5fb
movq %rax, %rbx
jmp 0x2c5d6
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2c5d6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x2c5fb
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x2c640
movq 0xd8(%rsp), %rsi
jmp 0x2c633
jmp 0x2c63d
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2c640
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x2c640
movq %rax, %rbx
leaq 0x80(%rsp), %r14
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x2c664
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x6260
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2c68c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x2c68c
movq %rax, %rbx
leaq 0x80(%rsp), %r14
movq %r14, %rdi
callq 0xd5b0
movq %rbx, %rdi
callq 0x64a0