// File: /workspace/github_cpp_makefile_star2_O1/Nallantli[P]Rossa/main/rossa/instruction/instruction.cpp
// Function: LengthI::evaluate(object_t const*, std::vector<std::pair<token_t, function_t>, std::allocator<std::pair<token_t, function_t>>>&) const
const symbol_t LengthI::evaluate(const object_t *scope, trace_t &stack_trace) const
{
	const symbol_t evalA = a->evaluate(scope, stack_trace);
	switch (evalA.getValueType())
	{
	case value_type_enum::STRING:
	{
		std::string str = evalA.getString(&token, stack_trace);
		int c, i, ix, q;
		for (q = 0, i = 0, ix = str.size(); i < ix; i++, q++)
		{
			c = static_cast<unsigned char>(str[i]);
			if (c >= 0 && c <= 127)
				i += 0;
			else if ((c & 0xE0) == 0xC0)
				i += 1;
			else if ((c & 0xF0) == 0xE0)
				i += 2;
			else if ((c & 0xF8) == 0xF0)
				i += 3;
			else
				return symbol_t::Number(number_t::Long(evalA.getString(&token, stack_trace).size()));
		}
		return symbol_t::Number(number_t::Long(q));
	}
	case value_type_enum::DICTIONARY:
		return symbol_t::Number(number_t::Long(evalA.dictionarySize(&token, stack_trace)));
	case value_type_enum::ARRAY:
		return symbol_t::Number(number_t::Long(evalA.vectorSize()));
	case value_type_enum::OBJECT:
	{
		const auto &o = evalA.getObject(&token, stack_trace);
		if (o->hasValue(parser_t::HASH_LENGTH))
			return o->getVariable(parser_t::HASH_LENGTH, &token, stack_trace).call({}, &token, stack_trace);
	}
	default:
		throw rossa_error_t(_FAILURE_LENGTH_, token, stack_trace);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x90(%rsi), %rsi
movq (%rsi), %rax
leaq 0x20(%rsp), %r12
movq %r12, %rdi
callq *(%rax)
movq %r12, %rdi
callq 0x41262
addl $0x8, %eax
cmpl $0x4, %eax
ja 0x72105
leaq 0x162f0(%rip), %rcx     # 0x88378
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x8(%r15), %r12
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x411a4
movq %rax, %r13
leaq 0x45951(%rip), %rsi     # 0xb7a00
movq %rax, %rdi
callq 0x3d498
movl %eax, %ebp
testb %al, %al
je 0x72105
leaq 0x4593c(%rip), %rsi     # 0xb7a00
movq %r13, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x3d502
xorps %xmm0, %xmm0
movq %rsp, %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
movq %rbx, %rdi
movq %rax, %rsi
movq %r12, %rcx
movq %r14, %r8
callq 0x42736
movq %rsp, %rdi
callq 0x20a84
testb %bpl, %bpl
jne 0x7227c
movl $0xa8, %edi
callq 0x101e0
movq %rax, %r12
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x16606(%rip), %rsi     # 0x88728
leaq 0x16619(%rip), %rdx     # 0x88742
movq %rsp, %rdi
callq 0x1e7ca
addq $0x8, %r15
movb $0x1, %bpl
movq %rsp, %rsi
movq %r12, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x476dc
xorl %ebp, %ebp
leaq 0x40b8e(%rip), %rsi     # 0xb2ce0
leaq -0x3a9a5(%rip), %rdx    # 0x377b4
movq %r12, %rdi
callq 0x106d0
leaq 0x20(%rsp), %rdi
callq 0x41a46
leaq 0x30(%rsp), %rdi
movq %rax, (%rdi)
callq 0x47868
movq %rsp, %rsi
movq %rax, (%rsi)
movl %edx, 0x8(%rsi)
movq %rbx, %rdi
callq 0x40458
jmp 0x7227c
addq $0x8, %r15
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x41004
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
testl %eax, %eax
jle 0x7223f
movq (%rsp), %rsi
xorl %edx, %edx
movslq %ecx, %rdi
movzbl (%rsi,%rdi), %edi
testb %dil, %dil
jns 0x72200
movl %edi, %r8d
andl $-0x20, %r8d
cmpl $0xc0, %r8d
jne 0x721d9
incl %ecx
jmp 0x72200
movl %edi, %r8d
andl $-0x10, %r8d
cmpl $0xe0, %r8d
jne 0x721ee
addl $0x2, %ecx
jmp 0x72200
andl $-0x8, %edi
cmpl $0xf0, %edi
jne 0x72298
addl $0x3, %ecx
incl %ecx
incq %rdx
cmpl %eax, %ecx
jl 0x721b9
jmp 0x72241
addq $0x8, %r15
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x41a64
leaq 0x30(%rsp), %rdi
movq %rax, (%rdi)
callq 0x47868
movq %rsp, %rsi
movq %rax, (%rsi)
movl %edx, 0x8(%rsi)
movq %rbx, %rdi
callq 0x40458
jmp 0x7227c
xorl %edx, %edx
leaq 0x58(%rsp), %rdi
movq %rdx, (%rdi)
callq 0x47868
leaq 0x30(%rsp), %rsi
movq %rax, (%rsi)
movl %edx, 0x8(%rsi)
movq %rbx, %rdi
callq 0x40458
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7227c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x20(%rsp), %rdi
callq 0x404da
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x41004
movq 0x38(%rsp), %rax
leaq 0x50(%rsp), %rdi
movq %rax, (%rdi)
callq 0x47868
leaq 0x58(%rsp), %rsi
movq %rax, (%rsi)
movl %edx, 0x8(%rsi)
movq %rbx, %rdi
callq 0x40458
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x72261
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x72261
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x72317
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x72317
jmp 0x72314
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7237e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x7237e
movq %rax, %rbx
movq %rsp, %rdi
callq 0x20a84
jmp 0x7237e
jmp 0x7237b
jmp 0x7237b
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x72366
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x72366
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x7237e
movq %r12, %rdi
callq 0x102d0
jmp 0x7237e
jmp 0x7237b
jmp 0x7237b
jmp 0x7237b
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x404da
movq %rbx, %rdi
callq 0x106f0