// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0xa0e49
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm3
jne 0xa0e4a
jp 0xa0e4a
ucomisd %xmm4, %xmm2
jne 0xa0e4a
jp 0xa0e4a
retq
ucomisd %xmm4, %xmm1
jne 0xa0e5a
jp 0xa0e5a
ucomisd %xmm4, %xmm0
jne 0xa0e5a
jnp 0xa0e49
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, %rdi
shrq $0x8, %rdi
orq %rcx, %rdi
movq %r8, %rax
shrq $0x8, %rax
orq %r8, %rax
movq %rdi, %r9
shrq $0x10, %r9
movl $0xffff0000, %ecx       # imm = 0xFFFF0000
andl %ecx, %r9d
movl $0xffff, %r10d          # imm = 0xFFFF
andl %r10d, %edi
leal (%r9,%rdi), %r11d
movq %rax, %r8
shrq $0x10, %r8
andl %ecx, %r8d
andl %r10d, %eax
leal (%r8,%rax), %r10d
subsd %xmm2, %xmm3
subsd %xmm0, %xmm1
cvtsi2sd %r11, %xmm5
movl $0x1, %r11d
movl %esi, %ecx
shlq %cl, %r11
movq %r11, %xmm6
punpckldq 0x24988(%rip), %xmm6 # xmm6 = xmm6[0],mem[0],xmm6[1],mem[1]
subpd 0x24990(%rip), %xmm6    # 0xc58f0
movapd %xmm6, %xmm4
unpckhpd %xmm6, %xmm4            # xmm4 = xmm4[1],xmm6[1]
addsd %xmm6, %xmm4
divsd %xmm4, %xmm5
mulsd %xmm3, %xmm5
addsd %xmm2, %xmm5
movsd %xmm5, 0x20(%rdx)
leal 0x1(%r9,%rdi), %ecx
xorps %xmm5, %xmm5
cvtsi2sd %rcx, %xmm5
divsd %xmm4, %xmm5
mulsd %xmm3, %xmm5
addsd %xmm2, %xmm5
movsd %xmm5, 0x28(%rdx)
cvtsi2sd %r10, %xmm2
divsd %xmm4, %xmm2
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, 0x10(%rdx)
leal 0x1(%r8,%rax), %eax
xorps %xmm2, %xmm2
cvtsi2sd %rax, %xmm2
divsd %xmm4, %xmm2
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, 0x18(%rdx)
movl $0x1, %eax
retq