// File: /workspace/github_cpp_makefile_star2_O1/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 %rdi, (%rsp)
movq (%rdi), %rdi
cmpq %rdi, (%rsi)
je 0x40a05
movq %rcx, %rbp
movq %rdx, %r12
movq %rsi, %r13
cmpl $-0x8, (%rdi)
jne 0x407f6
addq $0x8, %rdi
callq 0x442b8
leaq 0x77319(%rip), %rsi     # 0xb79d0
movq %rax, %rdi
callq 0x3d498
testb %al, %al
je 0x407f6
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq (%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
callq 0x442b8
leaq 0x772ea(%rip), %rsi     # 0xb79d0
movq %rax, %rdi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x3d502
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
movq %r13, %rsi
callq 0x404c8
leaq 0x20(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0xf(%rsp), %rcx
movl $0x1, %edx
callq 0x43e3c
leaq 0x58(%rsp), %rdi
leaq 0x20(%rsp), %rdx
movq %rbx, %rsi
movq %r12, %rcx
movq %rbp, %r8
callq 0x41626
leaq 0x60(%rsp), %rbx
movq -0x8(%rbx), %rax
leaq 0x18(%rsp), %rdi
movq %rax, -0x8(%rdi)
movq %rbx, %rsi
callq 0x37c6e
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x4075c
callq 0x1e6ee
leaq 0x20(%rsp), %rdi
callq 0x20a84
leaq 0x68(%rsp), %rdi
callq 0x404da
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x407de
leaq 0x58(%rsp), %rdi
movq %r13, %rsi
callq 0x404c8
leaq 0x20(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0x68(%rsp), %rcx
movl $0x1, %edx
callq 0x43e3c
leaq 0x88(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %r12, %rcx
movq %rbp, %r8
callq 0x24a66
leaq 0x88(%rsp), %rdi
callq 0x404da
leaq 0x20(%rsp), %rdi
callq 0x20a84
leaq 0x58(%rsp), %rdi
callq 0x404da
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x407ed
callq 0x1e6ee
testq %rbx, %rbx
jne 0x40a05
movq (%r13), %rsi
movl (%rsi), %eax
cmpl $-0x7, %eax
movq %r13, 0x78(%rsp)
je 0x408b5
cmpl $-0x5, %eax
je 0x40829
cmpl $-0x1, %eax
jne 0x409cb
movq (%rsp), %rax
movq (%rax), %rdi
callq 0x46c5e
jmp 0x409f2
addq $0x8, %rsi
movq %rsi, %rdi
callq 0x44177
movq %rax, %rbx
movq 0x8(%rax), %rsi
subq (%rax), %rsi
sarq $0x4, %rsi
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x43baa
movq (%rbx), %rsi
cmpq %rsi, 0x8(%rbx)
je 0x40891
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x20(%rsp), %rdi
addq %r14, %rdi
addq %r14, %rsi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x40674
incq %r15
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq %rsi, %rax
sarq $0x4, %rax
addq $0x10, %r14
cmpq %rax, %r15
jb 0x40861
movq (%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
leaq 0x20(%rsp), %rsi
callq 0x43e84
leaq 0x20(%rsp), %rdi
callq 0x20a84
jmp 0x409f2
movq %r12, 0x80(%rsp)
movq %rbp, %r12
leaq 0x28(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x8(%rax)
movaps %xmm0, 0x18(%rax)
movaps %xmm0, -0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq $0x0, 0x20(%rax)
movq (%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
leaq 0x20(%rsp), %rbx
movq %rbx, %rsi
callq 0x43ef6
movq %rbx, %rdi
callq 0x443fa
movq (%r13), %rdi
addq $0x8, %rdi
callq 0x4410c
movq %rax, %r13
movq 0x18(%rax), %rbp
addq $0x8, %r13
cmpq %r13, %rbp
je 0x409f2
leaq 0x10(%rsp), %r14
leaq 0x20(%rsp), %rbx
movq 0x40(%rbp), %rax
cmpl $-0x1, (%rax)
je 0x409b5
leaq 0x40(%rbp), %r15
movq %r14, %rdi
callq 0x400a4
movq %r14, %rdi
movq %r15, %rsi
movq 0x80(%rsp), %rdx
movq %r12, %rcx
callq 0x40674
movq (%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
callq 0x4410c
movq %rax, %r15
leaq 0x20(%rbp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x43f3a
movq %r15, %rdi
movq %rbx, %rsi
callq 0x465c6
leaq 0x40(%rsp), %rdi
callq 0x404da
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x409ad
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x103d0
movq %r14, %rdi
callq 0x404da
movq %rbp, %rdi
callq 0x102a0
movq %rax, %rbp
cmpq %r13, %rax
jne 0x4092f
jmp 0x409f2
movq (%rsp), %rax
movq (%rax), %rax
addq $0x8, %rax
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
movsbq 0x50(%rsi), %rax
addq $0x8, %rsi
leaq 0x72d72(%rip), %rcx     # 0xb3760
callq *0x8(%rcx,%rax,8)
movq 0x78(%rsp), %rax
movq (%rax), %rax
movl (%rax), %eax
movq (%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 0x20(%rsp), %rdi
callq 0x20a84
jmp 0x40a29
movq %rax, %r13
leaq 0x58(%rsp), %rdi
callq 0x404da
jmp 0x40a38
movq %rax, %r13
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x40af9
callq 0x1e6ee
jmp 0x40af9
jmp 0x40add
movq %rax, %r13
jmp 0x40af9
movq %r13, %r14
movq %rdx, %rbx
movq %rax, %r13
leaq 0x20(%rsp), %rdi
callq 0x20a84
jmp 0x40a7b
movq %r13, %r14
movq %rdx, %rbx
movq %rax, %r13
leaq 0x68(%rsp), %rdi
callq 0x404da
jmp 0x40a92
jmp 0x40a89
movq %r13, %r14
movq %rdx, %rbx
movq %rax, %r13
cmpl $0x1, %ebx
jne 0x40a38
movq %r13, %rdi
callq 0x101a0
callq 0x10690
movq %r14, %r13
jmp 0x40770
jmp 0x40a35
movq %rax, %r13
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
callq 0x404da
movq -0x20(%rbx), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x40aef
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x40aef
jmp 0x40aec
movq %rax, %r13
leaq 0x20(%rsp), %rdi
callq 0x20a84
jmp 0x40af9
movq %rax, %r13
leaq 0x10(%rsp), %rdi
callq 0x404da
movq %r13, %rdi
callq 0x106f0
nop