// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/quicklist.c
// Function: _quicklistCompress
REDIS_STATIC void __quicklistCompress(const quicklist *quicklist,
                                      quicklistNode *node) {
    /* If length is less than our compress depth (from both sides),
     * we can't compress anything. */
    if (!quicklistAllowsCompression(quicklist) ||
        quicklist->len < (unsigned int)(quicklist->compress * 2))
        return;

#if 0
    /* Optimized cases for small depth counts */
    if (quicklist->compress == 1) {
        quicklistNode *h = quicklist->head, *t = quicklist->tail;
        quicklistDecompressNode(h);
        quicklistDecompressNode(t);
        if (h != node && t != node)
            quicklistCompressNode(node);
        return;
    } else if (quicklist->compress == 2) {
        quicklistNode *h = quicklist->head, *hn = h->next, *hnn = hn->next;
        quicklistNode *t = quicklist->tail, *tp = t->prev, *tpp = tp->prev;
        quicklistDecompressNode(h);
        quicklistDecompressNode(hn);
        quicklistDecompressNode(t);
        quicklistDecompressNode(tp);
        if (h != node && hn != node && t != node && tp != node) {
            quicklistCompressNode(node);
        }
        if (hnn != t) {
            quicklistCompressNode(hnn);
        }
        if (tpp != h) {
            quicklistCompressNode(tpp);
        }
        return;
    }
#endif

    /* Iterate until we reach compress depth for both sides of the list.a
     * Note: because we do length checks at the *top* of this function,
     *       we can skip explicit null checks below. Everything exists. */
    quicklistNode *forward = quicklist->head;
    quicklistNode *reverse = quicklist->tail;
    int depth = 0;
    int in_depth = 0;
    while (depth++ < quicklist->compress) {
        quicklistDecompressNode(forward);
        quicklistDecompressNode(reverse);

        if (forward == node || reverse == node)
            in_depth = 1;

        if (forward == reverse)
            return;

        forward = forward->next;
        reverse = reverse->prev;
    }

    if (!in_depth)
        quicklistCompressNode(node);

    if (depth > 2) {
        /* At this point, forward and reverse are one node beyond depth */
        quicklistCompressNode(forward);
        quicklistCompressNode(reverse);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x10, %eax
cmpl $0x0, %eax
je 0x27b86
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x8(%rbp), %rcx
movl 0x1c(%rcx), %ecx
shrl $0x10, %ecx
shll %ecx
cmpl %ecx, %eax
jae 0x27b8b
jmp 0x27ce1
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x24(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x24(%rbp)
movq -0x8(%rbp), %rcx
movl 0x1c(%rcx), %ecx
shrl $0x10, %ecx
cmpl %ecx, %eax
jge 0x27c5f
jmp 0x27bcf
cmpq $0x0, -0x18(%rbp)
je 0x27bf1
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x10, %eax
andl $0x3, %eax
cmpl $0x2, %eax
jne 0x27bf1
movq -0x18(%rbp), %rdi
callq 0x27a80
jmp 0x27bf3
jmp 0x27bf5
cmpq $0x0, -0x20(%rbp)
je 0x27c17
movq -0x20(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x10, %eax
andl $0x3, %eax
cmpl $0x2, %eax
jne 0x27c17
movq -0x20(%rbp), %rdi
callq 0x27a80
jmp 0x27c19
movq -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0x27c2d
movq -0x20(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0x27c34
movl $0x1, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x27c43
jmp 0x27ce1
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x27bb0
cmpl $0x0, -0x28(%rbp)
jne 0x27c8d
jmp 0x27c67
cmpq $0x0, -0x10(%rbp)
je 0x27c89
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x10, %eax
andl $0x3, %eax
cmpl $0x1, %eax
jne 0x27c89
movq -0x10(%rbp), %rdi
callq 0x27980
jmp 0x27c8b
jmp 0x27c8d
cmpl $0x2, -0x24(%rbp)
jle 0x27ce1
jmp 0x27c95
cmpq $0x0, -0x18(%rbp)
je 0x27cb7
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x10, %eax
andl $0x3, %eax
cmpl $0x1, %eax
jne 0x27cb7
movq -0x18(%rbp), %rdi
callq 0x27980
jmp 0x27cb9
jmp 0x27cbb
cmpq $0x0, -0x20(%rbp)
je 0x27cdd
movq -0x20(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x10, %eax
andl $0x3, %eax
cmpl $0x1, %eax
jne 0x27cdd
movq -0x20(%rbp), %rdi
callq 0x27980
jmp 0x27cdf
jmp 0x27ce1
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)