// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_cross.cpp
// Function: spirv_cross::Compiler::flatten_interface_block(unsigned int)
void Compiler::flatten_interface_block(uint32_t id)
{
	auto &var = get<SPIRVariable>(id);
	auto &type = get<SPIRType>(var.basetype);
	auto &flags = ir.meta.at(type.self).decoration.decoration_flags;

	if (!type.array.empty())
		SPIRV_CROSS_THROW("Type is array of UBOs.");
	if (type.basetype != SPIRType::Struct)
		SPIRV_CROSS_THROW("Type is not a struct.");
	if (!flags.get(DecorationBlock))
		SPIRV_CROSS_THROW("Type is not a block.");
	if (type.member_types.empty())
		SPIRV_CROSS_THROW("Member list of struct is empty.");

	uint32_t t = type.member_types[0];
	for (auto &m : type.member_types)
		if (t != m)
			SPIRV_CROSS_THROW("Types in block differ.");

	auto &mtype = get<SPIRType>(t);
	if (!mtype.array.empty())
		SPIRV_CROSS_THROW("Member type cannot be arrays.");
	if (mtype.basetype == SPIRType::Struct)
		SPIRV_CROSS_THROW("Member type cannot be struct.");

	// Inherit variable name from interface block name.
	ir.meta.at(var.self).decoration.alias = ir.meta.at(type.self).decoration.alias;

	auto storage = var.storage;
	if (storage == StorageClassUniform)
		storage = StorageClassUniformConstant;

	// Change type definition in-place into an array instead.
	// Access chains will still work as-is.
	uint32_t array_size = uint32_t(type.member_types.size());
	type = mtype;
	type.array.push_back(array_size);
	type.pointer = true;
	type.storage = storage;
	var.storage = storage;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r13
callq 0x9c0e
movq %rax, %rbx
movl 0xc(%rax), %esi
movq %r13, %rdi
callq 0x90a4
movq %rax, %r14
leaq 0x38(%r13), %r15
movl 0x8(%rax), %esi
movq %r15, %rdi
callq 0x1738e
movq 0x20(%r14), %rcx
cmpq 0x28(%r14), %rcx
jne 0x11a5a
cmpl $0xc, 0xc(%r14)
jne 0x11aa8
testb $0x4, 0x60(%rax)
je 0x11af6
movq 0x68(%r14), %rcx
movq 0x70(%r14), %rax
cmpq %rax, %rcx
je 0x11b44
movq %r14, %r12
addq $0x20, %r12
movl (%rcx), %esi
cmpq %rax, %rcx
je 0x119c1
leaq 0x4(%rcx), %rdx
cmpl (%rcx), %esi
movq %rdx, %rcx
je 0x11963
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x7e2ed(%rip), %rsi     # 0x8fc72
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xd5413(%rip), %rsi     # 0xe6dc0
movq 0xd662c(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
jmp 0x11c26
movq %r13, %rdi
callq 0x90a4
movq %rax, %r13
movq 0x20(%rax), %rax
cmpq 0x28(%r13), %rax
jne 0x11b92
cmpl $0xc, 0xc(%r13)
je 0x11bdd
movl 0x8(%r14), %esi
movq %r15, %rdi
callq 0x1738e
movq %rax, %rbp
movl 0x8(%rbx), %esi
movq %r15, %rdi
callq 0x1738e
movq %rax, %rdi
movq %rbp, %rsi
callq 0x6170
movl 0x10(%rbx), %eax
xorl %ebp, %ebp
cmpl $0x2, %eax
cmovnel %eax, %ebp
movq 0x70(%r14), %rax
subq 0x68(%r14), %rax
shrq $0x2, %rax
leaq 0x8(%rsp), %r15
movl %eax, (%r15)
movq %r14, %rdi
movq %r13, %rsi
callq 0x173b0
movq %r12, %rdi
movq %r15, %rsi
callq 0x6c06
movb $0x1, 0x60(%r14)
movl %ebp, 0x64(%r14)
movl %ebp, 0x10(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x7e1a4(%rip), %rsi     # 0x8fc10
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xd532c(%rip), %rsi     # 0xe6dc0
movq 0xd6545(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
jmp 0x11c26
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x7e16d(%rip), %rsi     # 0x8fc27
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xd52de(%rip), %rsi     # 0xe6dc0
movq 0xd64f7(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
jmp 0x11c26
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x7e135(%rip), %rsi     # 0x8fc3d
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xd5290(%rip), %rsi     # 0xe6dc0
movq 0xd64a9(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
jmp 0x11c26
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x7e0fc(%rip), %rsi     # 0x8fc52
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xd5242(%rip), %rsi     # 0xe6dc0
movq 0xd645b(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
jmp 0x11c26
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x7e0e5(%rip), %rsi     # 0x8fc89
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xd51f4(%rip), %rsi     # 0xe6dc0
movq 0xd640d(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
jmp 0x11c26
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x7e0b8(%rip), %rsi     # 0x8fca7
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xd51a9(%rip), %rsi     # 0xe6dc0
movq 0xd63c2(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
jmp 0x11c3e
jmp 0x11c52
jmp 0x11c3e
jmp 0x11c52
jmp 0x11c3e
jmp 0x11c52
jmp 0x11c3e
jmp 0x11c52
jmp 0x11c3e
jmp 0x11c52
jmp 0x11c3e
jmp 0x11c52
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x11c55
jmp 0x11c5d
movq %rax, %r14
movq %rbx, %rdi
callq 0x6200
movq %r14, %rdi
callq 0x64b0
nop