// File: /workspace/github_cpp_makefile_star2_O1/Nallantli[P]Rossa/main/rossa/global/global.cpp
// Function: global::convertToMediator(symbol_t const&, token_t const*, std::vector<std::pair<token_t, function_t>, std::allocator<std::pair<token_t, function_t>>>&)
const mediator_t global::convertToMediator(const symbol_t &s, const token_t *token, trace_t &stack_trace)
{
	switch (s.getValueType())
	{
	case NIL:
		return mediator_t();
	case BOOLEAN_D:
		return mediator_t(
			MEDIATOR_BOOLEAN_D,
			std::make_shared<bool>(s.getBool(token, stack_trace)));
	case NUMBER:
		return mediator_t(
			MEDIATOR_NUMBER,
			std::make_shared<number_t>(s.getNumber(token, stack_trace)));
	case STRING:
		return mediator_t(
			MEDIATOR_STRING,
			std::make_shared<std::string>(s.getString(token, stack_trace)));
	case POINTER:
		return mediator_t(
			MEDIATOR_POINTER,
			s.getPointer(token, stack_trace));
	case FUNCTION:
		return MAKE_POINTER(s.getFunction({}, token, stack_trace));
	case ARRAY:
	{
		std::vector<mediator_t> mv;
		for (auto &e : s.getVector(token, stack_trace))
		{
			mv.push_back(convertToMediator(e, token, stack_trace));
		}
		return mediator_t(
			MEDIATOR_ARRAY,
			std::make_shared<std::vector<mediator_t>>(mv));
	}
	case DICTIONARY:
	{
		std::map<const std::string, const mediator_t> md;
		for (auto &e : s.getDictionary(token, stack_trace))
		{
			md.insert({e.first, convertToMediator(e.second, token, stack_trace)});
		}
		return MAKE_DICTIONARY(md);
	}
	default:
		throw rossa_error_t("[this shouldn't happen] Improper symbol_t to mediator_t conversion: " + s.toCodeString(), *token, stack_trace);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
movq %rsi, %rdi
callq 0x41262
addl $0xa, %eax
cmpl $0x9, %eax
ja 0x57ab8
leaq 0x2f212(%rip), %rcx     # 0x867c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x40(%rsp), %r12
movl $0xfffffff6, (%r12)     # imm = 0xFFFFFFF6
leaq 0xc8(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x40bca
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x6ea72
movq 0xd0(%rsp), %rdi
jmp 0x57a4c
movl $0xfffffffc, 0x80(%rsp) # imm = 0xFFFFFFFC
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x41004
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x7(%rsp), %rdx
movq %r12, %rcx
callq 0x59004
movups 0x10(%rsp), %xmm0
leaq 0xd8(%rsp), %rdx
movups %xmm0, (%rdx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
leaq 0x80(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x6ea72
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x57676
callq 0x1e6ee
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x57685
callq 0x1e6ee
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x57aa1
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x57aa1
leaq 0x40(%rsp), %r12
movl $0xfffffffd, (%r12)     # imm = 0xFFFFFFFD
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x410e2
movl %eax, %ebx
movl $0x18, %edi
callq 0x103c0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x5c36b(%rip), %rcx     # 0xb3a50
addq $0x10, %rcx
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
movb %bl, 0x10(%rax)
leaq 0xf8(%rsp), %rdx
movq %rcx, (%rdx)
movq %rax, 0x8(%rdx)
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x6ea72
movq 0x100(%rsp), %rdi
jmp 0x57a4c
movl $0xfffffff6, 0x80(%rsp) # imm = 0xFFFFFFF6
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rcx
movq %r14, %r8
callq 0x41626
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x98(%rsp)
movq %rax, 0xa0(%rsp)
testq %rax, %rax
je 0x57a5c
movq 0x5f819(%rip), %rcx     # 0xb6f90
cmpb $0x0, (%rcx)
je 0x57a58
incl 0x8(%rax)
jmp 0x57a5c
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x6ea64
movq %rbx, %rax
jmp 0x57aa6
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x40f46
movq (%rax), %rbx
movq 0x8(%rax), %rbp
cmpq %rbp, %rbx
je 0x57806
leaq 0x10(%rsp), %r12
leaq 0x40(%rsp), %r13
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x57574
movq %r13, %rdi
movq %r12, %rsi
callq 0x5819c
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x577fd
callq 0x1e6ee
addq $0x10, %rbx
cmpq %rbp, %rbx
jne 0x577d2
movl $0xfffffffb, 0x80(%rsp) # imm = 0xFFFFFFFB
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x7(%rsp), %rdx
leaq 0x40(%rsp), %rcx
callq 0x592cc
movups 0x10(%rsp), %xmm0
leaq 0xb8(%rsp), %rdx
movups %xmm0, (%rdx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
leaq 0x80(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x6ea72
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x5786e
callq 0x1e6ee
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x5787d
callq 0x1e6ee
leaq 0x40(%rsp), %rdi
callq 0x581e2
jmp 0x57aa1
leaq 0x18(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x40cb8
movq %rax, %r12
movq 0x18(%rax), %r13
addq $0x8, %r12
cmpq %r12, %r13
je 0x57953
leaq 0x80(%rsp), %rbp
leaq 0x40(%rsp), %rbx
leaq 0x40(%r13), %rsi
movq %rbp, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x57574
leaq 0x20(%r13), %rsi
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x5822a
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x59480
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x57915
callq 0x1e6ee
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x57931
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x103d0
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x57943
callq 0x1e6ee
movq %r13, %rdi
callq 0x102a0
movq %rax, %r13
cmpq %r12, %rax
jne 0x578d8
movl $0xfffffff9, 0x80(%rsp) # imm = 0xFFFFFFF9
leaq 0x48(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x40(%rsp), %rsi
leaq 0x7(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x59672
movups 0x40(%rsp), %xmm0
leaq 0xa8(%rsp), %rdx
movups %xmm0, (%rdx)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rsp)
leaq 0x80(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x6ea72
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x579bb
callq 0x1e6ee
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x579ca
callq 0x1e6ee
leaq 0x10(%rsp), %rdi
callq 0x5875c
jmp 0x57aa1
leaq 0x40(%rsp), %r12
movl $0xfffffffe, (%r12)     # imm = 0xFFFFFFFE
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x40b0c
movq %rax, %rbx
movl $0x20, %edi
callq 0x103c0
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x5c08a(%rip), %rcx     # 0xb3aa0
addq $0x10, %rcx
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
movups (%rbx), %xmm0
movups %xmm0, 0x10(%rax)
leaq 0xe8(%rsp), %rdx
movq %rcx, (%rdx)
movq %rax, 0x8(%rdx)
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x6ea72
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x57aa1
callq 0x1e6ee
jmp 0x57aa1
lock
incl 0x8(%rax)
leaq 0x80(%rsp), %rsi
leaq 0x98(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x6ea72
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x57a88
callq 0x1e6ee
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x57a97
callq 0x1e6ee
leaq 0x40(%rsp), %rdi
callq 0x20a84
movq 0x8(%rsp), %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xa8, %edi
callq 0x101e0
movq %rax, %r12
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x427a8
leaq 0x2ee50(%rip), %rsi     # 0x86929
leaq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x1d7be
movb $0x1, %bpl
leaq 0x40(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x476dc
xorl %ebp, %ebp
leaq 0x5b1d9(%rip), %rsi     # 0xb2ce0
leaq -0x2035a(%rip), %rdx    # 0x377b4
movq %r12, %rdi
callq 0x106d0
movq %rax, %rbx
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x57b3c
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x57b3c
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x57b5f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x57b5f
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x57cc9
movq %r12, %rdi
callq 0x102d0
jmp 0x57cc9
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x57b8a
callq 0x1e6ee
movq 0x48(%rsp), %rdi
jmp 0x57c92
jmp 0x57c73
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x57bae
callq 0x1e6ee
movq 0x18(%rsp), %rdi
jmp 0x57cb5
jmp 0x57ca8
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x57bd2
callq 0x1e6ee
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x57c20
callq 0x1e6ee
jmp 0x57c20
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x57bf8
callq 0x1e6ee
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x57c56
callq 0x1e6ee
jmp 0x57c56
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
jmp 0x57c47
jmp 0x57c73
jmp 0x57ca8
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x20a84
jmp 0x57cc9
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
jmp 0x57c47
movq %rax, %rbx
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x57cc9
callq 0x1e6ee
jmp 0x57cc9
movq %rax, %rbx
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x57cc9
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x57cc9
movq %rax, %rbx
jmp 0x57c9c
movq %rax, %rbx
jmp 0x57c8a
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x58286
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x57c9c
callq 0x1e6ee
leaq 0x10(%rsp), %rdi
callq 0x5875c
jmp 0x57cc9
movq %rax, %rbx
jmp 0x57cbf
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x57cbf
callq 0x1e6ee
leaq 0x40(%rsp), %rdi
callq 0x581e2
movq %rbx, %rdi
callq 0x106f0