// File: rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::emit_specialization_constants()
void CompilerHLSL::emit_specialization_constants()
{
	bool emitted = false;
	SpecializationConstant wg_x, wg_y, wg_z;
	uint32_t workgroup_size_id = get_work_group_size_specialization_constants(wg_x, wg_y, wg_z);

	for (auto &id : ir.ids)
	{
		if (id.get_type() == TypeConstant)
		{
			auto &c = id.get<SPIRConstant>();
			if (!c.specialization)
				continue;
			if (c.self == workgroup_size_id)
				continue;

			auto &type = get<SPIRType>(c.constant_type);
			auto name = to_name(c.self);

			statement("static const ", variable_decl(type, name), " = ", constant_expression(c), ";");
			emitted = true;
		}
		else if (id.get_type() == TypeConstantOp)
		{
			auto &c = id.get<SPIRConstantOp>();
			auto &type = get<SPIRType>(c.basetype);
			auto name = to_name(c.self);
			statement("static const ", variable_decl(type, name), " = ", constant_op_expression(c), ";");
		}
	}

	if (workgroup_size_id)
	{
		statement("static const uint3 gl_WorkGroupSize = ", constant_expression(get<SPIRConstant>(workgroup_size_id)),
		          ";");
		emitted = true;
	}

	if (emitted)
		statement("");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x160(%rbp)
movb $0x0, -0x9(%rbp)
leaq -0x14(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
leaq -0x24(%rbp), %rcx
callq 0x251e0
movl %eax, %ecx
movq -0x160(%rbp), %rax
movl %ecx, -0x28(%rbp)
addq $0x8, %rax
addq $0x18, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0xf940
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0xf970
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xf9a0
testb $0x1, %al
jne 0xbebb7
jmp 0xbeec3
leaq -0x38(%rbp), %rdi
callq 0xf9e0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0xfa00
cmpl $0x3, %eax
jne 0xbed42
movq -0x48(%rbp), %rdi
callq 0x2f2f0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
testb $0x1, 0x108(%rax)
jne 0xbebf5
jmp 0xbeeb5
movq -0x50(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x28(%rbp), %eax
jne 0xbec06
jmp 0xbeeb5
movq -0x160(%rbp), %rdi
movq -0x50(%rbp), %rax
movl 0xc(%rax), %esi
callq 0xea90
movq -0x160(%rbp), %rsi
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
movl 0x8(%rax), %edx
movq (%rsi), %rax
movq 0x38(%rax), %rax
leaq -0x78(%rbp), %rdi
movq %rdi, -0x168(%rbp)
movl $0x1, %ecx
callq *%rax
movq -0x160(%rbp), %rsi
movq -0x168(%rbp), %rcx
movq -0x58(%rbp), %rdx
movq (%rsi), %rax
movq 0xc8(%rax), %rax
leaq -0x98(%rbp), %rdi
xorl %r8d, %r8d
callq *%rax
jmp 0xbec6e
movq -0x160(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
callq 0x64bc0
jmp 0xbec87
movq -0x160(%rbp), %rdi
leaq 0x87439(%rip), %rsi     # 0x1460ce
leaq 0x8a373(%rip), %rcx     # 0x14900f
leaq 0x8a403(%rip), %r9      # 0x1490a6
leaq -0x98(%rbp), %rdx
leaq -0xc8(%rbp), %r8
callq 0xd7ca0
jmp 0xbecb8
leaq -0xc8(%rbp), %rdi
callq 0x7708
leaq -0x98(%rbp), %rdi
callq 0x7708
movb $0x1, -0x9(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x7708
jmp 0xbeeb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xbed34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xbed28
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x7708
leaq -0x98(%rbp), %rdi
callq 0x7708
leaq -0x78(%rbp), %rdi
callq 0x7708
jmp 0xbef70
movq -0x48(%rbp), %rdi
callq 0xfa00
cmpl $0xa, %eax
jne 0xbeeb1
movq -0x48(%rbp), %rdi
callq 0x57610
movq -0x160(%rbp), %rdi
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movl 0x28(%rax), %esi
callq 0xea90
movq -0x160(%rbp), %rsi
movq %rax, -0xd8(%rbp)
movq -0xd0(%rbp), %rax
movl 0x8(%rax), %edx
movq (%rsi), %rax
movq 0x38(%rax), %rax
leaq -0xf8(%rbp), %rdi
movq %rdi, -0x170(%rbp)
movl $0x1, %ecx
callq *%rax
movq -0x160(%rbp), %rsi
movq -0x170(%rbp), %rcx
movq -0xd8(%rbp), %rdx
movq (%rsi), %rax
movq 0xc8(%rax), %rax
leaq -0x118(%rbp), %rdi
xorl %r8d, %r8d
callq *%rax
jmp 0xbeddb
movq -0x160(%rbp), %rsi
movq -0xd0(%rbp), %rdx
leaq -0x138(%rbp), %rdi
callq 0x63510
jmp 0xbedf7
movq -0x160(%rbp), %rdi
leaq 0x872c9(%rip), %rsi     # 0x1460ce
leaq 0x8a203(%rip), %rcx     # 0x14900f
leaq 0x8a293(%rip), %r9      # 0x1490a6
leaq -0x118(%rbp), %rdx
leaq -0x138(%rbp), %r8
callq 0xd7ca0
jmp 0xbee28
leaq -0x138(%rbp), %rdi
callq 0x7708
leaq -0x118(%rbp), %rdi
callq 0x7708
leaq -0xf8(%rbp), %rdi
callq 0x7708
jmp 0xbeeb1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xbeea0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0xbee94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x7708
leaq -0x118(%rbp), %rdi
callq 0x7708
leaq -0xf8(%rbp), %rdi
callq 0x7708
jmp 0xbef70
jmp 0xbeeb3
jmp 0xbeeb5
leaq -0x38(%rbp), %rdi
callq 0xfbd0
jmp 0xbeba1
cmpl $0x0, -0x28(%rbp)
je 0xbef4e
movq -0x160(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x31910
movq -0x160(%rbp), %rsi
movq %rax, %rdx
leaq -0x158(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0x64bc0
movq -0x160(%rbp), %rdi
movq -0x178(%rbp), %rdx
leaq 0x871ce(%rip), %rsi     # 0x1460dc
leaq 0x8a191(%rip), %rcx     # 0x1490a6
callq 0xd7df0
jmp 0xbef1c
leaq -0x158(%rbp), %rdi
callq 0x7708
movb $0x1, -0x9(%rbp)
jmp 0xbef4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x7708
jmp 0xbef70
testb $0x1, -0x9(%rbp)
je 0xbef67
movq -0x160(%rbp), %rdi
leaq 0x7f93c(%rip), %rsi     # 0x13e89e
callq 0xedf0
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0xa0(%rbp), %rdi
callq 0x7640
nopl (%rax)