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

	if (std::isnan(double_value) || std::isinf(double_value))
	{
		// Use special representation.
		if (!is_legacy())
		{
			SPIRType out_type;
			SPIRType in_type;
			out_type.basetype = SPIRType::Double;
			in_type.basetype = SPIRType::UInt64;
			out_type.vecsize = 1;
			in_type.vecsize = 1;
			out_type.width = 64;
			in_type.width = 64;

			uint64_t u64_value = c.scalar_u64(col, row);

			if (options.es)
				SPIRV_CROSS_THROW("64-bit integers/float not supported in ES profile.");
			require_extension_internal("GL_ARB_gpu_shader_int64");

			char print_buffer[64];
			sprintf(print_buffer, "0x%llx%s", static_cast<unsigned long long>(u64_value),
			        backend.long_long_literal_suffix ? "ull" : "ul");
			res = join(bitcast_glsl_op(out_type, in_type), "(", print_buffer, ")");
		}
		else
		{
			if (options.es)
				SPIRV_CROSS_THROW("FP64 not supported in ES profile.");
			if (options.version < 400)
				require_extension_internal("GL_ARB_gpu_shader_fp64");

			if (double_value == numeric_limits<double>::infinity())
			{
				if (backend.double_literal_suffix)
					res = "(1.0lf / 0.0lf)";
				else
					res = "(1.0 / 0.0)";
			}
			else if (double_value == -numeric_limits<double>::infinity())
			{
				if (backend.double_literal_suffix)
					res = "(-1.0lf / 0.0lf)";
				else
					res = "(-1.0 / 0.0)";
			}
			else if (std::isnan(double_value))
			{
				if (backend.double_literal_suffix)
					res = "(0.0lf / 0.0lf)";
				else
					res = "(0.0 / 0.0)";
			}
			else
				SPIRV_CROSS_THROW("Cannot represent non-finite floating point constant.");
		}
	}
	else
	{
		res = convert_to_string(double_value);
		if (backend.double_literal_suffix)
			res += "lf";
	}

	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3f0, %rsp            # imm = 0x3F0
movq %rdi, -0x388(%rbp)
movq %rdi, %rax
movq %rax, -0x380(%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, -0x378(%rbp)
movb $0x0, -0x21(%rbp)
callq 0x7530
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0xa1f90
movsd %xmm0, -0x370(%rbp)
jmp 0x758dc
movsd -0x370(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0xa1fc0
movb %al, -0x389(%rbp)
jmp 0x758fb
movb -0x389(%rbp), %al
testb $0x1, %al
jne 0x75928
jmp 0x75907
movsd -0x30(%rbp), %xmm0
callq 0xa1fe0
movb %al, -0x38a(%rbp)
jmp 0x75919
movb -0x38a(%rbp), %al
testb $0x1, %al
jne 0x75928
jmp 0x7601d
movq -0x378(%rbp), %rdi
callq 0x9f610
movb %al, -0x38b(%rbp)
jmp 0x7593c
movb -0x38b(%rbp), %al
testb $0x1, %al
jne 0x75c6d
jmp 0x7594c
leaq -0x118(%rbp), %rdi
callq 0x31440
leaq -0x1f0(%rbp), %rdi
callq 0x31440
movl $0xb, -0x10c(%rbp)
movl $0x7, -0x1e4(%rbp)
movl $0x1, -0x104(%rbp)
movl $0x1, -0x1dc(%rbp)
movl $0x40, -0x108(%rbp)
movl $0x40, -0x1e0(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0xa2020
movq %rax, -0x398(%rbp)
jmp 0x759b8
movq -0x378(%rbp), %rax
movq -0x398(%rbp), %rcx
movq %rcx, -0x1f8(%rbp)
testb $0x1, 0x43c(%rax)
je 0x75acc
movb $0x1, -0x21a(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x3a8(%rbp)
leaq -0x219(%rbp), %rdi
movq %rdi, -0x3a0(%rbp)
callq 0x7650
movq -0x3a0(%rbp), %rdx
leaq 0xcccfe(%rip), %rsi     # 0x142711
leaq -0x218(%rbp), %rdi
callq 0x7520
jmp 0x75a21
movq -0x3a8(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x9c50
jmp 0x75a36
movq -0x3a8(%rbp), %rdi
movb $0x0, -0x21a(%rbp)
leaq 0x13838d(%rip), %rsi    # 0x1addd8
leaq -0x6bdc2(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x760b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x7609e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x75c50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x75aa4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x7708
leaq -0x219(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x21a(%rbp)
jne 0x75abb
jmp 0x75ac7
movq -0x3a8(%rbp), %rdi
callq 0x72c0
jmp 0x75c50
leaq -0x241(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0x7650
movq -0x3b0(%rbp), %rdx
leaq 0xcaf8e(%rip), %rsi     # 0x140a7b
leaq -0x240(%rbp), %rdi
callq 0x7520
jmp 0x75afb
movq -0x378(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x589d0
jmp 0x75b10
leaq -0x240(%rbp), %rdi
callq 0x7708
leaq -0x241(%rbp), %rdi
callq 0x73d0
movq -0x378(%rbp), %rax
movq -0x1f8(%rbp), %rdx
movb 0x603(%rax), %sil
leaq 0xccc09(%rip), %rax     # 0x14274d
leaq 0xcd6ba(%rip), %rcx     # 0x143205
testb $0x1, %sil
cmovneq %rax, %rcx
leaq 0xccbea(%rip), %rsi     # 0x142744
xorl %eax, %eax
leaq -0x290(%rbp), %rdi
callq 0x7080
movq -0x378(%rbp), %rsi
movq (%rsi), %rax
movq 0x168(%rax), %rax
leaq -0x2d0(%rbp), %rdi
leaq -0x118(%rbp), %rdx
leaq -0x1f0(%rbp), %rcx
callq *%rax
jmp 0x75b92
leaq 0xd7794(%rip), %rdx     # 0x14d32d
leaq 0xcf359(%rip), %r8      # 0x144ef9
leaq -0x2b0(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
leaq -0x290(%rbp), %rcx
callq 0xa2050
jmp 0x75bbc
movq -0x388(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x7430
leaq -0x2b0(%rbp), %rdi
callq 0x7708
leaq -0x2d0(%rbp), %rdi
callq 0x7708
leaq -0x1f0(%rbp), %rdi
callq 0x314e0
leaq -0x118(%rbp), %rdi
callq 0x314e0
jmp 0x7601b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x75c2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x7708
leaq -0x241(%rbp), %rdi
callq 0x73d0
jmp 0x75c50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x7708
leaq -0x1f0(%rbp), %rdi
callq 0x314e0
leaq -0x118(%rbp), %rdi
callq 0x314e0
jmp 0x7609e
movq -0x378(%rbp), %rax
testb $0x1, 0x43c(%rax)
je 0x75d51
movb $0x1, -0x2f2(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x3c0(%rbp)
leaq -0x2f1(%rbp), %rdi
movq %rdi, -0x3b8(%rbp)
callq 0x7650
movq -0x3b8(%rbp), %rdx
leaq 0xcad5b(%rip), %rsi     # 0x140a15
leaq -0x2f0(%rbp), %rdi
callq 0x7520
jmp 0x75cc8
movq -0x3c0(%rbp), %rdi
leaq -0x2f0(%rbp), %rsi
callq 0x9c50
jmp 0x75cdd
movq -0x3c0(%rbp), %rdi
movb $0x0, -0x2f2(%rbp)
leaq 0x1380e6(%rip), %rsi    # 0x1addd8
leaq -0x6c069(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x760b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x75d29
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2f0(%rbp), %rdi
callq 0x7708
leaq -0x2f1(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x2f2(%rbp)
jne 0x75d40
jmp 0x75d4c
movq -0x3c0(%rbp), %rdi
callq 0x72c0
jmp 0x7609e
movq -0x378(%rbp), %rax
cmpl $0x190, 0x438(%rax)     # imm = 0x190
jae 0x75dfd
leaq -0x319(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0x7650
movq -0x3c8(%rbp), %rdx
leaq 0xcacae(%rip), %rsi     # 0x140a37
leaq -0x318(%rbp), %rdi
callq 0x7520
jmp 0x75d97
movq -0x378(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x589d0
jmp 0x75dac
leaq -0x318(%rbp), %rdi
callq 0x7708
leaq -0x319(%rbp), %rdi
callq 0x73d0
jmp 0x75dfd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x75dec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x318(%rbp), %rdi
callq 0x7708
leaq -0x319(%rbp), %rdi
callq 0x73d0
jmp 0x7609e
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x3d0(%rbp)
callq 0xa2110
movaps %xmm0, %xmm1
movsd -0x3d0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jne 0x75e65
jp 0x75e65
movq -0x378(%rbp), %rax
testb $0x1, 0x601(%rax)
je 0x75e49
movq -0x388(%rbp), %rdi
leaq 0xcc911(%rip), %rsi     # 0x142751
callq 0x7510
jmp 0x75e47
jmp 0x75e60
movq -0x388(%rbp), %rdi
leaq 0xcc864(%rip), %rsi     # 0x1426bb
callq 0x7510
jmp 0x75e5e
jmp 0x75e60
jmp 0x76019
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x3d8(%rbp)
callq 0xa2110
movaps %xmm0, %xmm1
movsd -0x3d8(%rbp), %xmm0
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
ucomisd %xmm1, %xmm0
jne 0x75ee4
jp 0x75ee4
movq -0x378(%rbp), %rax
testb $0x1, 0x601(%rax)
je 0x75ec8
movq -0x388(%rbp), %rdi
leaq 0xcc8a2(%rip), %rsi     # 0x142761
callq 0x7510
jmp 0x75ec6
jmp 0x75edf
movq -0x388(%rbp), %rdi
leaq 0xcc7f1(%rip), %rsi     # 0x1426c7
callq 0x7510
jmp 0x75edd
jmp 0x75edf
jmp 0x76017
movsd -0x30(%rbp), %xmm0
callq 0xa1fc0
movb %al, -0x3d9(%rbp)
jmp 0x75ef6
movb -0x3d9(%rbp), %al
testb $0x1, %al
jne 0x75f02
jmp 0x75f45
movq -0x378(%rbp), %rax
testb $0x1, 0x601(%rax)
je 0x75f29
movq -0x388(%rbp), %rdi
leaq 0xcc852(%rip), %rsi     # 0x142772
callq 0x7510
jmp 0x75f27
jmp 0x75f40
movq -0x388(%rbp), %rdi
leaq 0xcc79d(%rip), %rsi     # 0x1426d4
callq 0x7510
jmp 0x75f3e
jmp 0x75f40
jmp 0x76015
movb $0x1, -0x342(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x3f0(%rbp)
leaq -0x341(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x7650
movq -0x3e8(%rbp), %rdx
leaq 0xcc708(%rip), %rsi     # 0x142686
leaq -0x340(%rbp), %rdi
callq 0x7520
jmp 0x75f8c
movq -0x3f0(%rbp), %rdi
leaq -0x340(%rbp), %rsi
callq 0x9c50
jmp 0x75fa1
movq -0x3f0(%rbp), %rdi
movb $0x0, -0x342(%rbp)
leaq 0x137e22(%rip), %rsi    # 0x1addd8
leaq -0x6c32d(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x760b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x75fed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x340(%rbp), %rdi
callq 0x7708
leaq -0x341(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x342(%rbp)
jne 0x76004
jmp 0x76010
movq -0x3f0(%rbp), %rdi
callq 0x72c0
jmp 0x7609e
jmp 0x76017
jmp 0x76019
jmp 0x7601b
jmp 0x76078
movsd -0x30(%rbp), %xmm0
leaq -0x368(%rbp), %rdi
callq 0xa2120
jmp 0x76030
movq -0x388(%rbp), %rdi
leaq -0x368(%rbp), %rsi
callq 0x7430
leaq -0x368(%rbp), %rdi
callq 0x7708
movq -0x378(%rbp), %rax
testb $0x1, 0x601(%rax)
je 0x76076
movq -0x388(%rbp), %rdi
leaq 0xcbd34(%rip), %rsi     # 0x141da1
callq 0x7340
jmp 0x76074
jmp 0x76076
jmp 0x76078
movb $0x1, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
jne 0x7608e
movq -0x388(%rbp), %rdi
callq 0x7708
movq -0x380(%rbp), %rax
addq $0x3f0, %rsp            # imm = 0x3F0
popq %rbp
retq
movq -0x388(%rbp), %rdi
callq 0x7708
movq -0x38(%rbp), %rdi
callq 0x7640
nopw %cs:(%rax,%rax)