// File: /workspace/github_cpp_makefile_star2_O2/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, %r13
movq %rdi, (%rsp)
movq %rsi, %rdi
callq 0x39ca6
addl $0xa, %eax
cmpl $0x9, %eax
ja 0x4c8f2
leaq 0x2c30a(%rip), %rcx     # 0x78800
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x50(%rsp), %rbx
movl $0xfffffff6, (%rbx)     # imm = 0xFFFFFFF6
leaq 0xa0(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x39730
movq (%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x6463c
leaq 0xa8(%rsp), %rdi
jmp 0x4c804
movl $0xfffffffc, 0x8(%rsp)  # imm = 0xFFFFFFFC
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x39aa6
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x4cec2
leaq 0xd8(%rsp), %r15
leaq 0x28(%rsp), %r14
movaps -0x8(%r14), %xmm0
movaps %xmm0, -0x8(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r14)
leaq 0x8(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
movq (%rsp), %rdi
callq 0x6463c
movq %r15, %rdi
callq 0x1d786
movq %r14, %rdi
callq 0x1d786
leaq 0x50(%rsp), %rdi
callq 0x101d0
jmp 0x4c8dc
leaq 0x20(%rsp), %rbx
movl $0xfffffffd, (%rbx)     # imm = 0xFFFFFFFD
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x39b5c
leaq 0x8(%rsp), %rsi
movb %al, (%rsi)
leaq 0x50(%rsp), %rdi
callq 0x4ce86
leaq 0xf8(%rsp), %r15
leaq 0x58(%rsp), %r14
movaps -0x8(%r14), %xmm0
movaps %xmm0, -0x8(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r14)
leaq 0xf0(%rsp), %rdx
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x6463c
jmp 0x4c7f9
movl $0xfffffff6, 0x8(%rsp)  # imm = 0xFFFFFFF6
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rcx
movq %r14, %r8
callq 0x39fb2
leaq 0x90(%rsp), %rbx
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x4e040
leaq 0x8(%rsp), %rsi
movq (%rsp), %rdi
movq %rbx, %rdx
callq 0x6463c
leaq 0x98(%rsp), %rdi
callq 0x1d786
leaq 0x28(%rsp), %rdi
callq 0x1d786
leaq 0x50(%rsp), %rdi
callq 0x1f0b8
jmp 0x4c8dc
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x64630
movq %rbx, %rax
jmp 0x4c8e0
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x39a02
movq (%rax), %rbx
movq 0x8(%rax), %r12
leaq 0x20(%rsp), %r13
leaq 0x50(%rsp), %rbp
cmpq %r12, %rbx
je 0x4c80e
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x4c4bd
movq %rbp, %rdi
movq %r13, %rsi
callq 0x4cee0
leaq 0x30(%rsp), %rdi
callq 0x1d786
addq $0x10, %rbx
jmp 0x4c6d8
leaq 0x28(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x397e6
movq %rax, %r13
movq 0x18(%rax), %rbp
addq $0x8, %r13
leaq 0x8(%rsp), %rbx
leaq 0x50(%rsp), %r12
cmpq %r13, %rbp
je 0x4c876
leaq 0x40(%rbp), %rsi
movq %rbx, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x4c4bd
leaq 0x20(%rbp), %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x4cf4c
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x4e4a8
movq %r12, %rdi
callq 0x4cf72
leaq 0x18(%rsp), %rdi
callq 0x1d786
movq %rbp, %rdi
callq 0x102b0
movq %rax, %rbp
jmp 0x4c74a
leaq 0x20(%rsp), %rbx
movl $0xfffffffe, (%rbx)     # imm = 0xFFFFFFFE
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3968c
leaq 0x50(%rsp), %rdi
movq %rax, %rsi
callq 0x4cea4
leaq 0xe8(%rsp), %r15
leaq 0x58(%rsp), %r14
movaps -0x8(%r14), %xmm0
movaps %xmm0, -0x8(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r14)
leaq 0xe0(%rsp), %rdx
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x6463c
movq %r15, %rdi
callq 0x1d786
movq %r14, %rdi
callq 0x1d786
jmp 0x4c8dc
movl $0xfffffffb, 0x8(%rsp)  # imm = 0xFFFFFFFB
leaq 0x20(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x4cf0c
leaq 0xc8(%rsp), %r15
leaq 0x28(%rsp), %r14
movaps -0x8(%r14), %xmm0
movaps %xmm0, -0x8(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r14)
leaq 0x8(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
movq (%rsp), %rdi
callq 0x6463c
movq %r15, %rdi
callq 0x1d786
movq %r14, %rdi
callq 0x1d786
leaq 0x50(%rsp), %rdi
callq 0x4cf2a
jmp 0x4c8dc
movl $0xfffffff9, 0x8(%rsp)  # imm = 0xFFFFFFF9
leaq 0x50(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x4cf88
leaq 0xb8(%rsp), %r15
leaq 0x58(%rsp), %r14
movaps -0x8(%r14), %xmm0
movaps %xmm0, -0x8(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r14)
leaq 0x8(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
movq (%rsp), %rdi
callq 0x6463c
movq %r15, %rdi
callq 0x1d786
movq %r14, %rdi
callq 0x1d786
leaq 0x20(%rsp), %rdi
callq 0x4d444
movq (%rsp), %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xa8, %edi
callq 0x101f0
movq %rax, %r12
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x3aaf4
leaq 0x2c056(%rip), %rsi     # 0x78969
leaq 0x50(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x1cb73
movb $0x1, %bpl
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x3ebb8
xorl %ebp, %ebp
leaq 0x6535f(%rip), %rsi     # 0xb1ca0
leaq -0x1d4d6(%rip), %rdx    # 0x2f472
movq %r12, %rdi
callq 0x106c0
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x101d0
jmp 0x4c965
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x20(%rsp), %rdi
callq 0x101d0
testb %bpl, %bpl
jne 0x4c97c
jmp 0x4ca79
movq %rax, %rbx
movq %r12, %rdi
callq 0x102e0
jmp 0x4ca79
movq %rax, %rbx
movq %r15, %rdi
callq 0x1d786
movq %r14, %rdi
jmp 0x4ca4c
jmp 0x4ca30
movq %rax, %rbx
movq %r15, %rdi
callq 0x1d786
movq %r14, %rdi
jmp 0x4ca6a
jmp 0x4ca5d
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x1d786
leaq 0x28(%rsp), %rdi
callq 0x1d786
jmp 0x4ca00
movq %rax, %rbx
movq %r15, %rdi
callq 0x1d786
movq %r14, %rdi
callq 0x1d786
jmp 0x4ca24
jmp 0x4ca0c
jmp 0x4ca30
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
jmp 0x4ca1a
jmp 0x4ca5d
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x1f0b8
jmp 0x4ca79
movq %rax, %rbx
movq %r15, %rdi
callq 0x1d786
movq %r14, %rdi
callq 0x1d786
jmp 0x4ca79
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x101d0
jmp 0x4ca79
movq %rax, %rbx
jmp 0x4ca51
movq %rax, %rbx
jmp 0x4ca47
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x4cf72
leaq 0x18(%rsp), %rdi
callq 0x1d786
leaq 0x20(%rsp), %rdi
callq 0x4d444
jmp 0x4ca79
movq %rax, %rbx
jmp 0x4ca6f
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x1d786
leaq 0x50(%rsp), %rdi
callq 0x4cf2a
movq %rbx, %rdi
callq 0x106f0