// File: /workspace/github_cpp_makefile_star2_O1/halsafar[P]libtmx-parser/./src/tmxparser.cpp
// Function: tmxparser::_updatePath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string _updatePath(std::string path, const std::string& tilesetPath)
{
	auto pathSeperatorMissing = (path.find(PATH_SEPARATOR) == std::string::npos);
	auto pathSeperatorAltMissing = (path.find(PATH_SEPARATOR_ALT) == std::string::npos);

	if (pathSeperatorMissing && pathSeperatorAltMissing) // no path_seperator found --> relative path
	{
		std::string baseFilename = path.substr(path.find_last_of(PATH_SEPARATOR) + 1);

		/*
		 * here we find out what separator is used in tilesetPath and choose it
		 * if both (alternative and normal) separators are used, we always use the normal separator
		 **/
		auto seperatorThere = (tilesetPath.find(PATH_SEPARATOR) != std::string::npos);
		auto seperatorAltThere = (tilesetPath.find(PATH_SEPARATOR_ALT) != std::string::npos);
		auto tileSetPathSeparator = PATH_SEPARATOR;

		if (!seperatorThere && seperatorAltThere) // only alternative separator exists in tilesetPath --> choose it
			tileSetPathSeparator = PATH_SEPARATOR_ALT;

		return tilesetPath + tileSetPathSeparator + baseFilename;
	}

  return path;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xd4e4(%rip), %r12      # 0x12e11
movl $0x1, %ecx
movq %rsi, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x43b0
movq %rax, %r13
movl $0x1, %ecx
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x43b0
andq %r13, %rax
cmpq $-0x1, %rax
je 0x5983
leaq 0x10(%rbx), %rcx
movq %rcx, (%rbx)
movq (%r15), %rdx
leaq 0x10(%r15), %rax
cmpq %rax, %rdx
je 0x5a3a
movq %rdx, (%rbx)
movq (%rax), %rcx
movq %rcx, 0x10(%rbx)
jmp 0x5a40
leaq 0xd487(%rip), %r12      # 0x12e11
movl $0x1, %ecx
movq %r15, %rdi
movq %r12, %rsi
movq $-0x1, %rdx
callq 0x4460
leaq 0x1(%rax), %rdx
leaq -0x68(%rbp), %rdi
movq %r15, %rsi
movq $-0x1, %rcx
callq 0x4220
movl $0x1, %ecx
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x43b0
movl $0x1, %ecx
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x43b0
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x90b8
leaq 0xd413(%rip), %rsi      # 0x12e11
leaq -0x48(%rbp), %rdi
callq 0x4430
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0x4090
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x5a5a
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x5a60
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x8(%r15), %rcx
movq %rcx, 0x8(%rbx)
movq %rax, (%r15)
movq $0x0, 0x8(%r15)
movb $0x0, 0x10(%r15)
jmp 0x5a97
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x5a85
callq 0x41c0
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5a97
callq 0x41c0
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5aab
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x5ac1
callq 0x41c0
jmp 0x5ac1
movq %rax, %rbx
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5ad3
callq 0x41c0
movq %rbx, %rdi
callq 0x43d0