// File: /workspace/github_cpp_makefile_star2_O3/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 0x9fe96
cmpl $0x16, %r14d
ja 0xa006e
movl %r14d, %eax
leaq 0x200d4(%rip), %rcx     # 0xbfe98
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x1, %ebp
je 0xa006e
movq 0x148(%r15), %rax
testq %rax, %rax
je 0xa006e
movl 0x8(%rax), %eax
cmpl 0x108(%r15), %eax
jne 0xa006e
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 0xe456
leaq 0x1aa25(%rip), %rsi     # 0xba849
movq %r12, %rdi
callq 0x64e0
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x402b0
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %r8
movq 0x30(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %r13, %rcx
je 0x9fe60
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rsi
cmpq %rdi, %rax
jbe 0x9fe87
leaq 0x38(%rsp), %r9
movl $0xf, %edi
cmpq %r9, %rsi
je 0x9fe7e
movq 0x38(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x9ffe2
leaq 0x8(%rsp), %rdi
callq 0x60b0
jmp 0x9fff0
cmpl $0x1147, %r14d          # imm = 0x1147
jle 0x9fed3
cmpl $0x1148, %r14d          # imm = 0x1148
je 0x9ffc0
cmpl $0x1149, %r14d          # imm = 0x1149
jne 0xa0065
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x1938d(%rip), %rsi     # 0xb9254
leaq 0x19395(%rip), %rdx     # 0xb9263
jmp 0x9ffd5
cmpl $0x2a, %r14d
je 0x9ffa9
cmpl $0x2b, %r14d
jne 0xa006e
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x1915b(%rip), %rsi     # 0xb9050
leaq 0x19164(%rip), %rdx     # 0xb9060
jmp 0x9ffd5
cmpl $0x4e1f, 0x7d0(%r15) # imm = 0x4E1F
ja 0x9fdcd
movl $0x10, %edi
callq 0x6140
movq %rax, %r14
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x22df4(%rip), %rsi     # 0xc2d23
leaq 0x22e0e(%rip), %rdx     # 0xc2d44
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x6320
leaq 0x5be71(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0x5be49(%rip), %rsi     # 0xfbdb0
movq 0x5d06a(%rip), %rdx     # 0xfcfd8
movq %r14, %rdi
callq 0x6470
jmp 0xa00f4
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x19044(%rip), %rsi     # 0xb8fcd
leaq 0x19048(%rip), %rdx     # 0xb8fd8
jmp 0x9ffd5
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x19093(%rip), %rsi     # 0xb9033
leaq 0x19099(%rip), %rdx     # 0xb9040
jmp 0x9ffd5
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x1908a(%rip), %rsi     # 0xb9041
leaq 0x19091(%rip), %rdx     # 0xb904f
jmp 0x9ffd5
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x1923b(%rip), %rsi     # 0xb9209
leaq 0x19241(%rip), %rdx     # 0xb9216
movq %rbx, %rdi
callq 0x7be0
jmp 0xa007e
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 0xa000f
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0xa0015
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 0xa004c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0xa007e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0xa007e
cmpl $0x114a, %r14d          # imm = 0x114A
je 0xa0090
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x402b0
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 0x22c41(%rip), %rsi     # 0xc2cee
leaq 0x22c5c(%rip), %rdx     # 0xc2d10
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x6320
leaq 0x5bcf3(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0x5bccb(%rip), %rsi     # 0xfbdb0
movq 0x5ceec(%rip), %rdx     # 0xfcfd8
movq %r14, %rdi
callq 0x6470
jmp 0xa00f8
jmp 0xa0119
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0xa0112
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0xa011c
jmp 0xa0162
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0xa0162
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa014b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0xa014b
jmp 0xa0148
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0xa0162
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0