// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/sort.c
// Function: sortCompare
int sortCompare(const void *s1, const void *s2) {
    const redisSortObject *so1 = s1, *so2 = s2;
    int cmp;

    if (!server.sort_alpha) {
        /* Numeric sorting. Here it's trivial as we precomputed scores */
        if (so1->u.score > so2->u.score) {
            cmp = 1;
        } else if (so1->u.score < so2->u.score) {
            cmp = -1;
        } else {
            /* Objects have the same score, but we don't want the comparison
             * to be undefined, so we compare objects lexicographically.
             * This way the result of SORT is deterministic. */
            cmp = compareStringObjects(so1->obj,so2->obj);
        }
    } else {
        /* Alphanumeric sorting */
        if (server.sort_bypattern) {
            if (!so1->u.cmpobj || !so2->u.cmpobj) {
                /* At least one compare object is NULL */
                if (so1->u.cmpobj == so2->u.cmpobj)
                    cmp = 0;
                else if (so1->u.cmpobj == NULL)
                    cmp = -1;
                else
                    cmp = 1;
            } else {
                /* We have both the objects, compare them. */
                if (server.sort_store) {
                    cmp = compareStringObjects(so1->u.cmpobj,so2->u.cmpobj);
                } else {
                    /* Here we can use strcoll() directly as we are sure that
                     * the objects are decoded string objects. */
                    cmp = strcoll(so1->u.cmpobj->ptr,so2->u.cmpobj->ptr);
                }
            }
        } else {
            /* Compare elements directly. */
            if (server.sort_store) {
                cmp = compareStringObjects(so1->obj,so2->obj);
            } else {
                cmp = collateStringObjects(so1->obj,so2->obj);
            }
        }
    }
    return server.sort_desc ? -cmp : cmp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0xfe401(%rip), %rax     # 0x1781d8
cmpl $0x0, 0x934(%rax)
jne 0x79e3b
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x20(%rbp), %rax
ucomisd 0x8(%rax), %xmm0
jbe 0x79dfd
movl $0x1, -0x24(%rbp)
jmp 0x79e36
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm1
movq -0x20(%rbp), %rax
movsd 0x8(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x79e1e
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
jmp 0x79e34
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
callq 0x497e0
movl %eax, -0x24(%rbp)
jmp 0x79e36
jmp 0x79f2f
leaq 0xfe396(%rip), %rax     # 0x1781d8
cmpl $0x0, 0x938(%rax)
je 0x79eed
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x79e65
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x79e9f
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x79e80
movl $0x0, -0x24(%rbp)
jmp 0x79e9d
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x79e94
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
jmp 0x79e9b
movl $0x1, -0x24(%rbp)
jmp 0x79e9d
jmp 0x79eeb
leaq 0xfe332(%rip), %rax     # 0x1781d8
cmpl $0x0, 0x93c(%rax)
je 0x79ec9
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x497e0
movl %eax, -0x24(%rbp)
jmp 0x79ee9
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x260e0
movl %eax, -0x24(%rbp)
jmp 0x79eeb
jmp 0x79f2d
leaq 0xfe2e4(%rip), %rax     # 0x1781d8
cmpl $0x0, 0x93c(%rax)
je 0x79f15
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
callq 0x497e0
movl %eax, -0x24(%rbp)
jmp 0x79f2b
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
callq 0x49810
movl %eax, -0x24(%rbp)
jmp 0x79f2d
jmp 0x79f2f
leaq 0xfe2a2(%rip), %rax     # 0x1781d8
cmpl $0x0, 0x930(%rax)
je 0x79f49
xorl %eax, %eax
subl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0x79f4f
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)