// File: /workspace/github_cpp_makefile_star2_O3/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 0x28622
movq %rsi, %r15
movl 0x8(%r12), %edx
movq 0x38(%rsi), %rax
imulq $0x148, %rdx, %rdx      # imm = 0x148
testb $0xc, 0x60(%rax,%rdx)
je 0x28622
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 0x28622
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1af9a
testb $0x10, 0x48(%rsp)
je 0x28533
leaq 0x10(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x8e5c5(%rip), %rsi     # 0xb6ac6
leaq 0x8e5c7(%rip), %rdx     # 0xb6acf
movq %rsp, %rdi
callq 0x7be0
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0xebc2
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x28533
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
imulq $0xd0, %r13, %rax
addq %rax, %r14
testb $0x40, 0x63(%r14)
je 0x28598
movl 0x64(%r12), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x28994
testb %al, %al
je 0x28598
leaq 0xa4(%r14), %rdx
leaq 0x8e568(%rip), %rsi     # 0xb6ad0
movq %rsp, %rdi
callq 0x5106e
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0xebc2
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28598
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
testb $-0x80, 0x63(%r14)
je 0x28699
movl 0x64(%r12), %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x28994
testb %al, %al
je 0x28699
cmpb $0x0, 0x43c(%r15)
jne 0x287f4
movl 0x438(%r15), %eax
leal -0x8c(%rax), %ecx
cmpl $0x12b, %ecx            # imm = 0x12B
ja 0x28650
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x8e4ec(%rip), %rsi     # 0xb6adc
leaq 0x8e4fc(%rip), %rdx     # 0xb6af3
movq %rsp, %rdi
callq 0x7be0
movq %rsp, %rsi
movq %r15, %rdi
callq 0x26356
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x2865b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x2865b
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x8c27f(%rip), %rdx     # 0xb48af
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x7be0
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x8b, %eax
jbe 0x28856
leaq 0xa8(%r14), %rdx
leaq 0x8e4cd(%rip), %rsi     # 0xb6b36
movq %rsp, %rdi
callq 0x517c4
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0xebc2
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28699
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movl 0x8(%r12), %esi
movq %r15, %rdi
movl $0xa, %edx
callq 0x12974
testb %al, %al
je 0x286f7
testb $0x8, 0x64(%r14)
je 0x286f7
addq $0xb4, %r14
leaq 0x8e4b4(%rip), %rsi     # 0xb6b78
movq %rsp, %rdi
movq %r14, %rdx
callq 0x51850
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0xebc2
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x286f7
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x20(%rsp), %rax
leaq 0x10(%rbx), %rcx
movq %rcx, (%rbx)
cmpq 0x28(%rsp), %rax
je 0x28795
movq %rcx, 0x40(%rsp)
leaq 0x8e328(%rip), %rsi     # 0xb6a42
leaq 0x8e328(%rip), %rdx     # 0xb6a49
movq %rbx, %rdi
callq 0x7be0
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 0x287a9
movq %rsp, %r14
leaq 0x91953(%rip), %r15     # 0xba0ab
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
movq %r14, %rdi
callq 0x60b0
movq 0x28(%rsp), %rax
addq $-0x20, %rax
cmpq %rax, %rbp
je 0x28781
movq %r14, %rdi
movq %r15, %rsi
callq 0x64e0
addq $0x20, %rbp
cmpq %r12, %rbp
jne 0x28758
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
jmp 0x287ae
leaq 0x8c113(%rip), %rdx     # 0xb48af
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x7be0
jmp 0x287db
xorl %edx, %edx
movq %r13, %rsi
movq %rbx, %rdi
callq 0x60b0
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x287cc
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x9261a(%rip), %rsi     # 0xbaded
movq %rbx, %rdi
callq 0x64e0
leaq 0x50(%rsp), %rdi
callq 0xd570
leaq 0x20(%rsp), %rdi
callq 0xda2c
jmp 0x2863b
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x8e332(%rip), %rsi     # 0xb6b43
leaq 0x8e35f(%rip), %rdx     # 0xb6b77
movq %rsp, %rdi
callq 0x7be0
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xd3593(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xd356b(%rip), %rsi     # 0xfbdb0
movq 0xd478c(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x288b6
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x8e281(%rip), %rsi     # 0xb6af4
leaq 0x8e2bb(%rip), %rdx     # 0xb6b35
movq %rsp, %rdi
callq 0x7be0
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xd3531(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xd3509(%rip), %rsi     # 0xfbdb0
movq 0xd472a(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x288cd
jmp 0x288f0
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r13, %rdi
jne 0x28928
jmp 0x28977
jmp 0x2893f
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x288e6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x288f3
jmp 0x28977
movq %rax, %r14
movq %rbx, %rdi
callq 0x6200
jmp 0x28977
jmp 0x28905
jmp 0x28905
jmp 0x2893f
jmp 0x2893f
movq %rax, %r14
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x28928
jmp 0x28977
jmp 0x2893f
jmp 0x2893f
movq %rax, %r14
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x28977
movq 0x10(%rsp), %rsi
jmp 0x2896f
jmp 0x2893f
movq %rax, %r14
jmp 0x2895d
jmp 0x28944
jmp 0x2893f
movq %rax, %r14
jmp 0x28981
movq %rax, %r14
jmp 0x28977
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x2895d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movq (%rbx), %rdi
cmpq 0x40(%rsp), %rdi
je 0x28977
movq 0x40(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x6260
leaq 0x50(%rsp), %rdi
callq 0xd570
leaq 0x20(%rsp), %rdi
callq 0xda2c
movq %r14, %rdi
callq 0x64a0
nop