// File: /workspace/github_cpp_makefile_star2_O2/swxlion[P]swxJson/src/swxJson.cpp
// Function: swxJson::Json::getParentNode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, bool&, bool&)
JsonPtr Json::getParentNode(const std::string& path, const std::string& delim, std::string& lastSection, bool& nodeTypeError, bool& nodeNotFound)
{
	nodeTypeError = false;
	nodeNotFound = false;

	std::vector<std::string> sections;
	pathSplit(path, delim, sections);

	if (sections.empty())
	{
		lastSection = "";
		return nullptr;
	}

	JsonPtr node;
	for (int i = 0; i < (int)sections.size() - 1; i++)
	{
		JsonPtr next = (i>0) ? node->getNodeByKey(sections[i]) : getNodeByKey(sections[0]);
		if (next == nullptr)
		{
			enum ElementType nodeType = (i>0) ? node->type() : type();
			if (nodeType == JSON_Object)
			{
				nodeNotFound = true;
				lastSection = sections[i];
				return nullptr;
			}
			else
			{
				nodeTypeError = true;
				lastSection = sections[i];
				return nullptr;
			}
		}
		else
			node = next;
	}

	lastSection = sections[sections.size() - 1];
	return node;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, %r15
movq %r8, %r14
movq %rdx, %rax
movq %rsi, %r13
movq %rdi, %rbx
movq 0x90(%rsp), %rsi
xorl %edx, %edx
movb %dl, (%r9)
movb %dl, (%rsi)
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
movq %rax, %rdi
movq %rcx, %rsi
callq 0x16905
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rax
cmpq %rax, %rdx
je 0x16cb6
movq %r15, 0x50(%rsp)
movq %r14, 0x18(%rsp)
movq %rbx, 0x10(%rsp)
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
movabsq $-0x100000000, %r15     # imm = 0xFFFFFFFF00000000
leaq 0x20(%rsp), %rbx
xorl %r12d, %r12d
xorl %ebp, %ebp
subq %rdx, %rax
movq %rax, %rcx
shlq $0x1b, %rcx
addq %r15, %rcx
sarq $0x20, %rcx
cmpq %rcx, %rbp
jge 0x16ccd
testq %rbp, %rbp
je 0x16c7b
movq (%rsp), %rsi
addq %r12, %rdx
movq %rbx, %rdi
callq 0x16a20
cmpq $0x0, 0x20(%rsp)
jne 0x16c8e
jmp 0x16cf8
movq %rbx, %rdi
movq %r13, %rsi
callq 0x16a20
cmpq $0x0, 0x20(%rsp)
je 0x16cfe
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1ae3a
leaq 0x28(%rsp), %rdi
callq 0x161f0
incq %rbp
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rax
addq $0x20, %r12
jmp 0x16c47
leaq 0x87b7(%rip), %rsi      # 0x1f474
movq %r14, %rdi
callq 0xe3d0
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x16d4b
leaq (%rdx,%rax), %rsi
addq $-0x20, %rsi
movq 0x18(%rsp), %rdi
callq 0xe110
movaps (%rsp), %xmm0
andq $0x0, 0x8(%rsp)
movq 0x10(%rsp), %rbx
movups %xmm0, (%rbx)
andq $0x0, (%rsp)
jmp 0x16d41
movq (%rsp), %r13
jmp 0x16d00
xorl %ebp, %ebp
cmpl $0x0, (%r13)
movq 0x50(%rsp), %rax
cmoveq 0x90(%rsp), %rax
movb $0x1, (%rax)
shlq $0x5, %rbp
addq 0x30(%rsp), %rbp
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0xe110
xorps %xmm0, %xmm0
movq 0x10(%rsp), %rbx
movups %xmm0, (%rbx)
leaq 0x28(%rsp), %rdi
callq 0x161f0
leaq 0x8(%rsp), %rdi
callq 0x161f0
leaq 0x30(%rsp), %rdi
callq 0x15930
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x161f0
jmp 0x16d80
jmp 0x16d7d
movq %rax, %rbx
jmp 0x16d8a
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x161f0
leaq 0x30(%rsp), %rdi
callq 0x15930
movq %rbx, %rdi
callq 0xe3a0