// File: Nallantli[P]Rossa/main/rossa/operation/operation.cpp
// Function: operation::bnot(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::bnot(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] = bnot(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_B_NOT))
			return o->getVariable(parser_t::HASH_B_NOT, token, stack_trace).call({}, token, stack_trace);
	}
	default:
		break;
	}

	if (scope != NULL)
		return scope->getVariable(parser_t::HASH_B_NOT, 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 0x14b00b
jmp 0x14adfc
movl -0x1b8(%rbp), %eax
subl $-0x5, %eax
je 0x14ae5d
jmp 0x14ae09
movl -0x1b8(%rbp), %eax
subl $-0x2, %eax
jne 0x14b0f7
jmp 0x14ae1a
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x87a00
movq %rax, %rdi
callq 0x9d880
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 0x14b5b9
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 0x14aebd
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 0x14afcb
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 0x14adb0
jmp 0x14af36
movq -0x98(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x8c3d0
movq %rax, %rdi
leaq -0xa8(%rbp), %rsi
callq 0x86e20
jmp 0x14af57
leaq -0xa8(%rbp), %rdi
callq 0x86dc0
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x14aed1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x79(%rbp), %rdi
callq 0x304d0
jmp 0x14affd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14aff4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x86dc0
jmp 0x14aff4
movq -0x1c8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x86c50
jmp 0x14afdd
leaq -0x78(%rbp), %rdi
callq 0x2cf10
leaq -0x60(%rbp), %rdi
callq 0x2cf10
jmp 0x14b5b9
leaq -0x78(%rbp), %rdi
callq 0x2cf10
leaq -0x60(%rbp), %rdi
callq 0x2cf10
jmp 0x14b5c9
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 0x9aaee(%rip), %rsi     # 0x1e5b30
callq 0x7dd00
testb $0x1, %al
jne 0x14b050
jmp 0x14b0f5
movq -0xb0(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq 0x9aac7(%rip), %rsi     # 0x1e5b30
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 0x14b0c1
leaq -0xd0(%rbp), %rdi
callq 0x2cf10
jmp 0x14b5b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x2cf10
jmp 0x14b5c9
jmp 0x14b0f7
jmp 0x14b0f9
cmpq $0x0, -0x10(%rbp)
je 0x14b305
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq 0x9aa19(%rip), %rsi     # 0x1e5b30
callq 0x7ddd0
movq %rax, -0x208(%rbp)
leaq -0x108(%rbp), %rdi
movq %rdi, -0x110(%rbp)
movq -0x18(%rbp), %rsi
callq 0x86d80
jmp 0x14b13c
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 0x14b18b
movq -0x208(%rbp), %rsi
movq -0x1c8(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq -0xe8(%rbp), %rdx
callq 0x89e20
jmp 0x14b1af
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 0x14b1e0
jmp 0x14b5b9
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 0x14b273
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 0x14b242
jmp 0x14b5c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14b2aa
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 0x14b2cf
jmp 0x14b5c9
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 0x9fcd(%rip), %rsi      # 0x15530b
leaq -0x158(%rbp), %rdi
callq 0x24740
jmp 0x14b34c
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 0x4cdd(%rip), %rsi      # 0x15006d
callq 0x24740
jmp 0x14b397
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 0x14b3ed
leaq -0x138(%rbp), %rdi
leaq -0x158(%rbp), %rsi
leaq -0x178(%rbp), %rdx
callq 0x9e250
jmp 0x14b409
movq -0x260(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq -0x138(%rbp), %rsi
callq 0x9c360
jmp 0x14b426
movq -0x260(%rbp), %rdi
movb $0x0, -0x1b4(%rbp)
leaq 0x95845(%rip), %rsi     # 0x1e0c80
leaq -0xf0aa2(%rip), %rdx    # 0x5a9a0
callq 0x11970
jmp 0x14b5d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14b594
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14b524
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14b4cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14b4c0
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 0x14b4f1
jmp 0x14b524
leaq -0x1b1(%rbp), %rdi
callq 0x11600
testb $0x1, -0x1b2(%rbp)
jne 0x14b53b
jmp 0x14b588
movq -0x1b0(%rbp), %rax
leaq -0x1a8(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x298(%rbp)
je 0x14b586
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 0x14b555
jmp 0x14b588
leaq -0x158(%rbp), %rdi
callq 0x11360
leaq -0x159(%rbp), %rdi
callq 0x11600
testb $0x1, -0x1b4(%rbp)
jne 0x14b5ab
jmp 0x14b5b7
movq -0x260(%rbp), %rdi
callq 0x11420
jmp 0x14b5c9
movq -0x1c0(%rbp), %rax
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x119c0
nopw %cs:(%rax,%rax)