// File: /workspace/github_cpp_makefile_star2_O3/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 0x40311
movq %rcx, %r13
movq %rdx, %r12
movq %rsi, %r14
cmpl $-0x8, (%rdi)
jne 0x4010a
addq $0x8, %rdi
callq 0x43b28
leaq 0x75a05(%rip), %rsi     # 0xb59d0
movq %rax, %rdi
callq 0x3ce6c
testb %al, %al
je 0x4010a
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq (%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
callq 0x43b28
leaq 0x759d6(%rip), %rsi     # 0xb59d0
movq %rax, %rdi
movq %r12, %rdx
movq %r13, %rcx
callq 0x3ced2
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0x3fdf4
leaq 0x20(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0xf(%rsp), %rcx
movl $0x1, %edx
callq 0x436ac
leaq 0x58(%rsp), %rdi
leaq 0x20(%rsp), %rdx
movq %rbx, %rsi
movq %r12, %rcx
movq %r13, %r8
callq 0x40f14
leaq 0x60(%rsp), %rbx
movq -0x8(%rbx), %rax
leaq 0x18(%rsp), %rdi
movq %rax, -0x8(%rdi)
movq %rbx, %rsi
callq 0x3775e
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x40070
callq 0x1e5bc
leaq 0x20(%rsp), %rdi
callq 0x20952
leaq 0x68(%rsp), %rdi
callq 0x3fe06
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x400f2
leaq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0x3fdf4
leaq 0x20(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0x68(%rsp), %rcx
movl $0x1, %edx
callq 0x436ac
leaq 0x88(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0x2489a
leaq 0x88(%rsp), %rdi
callq 0x3fe06
leaq 0x20(%rsp), %rdi
callq 0x20952
leaq 0x58(%rsp), %rdi
callq 0x3fe06
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x40101
callq 0x1e5bc
testq %rbx, %rbx
jne 0x40311
movq (%r14), %rsi
movl (%rsi), %eax
cmpl $-0x7, %eax
movq %r14, 0x78(%rsp)
je 0x401c8
cmpl $-0x5, %eax
je 0x4013c
cmpl $-0x1, %eax
jne 0x402d7
movq (%rsp), %rax
movq (%rax), %rdi
callq 0x463ea
jmp 0x402fe
addq $0x8, %rsi
movq %rsi, %rdi
callq 0x439e7
movq %rax, %rbx
movq 0x8(%rax), %rsi
subq (%rax), %rsi
sarq $0x4, %rsi
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x43418
movq (%rbx), %rsi
cmpq %rsi, 0x8(%rbx)
je 0x401a4
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x20(%rsp), %rdi
addq %r14, %rdi
addq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x3ff88
incq %r15
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq %rsi, %rax
sarq $0x4, %rax
addq $0x10, %r14
cmpq %rax, %r15
jb 0x40174
movq (%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
leaq 0x20(%rsp), %rsi
callq 0x436f4
leaq 0x20(%rsp), %rdi
callq 0x20952
jmp 0x402fe
movq %r12, 0x80(%rsp)
movq %r13, %r12
leaq 0x28(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq (%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
leaq 0x20(%rsp), %rbx
movq %rbx, %rsi
callq 0x43766
movq %rbx, %rdi
callq 0x43c6a
movq (%r14), %rdi
addq $0x8, %rdi
callq 0x4397c
movq %rax, %r13
movq 0x18(%rax), %r14
addq $0x8, %r13
cmpq %r13, %r14
je 0x402fe
leaq 0x10(%rsp), %rbp
leaq 0x20(%rsp), %rbx
movq 0x40(%r14), %rax
cmpl $-0x1, (%rax)
je 0x402c1
leaq 0x40(%r14), %r15
movq %rbp, %rdi
callq 0x3f9d0
movq %rbp, %rdi
movq %r15, %rsi
movq 0x80(%rsp), %rdx
movq %r12, %rcx
callq 0x3ff88
movq (%rsp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
callq 0x4397c
movq %rax, %r15
leaq 0x20(%r14), %rsi
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x437aa
movq %r15, %rdi
movq %rbx, %rsi
callq 0x45d92
leaq 0x40(%rsp), %rdi
callq 0x3fe06
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x402b9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x103d0
movq %rbp, %rdi
callq 0x3fe06
movq %r14, %rdi
callq 0x102a0
movq %rax, %r14
cmpq %r13, %rax
jne 0x4023b
jmp 0x402fe
movq (%rsp), %rax
movq (%rax), %rax
addq $0x8, %rax
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
movsbq 0x50(%rsi), %rax
addq $0x8, %rsi
leaq 0x7146e(%rip), %rcx     # 0xb1768
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 0x20952
jmp 0x40335
movq %rax, %r13
leaq 0x58(%rsp), %rdi
callq 0x3fe06
jmp 0x40344
movq %rax, %r13
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x40403
callq 0x1e5bc
jmp 0x40403
jmp 0x403e7
movq %rax, %r13
jmp 0x40403
movq %r13, %r15
movq %rdx, %rbx
movq %rax, %r13
leaq 0x20(%rsp), %rdi
callq 0x20952
jmp 0x40387
movq %r13, %r15
movq %rdx, %rbx
movq %rax, %r13
leaq 0x68(%rsp), %rdi
callq 0x3fe06
jmp 0x4039e
jmp 0x40395
movq %r13, %r15
movq %rdx, %rbx
movq %rax, %r13
cmpl $0x1, %ebx
jne 0x40344
movq %r13, %rdi
callq 0x101a0
callq 0x10690
movq %r15, %r13
jmp 0x40084
jmp 0x40341
movq %rax, %r13
leaq 0x40(%rsp), %rdi
callq 0x3fe06
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x403f9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x403f9
jmp 0x403f6
movq %rax, %r13
leaq 0x20(%rsp), %rdi
callq 0x20952
jmp 0x40403
movq %rax, %r13
leaq 0x10(%rsp), %rdi
callq 0x3fe06
movq %r13, %rdi
callq 0x106f0
nop