// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/json.cpp
// Function: JSON::construct(jsonparser&, jsonparser::event&, bool*, unsigned long)
void JSON::construct(jsonparser& p, jsonparser::event& ev, bool* ok, size_t maxdepth)
{
	m_action = ev.action;
	if(0);
	else if (ev.action == jsonparser::str) m_str = ev.str;
	else if (ev.action == jsonparser::num) fromstring(ev.str, m_num);
	else if (ev.action == jsonparser::error) *ok = false;
	else if (maxdepth == 0)
	{
		*ok = false;
		m_action = jsonparser::error;
		if (ev.action == jsonparser::enter_list || ev.action == jsonparser::enter_map)
		{
			// it would be faster to reset the jsonparser somehow,
			// but performance on hostile inputs isn't really a priority
			size_t xdepth = 1;
			while (xdepth)
			{
				jsonparser::event next = p.next();
				if (next.action == jsonparser::enter_list) xdepth++;
				if (next.action == jsonparser::enter_map) xdepth++;
				if (next.action == jsonparser::exit_list) xdepth--;
				if (next.action == jsonparser::exit_map) xdepth--;
			}
		}
		return;
	}
	else if (ev.action == jsonparser::enter_list)
	{
		while (true)
		{
			jsonparser::event next = p.next();
			if (next.action == jsonparser::exit_list) break;
			if (next.action == jsonparser::error) *ok = false;
			m_chld_list.append().construct(p, next, ok, maxdepth-1);
		}
	}
	else if (ev.action == jsonparser::enter_map)
	{
		while (true)
		{
			jsonparser::event next = p.next();
			if (next.action == jsonparser::exit_map) break;
			if (next.action == jsonparser::map_key)
			{
				jsonparser::event ev = p.next();
				m_chld_map.insert(next.str).construct(p, ev, ok, maxdepth-1);
			}
			if (next.action == jsonparser::error) *ok = false;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r15
movl (%rdx), %eax
movq %rdi, (%rsp)
movl %eax, (%rdi)
cmpl $0xb, %eax
je 0x10130
cmpl $0x5, %eax
je 0x1010d
cmpl $0x4, %eax
jne 0x10143
movq (%rsp), %rdi
addq $0x8, %rdi
movq 0x8(%rdx), %rsi
movq 0x10(%rdx), %rdx
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5682
movq 0x8(%rdx), %rdi
movq 0x10(%rdx), %rsi
movq (%rsp), %rdx
addq $0x18, %rdx
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x15e28
movb $0x0, (%r15)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r8, %r14
movq %rsi, %rbx
testq %r8, %r8
je 0x101f4
cmpl $0x6, %eax
je 0x10262
cmpl $0x8, %eax
jne 0x10134
addq $0x30, (%rsp)
decq %r14
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0xf7a6
movl 0x8(%rsp), %eax
cmpl $0x9, %eax
je 0x10188
cmpl $0xa, %eax
jne 0x101e6
jmp 0x10134
movq %r13, %rbp
leaq 0x40(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0xf7a6
movups 0x10(%rsp), %xmm0
movups %xmm0, 0x20(%rsp)
leaq 0x30(%rsp), %r12
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
callq 0x14754
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x10ac6
movq %rax, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %rbp, %r13
movq %r15, %rcx
movq %r14, %r8
callq 0x100c2
movq %r12, %rdi
callq 0x56b4
movl 0x8(%rsp), %eax
cmpl $0xb, %eax
jne 0x1016d
movb $0x0, (%r15)
jmp 0x1016d
movb $0x0, (%r15)
movq (%rsp), %rcx
movl $0xb, (%rcx)
cmpl $0x8, %eax
je 0x10210
cmpl $0x6, %eax
jne 0x10134
pushq $0x1
popq %r15
leaq 0x8(%rsp), %r14
testq %r15, %r15
je 0x10134
movq %r14, %rdi
movq %rbx, %rsi
callq 0xf7a6
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl $0x6, %eax
sete %cl
addq %rcx, %r15
xorl %ecx, %ecx
cmpl $0x8, %eax
sete %cl
addq %r15, %rcx
xorl %edx, %edx
cmpl $0x7, %eax
sete %dl
subq %rdx, %rcx
xorl %edx, %edx
cmpl $0xa, %eax
sete %dl
subq %rdx, %rcx
movq %rcx, %r15
jmp 0x10219
addq $0x20, (%rsp)
decq %r14
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0xf7a6
movl 0x8(%rsp), %eax
cmpl $0xb, %eax
je 0x1028d
cmpl $0x7, %eax
jne 0x10291
jmp 0x10134
movb $0x0, (%r15)
movq (%rsp), %rdi
callq 0x104ee
movq %rax, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
movq %r14, %r8
callq 0x100c2
jmp 0x1026f