// File: /workspace/github_cpp_makefile_star2_O2/Nallantli[P]Rossa/main/rossa/symbol/symbol.cpp
// Function: symbol_t::set(symbol_t const*, token_t const*, std::vector<std::pair<token_t, function_t>, std::allocator<std::pair<token_t, function_t>>>&) const
void symbol_t::set(const symbol_t *b, const token_t *token, trace_t &stack_trace) const
{
	if (b->d == d)
	{
		return;
	}
	if (d->type == value_type_enum::OBJECT && std::get<object_t>(d->value).hasValue(parser_t::HASH_SET))
	{
		ptr_function_t f = nullptr;
		try
		{
			f = std::get<object_t>(d->value)
					.getVariable(parser_t::HASH_SET, token, stack_trace)
					.getFunction({*b}, token, stack_trace);
		}
		catch (const rossa_error_t &e)
		{
		}
		if (f)
		{
			function_evaluate(f, {*b}, token, stack_trace);
			return;
		}
	}
	switch (b->d->type)
	{
	case value_type_enum::NIL:
		d->clearData();
		break;
	case value_type_enum::ARRAY:
	{
		auto v = &std::get<std::vector<symbol_t>>(b->d->value);
		std::vector<symbol_t> nv(v->size());
		for (size_t i = 0; i < v->size(); i++)
		{
			nv[i].set(&v->at(i), token, stack_trace);
		}
		d->value = nv;
		break;
	}
	case value_type_enum::DICTIONARY:
	{
		d->value = std::map<const std::string, const symbol_t>();
		auto v = &std::get<std::map<const std::string, const symbol_t>>(b->d->value);
		for (auto &e : *v)
		{
			if (e.second.d->type == value_type_enum::NIL)
			{
				continue;
			}
			auto newd = symbol_t();
			newd.set(&e.second, token, stack_trace);
			std::get<std::map<const std::string, const symbol_t>>(d->value).insert({e.first, newd});
		}
		break;
	}
	default:
		d->value = b->d->value;
		break;
	}
	d->type = b->d->type;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rcx, 0x18(%rsp)
movq %rdi, 0x8(%rsp)
movq (%rdi), %rdi
cmpq %rdi, (%rsi)
je 0x395c2
movq %rdx, %r12
movq %rsi, %rbp
cmpl $-0x8, (%rdi)
jne 0x393f3
addq $0x8, %rdi
callq 0x3bd3f
leaq 0x7d720(%rip), %rsi     # 0xb69e0
movq %rax, %rdi
callq 0x366b2
testb %al, %al
je 0x393f3
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
callq 0x3bd3f
leaq 0x7d6f0(%rip), %rsi     # 0xb69e0
movq %rax, %rdi
movq %r12, %rdx
movq 0x18(%rsp), %rcx
callq 0x366ec
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
movq %rbp, %rsi
callq 0x390f0
leaq 0x40(%rsp), %rdi
leaq 0x70(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x17(%rsp), %rcx
callq 0x3ba84
leaq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rdx
movq %rbx, %rsi
movq %r12, %rcx
movq 0x18(%rsp), %r8
callq 0x39fb2
leaq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3bd96
leaq 0x38(%rsp), %rdi
callq 0x1d786
leaq 0x40(%rsp), %rdi
callq 0x1f0b8
leaq 0x70(%rsp), %rdi
callq 0x39102
cmpq $0x0, 0x20(%rsp)
je 0x393e9
leaq 0x30(%rsp), %rdi
movq %rbp, %rsi
callq 0x390f0
leaq 0x40(%rsp), %rdi
leaq 0x30(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x70(%rsp), %rcx
callq 0x3ba84
leaq 0x88(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %r12, %rcx
movq 0x18(%rsp), %r8
callq 0x225a1
leaq 0x88(%rsp), %rdi
callq 0x39102
leaq 0x40(%rsp), %rdi
callq 0x1f0b8
leaq 0x30(%rsp), %rdi
callq 0x39102
leaq 0x28(%rsp), %rdi
callq 0x1d786
jmp 0x395c2
leaq 0x28(%rsp), %rdi
callq 0x1d786
movq (%rbp), %rsi
movl (%rsi), %eax
cmpl $-0x7, %eax
movq %rbp, 0x80(%rsp)
je 0x3949c
cmpl $-0x5, %eax
je 0x3942a
cmpl $-0x1, %eax
jne 0x39574
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0x3e50a
jmp 0x395ab
addq $0x8, %rsi
movq %rsi, %rdi
callq 0x3bce8
movq %rax, %rbx
movq 0x8(%rax), %rsi
subq (%rax), %rsi
sarq $0x4, %rsi
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x3b8f4
xorl %r13d, %r13d
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x4, %rax
cmpq %rax, %r14
jae 0x3958b
movq 0x40(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3b946
addq %r13, %r15
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
movq 0x18(%rsp), %rcx
callq 0x3927a
incq %r14
addq $0x10, %r13
jmp 0x39459
leaq 0x48(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq 0x8(%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
leaq 0x40(%rsp), %r13
movq %r13, %rsi
callq 0x3bb30
movq %r13, %rdi
callq 0x3bdb2
movq (%rbp), %rdi
addq $0x8, %rdi
callq 0x3bccb
movq %rax, %rbp
movq 0x18(%rax), %r14
addq $0x8, %rbp
leaq 0x20(%rsp), %rbx
cmpq %rbp, %r14
je 0x395ab
movq 0x40(%r14), %rax
cmpl $-0x1, (%rax)
je 0x39567
leaq 0x40(%r14), %r15
movq %rbx, %rdi
callq 0x38d00
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq 0x18(%rsp), %rcx
callq 0x3927a
movq 0x8(%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
callq 0x3bccb
movq %rax, %r15
leaq 0x20(%r14), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x3bb74
movq %r15, %rdi
movq %r13, %rsi
callq 0x3dfc6
movq %r13, %rdi
callq 0x3bbaa
movq %rbx, %rdi
callq 0x39102
movq %r14, %rdi
callq 0x102b0
movq %rax, %r14
jmp 0x394f8
addq $0x8, %rsi
movq 0x8(%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
callq 0x3be16
jmp 0x395ab
movq 0x8(%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
leaq 0x40(%rsp), %rsi
callq 0x3babe
leaq 0x40(%rsp), %rdi
callq 0x1f0b8
movq 0x80(%rsp), %rax
movq (%rax), %rax
movl (%rax), %eax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movl %eax, (%rcx)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r13
leaq 0x40(%rsp), %rdi
callq 0x1f0b8
jmp 0x395e6
movq %rax, %r13
leaq 0x30(%rsp), %rdi
callq 0x39102
jmp 0x395f5
movq %rax, %r13
leaq 0x28(%rsp), %rdi
callq 0x1d786
jmp 0x3967a
jmp 0x3966d
movq %rax, %r13
jmp 0x3967a
movq %rdx, %rbx
movq %rax, %r13
leaq 0x40(%rsp), %rdi
callq 0x1f0b8
jmp 0x39620
movq %rdx, %rbx
movq %rax, %r13
leaq 0x70(%rsp), %rdi
callq 0x39102
jmp 0x39634
jmp 0x3962e
movq %rdx, %rbx
movq %rax, %r13
cmpl $0x1, %ebx
jne 0x395f5
movq %r13, %rdi
callq 0x10190
callq 0x10680
jmp 0x3936e
jmp 0x395f2
movq %rax, %r13
leaq 0x40(%rsp), %rdi
callq 0x3bbaa
jmp 0x39661
jmp 0x3965e
movq %rax, %r13
leaq 0x20(%rsp), %rdi
callq 0x39102
jmp 0x3967a
movq %rax, %r13
leaq 0x40(%rsp), %rdi
callq 0x1f0b8
movq %r13, %rdi
callq 0x106f0