// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/t_zset.c
// Function: zslInsert
zskiplistNode *zslInsert(zskiplist *zsl, double score, robj *obj) {
    zskiplistNode *update[ZSKIPLIST_MAXLEVEL], *x;
    unsigned int rank[ZSKIPLIST_MAXLEVEL];
    int i, level;

    serverAssert(!isnan(score));
    x = zsl->header;
    for (i = zsl->level-1; i >= 0; i--) {
        /* store rank that is crossed to reach the insert position */
        rank[i] = i == (zsl->level-1) ? 0 : rank[i+1];
        while (x->level[i].forward &&
            (x->level[i].forward->score < score ||
                (x->level[i].forward->score == score &&
                compareStringObjects(x->level[i].forward->obj,obj) < 0))) {
            rank[i] += x->level[i].span;
            x = x->level[i].forward;
        }
        update[i] = x;
    }
    /* we assume the key is not already inside, since we allow duplicated
     * scores, and the re-insertion of score and redis object should never
     * happen since the caller of zslInsert() should test in the hash table
     * if the element is already inside or not. */
    level = zslRandomLevel();
    if (level > zsl->level) {
        for (i = zsl->level; i < level; i++) {
            rank[i] = 0;
            update[i] = zsl->header;
            update[i]->level[i].span = zsl->length;
        }
        zsl->level = level;
    }
    x = zslCreateNode(level,score,obj);
    for (i = 0; i < level; i++) {
        x->level[i].forward = update[i]->level[i].forward;
        update[i]->level[i].forward = x;

        /* update span covered by update[i] as x is inserted here */
        x->level[i].span = update[i]->level[i].span - (rank[0] - rank[i]);
        update[i]->level[i].span = (rank[0] - rank[i]) + 1;
    }

    /* increment span for untouched levels */
    for (i = level; i < zsl->level; i++) {
        update[i]->level[i].span++;
    }

    x->backward = (update[0] == zsl->header) ? NULL : update[0];
    if (x->level[0].forward)
        x->level[0].forward->backward = x;
    else
        zsl->tail = x;
    zsl->length++;
    return x;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, 0x10(%rsp)
ucomisd %xmm0, %xmm0
jp 0x5011d
movq %rdi, %r12
movslq 0x18(%rdi), %r13
testq %r13, %r13
movsd %xmm0, 0x8(%rsp)
jle 0x4ffae
movq (%r12), %r15
movq %r12, 0x18(%rsp)
movq %r13, %rbx
movl 0x18(%r12), %eax
xorl %ebp, %ebp
cmpq %rax, %r13
je 0x4ff2c
movl 0x20(%rsp,%rbx,4), %ebp
leaq -0x1(%rbx), %r13
movl %ebp, 0x20(%rsp,%r13,4)
movq %r13, %r12
shlq $0x4, %r12
movq 0x18(%r15,%r12), %rax
testq %rax, %rax
je 0x4ff97
leaq (%r15,%r12), %r14
addq $0x18, %r14
movsd 0x8(%rax), %xmm1
ucomisd %xmm1, %xmm0
ja 0x4ff7b
ucomisd %xmm0, %xmm1
jne 0x4ff97
jp 0x4ff97
movq (%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0x41222
movsd 0x8(%rsp), %xmm0
testl %eax, %eax
jns 0x4ff97
movq (%r14), %rax
movq %rax, %r15
addl 0x8(%r14), %ebp
movl %ebp, 0x20(%rsp,%r13,4)
leaq (%rax,%r12), %r14
addq $0x18, %r14
movq (%r14), %rax
testq %rax, %rax
jne 0x4ff4e
movq %r15, 0xa0(%rsp,%r13,8)
cmpq $0x1, %rbx
movq 0x18(%rsp), %r12
jg 0x4ff19
xorl %r15d, %r15d
callq 0x26a30
incq %r15
testl $0xc000, %eax           # imm = 0xC000
je 0x4ffb1
cmpl $0x20, %r15d
movl $0x20, %ebp
cmovbl %r15d, %ebp
movslq 0x18(%r12), %rbx
cmpl %ebx, %ebp
jle 0x5002d
movq (%r12), %r14
movq %r12, %r13
movl 0x10(%r12), %r12d
leaq (%rsp,%rbx,4), %rdi
addq $0x20, %rdi
movl %ebx, %eax
notl %eax
addl %ebp, %eax
leaq 0x4(,%rax,4), %rdx
xorl %esi, %esi
callq 0x26110
movl %ebp, %eax
movq %rbx, %rcx
shlq $0x4, %rcx
addq %r14, %rcx
addq $0x20, %rcx
movq %r14, 0xa0(%rsp,%rbx,8)
movl %r12d, (%rcx)
incq %rbx
addq $0x10, %rcx
cmpq %rax, %rbx
jl 0x5000f
movq %r13, %r12
movl %ebp, 0x18(%r13)
movl %ebp, %edi
shll $0x4, %edi
addl $0x18, %edi
callq 0x382d1
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
movq 0x10(%rsp), %rcx
movq %rcx, (%rax)
movl 0x20(%rsp), %ecx
leal 0x1(%rcx), %edx
cmpq $0x20, %r15
movl $0x20, %esi
cmovbq %r15, %rsi
shll $0x2, %esi
xorl %edi, %edi
movq 0xa0(%rsp,%rdi,2), %r8
movq 0x18(%r8,%rdi,4), %r9
movq %r9, 0x18(%rax,%rdi,4)
movq %rax, 0x18(%r8,%rdi,4)
movl 0x20(%r8,%rdi,4), %r9d
movl 0x20(%rsp,%rdi), %r10d
subl %ecx, %r9d
addl %r10d, %r9d
movl %r9d, 0x20(%rax,%rdi,4)
movl %edx, %r9d
subl %r10d, %r9d
movl %r9d, 0x20(%r8,%rdi,4)
addq $0x4, %rdi
cmpq %rdi, %rsi
jne 0x50066
movslq 0x18(%r12), %rcx
cmpl %ecx, %ebp
jge 0x500d9
cmpq $0x20, %r15
movl $0x20, %edx
cmovbq %r15, %rdx
movl %edx, %esi
shll $0x4, %esi
movq 0xa0(%rsp,%rdx,8), %rdi
incl 0x20(%rdi,%rsi)
incq %rdx
addq $0x10, %rsi
cmpq %rcx, %rdx
jl 0x500c1
movq 0xa0(%rsp), %rcx
xorl %edx, %edx
cmpq (%r12), %rcx
cmovneq %rcx, %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rax), %rcx
leaq 0x8(%r12), %rdx
leaq 0x10(%rcx), %rsi
testq %rcx, %rcx
cmoveq %rdx, %rsi
movq %rax, (%rsi)
incq 0x10(%r12)
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x735a4(%rip), %rdi     # 0xc36c8
leaq 0x735ab(%rip), %rsi     # 0xc36d6
movl $0x73, %edx
callq 0x61908
movl $0x1, %edi
callq 0x263c0