// File: /workspace/github_cpp_makefile_star2_O1/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::layout_for_member[abi:cxx11](spirv_cross::SPIRType const&, unsigned int)
string CompilerGLSL::layout_for_member(const SPIRType &type, uint32_t index)
{
	if (is_legacy())
		return "";

	bool is_block = ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock) ||
	                ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock);
	if (!is_block)
		return "";

	auto &memb = ir.meta[type.self].members;
	if (index >= memb.size())
		return "";
	auto &dec = memb[index];

	vector<string> attr;

	// We can only apply layouts on members in block interfaces.
	// This is a bit problematic because in SPIR-V decorations are applied on the struct types directly.
	// This is not supported on GLSL, so we have to make the assumption that if a struct within our buffer block struct
	// has a decoration, it was originally caused by a top-level layout() qualifier in GLSL.
	//
	// We would like to go from (SPIR-V style):
	//
	// struct Foo { layout(row_major) mat4 matrix; };
	// buffer UBO { Foo foo; };
	//
	// to
	//
	// struct Foo { mat4 matrix; }; // GLSL doesn't support any layout shenanigans in raw struct declarations.
	// buffer UBO { layout(row_major) Foo foo; }; // Apply the layout on top-level.
	auto flags = combined_decoration_for_member(type, index);

	if (flags.get(DecorationRowMajor))
		attr.push_back("row_major");
	// We don't emit any global layouts, so column_major is default.
	//if (flags & (1ull << DecorationColMajor))
	//    attr.push_back("column_major");

	if (dec.decoration_flags.get(DecorationLocation) && can_use_io_location(type.storage, true))
		attr.push_back(join("location = ", dec.location));

	// Can only declare component if we can declare location.
	if (dec.decoration_flags.get(DecorationComponent) && can_use_io_location(type.storage, true))
	{
		if (!options.es)
		{
			if (options.version < 440 && options.version >= 140)
				require_extension_internal("GL_ARB_enhanced_layouts");
			else if (options.version < 140)
				SPIRV_CROSS_THROW("Component decoration is not supported in targets below GLSL 1.40.");
			attr.push_back(join("component = ", dec.component));
		}
		else
			SPIRV_CROSS_THROW("Component decoration is not supported in ES targets.");
	}

	// DecorationCPacked is set by layout_for_variable earlier to mark that we need to emit offset qualifiers.
	// This is only done selectively in GLSL as needed.
	if (has_decoration(type.self, DecorationCPacked) && dec.decoration_flags.get(DecorationOffset))
		attr.push_back(join("offset = ", dec.offset));

	if (attr.empty())
		return "";

	string res = "layout(";
	res += merge(attr);
	res += ") ";
	return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r12
movq %rdi, %rbx
cmpb $0x0, 0x43c(%rsi)
movl $0x12b, %eax            # imm = 0x12B
movl $0x81, %edx
cmovnel %eax, %edx
cmpl %edx, 0x438(%rsi)
jbe 0x28c46
movq %rsi, %r15
movl 0x8(%r12), %edx
movq 0x38(%rsi), %rax
imulq $0x148, %rdx, %rdx      # imm = 0x148
testb $0xc, 0x60(%rax,%rdx)
je 0x28c46
addq %rdx, %rax
movl %ecx, %r13d
movq 0xd0(%rax), %r14
movq 0xd8(%rax), %rax
subq %r14, %rax
sarq $0x4, %rax
movabsq $0x4ec4ec4ec4ec4ec5, %rdx # imm = 0x4EC4EC4EC4EC4EC5
imulq %rax, %rdx
cmpq %r13, %rdx
jbe 0x28c46
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1b67c
testb $0x10, 0x48(%rsp)
je 0x28b57
leaq 0x10(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x8efb1(%rip), %rsi     # 0xb7ad6
leaq 0x8efb3(%rip), %rdx     # 0xb7adf
movq %rsp, %rdi
callq 0x7c64
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0xebe6
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x28b57
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
imulq $0xd0, %r13, %rax
addq %rax, %r14
testb $0x40, 0x63(%r14)
je 0x28bbc
movl 0x64(%r12), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x28fb4
testb %al, %al
je 0x28bbc
leaq 0xa4(%r14), %rdx
leaq 0x8ef54(%rip), %rsi     # 0xb7ae0
movq %rsp, %rdi
callq 0x51866
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0xebe6
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28bbc
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
testb $-0x80, 0x63(%r14)
je 0x28cbd
movl 0x64(%r12), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x28fb4
testb %al, %al
je 0x28cbd
cmpb $0x0, 0x43c(%r15)
jne 0x28e11
movl 0x438(%r15), %eax
leal -0x8c(%rax), %ecx
cmpl $0x12b, %ecx            # imm = 0x12B
ja 0x28c74
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x8eed8(%rip), %rsi     # 0xb7aec
leaq 0x8eee8(%rip), %rdx     # 0xb7b03
movq %rsp, %rdi
callq 0x7c64
movq %rsp, %rsi
movq %r15, %rdi
callq 0x26a0a
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x28c7f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x28c7f
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x8cc5b(%rip), %rdx     # 0xb58af
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x7c64
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x8b, %eax
jbe 0x28e73
leaq 0xa8(%r14), %rdx
leaq 0x8eeb9(%rip), %rsi     # 0xb7b46
movq %rsp, %rdi
callq 0x51fbc
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0xebe6
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28cbd
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movl 0x8(%r12), %esi
movq %r15, %rdi
movl $0xa, %edx
callq 0x1299a
testb %al, %al
je 0x28d1b
testb $0x8, 0x64(%r14)
je 0x28d1b
addq $0xb4, %r14
leaq 0x8eea0(%rip), %rsi     # 0xb7b88
movq %rsp, %rdi
movq %r14, %rdx
callq 0x52048
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0xebe6
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28d1b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x20(%rsp), %rax
leaq 0x10(%rbx), %rcx
movq %rcx, (%rbx)
cmpq 0x28(%rsp), %rax
je 0x28de6
movq %rcx, 0x40(%rsp)
leaq 0x8ed14(%rip), %rsi     # 0xb7a52
leaq 0x8ed14(%rip), %rdx     # 0xb7a59
movq %rbx, %rdi
callq 0x7c64
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
movq 0x20(%rsp), %rbp
movq 0x28(%rsp), %r12
cmpq %r12, %rbp
je 0x28dae
movq %rsp, %r14
leaq 0x9233f(%rip), %r15     # 0xbb0bb
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
movq %r14, %rdi
callq 0x60b0
movq 0x28(%rsp), %rax
addq $-0x20, %rax
cmpq %rax, %rbp
je 0x28da5
movq %r14, %rdi
movq %r15, %rsi
callq 0x64e0
addq $0x20, %rbp
cmpq %r12, %rbp
jne 0x28d7c
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x60b0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x28dd5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x93021(%rip), %rsi     # 0xbbdfd
movq %rbx, %rdi
callq 0x64e0
jmp 0x28df8
leaq 0x8cac2(%rip), %rdx     # 0xb58af
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x7c64
leaq 0x50(%rsp), %rdi
callq 0xd5b0
leaq 0x20(%rsp), %rdi
callq 0xda64
jmp 0x28c5f
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x8ed25(%rip), %rsi     # 0xb7b53
leaq 0x8ed52(%rip), %rdx     # 0xb7b87
movq %rsp, %rdi
callq 0x7c64
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xd3f46(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xd3f1e(%rip), %rsi     # 0xfcd80
movq 0xd516f(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x28ed3
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x8ec74(%rip), %rsi     # 0xb7b04
leaq 0x8ecae(%rip), %rdx     # 0xb7b45
movq %rsp, %rdi
callq 0x7c64
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xd3ee4(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xd3ebc(%rip), %rsi     # 0xfcd80
movq 0xd510d(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x28eea
jmp 0x28f05
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r13, %rdi
jne 0x28f49
jmp 0x28f98
jmp 0x28f60
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x28f0b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x28f0b
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x28f98
movq %rbx, %rdi
callq 0x6200
jmp 0x28f98
jmp 0x28f26
jmp 0x28f26
jmp 0x28f60
jmp 0x28f60
movq %rax, %r14
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x28f49
jmp 0x28f98
jmp 0x28f60
jmp 0x28f60
movq %rax, %r14
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x28f98
movq 0x10(%rsp), %rsi
jmp 0x28f90
jmp 0x28f60
movq %rax, %r14
jmp 0x28f7e
jmp 0x28f65
jmp 0x28f60
movq %rax, %r14
jmp 0x28fa2
movq %rax, %r14
jmp 0x28f98
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x28f7e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movq (%rbx), %rdi
cmpq 0x40(%rsp), %rdi
je 0x28f98
movq 0x40(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x6260
leaq 0x50(%rsp), %rdi
callq 0xd5b0
leaq 0x20(%rsp), %rdi
callq 0xda64
movq %r14, %rdi
callq 0x64a0