// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::replace_illegal_names()
void CompilerMSL::replace_illegal_names()
{
	// FIXME: MSL and GLSL are doing two different things here.
	// Agree on convention and remove this override.
	static const unordered_set<string> keywords = {
		"kernel", "vertex", "fragment", "compute", "bias",
	};

	static const unordered_set<string> illegal_func_names = {
		"main",
		"saturate",
	};

	for (auto &id : ir.ids)
	{
		switch (id.get_type())
		{
		case TypeVariable:
		{
			auto &dec = ir.meta[id.get_id()].decoration;
			if (keywords.find(dec.alias) != end(keywords))
				dec.alias += "0";

			break;
		}

		case TypeFunction:
		{
			auto &dec = ir.meta[id.get_id()].decoration;
			if (illegal_func_names.find(dec.alias) != end(illegal_func_names))
				dec.alias += "0";

			break;
		}

		case TypeType:
		{
			for (auto &mbr_dec : ir.meta[id.get_id()].members)
				if (keywords.find(mbr_dec.alias) != end(keywords))
					mbr_dec.alias += "0";

			break;
		}

		default:
			break;
		}
	}

	for (auto &entry : ir.entry_points)
	{
		// Change both the entry point name and the alias, to keep them synced.
		string &ep_name = entry.second.name;
		if (illegal_func_names.find(ep_name) != end(illegal_func_names))
			ep_name += "0";

		// Always write this because entry point might have been renamed earlier.
		ir.meta[entry.first].decoration.alias = ep_name;
	}

	CompilerGLSL::replace_illegal_names();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %rbx
movb 0x6c334(%rip), %al      # 0xe8670
testb %al, %al
je 0x7c4ce
movb 0x6c366(%rip), %al      # 0xe86b0
testb %al, %al
je 0x7c5e0
movq 0x20(%rbx), %rbp
movq %rbx, 0x10(%rsp)
movq 0x28(%rbx), %r12
leaq 0x6c2d2(%rip), %r14     # 0xe8638
leaq 0x2171e(%rip), %r15     # 0x9da8b
cmpq %r12, %rbp
je 0x7c459
movl 0x8(%rbp), %eax
cmpl $0x1, %eax
je 0x7c3af
cmpl $0x4, %eax
je 0x7c3a1
cmpl $0x2, %eax
jne 0x7c450
movq (%rbp), %rax
testq %rax, %rax
je 0x7c423
movl 0x8(%rax), %eax
jmp 0x7c425
movq (%rbp), %rax
testq %rax, %rax
je 0x7c3bd
movl 0x8(%rax), %eax
jmp 0x7c3bf
movq (%rbp), %rax
testq %rax, %rax
je 0x7c3d8
movl 0x8(%rax), %eax
jmp 0x7c3da
xorl %eax, %eax
imulq $0x148, %rax, %r13      # imm = 0x148
movq 0x10(%rsp), %rax
addq 0x38(%rax), %r13
leaq 0x6c2a2(%rip), %rdi     # 0xe8678
jmp 0x7c438
xorl %eax, %eax
movq 0x10(%rsp), %rcx
movq 0x38(%rcx), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
movq 0xd0(%rcx,%rax), %r13
movq 0xd8(%rcx,%rax), %rbx
cmpq %rbx, %r13
je 0x7c450
movq %r14, %rdi
movq %r13, %rsi
callq 0x49a84
testq %rax, %rax
je 0x7c41a
movq %r13, %rdi
movq %r15, %rsi
callq 0x64d0
addq $0xd0, %r13
jmp 0x7c3fa
xorl %eax, %eax
imulq $0x148, %rax, %r13      # imm = 0x148
movq 0x10(%rsp), %rax
addq 0x38(%rax), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x49a84
testq %rax, %rax
je 0x7c450
movq %r13, %rdi
movq %r15, %rsi
callq 0x64d0
addq $0x10, %rbp
jmp 0x7c36d
movq 0x10(%rsp), %rbx
leaq 0xe0(%rbx), %r13
leaq 0x6c20c(%rip), %r14     # 0xe8678
leaq 0x21618(%rip), %r15     # 0x9da8b
movq (%r13), %r13
testq %r13, %r13
je 0x7c4b4
leaq 0x18(%r13), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x49a84
testq %rax, %rax
je 0x7c49b
movq %r12, %rdi
movq %r15, %rsi
callq 0x64d0
movl 0x8(%r13), %eax
imulq $0x148, %rax, %rdi      # imm = 0x148
addq 0x38(%rbx), %rdi
movq %r12, %rsi
callq 0x6170
jmp 0x7c473
movq %rbx, %rdi
callq 0x274fa
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6c19b(%rip), %r14     # 0xe8670
movq %r14, %rdi
callq 0x64c0
testl %eax, %eax
je 0x7c344
movq %rbx, %r13
leaq 0x218d2(%rip), %rsi     # 0x9ddc1
leaq 0x18(%rsp), %r15
leaq 0xc(%rsp), %rdx
movq %r15, %rdi
callq 0x6100
leaq 0x38(%rsp), %r12
leaq 0x21d03(%rip), %rsi     # 0x9e210
leaq 0xb(%rsp), %rdx
movq %r12, %rdi
callq 0x6100
leaq 0x58(%rsp), %r12
leaq 0x21892(%rip), %rsi     # 0x9ddb8
leaq 0xa(%rsp), %rdx
movq %r12, %rdi
callq 0x6100
leaq 0x78(%rsp), %r12
leaq 0x21959(%rip), %rsi     # 0x9de98
leaq 0x9(%rsp), %rdx
movq %r12, %rdi
callq 0x6100
leaq 0x98(%rsp), %r12
leaq 0x1c95d(%rip), %rsi     # 0x98eb8
leaq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x6100
leaq 0xb8(%rsp), %rdx
leaq 0xd(%rsp), %rax
movq %rax, (%rsp)
leaq 0x6c0b8(%rip), %rdi     # 0xe8638
leaq 0x18(%rsp), %rsi
leaq 0xf(%rsp), %r8
leaq 0xe(%rsp), %r9
xorl %ecx, %ecx
callq 0x499c8
movl $0x80, %ebx
leaq (%rsp,%rbx), %rdi
addq $0x18, %rdi
callq 0x6548
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x7c59b
leaq -0x39fd7(%rip), %rdi    # 0x425e2
leaq 0x6c078(%rip), %rsi     # 0xe8638
leaq 0x6bcd9(%rip), %rdx     # 0xe82a0
callq 0x6240
leaq 0x6c09d(%rip), %rdi     # 0xe8670
callq 0x61b0
movq %r13, %rbx
jmp 0x7c344
leaq 0x6c0c9(%rip), %r14     # 0xe86b0
movq %r14, %rdi
callq 0x64c0
testl %eax, %eax
je 0x7c352
movq %rbx, %r15
leaq 0x1c46c(%rip), %rsi     # 0x98a6d
leaq 0x18(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x6100
leaq 0x38(%rsp), %rdi
leaq 0x21884(%rip), %rsi     # 0x9dea0
leaq 0xb(%rsp), %rdx
callq 0x6100
leaq 0x58(%rsp), %rdx
leaq 0x8(%rsp), %rax
movq %rax, (%rsp)
leaq 0x6c03d(%rip), %rdi     # 0xe8678
leaq 0x18(%rsp), %rsi
leaq 0xa(%rsp), %r8
leaq 0x9(%rsp), %r9
xorl %ecx, %ecx
callq 0x499c8
pushq $0x20
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0x18, %rdi
callq 0x6548
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x7c654
leaq -0x3a090(%rip), %rdi    # 0x425e2
leaq 0x6bfff(%rip), %rsi     # 0xe8678
leaq 0x6bc20(%rip), %rdx     # 0xe82a0
callq 0x6240
leaq 0x6c024(%rip), %rdi     # 0xe86b0
callq 0x61b0
movq %r15, %rbx
jmp 0x7c352
movq %rax, %rbx
pushq $0x20
popq %r15
leaq (%rsp,%r15), %rdi
addq $0x18, %rdi
callq 0x6548
addq $-0x20, %r15
cmpq $-0x20, %r15
jne 0x7c6a0
jmp 0x7c70b
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x6548
jmp 0x7c70b
jmp 0x7c708
movq %rax, %rbx
movl $0x80, %r15d
leaq (%rsp,%r15), %rdi
addq $0x18, %rdi
callq 0x6548
addq $-0x20, %r15
cmpq $-0x20, %r15
jne 0x7c6d3
jmp 0x7c70b
jmp 0x7c6f2
jmp 0x7c6f2
jmp 0x7c6f2
movq %rax, %rbx
addq $-0x20, %r12
movq %r12, %rdi
callq 0x6548
cmpq %r15, %r12
jne 0x7c6f5
jmp 0x7c70b
movq %rax, %rbx
movq %r14, %rdi
callq 0x61a0
movq %rbx, %rdi
callq 0x64b0
nop