// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/quicklist.c
// Function: quicklistMergeNodes
REDIS_STATIC void _quicklistMergeNodes(quicklist *quicklist,
                                       quicklistNode *center) {
    int fill = quicklist->fill;
    quicklistNode *prev, *prev_prev, *next, *next_next, *target;
    prev = prev_prev = next = next_next = target = NULL;

    if (center->prev) {
        prev = center->prev;
        if (center->prev->prev)
            prev_prev = center->prev->prev;
    }

    if (center->next) {
        next = center->next;
        if (center->next->next)
            next_next = center->next->next;
    }

    /* Try to merge prev_prev and prev */
    if (_quicklistNodeAllowMerge(prev, prev_prev, fill)) {
        _quicklistZiplistMerge(quicklist, prev_prev, prev);
        prev_prev = prev = NULL; /* they could have moved, invalidate them. */
    }

    /* Try to merge next and next_next */
    if (_quicklistNodeAllowMerge(next, next_next, fill)) {
        _quicklistZiplistMerge(quicklist, next, next_next);
        next = next_next = NULL; /* they could have moved, invalidate them. */
    }

    /* Try to merge center node and previous node */
    if (_quicklistNodeAllowMerge(center, center->prev, fill)) {
        target = _quicklistZiplistMerge(quicklist, center->prev, center);
        center = NULL; /* center could have been deleted, invalidate it. */
    } else {
        /* else, we didn't merge here, but target needs to be valid below. */
        target = center;
    }

    /* Use result of center merge (or original) to merge with next node. */
    if (_quicklistNodeAllowMerge(target, target->next, fill)) {
        _quicklistZiplistMerge(quicklist, target, target->next);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %eax
shll $0x10, %eax
sarl $0x10, %eax
movl %eax, -0x14(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x28cfa
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, (%rax)
je 0x28cf8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x28cfa
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x28d32
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x28d30
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x28d32
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x28050
cmpl $0x0, %eax
je 0x28d68
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x28af0
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x28050
cmpl $0x0, %eax
je 0x28d9e
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x28af0
movq $0x0, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl -0x14(%rbp), %edx
callq 0x28050
cmpl $0x0, %eax
je 0x28dd8
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
callq 0x28af0
movq %rax, -0x40(%rbp)
movq $0x0, -0x10(%rbp)
jmp 0x28de0
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0x28050
cmpl $0x0, %eax
je 0x28e0e
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x28af0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)