// File: /workspace/github_cpp_makefile_star2_O1/Nallantli[P]Rossa/main/rossa/value/value.cpp
// Function: value_t::hash() const
const unsigned int value_t::hash() const
{
	switch (type)
	{
	case NIL:
		return 0x00000000;
	case BOOLEAN_D:
		return std::get<bool>(value) ? 0x10000001 : 0x10000000;
	case NUMBER:
		return 0x20000000 | (std::get<number_t>(value).type == number_t::LONG_NUM ? 0x00000000 : 0x0100000) | (std::get<number_t>(value).getLong() % 0x00FFFFFF);
	case ARRAY:
	{
		int h = 0;
		int i = 0;
		for (auto &e : std::get<std::vector<symbol_t>>(value))
		{
			h = (h + (e.hash() << i++)) % 0x0FFFFFFF;
		}
		return 0x30000000 | h;
	}
	case STRING:
	{
		int h = 0;
		int i = 0;
		for (auto &c : std::get<std::string>(value))
		{
			h = (h + ((int)c << i++)) % 0x0FFFFFFF;
		}
		return 0x40000000 | h;
	}
	case OBJECT:
		return 0x50000000 | (std::get<object_t>(value).hash() % 0x0FFFFFFF);
	case DICTIONARY:
	{
		int h = 0;
		int i = 0;
		for (auto &e : std::get<std::map<const std::string, const symbol_t>>(value))
		{
			h = (h + (e.second.hash() << i++)) % 0x0FFFFFFF;
		}
		return 0x60000000 | h;
	}
	case FUNCTION:
		return 0x70000000 | (std::get<wrapper_t>(value).hash() % 0x0FFFFFFF);
	case TYPE_NAME:
		return 0x80000000 | (std::get<parameter_t>(value).hash() % 0x0FFFFFFF);
	default:
		return 0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl (%rdi), %eax
addl $0x9, %eax
cmpl $0x7, %eax
ja 0x46f18
movq %rdi, %r14
leaq 0x3ecac(%rip), %rcx     # 0x8593c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
addq $0x8, %r14
movq %r14, %rdi
callq 0x473c6
movq %rax, %rdi
callq 0x3ddd2
movl %eax, %ecx
movq %rcx, %rdx
shlq $0x4, %rdx
addq %rcx, %rdx
shrq $0x20, %rdx
movl %eax, %ecx
subl %edx, %ecx
shrl %ecx
addl %edx, %ecx
shrl $0x1b, %ecx
movl %ecx, %edx
shll $0x1c, %edx
subl %edx, %ecx
leal (%rax,%rcx), %ebx
addl $0x80000000, %ebx       # imm = 0x80000000
jmp 0x46f2f
addq $0x8, %r14
movq %r14, %rdi
callq 0x471af
movq (%rax), %r14
movq 0x8(%rax), %r12
cmpq %r12, %r14
je 0x46f1c
xorl %ebx, %ebx
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x40554
leal 0x1(%r15), %edx
movl %r15d, %ecx
shll %cl, %eax
addl %ebx, %eax
movq %rax, %rcx
shlq $0x4, %rcx
addq %rax, %rcx
shrq $0x20, %rcx
movl %eax, %ebx
subl %ecx, %ebx
shrl %ebx
addl %ecx, %ebx
shrl $0x1b, %ebx
movl %ebx, %ecx
shll $0x1c, %ecx
subl %ecx, %ebx
addl %eax, %ebx
addq $0x10, %r14
movl %edx, %r15d
cmpq %r12, %r14
jne 0x46cfe
orl $0x30000000, %ebx       # imm = 0x30000000
jmp 0x46f2f
addq $0x8, %r14
movq %r14, %rdi
callq 0x472f0
movq %rax, %r14
movq 0x18(%rax), %r15
addq $0x8, %r14
cmpq %r14, %r15
je 0x46f23
xorl %r12d, %r12d
xorl %ebx, %ebx
leaq 0x40(%r15), %rdi
callq 0x40554
movl %r12d, %ecx
shll %cl, %eax
leal 0x1(%r12), %ebp
addl %ebx, %eax
movq %rax, %rcx
shlq $0x4, %rcx
addq %rax, %rcx
shrq $0x20, %rcx
movl %eax, %ebx
subl %ecx, %ebx
shrl %ebx
addl %ecx, %ebx
shrl $0x1b, %ebx
movl %ebx, %ecx
shll $0x1c, %ecx
subl %ecx, %ebx
addl %eax, %ebx
movq %r15, %rdi
callq 0x104b0
movq %rax, %r15
movl %ebp, %r12d
cmpq %r14, %rax
jne 0x46d6f
orl $0x60000000, %ebx       # imm = 0x60000000
jmp 0x46f2f
addq $0x8, %r14
movq %r14, %rdi
callq 0x4735b
movq %rax, %rdi
callq 0x4764c
movl %eax, %ecx
movq %rcx, %rdx
shlq $0x4, %rdx
addq %rcx, %rdx
shrq $0x20, %rdx
movl %eax, %ecx
subl %edx, %ecx
shrl %ecx
addl %edx, %ecx
shrl $0x1b, %ecx
movl %ecx, %edx
shll $0x1c, %edx
subl %edx, %ecx
leal (%rax,%rcx), %ebx
addl $0x70000000, %ebx       # imm = 0x70000000
jmp 0x46f2f
addq $0x8, %r14
movq %r14, %rdi
callq 0x47144
xorl %ebx, %ebx
cmpl $0x1, 0x8(%rax)
setne %bl
movq %r14, %rdi
callq 0x47144
movq %rax, %rdi
callq 0x479d4
movq %rax, %rcx
movabsq $-0x7fffff7fffff7fff, %rdx # imm = 0x8000008000008001
imulq %rdx
addq %rcx, %rdx
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x17, %rdx
addl %eax, %edx
movl %edx, %eax
shll $0x18, %eax
subl %eax, %edx
addl %edx, %ecx
shll $0x14, %ebx
orl %ecx, %ebx
orl $0x20000000, %ebx       # imm = 0x20000000
jmp 0x46f2f
addq $0x8, %r14
movq %r14, %rdi
callq 0x47285
movq %rax, %rdi
callq 0x3d4f2
movl %eax, %ecx
movq %rcx, %rdx
shlq $0x4, %rdx
addq %rcx, %rdx
shrq $0x20, %rdx
movl %eax, %ecx
subl %edx, %ecx
shrl %ecx
addl %edx, %ecx
shrl $0x1b, %ecx
movl %ecx, %edx
shll $0x1c, %edx
subl %edx, %ecx
leal (%rax,%rcx), %ebx
addl $0x50000000, %ebx       # imm = 0x50000000
jmp 0x46f2f
addq $0x8, %r14
movq %r14, %rdi
callq 0x4721a
movq 0x8(%rax), %rdx
testq %rdx, %rdx
je 0x46f2a
movq (%rax), %rax
xorl %ecx, %ecx
xorl %ebx, %ebx
movsbl (%rax,%rcx), %esi
shll %cl, %esi
addl %ebx, %esi
movslq %esi, %rsi
imulq $-0x7ffffff7, %rsi, %rbx # imm = 0x80000009
shrq $0x20, %rbx
addl %esi, %ebx
movl %ebx, %edi
shrl $0x1f, %edi
sarl $0x1b, %ebx
addl %edi, %ebx
movl %ebx, %edi
shll $0x1c, %edi
subl %edi, %ebx
addl %esi, %ebx
incq %rcx
cmpq %rcx, %rdx
jne 0x46ec6
orl $0x40000000, %ebx       # imm = 0x40000000
jmp 0x46f2f
addq $0x8, %r14
movq %r14, %rdi
callq 0x470d9
movzbl (%rax), %ebx
orl $0x10000000, %ebx       # imm = 0x10000000
jmp 0x46f2f
xorl %ebx, %ebx
jmp 0x46f2f
movl $0x30000000, %ebx       # imm = 0x30000000
jmp 0x46f2f
movl $0x60000000, %ebx       # imm = 0x60000000
jmp 0x46f2f
movl $0x40000000, %ebx       # imm = 0x40000000
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq