// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
cmpl $0x29, %edx
jg 0xa0d07
cmpl $0x16, %r14d
ja 0xa0edf
movl %r14d, %eax
leaq 0x20254(%rip), %rcx     # 0xc0e88
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x1, %ebp
je 0xa0edf
movq 0x148(%r15), %rax
testq %rax, %rax
je 0xa0edf
movl 0x8(%rax), %eax
cmpl 0x108(%r15), %eax
jne 0xa0edf
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x980(%r15), %rsi
movq 0x988(%r15), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0xe480
leaq 0x1abc5(%rip), %rsi     # 0xbb859
movq %r12, %rdi
callq 0x64e0
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x40af6
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %r8
movq 0x30(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r13, %rcx
je 0xa0cd0
movq 0x18(%rsp), %rsi
cmpq %rsi, %rax
jbe 0xa0cf3
leaq 0x38(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0xa0cea
movq 0x38(%rsp), %rsi
cmpq %rsi, %rax
jbe 0xa0e53
movq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x60b0
jmp 0xa0e61
cmpl $0x1147, %r14d          # imm = 0x1147
jle 0xa0d44
cmpl $0x1148, %r14d          # imm = 0x1148
je 0xa0e31
cmpl $0x1149, %r14d          # imm = 0x1149
jne 0xa0ed6
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x1952c(%rip), %rsi     # 0xba264
leaq 0x19534(%rip), %rdx     # 0xba273
jmp 0xa0e46
cmpl $0x2a, %r14d
je 0xa0e1a
cmpl $0x2b, %r14d
jne 0xa0edf
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x192fa(%rip), %rsi     # 0xba060
leaq 0x19303(%rip), %rdx     # 0xba070
jmp 0xa0e46
cmpl $0x4e1f, 0x7d0(%r15) # imm = 0x4E1F
ja 0xa0c3d
movl $0x10, %edi
callq 0x6140
movq %rax, %r14
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x22fb3(%rip), %rsi     # 0xc3d53
leaq 0x22fcd(%rip), %rdx     # 0xc3d74
leaq 0x8(%rsp), %rdi
callq 0x7c64
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x6320
leaq 0x5bfd0(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0x5bfa8(%rip), %rsi     # 0xfcd80
movq 0x5d1f9(%rip), %rdx     # 0xfdfd8
movq %r14, %rdi
callq 0x6470
jmp 0xa0f65
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x191e3(%rip), %rsi     # 0xb9fdd
leaq 0x191e7(%rip), %rdx     # 0xb9fe8
jmp 0xa0e46
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x19232(%rip), %rsi     # 0xba043
leaq 0x19238(%rip), %rdx     # 0xba050
jmp 0xa0e46
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x19229(%rip), %rsi     # 0xba051
leaq 0x19230(%rip), %rdx     # 0xba05f
jmp 0xa0e46
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x193da(%rip), %rsi     # 0xba219
leaq 0x193e0(%rip), %rdx     # 0xba226
movq %rbx, %rdi
callq 0x7c64
jmp 0xa0eef
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x62c0
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0xa0e80
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0xa0e86
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa0ebd
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0xa0eef
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0xa0eef
cmpl $0x114a, %r14d          # imm = 0x114A
je 0xa0f01
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x40af6
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x6140
movq %rax, %r14
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x22e00(%rip), %rsi     # 0xc3d1e
leaq 0x22e1b(%rip), %rdx     # 0xc3d40
leaq 0x8(%rsp), %rdi
callq 0x7c64
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x6320
leaq 0x5be52(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0x5be2a(%rip), %rsi     # 0xfcd80
movq 0x5d07b(%rip), %rdx     # 0xfdfd8
movq %r14, %rdi
callq 0x6470
jmp 0xa0f69
jmp 0xa0f85
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0xa0f8b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0xa0f8b
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0xa0fd6
movq %r14, %rdi
callq 0x6200
jmp 0xa0fd6
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa0fbf
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0xa0fbf
jmp 0xa0fbc
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0xa0fd6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0