// File: /workspace/github_cpp_makefile_star2_O3/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::emit_interface_block_in_struct(spirv_cross::SPIRVariable const&, std::unordered_set<unsigned int, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<unsigned int>>&)
void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, unordered_set<uint32_t> &active_locations)
{
	auto &execution = get_entry_point();
	auto type = get<SPIRType>(var.basetype);

	string binding;
	bool use_location_number = true;
	bool legacy = hlsl_options.shader_model <= 30;
	if (execution.model == ExecutionModelFragment && var.storage == StorageClassOutput)
	{
		binding = join(legacy ? "COLOR" : "SV_Target", get_decoration(var.self, DecorationLocation));
		use_location_number = false;
		if (legacy) // COLOR must be a four-component vector on legacy shader model targets (HLSL ERR_COLOR_4COMP)
			type.vecsize = 4;
	}

	const auto get_vacant_location = [&]() -> uint32_t {
		for (uint32_t i = 0; i < 64; i++)
			if (!active_locations.count(i))
				return i;
		SPIRV_CROSS_THROW("All locations from 0 to 63 are exhausted.");
	};

	bool need_matrix_unroll = var.storage == StorageClassInput && execution.model == ExecutionModelVertex;

	auto &m = ir.meta[var.self].decoration;
	auto name = to_name(var.self);
	if (use_location_number)
	{
		uint32_t location_number;

		// If an explicit location exists, use it with TEXCOORD[N] semantic.
		// Otherwise, pick a vacant location.
		if (m.decoration_flags.get(DecorationLocation))
			location_number = m.location;
		else
			location_number = get_vacant_location();

		// Allow semantic remap if specified.
		auto semantic = to_semantic(location_number);

		if (need_matrix_unroll && type.columns > 1)
		{
			if (!type.array.empty())
				SPIRV_CROSS_THROW("Arrays of matrices used as input/output. This is not supported.");

			// Unroll matrices.
			for (uint32_t i = 0; i < type.columns; i++)
			{
				SPIRType newtype = type;
				newtype.columns = 1;
				statement(to_interpolation_qualifiers(get_decoration_bitset(var.self)),
				          variable_decl(newtype, join(name, "_", i)), " : ", semantic, "_", i, ";");
				active_locations.insert(location_number++);
			}
		}
		else
		{
			statement(to_interpolation_qualifiers(get_decoration_bitset(var.self)), variable_decl(type, name), " : ",
			          semantic, ";");

			// Structs and arrays should consume more locations.
			uint32_t consumed_locations = type_to_consumed_locations(type);
			for (uint32_t i = 0; i < consumed_locations; i++)
				active_locations.insert(location_number + i);
		}
	}
	else
		statement(variable_decl(type, name), " : ", binding, ";");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
callq 0x15f76
movq %rax, %r15
movl 0xc(%r12), %esi
movq %r14, %rdi
callq 0xa3ea
leaq 0x1b0(%rsp), %rdi
movq %rax, %rsi
callq 0x1eafa
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl 0xb8(%r15), %eax
xorl $0x4, %eax
movl 0x10(%r12), %ecx
xorl $0x3, %ecx
orl %eax, %ecx
setne %bpl
movq %r12, 0x28(%rsp)
jne 0x64674
movl 0x788(%r14), %r13d
cmpl $0x1f, %r13d
leaq 0x5747f(%rip), %rax     # 0xbba69
leaq 0x5747e(%rip), %rcx     # 0xbba6f
cmovbq %rax, %rcx
movq %rcx, 0x30(%rsp)
movl 0x8(%r12), %esi
movq %r14, %rdi
movl $0x1e, %edx
callq 0x14e6e
leaq 0x98(%rsp), %rdx
movl %eax, (%rdx)
leaq 0xb8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x7589d
leaq 0x50(%rsp), %rdi
leaq 0xb8(%rsp), %r12
movq %r12, %rsi
callq 0x6310
movq (%r12), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x6465e
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x6260
cmpl $0x1e, %r13d
movq 0x28(%rsp), %r12
ja 0x64674
movl $0x4, 0x1c4(%rsp)
movl 0x8(%r12), %edx
movl 0x10(%r12), %eax
xorl $0x1, %eax
orl 0xb8(%r15), %eax
sete %r12b
imulq $0x148, %rdx, %r15      # imm = 0x148
addq 0x38(%r14), %r15
movq (%r14), %rax
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
movl $0x1, %ecx
callq *0x38(%rax)
testb %bpl, %bpl
je 0x64763
testb $0x40, 0x63(%r15)
jne 0x647cc
leaq 0xb8(%rsp), %r15
movl $0x0, (%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1f4b4
movl 0xb8(%rsp), %ebp
testq %rax, %rax
je 0x647d3
incl %ebp
movl %ebp, 0xb8(%rsp)
cmpl $0x40, %ebp
jb 0x646cd
movl $0x10, %edi
callq 0x6140
movq %rax, %r14
leaq 0xc8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x5a5a1(%rip), %rsi     # 0xbecb7
leaq 0x5a5c3(%rip), %rdx     # 0xbece0
leaq 0xb8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0xb8(%rsp), %rsi
movq %r14, %rdi
callq 0x6320
leaq 0x97684(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0x9765c(%rip), %rsi     # 0xfbdb0
movq 0x9887d(%rip), %rdx     # 0xfcfd8
movq %r14, %rdi
callq 0x6470
movq (%r14), %rax
leaq 0xb8(%rsp), %rdi
leaq 0x1b0(%rsp), %rdx
leaq 0x30(%rsp), %rcx
movq %r14, %rsi
xorl %r8d, %r8d
callq *0xc8(%rax)
leaq 0x4fbdc(%rip), %rdx     # 0xb436a
leaq 0x5a35c(%rip), %r8      # 0xbeaf1
leaq 0xb8(%rsp), %rsi
leaq 0x50(%rsp), %rcx
movq %r14, %rdi
callq 0x5585e
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x64b38
movq 0xc8(%rsp), %rsi
jmp 0x64b30
movl 0xa4(%r15), %ebp
leaq 0x98(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x640c4
cmpl $0x2, 0x1c8(%rsp)
setae %al
andb %al, %r12b
cmpb $0x1, %r12b
jne 0x64a23
movq 0x1d0(%rsp), %rax
cmpq 0x1d8(%rsp), %rax
jne 0x64c1e
leaq 0x4(%rsp), %rax
movl $0x0, (%rax)
leaq 0x78(%rsp), %r12
xorl %r13d, %r13d
leaq 0x97bb3(%rip), %rax     # 0xfc3e0
addq $0x10, %rax
movq %rax, 0x70(%rsp)
leaq 0xb8(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x1eafa
movl $0x1, 0xd0(%rsp)
movq 0x28(%rsp), %rax
movl 0x8(%rax), %esi
movq %r14, %rdi
callq 0x14e50
movq (%r14), %rcx
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq *0x140(%rcx)
leaq 0x190(%rsp), %r15
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
leaq 0x59726(%rip), %rdx     # 0xbdfb7
leaq 0x4(%rsp), %rcx
callq 0x75a66
movq (%r14), %rax
movq %r12, %rdi
movq %r14, %rsi
leaq 0xb8(%rsp), %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq *0xc8(%rax)
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
movq %r12, %rdx
leaq 0x4faa0(%rip), %rcx     # 0xb436a
leaq 0x98(%rsp), %r8
leaq 0x596de(%rip), %r9      # 0xbdfb7
leaq 0x5a211(%rip), %rax     # 0xbeaf1
pushq %rax
leaq 0xc(%rsp), %rax
pushq %rax
callq 0x7592a
addq $0x10, %rsp
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x64912
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x190(%rsp), %rdi
leaq 0x1a0(%rsp), %rax
cmpq %rax, %rdi
je 0x64937
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x64953
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movl %ebp, 0x78(%rsp)
movq %rbx, 0x8(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
leaq 0x8(%rsp), %rdx
callq 0x7d778
movq 0x70(%rsp), %rax
movq %rax, 0xb8(%rsp)
leaq 0x158(%rsp), %rdi
callq 0xde80
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x649a3
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x6260
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x649e8
movq 0x110(%rsp), %rsi
subq %rdi, %rsi
callq 0x6260
movq %r13, 0xf0(%rsp)
movl %r13d, 0xf8(%rsp)
movq %r13, 0x100(%rsp)
movl %r13d, 0x108(%rsp)
movq %r13, 0x110(%rsp)
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x64a05
movq 0xe8(%rsp), %rsi
subq %rdi, %rsi
callq 0x6260
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
incl %ebp
cmpl 0x1c8(%rsp), %eax
jb 0x64836
jmp 0x64b17
movq 0x28(%rsp), %rax
movl 0x8(%rax), %esi
movq %r14, %rdi
callq 0x14e50
movq (%r14), %rcx
leaq 0xb8(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq *0x140(%rcx)
movq (%r14), %rax
leaq 0x8(%rsp), %rdi
leaq 0x1b0(%rsp), %rdx
leaq 0x30(%rsp), %rcx
movq %r14, %rsi
xorl %r8d, %r8d
callq *0xc8(%rax)
leaq 0x4f8f8(%rip), %rcx     # 0xb436a
leaq 0x5a078(%rip), %r9      # 0xbeaf1
leaq 0xb8(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x98(%rsp), %r8
movq %r14, %rdi
callq 0x75b12
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x64ab1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x64ad2
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x1b0(%rsp), %rsi
movq %r14, %rdi
callq 0x63f0a
movl %eax, %r14d
testl %eax, %eax
je 0x64b17
leaq 0x8(%rsp), %r15
leaq 0xb8(%rsp), %r12
movl %ebp, 0x8(%rsp)
movq %rbx, 0xb8(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x7d778
incl %ebp
decl %r14d
jne 0x64af6
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x64b38
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x64b53
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x64b6f
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x9786a(%rip), %rax     # 0xfc3e0
addq $0x10, %rax
leaq 0x250(%rsp), %rbx
movq %rax, -0xa0(%rbx)
movq %rbx, %rdi
callq 0xde80
movq -0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x64baa
movq 0x228(%rsp), %rsi
subq %rdi, %rsi
callq 0x6260
movq 0x1e8(%rsp), %rdi
testq %rdi, %rdi
je 0x64bef
movq 0x208(%rsp), %rsi
subq %rdi, %rsi
callq 0x6260
xorl %eax, %eax
movq %rax, 0x1e8(%rsp)
movl %eax, 0x1f0(%rsp)
movq %rax, 0x1f8(%rsp)
movl %eax, 0x200(%rsp)
movq %rax, 0x208(%rsp)
movq 0x1d0(%rsp), %rdi
testq %rdi, %rdi
je 0x64c0c
movq 0x1e0(%rsp), %rsi
subq %rdi, %rsi
callq 0x6260
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x6140
movq %rax, %r14
leaq 0xc8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x56e3b(%rip), %rsi     # 0xbba79
leaq 0x56e73(%rip), %rdx     # 0xbbab8
leaq 0xb8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0xb8(%rsp), %rsi
movq %r14, %rdi
callq 0x6320
leaq 0x9715c(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0x97134(%rip), %rsi     # 0xfbdb0
movq 0x98355(%rip), %rdx     # 0xfcfd8
movq %r14, %rdi
callq 0x6470
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r15, %rdi
je 0x64cab
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x64cb8
jmp 0x64e1f
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0x64e1f
jmp 0x64d8e
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x64ced
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x64ced
movq %rax, %rbx
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x64e1f
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x64e1f
jmp 0x64d8e
jmp 0x64e0a
movq %rax, %rbx
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x64e40
movq 0xc8(%rsp), %rsi
jmp 0x64e38
jmp 0x64e0a
jmp 0x64d4a
movq %rax, %rbx
jmp 0x64e5b
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r15, %rdi
je 0x64d72
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x64d7f
jmp 0x64e40
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0x64e40
jmp 0x64d8e
movq %rax, %rbx
jmp 0x64e1f
movq %rax, %rbx
jmp 0x64dea
movq %rax, %rbx
jmp 0x64dc5
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x64dc5
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x190(%rsp), %rdi
leaq 0x1a0(%rsp), %rax
cmpq %rax, %rdi
je 0x64dea
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x64e12
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x64e12
jmp 0x64e0f
movq %rax, %rbx
jmp 0x64e40
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x1be02
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x64e40
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x64e5b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x64e77
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x1b0(%rsp), %rdi
callq 0x1be02
movq %rbx, %rdi
callq 0x64a0