// File: /workspace/github_cpp_makefile_star2_O3/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 $0x48, %rsp
movq %r8, %r14
movq %rdx, %rax
movq %rsi, %r12
movq %rdi, %rbx
movq 0x80(%rsp), %rsi
xorl %edx, %edx
movq %r9, 0x40(%rsp)
movb %dl, (%r9)
movb %dl, (%rsi)
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
movq %rax, %rdi
movq %rcx, %rsi
callq 0x17409
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rax
cmpq %rax, %rdx
je 0x17950
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
subq %rdx, %rax
movq %rax, %rcx
shrq $0x5, %rcx
cmpl $0x2, %ecx
jl 0x1793a
xorl %ebp, %ebp
xorl %r15d, %r15d
testq %rbp, %rbp
je 0x17878
movq (%rsp), %rsi
addq %rbp, %rdx
leaq 0x10(%rsp), %rdi
callq 0x175ae
movq 0x10(%rsp), %rax
testq %rax, %rax
jne 0x17892
movq (%rsp), %rcx
jmp 0x178aa
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x175ae
movq 0x10(%rsp), %rax
movq %r12, %rcx
testq %rax, %rax
je 0x178aa
movq %rax, (%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x1cb6c
xorl %r13d, %r13d
jmp 0x178ed
cmpl $0x0, (%rcx)
je 0x178c9
movq 0x40(%rsp), %rax
movb $0x1, (%rax)
movq 0x20(%rsp), %rsi
addq %rbp, %rsi
movq %r14, %rdi
callq 0xb130
jmp 0x178e4
movq 0x80(%rsp), %rax
movb $0x1, (%rax)
movq 0x20(%rsp), %rsi
addq %rbp, %rsi
movq %r14, %rdi
callq 0xb130
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movb $0x1, %r13b
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x178fc
callq 0x16c72
testb %r13b, %r13b
jne 0x1798a
incq %r15
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rax
subq %rdx, %rax
movq %rax, %rcx
shlq $0x1b, %rcx
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
addq %rsi, %rcx
sarq $0x20, %rcx
addq $0x20, %rbp
cmpq %rcx, %r15
jl 0x17852
leaq (%rdx,%rax), %rsi
addq $-0x20, %rsi
movq %r14, %rdi
callq 0xb130
movaps (%rsp), %xmm0
jmp 0x1796b
movq 0x8(%r14), %rdx
leaq 0x8b19(%rip), %rcx      # 0x20474
movq %r14, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb310
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
leaq 0x20(%rsp), %rdi
callq 0x161bc
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1796e
callq 0x16c72
jmp 0x1796e
jmp 0x179b6
movq %rax, %rbx
jmp 0x179c8
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x179b9
callq 0x16c72
jmp 0x179b9
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x179c8
callq 0x16c72
leaq 0x20(%rsp), %rdi
callq 0x161bc
movq %rbx, %rdi
callq 0xb3b0