// File: /workspace/github_cpp_makefile_star2_O1/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::remove_unity_swizzle(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool CompilerGLSL::remove_unity_swizzle(uint32_t base, string &op)
{
	auto pos = op.find_last_of('.');
	if (pos == string::npos || pos == 0)
		return false;

	string final_swiz = op.substr(pos + 1, string::npos);

	if (backend.swizzle_is_function)
	{
		if (final_swiz.size() < 2)
			return false;

		if (final_swiz.substr(final_swiz.size() - 2, string::npos) == "()")
			final_swiz.erase(final_swiz.size() - 2, string::npos);
		else
			return false;
	}

	// Check if final swizzle is of form .x, .xy, .xyz, .xyzw or similar.
	// If so, and previous swizzle is of same length,
	// we can drop the final swizzle altogether.
	for (uint32_t i = 0; i < final_swiz.size(); i++)
	{
		static const char expected[] = { 'x', 'y', 'z', 'w' };
		if (i >= 4 || final_swiz[i] != expected[i])
			return false;
	}

	auto &type = expression_type(base);

	// Sanity checking ...
	assert(type.columns == 1 && type.array.empty());

	if (type.vecsize == final_swiz.size())
		op.erase(pos, string::npos);
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
movq %rdx, %rdi
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x64f0
leaq 0x1(%rax), %rdx
cmpq $0x2, %rdx
jae 0x44429
xorl %ebp, %ebp
jmp 0x44557
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq $-0x1, %rcx
callq 0x6290
cmpb $0x1, 0x620(%r15)
jne 0x444d1
movq 0x10(%rsp), %rdx
cmpq $0x2, %rdx
jb 0x444aa
addq $-0x2, %rdx
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq $-0x1, %rcx
callq 0x6290
leaq 0x754e6(%rip), %rsi     # 0xb9960
leaq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x60a0
movl %eax, %r12d
movq (%r13), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x444a5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
testl %r12d, %r12d
je 0x444b1
xorl %ebp, %ebp
jmp 0x4453c
movq 0x10(%rsp), %rcx
movq %rcx, %rdx
subq $0x2, %rdx
jb 0x4459f
movq %rdx, 0x10(%rsp)
movq 0x8(%rsp), %rax
movb $0x0, (%rax,%rdx)
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x44501
movq 0x8(%rsp), %rcx
xorl %edx, %edx
leaq 0x72ff3(%rip), %rsi     # 0xb74dc
cmpq $0x4, %rdx
je 0x444aa
movb (%rcx,%rdx), %dil
cmpb (%rdx,%rsi), %dil
jne 0x444aa
incq %rdx
cmpq %rdx, %rax
jne 0x444e9
movq %r15, %rdi
movl %ebp, %esi
callq 0x12aba
cmpl $0x1, 0x18(%rax)
jne 0x44568
movq 0x20(%rax), %rcx
cmpq 0x28(%rax), %rcx
jne 0x44568
movl 0x14(%rax), %eax
movb $0x1, %bpl
cmpq %rax, 0x10(%rsp)
jne 0x4453c
movq 0x8(%r14), %rcx
cmpq %rbx, %rcx
jb 0x44587
movq %rbx, 0x8(%r14)
movq (%r14), %rax
movb $0x0, (%rax,%rbx)
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x44557
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x765ef(%rip), %rdi     # 0xbab5e
leaq 0x737e2(%rip), %rsi     # 0xb7d58
leaq 0x76609(%rip), %rcx     # 0xbab86
movl $0x179f, %edx           # imm = 0x179F
callq 0x61b0
leaq 0x778f1(%rip), %rdi     # 0xbbe7f
leaq 0x77921(%rip), %rsi     # 0xbbeb6
movq %rbx, %rdx
xorl %eax, %eax
callq 0x63d0
leaq 0x778d9(%rip), %rdi     # 0xbbe7f
leaq 0x77909(%rip), %rsi     # 0xbbeb6
xorl %eax, %eax
callq 0x63d0
jmp 0x445b8
jmp 0x445b8
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x445d6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0