// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::builtin_to_glsl[abi:cxx11](spv::BuiltIn, spv::StorageClass)
string CompilerMSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage)
{
	switch (builtin)
	{

	// Override GLSL compiler strictness
	case BuiltInVertexId:
		return "gl_VertexID";
	case BuiltInInstanceId:
		return "gl_InstanceID";
	case BuiltInVertexIndex:
		return "gl_VertexIndex";
	case BuiltInInstanceIndex:
		return "gl_InstanceIndex";
	case BuiltInBaseVertex:
		return "gl_BaseVertex";
	case BuiltInBaseInstance:
		return "gl_BaseInstance";
	case BuiltInDrawIndex:
		SPIRV_CROSS_THROW("DrawIndex is not supported in MSL.");

	// When used in the entry function, output builtins are qualified with output struct name.
	// Test storage class as NOT Input, as output builtins might be part of generic type.
	case BuiltInViewportIndex:
		if (!msl_options.supports_msl_version(2, 0))
			SPIRV_CROSS_THROW("ViewportIndex requires Metal 2.0.");
		/* fallthrough */
	case BuiltInPosition:
	case BuiltInPointSize:
	case BuiltInClipDistance:
	case BuiltInCullDistance:
	case BuiltInLayer:
	case BuiltInFragDepth:
	case BuiltInSampleMask:
		if (storage != StorageClassInput && current_function && (current_function->self == ir.default_entry_point))
			return stage_out_var_name + "." + CompilerGLSL::builtin_to_glsl(builtin, storage);

		break;

	default:
		break;
	}

	return CompilerGLSL::builtin_to_glsl(builtin, storage);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
cmpl $0x16, %edx
ja 0x7d2a3
movl %r14d, %eax
leaq 0x1dc0c(%rip), %rcx     # 0x9ae28
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x1, %ebp
je 0x7d2de
movq 0x148(%r15), %rax
testq %rax, %rax
je 0x7d2de
movl 0x8(%rax), %eax
cmpl 0x108(%r15), %eax
jne 0x7d2de
leaq 0x980(%r15), %rsi
leaq 0x185cd(%rip), %rdx     # 0x95829
leaq 0x8(%rsp), %rdi
callq 0x174a5
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x347ea
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x1743e
leaq 0x28(%rsp), %rdi
callq 0x6548
leaq 0x8(%rsp), %rdi
callq 0x6548
jmp 0x7d396
cmpl $0x2a, %r14d
je 0x7d382
cmpl $0x2b, %r14d
je 0x7d367
cmpl $0x1148, %r14d          # imm = 0x1148
je 0x7d379
cmpl $0x1149, %r14d          # imm = 0x1149
je 0x7d370
cmpl $0x114a, %r14d          # imm = 0x114A
je 0x7d3a4
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x347ea
jmp 0x7d396
leaq 0x16d19(%rip), %rsi     # 0x94013
jmp 0x7d389
cmpl $0x4e1f, 0x7d0(%r15) # imm = 0x4E1F
ja 0x7d225
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r14
leaq 0x209b9(%rip), %rsi     # 0x9dcdb
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x69a76(%rip), %rsi     # 0xe6dc0
movq 0x6ac8f(%rip), %rdx     # 0xe7fe0
movq %r14, %rdi
callq 0x6490
jmp 0x7d3ed
leaq 0x16c48(%rip), %rsi     # 0x93fad
jmp 0x7d389
leaq 0x16cc2(%rip), %rsi     # 0x94030
jmp 0x7d389
leaq 0x16ebd(%rip), %rsi     # 0x94234
jmp 0x7d389
leaq 0x16e69(%rip), %rsi     # 0x941e9
jmp 0x7d389
leaq 0x16c98(%rip), %rsi     # 0x94021
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x6100
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r14
leaq 0x208f0(%rip), %rsi     # 0x9dca6
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x699e2(%rip), %rsi     # 0xe6dc0
movq 0x6abfb(%rip), %rdx     # 0xe7fe0
movq %r14, %rdi
callq 0x6490
jmp 0x7d3f1
jmp 0x7d405
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x7d408
jmp 0x7d42e
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0x7d42e
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x6548
jmp 0x7d424
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6548
movq %rbx, %rdi
callq 0x64b0