// File: swxlion[P]swxJson/src/swxJson.cpp
// Function: swxJson::Json::createNode(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&, bool)
JsonPtr Json::createNode(const std::string& path, const std::string& delim, bool throwable)
{
	std::vector<std::string> sections;
	pathSplit(path, delim, sections);

	if (sections.empty())
		sections.push_back("");

	JsonPtr node;
	size_t i = 0;
	for (; i < sections.size(); 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)
				break;				//-- not found
			else if (nodeType == JSON_Uninit)
			{
				if (i < sections.size() - 1)
				{
					if (i > 0)
						node->setDict();
					else
						setDict();
				}
				break;
			}
			else
			{
				if (throwable)
					throw JSON_ERROR_FMT(JsonNodeTypeMissMatchError, "Section %d (%s)(base 0) in path is not object.", (int)i, sections[i].c_str());

				return nullptr;
			}
		}
		else
			node = next;
	}

	for (; i < sections.size() - 1; i++)
	{
		node = (i > 0) ? node->dictAddObject(sections[i]) : dictAddObject(sections[0]);
	}

	if (i == sections.size() - 1)
	{
		JsonPtr n(new Json());
		if (i > 0)
			node->addNode(sections[i], n);
		else
			addNode(sections[0], n);

		return n;
	}

	return node;
}

// Assembly:
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, 0x90(%rsp)
movb %r8b, %al
movq %rdi, %r8
movq %r8, 0x98(%rsp)
movq %rdi, 0x1b0(%rsp)
movq %rsi, 0x1a8(%rsp)
movq %rdx, 0x1a0(%rsp)
movq %rcx, 0x198(%rsp)
andb $0x1, %al
movb %al, 0x197(%rsp)
movq 0x1a8(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0x178(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0x3ecd0
movq 0xa8(%rsp), %rdx
movq 0x1a0(%rsp), %rdi
movq 0x198(%rsp), %rsi
callq 0x36a80
jmp 0x3765a
leaq 0x178(%rsp), %rdi
callq 0x3ece0
testb $0x1, %al
jne 0x37670
jmp 0x37738
leaq 0x147(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x224b0
movq 0x88(%rsp), %rdx
leaq 0x13de0(%rip), %rsi     # 0x4b474
leaq 0x148(%rsp), %rdi
callq 0x30e50
jmp 0x376a3
leaq 0x178(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x3eb90
jmp 0x376ba
leaq 0x148(%rsp), %rdi
callq 0x22160
leaq 0x147(%rsp), %rdi
callq 0x22320
jmp 0x37738
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x37df2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x37726
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x22160
leaq 0x147(%rsp), %rdi
callq 0x22320
jmp 0x37df2
leaq 0x130(%rsp), %rdi
callq 0x31340
movq $0x0, 0x128(%rsp)
movq 0x128(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x3ed50
movq %rax, %rcx
movq 0x80(%rsp), %rax
cmpq %rcx, %rax
jae 0x37ad0
cmpq $0x0, 0x128(%rsp)
jbe 0x377cd
leaq 0x130(%rsp), %rdi
callq 0x312a0
movq %rax, 0x78(%rsp)
movq 0x128(%rsp), %rsi
leaq 0x178(%rsp), %rdi
callq 0x3ed30
movq 0x78(%rsp), %rsi
movq %rax, %rdx
leaq 0x118(%rsp), %rdi
callq 0x36dd0
jmp 0x377cb
jmp 0x377fa
xorl %eax, %eax
movl %eax, %esi
leaq 0x178(%rsp), %rdi
callq 0x3ed30
movq 0xa0(%rsp), %rsi
movq %rax, %rdx
leaq 0x118(%rsp), %rdi
callq 0x36dd0
jmp 0x377f8
jmp 0x377fa
leaq 0x118(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3ed70
testb $0x1, %al
jne 0x37814
jmp 0x37a57
cmpq $0x0, 0x128(%rsp)
jbe 0x37844
leaq 0x130(%rsp), %rdi
callq 0x312a0
movq %rax, %rdi
callq 0x312b0
movl %eax, 0x74(%rsp)
jmp 0x3783a
movl 0x74(%rsp), %eax
movl %eax, 0x70(%rsp)
jmp 0x37861
movq 0xa0(%rsp), %rdi
callq 0x312b0
movl %eax, 0x6c(%rsp)
jmp 0x37857
movl 0x6c(%rsp), %eax
movl %eax, 0x70(%rsp)
jmp 0x37861
movl 0x70(%rsp), %eax
movl %eax, 0x114(%rsp)
cmpl $0x0, 0x114(%rsp)
jne 0x378b8
movl $0x2, 0x110(%rsp)
jmp 0x37a77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x37de5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x37abe
cmpl $0x8, 0x114(%rsp)
jne 0x37934
movq 0x128(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x3ed50
movq %rax, %rcx
movq 0x60(%rsp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x37924
cmpq $0x0, 0x128(%rsp)
jbe 0x37911
leaq 0x130(%rsp), %rdi
callq 0x312a0
movq %rax, %rdi
callq 0x37e10
jmp 0x3790f
jmp 0x37922
movq 0xa0(%rsp), %rdi
callq 0x37e10
jmp 0x37920
jmp 0x37922
jmp 0x37924
movl $0x2, 0x110(%rsp)
jmp 0x37a77
testb $0x1, 0x197(%rsp)
je 0x37a39
movb $0x1, 0xef(%rsp)
movl $0x60, %edi
callq 0x22100
movq %rax, 0x50(%rsp)
movq 0x128(%rsp), %rsi
movl %esi, %eax
movl %eax, 0x5c(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x3ed30
movq %rax, %rdi
callq 0x220d0
movl 0x5c(%rsp), %edx
movq %rax, %rcx
leaq 0x13cff(%rip), %rsi     # 0x4b689
xorl %eax, %eax
leaq 0xf0(%rsp), %rdi
callq 0x49820
jmp 0x3799b
movq 0x50(%rsp), %rdi
leaq 0x13ccb(%rip), %rsi     # 0x4b672
leaq 0x13cd0(%rip), %rdx     # 0x4b67e
movl $0x18e, %ecx            # imm = 0x18E
leaq 0xf0(%rsp), %r8
callq 0x3ee00
jmp 0x379c2
movq 0x50(%rsp), %rdi
movb $0x0, 0xef(%rsp)
leaq 0x202e2(%rip), %rsi     # 0x57cb8
leaq 0x7483(%rip), %rdx      # 0x3ee60
callq 0x22480
jmp 0x37e0c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x37a1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x22160
testb $0x1, 0xef(%rsp)
jne 0x37a2a
jmp 0x37a34
movq 0x50(%rsp), %rdi
callq 0x221d0
jmp 0x37abe
movq 0x90(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3ec30
movl $0x1, 0x110(%rsp)
jmp 0x37a77
leaq 0x130(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x3eda0
movl $0x0, 0x110(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x31150
movl 0x110(%rsp), %eax
movl %eax, 0x4c(%rsp)
testl %eax, %eax
je 0x37aa3
jmp 0x37a95
movl 0x4c(%rsp), %eax
subl $0x2, %eax
je 0x37ad0
jmp 0x37dbb
jmp 0x37aa5
movq 0x128(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x128(%rsp)
jmp 0x37751
leaq 0x118(%rsp), %rdi
callq 0x31150
jmp 0x37de5
jmp 0x37ad2
movq 0x128(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x3ed50
movq %rax, %rcx
movq 0x40(%rsp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x37bb4
cmpq $0x0, 0x128(%rsp)
jbe 0x37b4c
leaq 0x130(%rsp), %rdi
callq 0x312a0
movq %rax, 0x38(%rsp)
movq 0x128(%rsp), %rsi
leaq 0x178(%rsp), %rdi
callq 0x3ed30
movq 0x38(%rsp), %rsi
movq %rax, %rdx
leaq 0xd8(%rsp), %rdi
callq 0x37ea0
jmp 0x37b4a
jmp 0x37b79
xorl %eax, %eax
movl %eax, %esi
leaq 0x178(%rsp), %rdi
callq 0x3ed30
movq 0xa0(%rsp), %rsi
movq %rax, %rdx
leaq 0xd8(%rsp), %rdi
callq 0x37ea0
jmp 0x37b77
jmp 0x37b79
leaq 0x130(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x31350
leaq 0xd8(%rsp), %rdi
callq 0x31150
movq 0x128(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x128(%rsp)
jmp 0x37ad2
movq 0x128(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x3ed50
movq %rax, %rcx
movq 0x30(%rsp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x37d9b
movb $0x0, 0xd7(%rsp)
movl $0x10, %edi
callq 0x222b0
movq %rax, 0x28(%rsp)
jmp 0x37bfc
movq 0x28(%rsp), %rdi
callq 0x30e30
jmp 0x37c08
movq 0x28(%rsp), %rsi
movq 0x90(%rsp), %rdi
callq 0x33200
jmp 0x37c1c
cmpq $0x0, 0x128(%rsp)
jbe 0x37ce7
leaq 0x130(%rsp), %rdi
callq 0x312a0
movq %rax, 0x10(%rsp)
movq 0x128(%rsp), %rsi
leaq 0x178(%rsp), %rdi
callq 0x3ed30
movq 0x90(%rsp), %rsi
movq %rax, 0x18(%rsp)
leaq 0xc0(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x31120
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x37ff0
jmp 0x37c87
leaq 0xc0(%rsp), %rdi
callq 0x31150
jmp 0x37d60
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
movl $0x10, %esi
callq 0x222c0
jmp 0x37de5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x31150
jmp 0x37d8c
xorl %eax, %eax
movl %eax, %esi
leaq 0x178(%rsp), %rdi
callq 0x3ed30
movq 0x90(%rsp), %rsi
movq %rax, (%rsp)
leaq 0xb0(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x31120
movq 0xa0(%rsp), %rdi
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x37ff0
jmp 0x37d2e
leaq 0xb0(%rsp), %rdi
callq 0x31150
jmp 0x37d60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x31150
jmp 0x37d8c
movb $0x1, 0xd7(%rsp)
movl $0x1, 0x110(%rsp)
testb $0x1, 0xd7(%rsp)
jne 0x37d8a
movq 0x90(%rsp), %rdi
callq 0x31150
jmp 0x37dbb
movq 0x90(%rsp), %rdi
callq 0x31150
jmp 0x37de5
movq 0x90(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x3edd0
movl $0x1, 0x110(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x31150
leaq 0x178(%rsp), %rdi
callq 0x32770
movq 0x98(%rsp), %rax
addq $0x1b8, %rsp            # imm = 0x1B8
retq
leaq 0x130(%rsp), %rdi
callq 0x31150
leaq 0x178(%rsp), %rdi
callq 0x32770
movq 0x170(%rsp), %rdi
callq 0x224a0
nopl (%rax)