// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/value.c
// Function: janet_hash
int32_t janet_hash(Janet x) {
    int32_t hash = 0;
    switch (janet_type(x)) {
        case JANET_NIL:
            hash = 0;
            break;
        case JANET_BOOLEAN:
            hash = janet_unwrap_boolean(x);
            break;
        case JANET_STRING:
        case JANET_SYMBOL:
        case JANET_KEYWORD:
            hash = janet_string_hash(janet_unwrap_string(x));
            break;
        case JANET_TUPLE:
            hash = janet_tuple_hash(janet_unwrap_tuple(x));
            hash += (janet_tuple_flag(janet_unwrap_tuple(x)) & JANET_TUPLE_FLAG_BRACKETCTOR) ? 1 : 0;
            break;
        case JANET_STRUCT:
            hash = janet_struct_hash(janet_unwrap_struct(x));
            break;
        case JANET_NUMBER: {
            union {
                double d;
                uint64_t u;
            } as;
            as.d = janet_unwrap_number(x);
            as.d += 0.0; /* normalize negative 0 */
            uint32_t lo = (uint32_t)(as.u & 0xFFFFFFFF);
            uint32_t hi = (uint32_t)(as.u >> 32);
            uint32_t hilo = (hi ^ lo) * 2654435769u;
            hash = (int32_t)((hilo << 16) | (hilo >> 16));
            break;
        }
        case JANET_ABSTRACT: {
            JanetAbstract xx = janet_unwrap_abstract(x);
            const JanetAbstractType *at = janet_abstract_type(xx);
            if (at->hash != NULL) {
                hash = at->hash(xx, janet_abstract_size(xx));
                break;
            }
        }
        /* fallthrough */
        default:
            if (sizeof(double) == sizeof(void *)) {
                /* Assuming 8 byte pointer (8 byte aligned) */
                uint64_t i = murmur64(janet_u64(x));
                hash = (int32_t)(i >> 32);
            } else {
                /* Assuming 4 byte pointer (or smaller) */
                uintptr_t diff = (uintptr_t) janet_unwrap_pointer(x);
                uint32_t hilo = (uint32_t) diff * 2654435769u;
                hash = (int32_t)((hilo << 16) | (hilo >> 16));
            }
            break;
    }
    return hash;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movsd -0x8(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6f055
jmp 0x6f066
movq -0x8(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x44(%rbp)
jmp 0x6f06d
xorl %eax, %eax
movl %eax, -0x44(%rbp)
jmp 0x6f06d
movl -0x44(%rbp), %eax
movl %eax, %ecx
movq %rcx, -0x50(%rbp)
subl $0xe, %eax
ja 0x6f1a6
movq -0x50(%rbp), %rax
leaq 0x29a72(%rip), %rcx     # 0x98afc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0xc(%rbp)
jmp 0x6f1be
movq -0x8(%rbp), %rax
andq $0x1, %rax
movl %eax, -0xc(%rbp)
jmp 0x6f1be
movq -0x8(%rbp), %rdi
callq 0x7b260
movl -0x4(%rax), %eax
movl %eax, -0xc(%rbp)
jmp 0x6f1be
movq -0x8(%rbp), %rdi
callq 0x7b260
movl -0xc(%rax), %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7b260
movl -0x20(%rax), %edx
andl $0x10000, %edx          # imm = 0x10000
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x6f1be
movq -0x8(%rbp), %rdi
callq 0x7b260
movl -0x14(%rax), %eax
movl %eax, -0xc(%rbp)
jmp 0x6f1be
movsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq -0x18(%rbp), %rax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
shrq $0x20, %rax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
xorl -0x1c(%rbp), %eax
imull $0x9e3779b9, %eax, %eax # imm = 0x9E3779B9
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
shll $0x10, %eax
movl -0x24(%rbp), %ecx
shrl $0x10, %ecx
orl %ecx, %eax
movl %eax, -0xc(%rbp)
jmp 0x6f1be
movq -0x8(%rbp), %rdi
callq 0x7b260
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x6f1a4
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x30(%rbp), %rcx
movq -0x8(%rcx), %rsi
callq *%rax
movl %eax, -0xc(%rbp)
jmp 0x6f1be
jmp 0x6f1a6
movq -0x8(%rbp), %rdi
callq 0x6f1d0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
shrq $0x20, %rax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)