// File: /workspace/github_cpp_makefile_star2_O1/swxlion[P]swxJson/src/swxJson.cpp
// Function: swxJson::Json::operator[](int)
Json& Json::operator [] (int index)
{
	if (_type == JSON_Uninit)
		setArray();

	if (_type != JSON_Array)
		throw JSON_ERROR_MSG(JsonNodeTypeMissMatchError, "Current node is not an array.");

	std::list<JsonPtr>* data = (std::list<JsonPtr>*)_data;
	auto it = data->begin();
	int i = 0;
	for (; it != data->end(); it++, i++)
	{
		if (i == index)
		{
			JsonPtr node = *it;
			return *(node.get());
		}
	}

	for (; i < index; i++)
	{
		JsonPtr node(new Json());
		pushNode(node);
	}

	JsonPtr node(new Json());
	pushNode(node);
	return *(node.get());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movl %esi, %ebp
movq %rdi, %rbx
cmpl $0x8, (%rdi)
jne 0x1b7e2
movq %rbx, %rdi
callq 0x185ac
cmpl $0x1, (%rbx)
jne 0x1b957
movq 0x8(%rbx), %rdx
movq (%rdx), %rax
xorl %ecx, %ecx
cmpq %rdx, %rax
je 0x1b808
cmpl %ecx, %ebp
je 0x1b8f0
incl %ecx
movq (%rax), %rax
jmp 0x1b7f4
subl %ecx, %ebp
jle 0x1b89d
leaq 0x8(%rsp), %r14
leaq 0x30(%rsp), %r15
movq 0xd7af(%rip), %r12      # 0x28fd0
movl $0x10, %edi
callq 0xb250
movl $0x8, (%rax)
movq $0x0, 0x8(%rax)
movq %rax, (%rsp)
movq %r14, %rdi
movq %rax, %rsi
callq 0x169ea
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x30(%rsp)
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0x1b870
cmpb $0x0, (%r12)
je 0x1b86c
incl 0x8(%rax)
jmp 0x1b870
lock
incl 0x8(%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x18606
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x1b88a
callq 0x16eec
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1b899
callq 0x16eec
decl %ebp
jne 0x1b821
movl $0x10, %edi
callq 0xb250
movl $0x8, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x8(%rsp), %r14
movq %rax, -0x8(%r14)
movq %r14, %rdi
movq %rax, %rsi
callq 0x169ea
movq -0x8(%r14), %rcx
movq (%r14), %rax
movq %rcx, 0x20(%rsp)
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0x1b912
movq 0xd6ea(%rip), %rcx      # 0x28fd0
cmpb $0x0, (%rcx)
je 0x1b90e
incl 0x8(%rax)
jmp 0x1b912
movq 0x10(%rax), %rbx
movq 0x18(%rax), %rdi
testq %rdi, %rdi
je 0x1b941
movq 0xd6cc(%rip), %rax      # 0x28fd0
cmpb $0x0, (%rax)
je 0x1b951
incl 0x8(%rdi)
jmp 0x1b937
lock
incl 0x8(%rax)
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x18606
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1b92e
callq 0x16eec
movq (%rsp), %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1b941
callq 0x16eec
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
lock
incl 0x8(%rdi)
jmp 0x1b937
movl $0x60, %edi
callq 0xb0f0
movq %rax, %r14
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x5f28(%rip), %rsi      # 0x2189c
leaq 0x5f3e(%rip), %rdx      # 0x218b9
movq %rsp, %rdi
callq 0x17258
movb $0x1, %bpl
leaq 0x5d1d(%rip), %rsi      # 0x216aa
leaq 0x5efd(%rip), %rdx      # 0x21891
movq %rsp, %r8
movq %r14, %rdi
movl $0x532, %ecx            # imm = 0x532
callq 0x1ee7c
leaq 0xd355(%rip), %rax      # 0x28d00
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0xd2fd(%rip), %rsi      # 0x28cb8
leaq 0xf16(%rip), %rdx       # 0x1c8d8
movq %r14, %rdi
callq 0xb390
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x1b9eb
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xb260
jmp 0x1b9eb
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x1ba25
movq %r14, %rdi
callq 0xb1c0
jmp 0x1ba25
movq %rax, %rbx
movq 0x28(%rsp), %rdi
jmp 0x1ba0c
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x1ba16
callq 0x16eec
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1ba25
callq 0x16eec
movq %rbx, %rdi
callq 0xb3b0
nop