// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/deps/geohash-int/geohash.c
// Function: geohashDecode
int geohashDecode(const GeoHashRange long_range, const GeoHashRange lat_range,
                   const GeoHashBits hash, GeoHashArea *area) {
    if (HASHISZERO(hash) || NULL == area || RANGEISZERO(lat_range) ||
        RANGEISZERO(long_range)) {
        return 0;
    }

    area->hash = hash;
    uint8_t step = hash.step;
    uint64_t hash_sep = deinterleave64(hash.bits); /* hash = [LAT][LONG] */

    double lat_scale = lat_range.max - lat_range.min;
    double long_scale = long_range.max - long_range.min;

    uint32_t ilato = hash_sep;       /* get lat part of deinterleaved hash */
    uint32_t ilono = hash_sep >> 32; /* shift over to get long part of hash */

    /* divide by 2**step.
     * Then, for 0-1 coordinate, multiply times scale and add
       to the min to get the absolute coordinate. */
    area->latitude.min =
        lat_range.min + (ilato * 1.0 / (1ull << step)) * lat_scale;
    area->latitude.max =
        lat_range.min + ((ilato + 1) * 1.0 / (1ull << step)) * lat_scale;
    area->longitude.min =
        long_range.min + (ilono * 1.0 / (1ull << step)) * long_scale;
    area->longitude.max =
        long_range.min + ((ilono + 1) * 1.0 / (1ull << step)) * long_scale;

    return 1;
}

// Assembly:
testq %rdi, %rdi
sete %al
testb %sil, %sil
sete %cl
andb %al, %cl
testq %rdx, %rdx
sete %r8b
xorl %eax, %eax
orb %cl, %r8b
jne 0x8df2b
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm3
jne 0x8df2c
jp 0x8df2c
ucomisd %xmm4, %xmm2
jne 0x8df2c
jp 0x8df2c
retq
ucomisd %xmm4, %xmm1
jne 0x8df3c
jp 0x8df3c
ucomisd %xmm4, %xmm0
jne 0x8df3c
jnp 0x8df2b
pushq %rbx
movq %rdi, (%rdx)
movb %sil, 0x8(%rdx)
movq %rdi, %rax
shrq %rax
movabsq $0x5555555555555555, %rcx # imm = 0x5555555555555555
andq %rdi, %rcx
movabsq $0x4444444444444444, %r8 # imm = 0x4444444444444444
andq %rax, %r8
movq %rcx, %rax
shrq %rax
orq %rcx, %rax
movabsq $0x3333333333333333, %rcx # imm = 0x3333333333333333
andq %rax, %rcx
movabsq $0x2222222222222222, %rax # imm = 0x2222222222222222
andq %rdi, %rax
orq %r8, %rax
movq %rax, %rdi
shrq %rdi
movq %rcx, %r8
shrq $0x2, %r8
orq %rcx, %r8
movabsq $0xf0f0f0f0f0f0f0f, %rcx # imm = 0xF0F0F0F0F0F0F0F
andq %rcx, %r8
shrq $0x3, %rax
orq %rdi, %rax
andq %rcx, %rax
movq %r8, %rcx
shrq $0x4, %rcx
orq %r8, %rcx
movabsq $0xff00ff00ff00ff, %rdi # imm = 0xFF00FF00FF00FF
andq %rdi, %rcx
movq %rax, %r8
shrq $0x4, %r8
orq %rax, %r8
andq %rdi, %r8
movq %rcx, %r9
shrq $0x8, %r9
orq %rcx, %r9
movq %r8, %rax
shrq $0x8, %rax
orq %r8, %rax
movq %r9, %r10
shrq $0x10, %r10
movl $0xffff0000, %ecx       # imm = 0xFFFF0000
andl %ecx, %r10d
movl $0xffff, %r8d           # imm = 0xFFFF
andl %r8d, %r9d
leal (%r10,%r9), %r11d
movq %rax, %rdi
shrq $0x10, %rdi
andl %ecx, %edi
andl %r8d, %eax
leal (%rdi,%rax), %r8d
movabsq $0x1, %rbx
movl %esi, %ecx
shlq %cl, %rbx
subsd %xmm2, %xmm3
movq %rbx, %xmm4
punpckldq 0x25feb(%rip), %xmm4 # xmm4 = xmm4[0],mem[0],xmm4[1],mem[1]
subsd %xmm0, %xmm1
subpd 0x25fef(%rip), %xmm4    # 0xb4030
leal 0x1(%r10,%r9), %ecx
movd %r11d, %xmm7
movd %ecx, %xmm5
punpckldq %xmm5, %xmm7    # xmm7 = xmm7[0],xmm5[0],xmm7[1],xmm5[1]
pxor %xmm6, %xmm6
punpckldq %xmm6, %xmm7    # xmm7 = xmm7[0],xmm6[0],xmm7[1],xmm6[1]
movdqa 0x350dd(%rip), %xmm5    # 0xc3140
por %xmm5, %xmm7
subpd %xmm5, %xmm7
movapd %xmm4, %xmm8
unpcklpd %xmm4, %xmm8            # xmm8 = xmm8[0],xmm4[0]
unpckhpd %xmm4, %xmm4            # xmm4 = xmm4[1,1]
addpd %xmm8, %xmm4
divpd %xmm4, %xmm7
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
mulpd %xmm7, %xmm3
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
addpd %xmm3, %xmm2
movupd %xmm2, 0x20(%rdx)
leal 0x1(%rdi,%rax), %eax
movd %r8d, %xmm2
movd %eax, %xmm3
punpckldq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
punpckldq %xmm6, %xmm2    # xmm2 = xmm2[0],xmm6[0],xmm2[1],xmm6[1]
por %xmm5, %xmm2
subpd %xmm5, %xmm2
divpd %xmm4, %xmm2
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm2, %xmm1
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
addpd %xmm1, %xmm0
movupd %xmm0, 0x10(%rdx)
movl $0x1, %eax
popq %rbx
retq