// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::convert_half_to_string[abi:cxx11](spirv_cross::SPIRConstant const&, unsigned int, unsigned int)
string CompilerGLSL::convert_half_to_string(const SPIRConstant &c, uint32_t col, uint32_t row)
{
	string res;
	float float_value = c.scalar_f16(col, row);

	if (std::isnan(float_value) || std::isinf(float_value))
	{
		if (backend.half_literal_suffix)
		{
			// There is no uintBitsToFloat for 16-bit, so have to rely on legacy fallback here.
			if (float_value == numeric_limits<float>::infinity())
				res = join("(1.0", backend.half_literal_suffix, " / 0.0", backend.half_literal_suffix, ")");
			else if (float_value == -numeric_limits<float>::infinity())
				res = join("(-1.0", backend.half_literal_suffix, " / 0.0", backend.half_literal_suffix, ")");
			else if (std::isnan(float_value))
				res = join("(0.0", backend.half_literal_suffix, " / 0.0", backend.half_literal_suffix, ")");
			else
				SPIRV_CROSS_THROW("Cannot represent non-finite floating point constant.");
		}
		else
		{
			SPIRType type;
			type.basetype = SPIRType::Half;
			type.vecsize = 1;
			type.columns = 1;

			if (float_value == numeric_limits<float>::infinity())
				res = join(type_to_glsl(type), "(1.0 / 0.0)");
			else if (float_value == -numeric_limits<float>::infinity())
				res = join(type_to_glsl(type), "(-1.0 / 0.0)");
			else if (std::isnan(float_value))
				res = join(type_to_glsl(type), "(0.0 / 0.0)");
			else
				SPIRV_CROSS_THROW("Cannot represent non-finite floating point constant.");
		}
	}
	else
	{
		if (backend.half_literal_suffix)
			res = convert_to_string(float_value) + backend.half_literal_suffix;
		else
		{
			// In HLSL (FXC), it's important to cast the literals to half precision right away.
			// There is no literal for it.
			SPIRType type;
			type.basetype = SPIRType::Half;
			type.vecsize = 1;
			type.columns = 1;
			res = join(type_to_glsl(type), "(", convert_to_string(float_value), ")");
		}
	}

	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x460, %rsp            # imm = 0x460
movq %rdi, -0x418(%rbp)
movq %rdi, %rax
movq %rax, -0x410(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x408(%rbp)
movb $0x0, -0x21(%rbp)
callq 0x7530
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0xa1980
movss %xmm0, -0x3fc(%rbp)
jmp 0x74b6c
movss -0x3fc(%rbp), %xmm0
movss %xmm0, -0x28(%rbp)
movss -0x28(%rbp), %xmm0
callq 0xa19b0
movb %al, -0x419(%rbp)
jmp 0x74b8b
movb -0x419(%rbp), %al
testb $0x1, %al
jne 0x74bb8
jmp 0x74b97
movss -0x28(%rbp), %xmm0
callq 0xa19d0
movb %al, -0x41a(%rbp)
jmp 0x74ba9
movb -0x41a(%rbp), %al
testb $0x1, %al
jne 0x74bb8
jmp 0x75180
movq -0x408(%rbp), %rax
cmpq $0x0, 0x618(%rax)
je 0x74e20
movss -0x28(%rbp), %xmm0
movss %xmm0, -0x420(%rbp)
callq 0xa1a00
movaps %xmm0, %xmm1
movss -0x420(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jne 0x74c51
jp 0x74c51
movq -0x408(%rbp), %r8
addq $0x618, %r8             # imm = 0x618
leaq 0xcda69(%rip), %rsi     # 0x14266f
leaq 0xcda67(%rip), %rcx     # 0x142674
leaq 0xd02e5(%rip), %r9      # 0x144ef9
leaq -0x58(%rbp), %rdi
movq %r8, %rdx
callq 0xa1a10
jmp 0x74c22
movq -0x418(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x7430
leaq -0x58(%rbp), %rdi
callq 0x7708
jmp 0x74e1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x75366
movss -0x28(%rbp), %xmm0
movss %xmm0, -0x424(%rbp)
callq 0xa1a00
movaps %xmm0, %xmm1
movss -0x424(%rbp), %xmm0
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
ucomiss %xmm1, %xmm0
jne 0x74cd1
jp 0x74cd1
movq -0x408(%rbp), %r8
addq $0x618, %r8             # imm = 0x618
leaq 0xcd9e4(%rip), %rsi     # 0x14267b
leaq 0xcd9d6(%rip), %rcx     # 0x142674
leaq 0xd0254(%rip), %r9      # 0x144ef9
leaq -0x78(%rbp), %rdi
movq %r8, %rdx
callq 0xa1ae0
jmp 0x74cb3
movq -0x418(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x7430
leaq -0x78(%rbp), %rdi
callq 0x7708
jmp 0x74e19
movss -0x28(%rbp), %xmm0
callq 0xa19b0
movb %al, -0x425(%rbp)
jmp 0x74ce3
movb -0x425(%rbp), %al
testb $0x1, %al
jne 0x74cef
jmp 0x74d47
movq -0x408(%rbp), %r8
addq $0x618, %r8             # imm = 0x618
leaq 0xcd97d(%rip), %rsi     # 0x142681
leaq 0xcd969(%rip), %rcx     # 0x142674
leaq 0xd01e7(%rip), %r9      # 0x144ef9
leaq -0x98(%rbp), %rdi
movq %r8, %rdx
callq 0xa1a10
jmp 0x74d23
movq -0x418(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x7430
leaq -0x98(%rbp), %rdi
callq 0x7708
jmp 0x74e17
movb $0x1, -0xba(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x438(%rbp)
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x430(%rbp)
callq 0x7650
movq -0x430(%rbp), %rdx
leaq 0xcd906(%rip), %rsi     # 0x142686
leaq -0xb8(%rbp), %rdi
callq 0x7520
jmp 0x74d8e
movq -0x438(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x9c50
jmp 0x74da3
movq -0x438(%rbp), %rdi
movb $0x0, -0xba(%rbp)
leaq 0x139020(%rip), %rsi    # 0x1addd8
leaq -0x6b12f(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x7537b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x74def
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x7708
leaq -0xb9(%rbp), %rdi
callq 0x73d0
testb $0x1, -0xba(%rbp)
jne 0x74e06
jmp 0x74e12
movq -0x438(%rbp), %rdi
callq 0x72c0
jmp 0x75366
jmp 0x74e19
jmp 0x74e1b
jmp 0x7517b
leaq -0x198(%rbp), %rdi
callq 0x31440
movl $0x9, -0x18c(%rbp)
movl $0x1, -0x184(%rbp)
movl $0x1, -0x180(%rbp)
movss -0x28(%rbp), %xmm0
movss %xmm0, -0x43c(%rbp)
callq 0xa1a00
movaps %xmm0, %xmm1
movss -0x43c(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jne 0x74f15
jp 0x74f15
movq -0x408(%rbp), %rsi
movq (%rsi), %rax
movq 0x98(%rax), %rax
leaq -0x1d8(%rbp), %rdi
leaq -0x198(%rbp), %rdx
xorl %ecx, %ecx
callq *%rax
jmp 0x74e9b
leaq 0xcd819(%rip), %rdx     # 0x1426bb
leaq -0x1b8(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0xa1bb0
jmp 0x74eb7
movq -0x418(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x7430
leaq -0x1b8(%rbp), %rdi
callq 0x7708
leaq -0x1d8(%rbp), %rdi
callq 0x7708
jmp 0x7515c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x7516a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x7708
jmp 0x7516a
movss -0x28(%rbp), %xmm0
movss %xmm0, -0x440(%rbp)
callq 0xa1a00
movaps %xmm0, %xmm1
movss -0x440(%rbp), %xmm0
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
ucomiss %xmm1, %xmm0
jne 0x74fdc
jp 0x74fdc
movq -0x408(%rbp), %rsi
movq (%rsi), %rax
movq 0x98(%rax), %rax
leaq -0x218(%rbp), %rdi
leaq -0x198(%rbp), %rdx
xorl %ecx, %ecx
callq *%rax
jmp 0x74f73
leaq 0xcd74d(%rip), %rdx     # 0x1426c7
leaq -0x1f8(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0xa1c60
jmp 0x74f8f
movq -0x418(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x7430
leaq -0x1f8(%rbp), %rdi
callq 0x7708
leaq -0x218(%rbp), %rdi
callq 0x7708
jmp 0x7515a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x7708
jmp 0x7516a
movss -0x28(%rbp), %xmm0
callq 0xa19b0
movb %al, -0x441(%rbp)
jmp 0x74fee
movb -0x441(%rbp), %al
testb $0x1, %al
jne 0x74ffd
jmp 0x7508b
movq -0x408(%rbp), %rsi
movq (%rsi), %rax
movq 0x98(%rax), %rax
leaq -0x258(%rbp), %rdi
leaq -0x198(%rbp), %rdx
xorl %ecx, %ecx
callq *%rax
jmp 0x75022
leaq 0xcd6ab(%rip), %rdx     # 0x1426d4
leaq -0x238(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0xa1bb0
jmp 0x7503e
movq -0x418(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x7430
leaq -0x238(%rbp), %rdi
callq 0x7708
leaq -0x258(%rbp), %rdi
callq 0x7708
jmp 0x75158
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x7708
jmp 0x7516a
movb $0x1, -0x27a(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x458(%rbp)
leaq -0x279(%rbp), %rdi
movq %rdi, -0x450(%rbp)
callq 0x7650
movq -0x450(%rbp), %rdx
leaq 0xcd5c2(%rip), %rsi     # 0x142686
leaq -0x278(%rbp), %rdi
callq 0x7520
jmp 0x750d2
movq -0x458(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x9c50
jmp 0x750e7
movq -0x458(%rbp), %rdi
movb $0x0, -0x27a(%rbp)
leaq 0x138cdc(%rip), %rsi    # 0x1addd8
leaq -0x6b473(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x7537b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x75133
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x7708
leaq -0x279(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x27a(%rbp)
jne 0x7514a
jmp 0x75156
movq -0x458(%rbp), %rdi
callq 0x72c0
jmp 0x7516a
jmp 0x7515a
jmp 0x7515c
leaq -0x198(%rbp), %rdi
callq 0x314e0
jmp 0x7517b
leaq -0x198(%rbp), %rdi
callq 0x314e0
jmp 0x75366
jmp 0x75340
movq -0x408(%rbp), %rax
cmpq $0x0, 0x618(%rax)
je 0x75218
movss -0x28(%rbp), %xmm0
leaq -0x2c0(%rbp), %rdi
callq 0xa1d10
jmp 0x751a8
movq -0x408(%rbp), %rax
movq 0x618(%rax), %rdx
leaq -0x2a0(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x11910
jmp 0x751cb
movq -0x418(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x7430
leaq -0x2a0(%rbp), %rdi
callq 0x7708
leaq -0x2c0(%rbp), %rdi
callq 0x7708
jmp 0x7533e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x7708
jmp 0x75366
leaq -0x398(%rbp), %rdi
movq %rdi, -0x460(%rbp)
callq 0x31440
movq -0x408(%rbp), %rsi
movq -0x460(%rbp), %rdx
movl $0x9, -0x38c(%rbp)
movl $0x1, -0x384(%rbp)
movl $0x1, -0x380(%rbp)
movq (%rsi), %rax
movq 0x98(%rax), %rax
leaq -0x3d8(%rbp), %rdi
xorl %ecx, %ecx
callq *%rax
jmp 0x7526e
movss -0x28(%rbp), %xmm0
leaq -0x3f8(%rbp), %rdi
callq 0xa1d10
jmp 0x75281
leaq 0xd80a5(%rip), %rdx     # 0x14d32d
leaq 0xcfc6a(%rip), %r8      # 0x144ef9
leaq -0x3b8(%rbp), %rdi
leaq -0x3d8(%rbp), %rsi
leaq -0x3f8(%rbp), %rcx
callq 0xa1de0
jmp 0x752ab
movq -0x418(%rbp), %rdi
leaq -0x3b8(%rbp), %rsi
callq 0x7430
leaq -0x3b8(%rbp), %rdi
callq 0x7708
leaq -0x3f8(%rbp), %rdi
callq 0x7708
leaq -0x3d8(%rbp), %rdi
callq 0x7708
leaq -0x398(%rbp), %rdi
callq 0x314e0
jmp 0x7533e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x75330
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x75324
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x3f8(%rbp), %rdi
callq 0x7708
leaq -0x3d8(%rbp), %rdi
callq 0x7708
leaq -0x398(%rbp), %rdi
callq 0x314e0
jmp 0x75366
jmp 0x75340
movb $0x1, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
jne 0x75356
movq -0x418(%rbp), %rdi
callq 0x7708
movq -0x410(%rbp), %rax
addq $0x460, %rsp            # imm = 0x460
popq %rbp
retq
movq -0x418(%rbp), %rdi
callq 0x7708
movq -0x30(%rbp), %rdi
callq 0x7640
nopl (%rax,%rax)