// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
movq %rdi, %rbp
callq 0xb40a
movq %rax, 0x20(%rsp)
movl 0xc(%rax), %esi
movq %rbp, %rdi
callq 0xa426
movq %rax, %r14
movl 0x8(%rax), %esi
movq 0x38(%rbp), %rax
movq 0x40(%rbp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x7063e7063e7063e7, %r12 # imm = 0x8F9C18F9C18F9C19
imulq %r12, %rdx
cmpq %rsi, %rdx
jbe 0x145dd
movq 0x20(%r14), %rcx
cmpq 0x28(%r14), %rcx
jne 0x145e9
cmpl $0xc, 0xc(%r14)
jne 0x1464e
imulq $0x148, %rsi, %rcx      # imm = 0x148
addq %rcx, %rax
addq $0x60, %rax
testb $0x4, (%rax)
je 0x146b3
movq 0x68(%r14), %rax
movq 0x70(%r14), %rcx
cmpq %rcx, %rax
je 0x14718
leaq 0x20(%r14), %r15
leaq 0xc(%r14), %rdx
leaq 0x68(%r14), %rbx
movl (%rax), %esi
cmpl (%rax), %esi
jne 0x14578
addq $0x4, %rax
cmpq %rcx, %rax
jne 0x14403
movq %rdx, 0x30(%rsp)
movq %rbp, %rdi
callq 0xa426
movq %rax, %r13
movq 0x20(%rax), %rax
cmpq 0x28(%r13), %rax
jne 0x1477d
cmpl $0xc, 0xc(%r13)
je 0x147df
movq %rbx, 0x28(%rsp)
movl 0x8(%r14), %esi
movq 0x38(%rbp), %rcx
movq 0x40(%rbp), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %rsi, %rdx
jbe 0x145dd
movq 0x20(%rsp), %r12
movl 0x8(%r12), %eax
cmpq %rax, %rdx
jbe 0x1483f
movq %r15, %rbx
leaq 0x20(%r13), %rbp
leaq 0xc(%r13), %r15
imulq $0x148, %rsi, %rsi      # imm = 0x148
addq %rcx, %rsi
imulq $0x148, %rax, %rdi      # imm = 0x148
addq %rcx, %rdi
callq 0x6170
movl 0x10(%r12), %r12d
movq 0x70(%r14), %rax
subq 0x68(%r14), %rax
shrq $0x2, %rax
movl %eax, (%rsp)
movl 0x8(%r13), %eax
movl %eax, 0x8(%r14)
movups (%r15), %xmm0
movq 0x30(%rsp), %rax
movups %xmm0, (%rax)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1c2c2
leaq 0x38(%r14), %rdi
leaq 0x38(%r13), %rsi
callq 0x1c398
movq 0x60(%r13), %rax
movq %rax, 0x60(%r14)
leaq 0x68(%r13), %rsi
movq 0x28(%rsp), %rdi
callq 0x1c2c2
movups 0x80(%r13), %xmm0
movups 0x90(%r13), %xmm1
movups %xmm0, 0x80(%r14)
movups %xmm1, 0x90(%r14)
cmpq %r14, %r13
je 0x1452a
movl $0xa0, %eax
movq %r14, %rdi
addq %rax, %rdi
addq %rax, %r13
movq %r13, %rsi
callq 0xd5d6
movq 0x28(%r14), %rsi
cmpq 0x30(%r14), %rsi
je 0x14543
movl (%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%r14)
jmp 0x1454e
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x7a00
xorl %eax, %eax
cmpl $0x2, %r12d
cmovnel %r12d, %eax
movb $0x1, 0x60(%r14)
movl %eax, 0x64(%r14)
movq 0x20(%rsp), %rcx
movl %eax, 0x10(%rcx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa170d(%rip), %rsi     # 0xb5ca2
leaq 0xa171c(%rip), %rdx     # 0xb5cb8
movq %rsp, %rdi
callq 0x7c64
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe87df(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe87b7(%rip), %rsi     # 0xfcd80
movq 0xe9a08(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x1483f
leaq 0xa0b35(%rip), %rdi     # 0xb5119
jmp 0x14849
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa163a(%rip), %rsi     # 0xb5c40
leaq 0xa1649(%rip), %rdx     # 0xb5c56
movq %rsp, %rdi
callq 0x7c64
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe876e(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe8746(%rip), %rsi     # 0xfcd80
movq 0xe9997(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x1483f
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa15ec(%rip), %rsi     # 0xb5c57
leaq 0xa15fa(%rip), %rdx     # 0xb5c6c
movq %rsp, %rdi
callq 0x7c64
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe8709(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe86e1(%rip), %rsi     # 0xfcd80
movq 0xe9932(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x1483f
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa159d(%rip), %rsi     # 0xb5c6d
leaq 0xa15aa(%rip), %rdx     # 0xb5c81
movq %rsp, %rdi
callq 0x7c64
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe86a4(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe867c(%rip), %rsi     # 0xfcd80
movq 0xe98cd(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x1483f
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa154d(%rip), %rsi     # 0xb5c82
leaq 0xa1565(%rip), %rdx     # 0xb5ca1
movq %rsp, %rdi
callq 0x7c64
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe863f(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe8617(%rip), %rsi     # 0xfcd80
movq 0xe9868(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x1483f
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa151f(%rip), %rsi     # 0xb5cb9
leaq 0xa1535(%rip), %rdx     # 0xb5cd6
movq %rsp, %rdi
callq 0x7c64
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe85da(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe85b2(%rip), %rsi     # 0xfcd80
movq 0xe9803(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x1483f
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa14db(%rip), %rsi     # 0xb5cd7
leaq 0xa14f1(%rip), %rdx     # 0xb5cf4
movq %rsp, %rdi
callq 0x7c64
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe8578(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe8550(%rip), %rsi     # 0xfcd80
movq 0xe97a1(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
leaq 0xa08d3(%rip), %rdi     # 0xb5119
movq %rax, %rsi
xorl %eax, %eax
callq 0x63d0
jmp 0x14868
jmp 0x14883
jmp 0x14868
jmp 0x14883
jmp 0x14868
jmp 0x14883
jmp 0x14868
jmp 0x14883
jmp 0x14868
jmp 0x14883
jmp 0x14868
jmp 0x14883
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x14889
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x14889
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x14896
movq %rbx, %rdi
callq 0x6200
movq %r14, %rdi
callq 0x64a0