// File: /workspace/github_cpp_makefile_star2_O2/Nallantli[P]Rossa/main/rossa/operation/operation.cpp
// Function: operation::index(object_t const*, symbol_t const&, symbol_t const&, token_t const*, std::vector<std::pair<token_t, function_t>, std::allocator<std::pair<token_t, function_t>>>&)
const symbol_t operation::index(const object_t *scope, const symbol_t &evalA, const symbol_t &evalB, const token_t *token, trace_t &stack_trace)
{
	switch (COMP(evalA.getValueType(), evalB.getValueType()))
	{
	case COMP(value_type_enum::DICTIONARY, value_type_enum::STRING):
		return evalA.indexDict(evalB.getString(token, stack_trace));
	case COMP(value_type_enum::ARRAY, value_type_enum::NUMBER):
	{
		auto num = evalB.getNumber(token, stack_trace);
		if (num.type != number_t::LONG_NUM)
			throw rossa_error_t(util::format("Cannot index with non integral value: {0}", {num.toCodeString()}), *token, stack_trace);
		return evalA.indexVector(evalB.getNumber(token, stack_trace).getLong(), token, stack_trace);
	}
	case value_type_enum::OBJECT:
	{
		const auto &o = evalA.getObject(token, stack_trace);
		if (o->hasValue(parser_t::HASH_INDEX))
			return o->getVariable(parser_t::HASH_INDEX, token, stack_trace).call({evalB}, token, stack_trace);
	}
	default:
		if (scope != NULL)
			return scope->getVariable(parser_t::HASH_INDEX, token, stack_trace).call({evalA, evalB}, token, stack_trace);
	}

	throw rossa_error_t(util::format(_UNDECLARED_OPERATOR_ERROR_, {"[]"}), *token, stack_trace);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r9, %rbx
movq %r8, %r14
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, 0x8(%rsp)
movq %rdx, %rdi
callq 0x39ca6
cmpl $-0x8, %eax
jne 0x6d7c2
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x39c02
movq %rax, %r15
leaq 0x49286(%rip), %rsi     # 0xb69c8
movq %rax, %rdi
callq 0x366b2
testb %al, %al
je 0x6d83f
leaq 0x4926f(%rip), %rsi     # 0xb69c8
movq %r15, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x366ec
movq %rax, %r13
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x390f0
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x78(%rsp), %rcx
callq 0x3ba84
movq 0x8(%rsp), %r15
leaq 0x10(%rsp), %rdx
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rcx
movq %rbx, %r8
callq 0x3aa8c
leaq 0x10(%rsp), %rdi
callq 0x1f0b8
leaq 0x30(%rsp), %rdi
callq 0x39102
jmp 0x6d92f
movq %r13, %rdi
callq 0x39ca6
movl %eax, %r15d
shll $0x18, %r15d
negl %r15d
sarl $0x14, %r15d
movq %r12, %rdi
callq 0x39ca6
negb %al
movsbl %al, %eax
orl %r15d, %eax
cmpl $-0x8, %eax
je 0x6d72a
cmpl $0x52, %eax
je 0x6d8d2
cmpl $0x74, %eax
jne 0x6d83f
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x39aa6
movq %r13, %rdi
movq %r15, %rsi
callq 0x3a29e
movq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x390f0
leaq 0x10(%rsp), %rdi
callq 0x101d0
jmp 0x6d92f
testq %rbp, %rbp
je 0x6d944
leaq 0x49179(%rip), %rsi     # 0xb69c8
movq %rbp, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x366ec
movq %rax, %rbp
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x390f0
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x390f0
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
pushq $0x2
popq %rdx
leaq 0x78(%rsp), %rcx
callq 0x3ba84
movq 0x8(%rsp), %r15
leaq 0x30(%rsp), %rdx
movq %r15, %rdi
movq %rbp, %rsi
movq %r14, %rcx
movq %rbx, %r8
callq 0x3aa8c
leaq 0x30(%rsp), %rdi
callq 0x1f0b8
pushq $0x10
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0x10, %rdi
callq 0x39102
addq $-0x10, %rbx
cmpq $-0x10, %rbx
jne 0x6d8b9
jmp 0x6d92f
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3968c
movups (%rax), %xmm0
movaps %xmm0, 0x50(%rsp)
cmpl $0x1, 0x58(%rsp)
jne 0x6d9db
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3968c
movq %rax, %rdi
callq 0x3edf8
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movq %r13, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3988a
movq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x390f0
movq %r15, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xa8, %edi
callq 0x101f0
movq %rax, %r15
leaq 0xcf6b(%rip), %rsi      # 0x7a8c3
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x1c814
leaq 0x86b2(%rip), %rsi      # 0x76020
leaq 0x78(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1c814
leaq 0x60(%rsp), %rdi
leaq 0x78(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x6(%rsp), %rcx
callq 0x1f298
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x3f724
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3ebb8
xorl %ebp, %ebp
leaq 0x442d9(%rip), %rsi     # 0xb1ca0
leaq -0x3e55c(%rip), %rdx    # 0x2f472
movq %r15, %rdi
callq 0x106c0
jmp 0x6da67
movl $0xa8, %edi
callq 0x101f0
movq %rax, %r15
leaq 0xceaa(%rip), %rsi      # 0x7a899
leaq 0x30(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1c814
leaq 0x78(%rsp), %r12
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
callq 0x3f4dc
leaq 0x60(%rsp), %rdi
pushq $0x1
popq %rdx
leaq 0x6(%rsp), %rcx
movq %r12, %rsi
callq 0x1f298
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x3f724
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3ebb8
xorl %ebp, %ebp
leaq 0x44248(%rip), %rsi     # 0xb1ca0
leaq -0x3e5ed(%rip), %rdx    # 0x2f472
movq %r15, %rdi
callq 0x106c0
jmp 0x6da6b
jmp 0x6da7a
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x101d0
jmp 0x6da80
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x60(%rsp), %rdi
callq 0x1cea0
jmp 0x6da94
jmp 0x6da8e
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x78(%rsp), %rdi
callq 0x101d0
jmp 0x6daa8
jmp 0x6dab9
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x30(%rsp), %rdi
callq 0x101d0
testb %bpl, %bpl
jne 0x6dabc
jmp 0x6db31
movq %rax, %rbx
movq %r15, %rdi
callq 0x102e0
jmp 0x6db31
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x101d0
jmp 0x6db31
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x1f0b8
jmp 0x6dae7
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x6db27
jmp 0x6db2e
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x1f0b8
jmp 0x6db02
movq %rax, %rbx
pushq $0x10
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x10, %rdi
callq 0x39102
addq $-0x10, %r14
cmpq $-0x10, %r14
jne 0x6db06
jmp 0x6db31
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x39102
jmp 0x6db31
movq %rax, %rbx
movq %rbx, %rdi
callq 0x106f0