// File: swxlion[P]swxJson/src/swxJsonParser.cpp
// Function: swxJson::JsonParser::parse(char const*)
JsonPtr JsonParser::parse(const char* json)
{
	if (!json || *json == 0)
		throw JSON_ERROR_MSG(JosnInvalidContentError, "Json parser: content error. Empty content.");

	_pos = (char *)json;
	JsonPtr root;

	while (*_pos != 0)
	{
		while (isspace(*_pos) != 0)
			_pos++;

		if (root || *_pos == 0) break;
		root = (this->*_callMap[(unsigned char)(*_pos)])();
	}

	if (*_pos != 0)
		throw JSON_ERROR_MSG(JosnInvalidContentError, "Json parser: content error. Maybe multi-jsons.");

	if (root == nullptr)
		throw JSON_ERROR_MSG(JosnInvalidContentError, "Json parser: invalid or incomplete data.");

	return root;
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x50(%rsp)
movq %rdi, %rax
movq %rax, 0x58(%rsp)
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movq %rdx, 0x100(%rsp)
movq 0x108(%rsp), %rax
movq %rax, 0x60(%rsp)
cmpq $0x0, 0x100(%rsp)
je 0x7cbd8
movq 0x100(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x7ccc7
movb $0x1, 0xcb(%rsp)
movl $0x60, %edi
callq 0x4a160
movq %rax, 0x40(%rsp)
leaq 0xdf(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x4a530
movq 0x48(%rsp), %rdx
leaq 0x5f36(%rip), %rsi      # 0x82b43
leaq 0xe0(%rsp), %rdi
callq 0x4dcf0
jmp 0x7cc1c
movq 0x40(%rsp), %rdi
leaq 0x5ed8(%rip), %rsi      # 0x82b00
leaq 0x5f0e(%rip), %rdx      # 0x82b3d
movl $0x207, %ecx            # imm = 0x207
leaq 0xe0(%rsp), %r8
callq 0x7d0d0
jmp 0x7cc43
movq 0x40(%rsp), %rdi
movb $0x0, 0xcb(%rsp)
leaq 0x1b101(%rip), %rsi     # 0x97d58
leaq 0x4d2(%rip), %rdx       # 0x7d130
callq 0x4a500
jmp 0x7d03f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
jmp 0x7cc9f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x4a5b8
leaq 0xdf(%rsp), %rdi
callq 0x4a390
testb $0x1, 0xcb(%rsp)
jne 0x7ccb8
jmp 0x7ccc2
movq 0x40(%rsp), %rdi
callq 0x4a220
jmp 0x7d032
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rax
movq 0x100(%rsp), %rcx
movq %rcx, 0x12f0(%rax)
movb $0x0, 0xca(%rsp)
callq 0x71fd0
movq 0x60(%rsp), %rax
movq 0x12f0(%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x7ce0d
jmp 0x7cd07
movq 0x60(%rsp), %rax
movq 0x12f0(%rax), %rax
movsbl (%rax), %edi
callq 0x4a070
cmpl $0x0, %eax
je 0x7cd39
movq 0x60(%rsp), %rax
movq 0x12f0(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x12f0(%rax)
jmp 0x7cd07
movq 0x50(%rsp), %rdi
callq 0x52990
testb $0x1, %al
jne 0x7cd5b
movq 0x60(%rsp), %rax
movq 0x12f0(%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x7cd60
jmp 0x7ce0d
movq 0x60(%rsp), %rcx
movq 0x12f0(%rcx), %rax
movzbl (%rax), %eax
shll $0x4, %eax
movl %eax, %edx
movq (%rcx,%rdx), %rax
movq %rax, 0x30(%rsp)
movq 0x8(%rcx,%rdx), %rdx
addq %rdx, %rcx
movq %rcx, 0x38(%rsp)
andq $0x1, %rax
cmpq $0x0, %rax
je 0x7cdb0
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rax
movq (%rax), %rax
subq $0x1, %rcx
movq (%rax,%rcx), %rax
movq %rax, 0x28(%rsp)
jmp 0x7cdba
movq 0x30(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x38(%rsp), %rsi
movq 0x28(%rsp), %rax
leaq 0xb8(%rsp), %rdi
callq *%rax
jmp 0x7cdd0
movq 0x50(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x71fa0
leaq 0xb8(%rsp), %rdi
callq 0x4e270
jmp 0x7cced
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
jmp 0x7d028
movq 0x60(%rsp), %rax
movq 0x12f0(%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x7cf14
movb $0x1, 0x96(%rsp)
movl $0x60, %edi
callq 0x4a160
movq %rax, 0x18(%rsp)
leaq 0x97(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x4a530
movq 0x20(%rsp), %rdx
leaq 0x5d14(%rip), %rsi      # 0x82b6e
leaq 0x98(%rsp), %rdi
callq 0x4dcf0
jmp 0x7ce69
movq 0x18(%rsp), %rdi
leaq 0x5c8b(%rip), %rsi      # 0x82b00
leaq 0x5cc1(%rip), %rdx      # 0x82b3d
movl $0x216, %ecx            # imm = 0x216
leaq 0x98(%rsp), %r8
callq 0x7d0d0
jmp 0x7ce90
movq 0x18(%rsp), %rdi
movb $0x0, 0x96(%rsp)
leaq 0x1aeb4(%rip), %rsi     # 0x97d58
leaq 0x285(%rip), %rdx       # 0x7d130
callq 0x4a500
jmp 0x7d03f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
jmp 0x7ceec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x4a5b8
leaq 0x97(%rsp), %rdi
callq 0x4a390
testb $0x1, 0x96(%rsp)
jne 0x7cf05
jmp 0x7cf0f
movq 0x18(%rsp), %rdi
callq 0x4a220
jmp 0x7d028
movq 0x50(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x71fe0
testb $0x1, %al
jne 0x7cf2b
jmp 0x7cfff
movb $0x1, 0x6e(%rsp)
movl $0x60, %edi
callq 0x4a160
movq %rax, 0x8(%rsp)
leaq 0x6f(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x4a530
movq 0x10(%rsp), %rdx
leaq 0x5c43(%rip), %rsi      # 0x82b9d
leaq 0x70(%rsp), %rdi
callq 0x4dcf0
jmp 0x7cf66
movq 0x8(%rsp), %rdi
leaq 0x5b8e(%rip), %rsi      # 0x82b00
leaq 0x5bc4(%rip), %rdx      # 0x82b3d
movl $0x219, %ecx            # imm = 0x219
leaq 0x70(%rsp), %r8
callq 0x7d0d0
jmp 0x7cf8a
movq 0x8(%rsp), %rdi
movb $0x0, 0x6e(%rsp)
leaq 0x1adbd(%rip), %rsi     # 0x97d58
leaq 0x18e(%rip), %rdx       # 0x7d130
callq 0x4a500
jmp 0x7d03f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
jmp 0x7cfe0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x4a5b8
leaq 0x6f(%rsp), %rdi
callq 0x4a390
testb $0x1, 0x6e(%rsp)
jne 0x7cff3
jmp 0x7cffd
movq 0x8(%rsp), %rdi
callq 0x4a220
jmp 0x7d028
movb $0x1, 0xca(%rsp)
testb $0x1, 0xca(%rsp)
jne 0x7d01b
movq 0x50(%rsp), %rdi
callq 0x4e270
movq 0x58(%rsp), %rax
addq $0x118, %rsp            # imm = 0x118
retq
movq 0x50(%rsp), %rdi
callq 0x4e270
movq 0xd0(%rsp), %rdi
callq 0x4a520
nop