// File: /workspace/github_cpp_makefile_star2_O1/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 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
movq %rax, %rdi
movq %rcx, %rsi
callq 0x17687
movq 0x10(%rsp), %rax
cmpq 0x18(%rsp), %rax
je 0x17bd8
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rax
subq %rdx, %rax
shrq $0x5, %rax
cmpl $0x2, %eax
jl 0x17ba0
xorl %ebp, %ebp
xorl %r15d, %r15d
movq %r12, %rsi
testq %rbp, %rbp
je 0x17ae2
movq (%rsp), %rsi
addq %rbp, %rdx
leaq 0x30(%rsp), %rdi
callq 0x17824
movq 0x30(%rsp), %r13
testq %r13, %r13
je 0x17b0e
movq %r13, (%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x1ce9a
jmp 0x17b5a
movq %r12, %rax
testq %rbp, %rbp
je 0x17b1a
movq (%rsp), %rax
cmpl $0x0, (%rax)
je 0x17b39
movq 0x40(%rsp), %rax
movb $0x1, (%rax)
movq 0x10(%rsp), %rsi
addq %rbp, %rsi
movq %r14, %rdi
callq 0xb130
jmp 0x17b54
movq 0x80(%rsp), %rax
movb $0x1, (%rax)
movq 0x10(%rsp), %rsi
addq %rbp, %rsi
movq %r14, %rdi
callq 0xb130
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x17b69
callq 0x16eec
testq %r13, %r13
je 0x17bc7
incq %r15
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rax
subq %rdx, %rax
shlq $0x1b, %rax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
addq %rcx, %rax
sarq $0x20, %rax
addq $0x20, %rbp
cmpq %rax, %r15
jl 0x17ad6
movq 0x18(%rsp), %rsi
addq $-0x20, %rsi
movq %r14, %rdi
callq 0xb130
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movaps (%rsp), %xmm0
movq %rax, 0x8(%rsp)
movups %xmm0, (%rbx)
movq %rax, (%rsp)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x17bf6
callq 0x16eec
jmp 0x17bf6
movq 0x8(%r14), %rdx
leaq 0x9891(%rip), %rcx      # 0x21474
movq %r14, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xb310
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
leaq 0x10(%rsp), %rdi
callq 0x16430
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x17c2d
movq %rax, %rbx
jmp 0x17c3f
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x17c30
callq 0x16eec
jmp 0x17c30
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x17c3f
callq 0x16eec
leaq 0x10(%rsp), %rdi
callq 0x16430
movq %rbx, %rdi
callq 0xb3b0
nop