// File: Nallantli[P]Rossa/main/rossa/operation/operation.cpp
// Function: operation::neg(object_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::neg(const object_t *scope, const symbol_t &evalA, const token_t *token, trace_t &stack_trace)
{
	switch (evalA.getValueType())
	{
	case value_type_enum::NUMBER:
		return symbol_t::Number(-evalA.getNumber(token, stack_trace));
	case value_type_enum::ARRAY:
	{
		auto av = evalA.getVector(token, stack_trace);
		std::vector<symbol_t> v(av.size());
		for (size_t i = 0; i < v.size(); i++)
			v[i] = neg(scope, av[i], token, stack_trace);
		return symbol_t::Array(v);
	}
	case value_type_enum::OBJECT:
	{
		const auto &o = evalA.getObject(token, stack_trace);
		if (o->hasValue(parser_t::HASH_SUB))
			return o->getVariable(parser_t::HASH_SUB, token, stack_trace).call({}, token, stack_trace);
	}
	default:
		break;
	}

	if (scope != NULL)
		return scope->getVariable(parser_t::HASH_SUB, token, stack_trace).call({evalA}, token, stack_trace);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rdi, -0x1c8(%rbp)
movq %rdi, %rax
movq %rax, -0x1c0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x883e0
movl %eax, %ecx
movl %ecx, -0x1b8(%rbp)
subl $-0x8, %eax
je 0x14be4b
jmp 0x14bc3c
movl -0x1b8(%rbp), %eax
subl $-0x5, %eax
je 0x14bc9d
jmp 0x14bc49
movl -0x1b8(%rbp), %eax
subl $-0x2, %eax
jne 0x14bf37
jmp 0x14bc5a
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x87a00
movq %rax, %rdi
callq 0x9c850
movq -0x1c8(%rbp), %rdi
movl %edx, -0x40(%rbp)
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x30(%rbp)
leaq -0x38(%rbp), %rsi
callq 0x86bf0
jmp 0x14c3f9
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x87fe0
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x8c650
movq -0x1e0(%rbp), %rdi
callq 0x30a90
movq %rax, -0x1d8(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0x1d0(%rbp)
callq 0x2e2f0
movq -0x1d8(%rbp), %rsi
movq -0x1d0(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x8bb50
jmp 0x14bcfd
leaq -0x79(%rbp), %rdi
callq 0x304d0
movq $0x0, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x1e8(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x30a90
movq %rax, %rcx
movq -0x1e8(%rbp), %rax
cmpq %rcx, %rax
jae 0x14be0b
movq -0x10(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq -0x98(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x8c3d0
movq -0x1f0(%rbp), %rsi
movq %rax, %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq -0xa8(%rbp), %rdi
callq 0x14bbf0
jmp 0x14bd76
movq -0x98(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x8c3d0
movq %rax, %rdi
leaq -0xa8(%rbp), %rsi
callq 0x86e20
jmp 0x14bd97
leaq -0xa8(%rbp), %rdi
callq 0x86dc0
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x14bd11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x79(%rbp), %rdi
callq 0x304d0
jmp 0x14be3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14be34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x86dc0
jmp 0x14be34
movq -0x1c8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x86c50
jmp 0x14be1d
leaq -0x78(%rbp), %rdi
callq 0x2cf10
leaq -0x60(%rbp), %rdi
callq 0x2cf10
jmp 0x14c3f9
leaq -0x78(%rbp), %rdi
callq 0x2cf10
leaq -0x60(%rbp), %rdi
callq 0x2cf10
jmp 0x14c409
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x882f0
movq %rax, -0xb8(%rbp)
leaq -0xb8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq (%rax), %rdi
leaq 0x99c56(%rip), %rsi     # 0x1e5ad8
callq 0x7dd00
testb $0x1, %al
jne 0x14be90
jmp 0x14bf35
movq -0xb0(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq 0x99c2f(%rip), %rsi     # 0x1e5ad8
callq 0x7ddd0
movq %rax, -0x200(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0xd0(%rbp)
movq $0x0, -0xc0(%rbp)
leaq -0xd0(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x2cc30
movq -0x1c8(%rbp), %rdi
movq -0x200(%rbp), %rsi
movq -0x1f8(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x89e20
jmp 0x14bf01
leaq -0xd0(%rbp), %rdi
callq 0x2cf10
jmp 0x14c3f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x2cf10
jmp 0x14c409
jmp 0x14bf37
jmp 0x14bf39
cmpq $0x0, -0x10(%rbp)
je 0x14c145
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq 0x99b81(%rip), %rsi     # 0x1e5ad8
callq 0x7ddd0
movq %rax, -0x208(%rbp)
leaq -0x108(%rbp), %rdi
movq %rdi, -0x110(%rbp)
movq -0x18(%rbp), %rsi
callq 0x86d80
jmp 0x14bf7c
leaq -0x108(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq $0x1, -0xf0(%rbp)
leaq -0x111(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x2e2f0
movq -0x210(%rbp), %rcx
movq -0xf8(%rbp), %rsi
movq -0xf0(%rbp), %rdx
leaq -0xe8(%rbp), %rdi
callq 0x8c330
jmp 0x14bfcb
movq -0x208(%rbp), %rsi
movq -0x1c8(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq -0xe8(%rbp), %rdx
callq 0x89e20
jmp 0x14bfef
leaq -0xe8(%rbp), %rdi
callq 0x2cf10
leaq -0x111(%rbp), %rdi
callq 0x304d0
leaq -0x108(%rbp), %rax
movq %rax, -0x220(%rbp)
addq $0x10, %rax
movq %rax, -0x218(%rbp)
movq -0x218(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x228(%rbp)
callq 0x86dc0
movq -0x220(%rbp), %rcx
movq -0x228(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x218(%rbp)
jne 0x14c020
jmp 0x14c3f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
movq -0x110(%rbp), %rax
leaq -0x108(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x230(%rbp)
je 0x14c0b3
movq -0x230(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x238(%rbp)
callq 0x86dc0
movq -0x238(%rbp), %rax
leaq -0x108(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x230(%rbp)
jne 0x14c082
jmp 0x14c409
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14c0ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x2cf10
leaq -0x111(%rbp), %rdi
callq 0x304d0
leaq -0x108(%rbp), %rax
movq %rax, -0x248(%rbp)
addq $0x10, %rax
movq %rax, -0x240(%rbp)
movq -0x240(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x250(%rbp)
callq 0x86dc0
movq -0x248(%rbp), %rcx
movq -0x250(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x240(%rbp)
jne 0x14c10f
jmp 0x14c409
movb $0x1, -0x1b4(%rbp)
movl $0xa8, %edi
callq 0x112b0
movq %rax, -0x260(%rbp)
leaq -0x159(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x119d0
movq -0x258(%rbp), %rdx
leaq 0x918d(%rip), %rsi      # 0x15530b
leaq -0x158(%rbp), %rdi
callq 0x24740
jmp 0x14c18c
movb $0x1, -0x1b2(%rbp)
leaq -0x1a8(%rbp), %rax
movq %rax, -0x270(%rbp)
movq %rax, -0x1b0(%rbp)
leaq -0x1b1(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x119d0
movq -0x270(%rbp), %rdi
movq -0x268(%rbp), %rdx
leaq 0x3e45(%rip), %rsi      # 0x150015
callq 0x24740
jmp 0x14c1d7
movb $0x0, -0x1b2(%rbp)
leaq -0x1a8(%rbp), %rax
movq %rax, -0x188(%rbp)
movq $0x1, -0x180(%rbp)
leaq -0x1b3(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x26e30
movq -0x278(%rbp), %rcx
movq -0x188(%rbp), %rsi
movq -0x180(%rbp), %rdx
leaq -0x178(%rbp), %rdi
callq 0x2d6a0
jmp 0x14c22d
leaq -0x138(%rbp), %rdi
leaq -0x158(%rbp), %rsi
leaq -0x178(%rbp), %rdx
callq 0x9e250
jmp 0x14c249
movq -0x260(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq -0x138(%rbp), %rsi
callq 0x9c360
jmp 0x14c266
movq -0x260(%rbp), %rdi
movb $0x0, -0x1b4(%rbp)
leaq 0x94a05(%rip), %rsi     # 0x1e0c80
leaq -0xf18e2(%rip), %rdx    # 0x5a9a0
callq 0x11970
jmp 0x14c415
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14c3d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14c364
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14c30c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14c300
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x11360
leaq -0x178(%rbp), %rdi
callq 0x25b00
leaq -0x1b3(%rbp), %rdi
callq 0x279c0
leaq -0x1a8(%rbp), %rax
movq %rax, -0x288(%rbp)
addq $0x20, %rax
movq %rax, -0x280(%rbp)
movq -0x280(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x290(%rbp)
callq 0x11360
movq -0x288(%rbp), %rcx
movq -0x290(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x280(%rbp)
jne 0x14c331
jmp 0x14c364
leaq -0x1b1(%rbp), %rdi
callq 0x11600
testb $0x1, -0x1b2(%rbp)
jne 0x14c37b
jmp 0x14c3c8
movq -0x1b0(%rbp), %rax
leaq -0x1a8(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x298(%rbp)
je 0x14c3c6
movq -0x298(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x2a0(%rbp)
callq 0x11360
movq -0x2a0(%rbp), %rax
leaq -0x1a8(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x298(%rbp)
jne 0x14c395
jmp 0x14c3c8
leaq -0x158(%rbp), %rdi
callq 0x11360
leaq -0x159(%rbp), %rdi
callq 0x11600
testb $0x1, -0x1b4(%rbp)
jne 0x14c3eb
jmp 0x14c3f7
movq -0x260(%rbp), %rdi
callq 0x11420
jmp 0x14c409
movq -0x1c0(%rbp), %rax
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x119c0
nopw %cs:(%rax,%rax)