// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/geo.c
// Function: membersOfAllNeighbors
int membersOfAllNeighbors(robj *zobj, GeoHashRadius n, double lon, double lat, double radius, geoArray *ga) {
    GeoHashBits neighbors[9];
    unsigned int i, count = 0, last_processed = 0;
    int debugmsg = 0;

    neighbors[0] = n.hash;
    neighbors[1] = n.neighbors.north;
    neighbors[2] = n.neighbors.south;
    neighbors[3] = n.neighbors.east;
    neighbors[4] = n.neighbors.west;
    neighbors[5] = n.neighbors.north_east;
    neighbors[6] = n.neighbors.north_west;
    neighbors[7] = n.neighbors.south_east;
    neighbors[8] = n.neighbors.south_west;

    /* For each neighbor (*and* our own hashbox), get all the matching
     * members and add them to the potential result list. */
    for (i = 0; i < sizeof(neighbors) / sizeof(*neighbors); i++) {
        if (HASHISZERO(neighbors[i])) {
            if (debugmsg) D("neighbors[%d] is zero",i);
            continue;
        }

        /* Debugging info. */
        if (debugmsg) {
            GeoHashRange long_range, lat_range;
            geohashGetCoordRange(&long_range,&lat_range);
            GeoHashArea myarea = {{0,0},{0,0},{0,0}};
            geohashDecode(long_range, lat_range, neighbors[i], &myarea);

            /* Dump center square. */
            D("neighbors[%d]:\n",i);
            D("area.longitude.min: %f\n", myarea.longitude.min);
            D("area.longitude.max: %f\n", myarea.longitude.max);
            D("area.latitude.min: %f\n", myarea.latitude.min);
            D("area.latitude.max: %f\n", myarea.latitude.max);
            D("\n");
        }

        /* When a huge Radius (in the 5000 km range or more) is used,
         * adjacent neighbors can be the same, leading to duplicated
         * elements. Skip every range which is the same as the one
         * processed previously. */
        if (last_processed &&
            neighbors[i].bits == neighbors[last_processed].bits &&
            neighbors[i].step == neighbors[last_processed].step)
        {
            if (debugmsg)
                D("Skipping processing of %d, same as previous\n",i);
            continue;
        }
        count += membersOfGeoHashBox(zobj, neighbors[i], ga, lon, lat, radius);
        last_processed = i;
    }
    return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xb0, %rsp
movq %rsi, %rbx
movsd %xmm2, 0x18(%rsp)
movsd %xmm1, 0x10(%rsp)
movsd %xmm0, 0x8(%rsp)
movq %rdi, %r14
movaps 0xe0(%rsp), %xmm0
movaps 0x120(%rsp), %xmm1
movaps 0x130(%rsp), %xmm2
movaps 0x140(%rsp), %xmm3
leaq 0x28(%rsp), %r15
movaps %xmm0, -0x8(%r15)
movaps %xmm1, 0x8(%r15)
movaps 0x150(%rsp), %xmm0
movaps %xmm0, 0x18(%r15)
movaps %xmm2, 0x28(%r15)
movaps %xmm3, 0x38(%r15)
movaps 0x160(%rsp), %xmm0
movaps %xmm0, 0x48(%r15)
movaps 0x180(%rsp), %xmm0
movaps %xmm0, 0x58(%r15)
movaps 0x170(%rsp), %xmm0
movaps %xmm0, 0x68(%r15)
movaps 0x190(%rsp), %xmm0
movaps %xmm0, 0x78(%r15)
xorl %r12d, %r12d
xorl %eax, %eax
xorl %ebp, %ebp
cmpq $0x9, %r12
je 0x74052
movq -0x8(%r15), %rsi
testq %rsi, %rsi
jne 0x74004
cmpb $0x0, (%r15)
je 0x74049
testl %eax, %eax
je 0x74024
movl %eax, %ecx
shlq $0x4, %rcx
cmpq 0x20(%rsp,%rcx), %rsi
jne 0x74024
addq %rsp, %rcx
addq $0x20, %rcx
movb (%r15), %dl
cmpb 0x8(%rcx), %dl
je 0x74049
movl (%r15), %edx
movq %r14, %rdi
movq %rbx, %rcx
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
callq 0x73ea3
addl %eax, %ebp
movl %r12d, %eax
incq %r12
addq $0x10, %r15
jmp 0x73fef
movl %ebp, %eax
addq $0xb0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq