// File: /workspace/github_cpp_makefile_star2_O3/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 $0x48, %rsp
movq %rdi, %rbp
callq 0xb3ca
movq %rax, %r15
movl 0xc(%rax), %esi
movq %rbp, %rdi
callq 0xa3ea
movq %rax, %r14
movl 0x8(%rax), %esi
movq 0x38(%rbp), %rax
movq 0x40(%rbp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x7063e7063e7063e7, %rcx # imm = 0x8F9C18F9C18F9C19
imulq %rcx, %rdx
cmpq %rsi, %rdx
jbe 0x1443a
movq 0x20(%r14), %rcx
cmpq 0x28(%r14), %rcx
jne 0x14446
cmpl $0xc, 0xc(%r14)
jne 0x144af
imulq $0x148, %rsi, %rcx      # imm = 0x148
addq %rcx, %rax
addq $0x60, %rax
testb $0x4, (%rax)
je 0x14518
movq 0x68(%r14), %rax
movq 0x70(%r14), %rcx
cmpq %rcx, %rax
je 0x14581
leaq 0x20(%r14), %rbx
leaq 0xc(%r14), %rdx
leaq 0x68(%r14), %r12
movl (%rax), %esi
cmpl (%rax), %esi
jne 0x143d1
addq $0x4, %rax
cmpq %rcx, %rax
jne 0x1424d
movq %rdx, 0x40(%rsp)
movq %rbp, %rdi
callq 0xa3ea
movq %rax, %r13
movq 0x20(%rax), %rax
cmpq 0x28(%r13), %rax
jne 0x145ea
cmpl $0xc, 0xc(%r13)
je 0x14650
movq %r12, 0x38(%rsp)
movl 0x8(%r14), %esi
movq 0x38(%rbp), %rcx
movq 0x40(%rbp), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x7063e7063e7063e7, %rax # imm = 0x8F9C18F9C18F9C19
imulq %rax, %rdx
cmpq %rsi, %rdx
jbe 0x1443a
movl 0x8(%r15), %eax
cmpq %rax, %rdx
jbe 0x146b4
movq %rbx, %r12
leaq 0x20(%r13), %rbp
leaq 0xc(%r13), %rbx
imulq $0x148, %rsi, %rsi      # imm = 0x148
addq %rcx, %rsi
imulq $0x148, %rax, %rdi      # imm = 0x148
addq %rcx, %rdi
callq 0x6170
movq %r15, 0x30(%rsp)
movl 0x10(%r15), %eax
movl %eax, 0x2c(%rsp)
movq 0x70(%r14), %r15
subq 0x68(%r14), %r15
shrq $0x2, %r15
movl %r15d, 0x8(%rsp)
movl 0x8(%r13), %eax
movl %eax, 0x8(%r14)
movups (%rbx), %xmm0
movq 0x40(%rsp), %rax
movups %xmm0, (%rax)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1bc64
leaq 0x38(%r14), %rdi
leaq 0x38(%r13), %rsi
callq 0x1bd48
movq 0x60(%r13), %rax
movq %rax, 0x60(%r14)
leaq 0x68(%r13), %rsi
movq 0x38(%rsp), %rdi
callq 0x1bc64
movups 0x80(%r13), %xmm0
movups 0x90(%r13), %xmm1
movups %xmm0, 0x80(%r14)
movups %xmm1, 0x90(%r14)
cmpq %r14, %r13
je 0x14381
movl $0xa0, %eax
movq %r14, %rdi
addq %rax, %rdi
addq %rax, %r13
movq %r13, %rsi
callq 0xd596
movq 0x28(%r14), %rsi
cmpq 0x30(%r14), %rsi
je 0x14398
movl %r15d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%r14)
jmp 0x143a5
leaq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x797e
movl 0x2c(%rsp), %ecx
xorl %eax, %eax
cmpl $0x2, %ecx
cmovnel %ecx, %eax
movb $0x1, 0x60(%r14)
movl %eax, 0x64(%r14)
movq 0x30(%rsp), %rcx
movl %eax, 0x10(%rcx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa08b1(%rip), %rsi     # 0xb4c9f
leaq 0xa08c0(%rip), %rdx     # 0xb4cb5
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe79b2(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe798a(%rip), %rsi     # 0xfbdb0
movq 0xe8bab(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x146b4
leaq 0x9fcd8(%rip), %rdi     # 0xb4119
jmp 0x146be
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa07da(%rip), %rsi     # 0xb4c3d
leaq 0xa07e9(%rip), %rdx     # 0xb4c53
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe793d(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe7915(%rip), %rsi     # 0xfbdb0
movq 0xe8b36(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x146b4
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa0788(%rip), %rsi     # 0xb4c54
leaq 0xa0796(%rip), %rdx     # 0xb4c69
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe78d4(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe78ac(%rip), %rsi     # 0xfbdb0
movq 0xe8acd(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x146b4
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa0735(%rip), %rsi     # 0xb4c6a
leaq 0xa0742(%rip), %rdx     # 0xb4c7e
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe786b(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe7843(%rip), %rsi     # 0xfbdb0
movq 0xe8a64(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x146b4
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa06e1(%rip), %rsi     # 0xb4c7f
leaq 0xa06f9(%rip), %rdx     # 0xb4c9e
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe7802(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe77da(%rip), %rsi     # 0xfbdb0
movq 0xe89fb(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x146b4
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa06af(%rip), %rsi     # 0xb4cb6
leaq 0xa06c5(%rip), %rdx     # 0xb4cd3
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe7799(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe7771(%rip), %rsi     # 0xfbdb0
movq 0xe8992(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x146b4
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa0667(%rip), %rsi     # 0xb4cd4
leaq 0xa067d(%rip), %rdx     # 0xb4cf1
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xe7733(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xe770b(%rip), %rsi     # 0xfbdb0
movq 0xe892c(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
leaq 0x9fa5e(%rip), %rdi     # 0xb4119
movq %rax, %rsi
xorl %eax, %eax
callq 0x63d0
jmp 0x146dd
jmp 0x146fe
jmp 0x146dd
jmp 0x146fe
jmp 0x146dd
jmp 0x146fe
jmp 0x146dd
jmp 0x146fe
jmp 0x146dd
jmp 0x146fe
jmp 0x146dd
jmp 0x146fe
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x146f7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x14701
jmp 0x14709
movq %rax, %r14
movq %rbx, %rdi
callq 0x6200
movq %r14, %rdi
callq 0x64a0
nop