// File: rossy[P]crossc/SPIRV-Cross/spirv_cross.cpp
// Function: spirv_cross::Compiler::make_constant_null(unsigned int, unsigned int)
void Compiler::make_constant_null(uint32_t id, uint32_t type)
{
	auto &constant_type = get<SPIRType>(type);

	if (!constant_type.array.empty())
	{
		assert(constant_type.parent_type);
		uint32_t parent_id = ir.increase_bound_by(1);
		make_constant_null(parent_id, constant_type.parent_type);

		if (!constant_type.array_size_literal.back())
			SPIRV_CROSS_THROW("Array size of OpConstantNull must be a literal.");

		vector<uint32_t> elements(constant_type.array.back());
		for (uint32_t i = 0; i < constant_type.array.back(); i++)
			elements[i] = parent_id;
		set<SPIRConstant>(id, type, elements.data(), uint32_t(elements.size()), false);
	}
	else if (!constant_type.member_types.empty())
	{
		uint32_t member_ids = ir.increase_bound_by(uint32_t(constant_type.member_types.size()));
		vector<uint32_t> elements(constant_type.member_types.size());
		for (uint32_t i = 0; i < constant_type.member_types.size(); i++)
		{
			make_constant_null(member_ids + i, constant_type.member_types[i]);
			elements[i] = member_ids + i;
		}
		set<SPIRConstant>(id, type, elements.data(), uint32_t(elements.size()), false);
	}
	else
	{
		auto &constant = set<SPIRConstant>(id, type);
		constant.make_null(constant_type);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
movl -0x10(%rbp), %esi
callq 0xea90
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x8690
testb $0x1, %al
jne 0x2c3dd
movq -0x18(%rbp), %rax
cmpl $0x0, 0x9c(%rax)
je 0x2c150
jmp 0x2c16f
leaq 0x113854(%rip), %rdi    # 0x13f9ab
leaq 0x1133bb(%rip), %rsi    # 0x13f519
movl $0xdd3, %edx            # imm = 0xDD3
leaq 0x11385b(%rip), %rcx    # 0x13f9c5
callq 0x7260
movq -0xe0(%rbp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x55780
movq -0xe0(%rbp), %rdi
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %esi
movq -0x18(%rbp), %rax
movl 0x9c(%rax), %edx
callq 0x2c100
movq -0x18(%rbp), %rdi
addq $0x38, %rdi
callq 0x327d0
movq %rax, -0x30(%rbp)
movq %rdx, -0x28(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x1d8d0
xorb $-0x1, %al
testb $0x1, %al
jne 0x2c1c9
jmp 0x2c281
movb $0x1, -0x65(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0xf0(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x7650
movq -0xe8(%rbp), %rdx
leaq 0x11380c(%rip), %rsi    # 0x13fa08
leaq -0x50(%rbp), %rdi
callq 0x7520
jmp 0x2c207
movq -0xf0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x9c50
jmp 0x2c219
movq -0xf0(%rbp), %rdi
movb $0x0, -0x65(%rbp)
leaq 0x181bad(%rip), %rsi    # 0x1addd8
leaq -0x225a2(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x2c617
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x2c25f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x7708
leaq -0x51(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x65(%rbp)
jne 0x2c270
jmp 0x2c27c
movq -0xf0(%rbp), %rdi
callq 0x72c0
jmp 0x2c60e
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x32840
movl (%rax), %eax
movq %rax, -0x100(%rbp)
leaq -0x81(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x8d10
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
leaq -0x80(%rbp), %rdi
callq 0x32880
jmp 0x2c2c3
leaq -0x81(%rbp), %rdi
callq 0x9390
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
movl %eax, -0x104(%rbp)
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x32840
movq %rax, %rcx
movl -0x104(%rbp), %eax
cmpl (%rcx), %eax
jae 0x2c34f
movl -0x1c(%rbp), %eax
movl %eax, -0x108(%rbp)
movl -0x88(%rbp), %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0x8630
movl -0x108(%rbp), %ecx
movl %ecx, (%rax)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x2c2d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x81(%rbp), %rdi
callq 0x9390
jmp 0x2c60e
movl -0xc(%rbp), %eax
movl %eax, -0x10c(%rbp)
leaq -0x80(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x32960
movq -0x118(%rbp), %rdi
movq %rax, -0x90(%rbp)
callq 0x8650
movq -0xe0(%rbp), %rdi
movl -0x10c(%rbp), %esi
movl %eax, -0x94(%rbp)
movb $0x0, -0x95(%rbp)
leaq -0x10(%rbp), %rdx
leaq -0x90(%rbp), %rcx
leaq -0x94(%rbp), %r8
leaq -0x95(%rbp), %r9
callq 0x328f0
jmp 0x2c3b5
leaq -0x80(%rbp), %rdi
callq 0x8430
jmp 0x2c605
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x8430
jmp 0x2c60e
movq -0x18(%rbp), %rdi
addq $0x68, %rdi
callq 0x8690
testb $0x1, %al
jne 0x2c5d9
movq -0xe0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x130(%rbp)
movq -0x18(%rbp), %rdi
addq $0x68, %rdi
callq 0x8650
movq -0x130(%rbp), %rdi
movl %eax, %esi
callq 0x55780
movl %eax, -0x9c(%rbp)
movq -0x18(%rbp), %rdi
addq $0x68, %rdi
callq 0x8650
movq %rax, -0x128(%rbp)
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x8d10
movq -0x128(%rbp), %rsi
movq -0x120(%rbp), %rdx
leaq -0xb8(%rbp), %rdi
callq 0x32880
jmp 0x2c468
leaq -0xb9(%rbp), %rdi
callq 0x9390
movl $0x0, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
movq %rax, -0x138(%rbp)
movq -0x18(%rbp), %rdi
addq $0x68, %rdi
callq 0x8650
movq %rax, %rcx
movq -0x138(%rbp), %rax
cmpq %rcx, %rax
jae 0x2c562
movl -0x9c(%rbp), %eax
movl -0xc0(%rbp), %ecx
movl %ecx, %esi
movl %esi, %ecx
addl %ecx, %eax
movl %eax, -0x13c(%rbp)
movq -0x18(%rbp), %rdi
addq $0x68, %rdi
callq 0x8630
movq -0xe0(%rbp), %rdi
movl -0x13c(%rbp), %esi
movl (%rax), %edx
callq 0x2c100
jmp 0x2c4e6
movl -0x9c(%rbp), %eax
addl -0xc0(%rbp), %eax
movl %eax, -0x140(%rbp)
movl -0xc0(%rbp), %eax
movl %eax, %esi
leaq -0xb8(%rbp), %rdi
callq 0x8630
movl -0x140(%rbp), %ecx
movl %ecx, (%rax)
movl -0xc0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc0(%rbp)
jmp 0x2c47e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xb9(%rbp), %rdi
callq 0x9390
jmp 0x2c60e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x8430
jmp 0x2c60e
movl -0xc(%rbp), %eax
movl %eax, -0x144(%rbp)
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x32960
movq -0x150(%rbp), %rdi
movq %rax, -0xc8(%rbp)
callq 0x8650
movq -0xe0(%rbp), %rdi
movl -0x144(%rbp), %esi
movl %eax, -0xcc(%rbp)
movb $0x0, -0xcd(%rbp)
leaq -0x10(%rbp), %rdx
leaq -0xc8(%rbp), %rcx
leaq -0xcc(%rbp), %r8
leaq -0xcd(%rbp), %r9
callq 0x328f0
jmp 0x2c5cb
leaq -0xb8(%rbp), %rdi
callq 0x8430
jmp 0x2c603
movq -0xe0(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x10(%rbp), %rdx
callq 0x32980
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x329d0
jmp 0x2c605
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x7640
nopw (%rax,%rax)