// File: rossy[P]crossc/SPIRV-Cross/spirv_cross.cpp
// Function: spirv_cross::Compiler::update_name_cache(std::unordered_set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
void Compiler::update_name_cache(unordered_set<string> &cache, string &name)
{
	if (name.empty())
		return;

	if (cache.find(name) == end(cache))
	{
		cache.insert(name);
		return;
	}

	uint32_t counter = 0;
	auto tmpname = name;

	bool use_linked_underscore = true;

	if (tmpname == "_")
	{
		// We cannot just append numbers, as we will end up creating internally reserved names.
		// Make it like _0_<counter> instead.
		tmpname += "0";
	}
	else if (tmpname.back() == '_')
	{
		// The last_character is an underscore, so we don't need to link in underscore.
		// This would violate double underscore rules.
		use_linked_underscore = false;
	}

	// If there is a collision (very rare),
	// keep tacking on extra identifier until it's unique.
	do
	{
		counter++;
		name = tmpname + (use_linked_underscore ? "_" : "") + convert_to_string(counter);
	} while (cache.find(name) != end(cache));
	cache.insert(name);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x75f0
testb $0x1, %al
jne 0x22a76
jmp 0x22a7b
jmp 0x22c7b
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2f720
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2f750
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x2f6f0
testb $0x1, %al
jne 0x22aac
jmp 0x22ac5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2f780
movq %rax, -0x38(%rbp)
movb %dl, -0x30(%rbp)
jmp 0x22c7b
movl $0x0, -0x3c(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x7170
movq -0x108(%rbp), %rdi
movb $0x1, -0x61(%rbp)
leaq 0x125a2c(%rip), %rsi    # 0x14851e
callq 0x2f7c0
movb %al, -0xf9(%rbp)
jmp 0x22aff
movb -0xf9(%rbp), %al
testb $0x1, %al
jne 0x22b0b
jmp 0x22b30
leaq 0x12a67d(%rip), %rsi    # 0x14d18f
leaq -0x60(%rbp), %rdi
callq 0x7340
jmp 0x22b1d
jmp 0x22b47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x22cb6
leaq -0x60(%rbp), %rdi
callq 0x72b0
movsbl (%rax), %eax
cmpl $0x5f, %eax
jne 0x22b45
movb $0x0, -0x61(%rbp)
jmp 0x22b47
jmp 0x22b49
movl -0x3c(%rbp), %eax
incl %eax
movl %eax, -0x3c(%rbp)
movb -0x61(%rbp), %cl
leaq 0x1259c3(%rip), %rax    # 0x14851e
leaq 0x11bd3c(%rip), %rdx    # 0x13e89e
testb $0x1, %cl
cmovneq %rax, %rdx
leaq -0xb8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x2f8c0
jmp 0x22b7b
leaq -0xd8(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x2f940
jmp 0x22b8d
leaq -0x98(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x2f7f0
jmp 0x22ba9
movq -0x18(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x7430
leaq -0x98(%rbp), %rdi
callq 0x7708
leaq -0xd8(%rbp), %rdi
callq 0x7708
leaq -0xb8(%rbp), %rdi
callq 0x7708
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2f720
movq %rax, -0x110(%rbp)
jmp 0x22bf3
movq -0x110(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2f750
movq %rax, -0x118(%rbp)
jmp 0x22c13
movq -0x118(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x2f970
testb $0x1, %al
jne 0x22b49
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2f780
movb %dl, -0x121(%rbp)
movq %rax, -0x120(%rbp)
jmp 0x22c58
movb -0x121(%rbp), %al
movq -0x120(%rbp), %rcx
movq %rcx, -0xf8(%rbp)
movb %al, -0xf0(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x7708
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x22caa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x7708
leaq -0xb8(%rbp), %rdi
callq 0x7708
leaq -0x60(%rbp), %rdi
callq 0x7708
movq -0x70(%rbp), %rdi
callq 0x7640
nopl (%rax,%rax)