// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movsd -0x10(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x5e18a
jmp 0x5e1ac
leaq 0xdfa83(%rip), %rdi     # 0x13dc14
leaq 0xdfa8a(%rip), %rsi     # 0x13dc22
movl $0x73, %edx
callq 0x76ce0
movl $0x1, %edi
callq 0x263c0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x128(%rbp)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
subl $0x1, %eax
movl %eax, -0x1b4(%rbp)
cmpl $0x0, -0x1b4(%rbp)
jl 0x5e38d
movl -0x1b4(%rbp), %eax
movq -0x8(%rbp), %rcx
movl 0x18(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x5e1f5
xorl %eax, %eax
movl %eax, -0x1bc(%rbp)
jmp 0x5e20d
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
cltq
movl -0x1b0(%rbp,%rax,4), %eax
movl %eax, -0x1bc(%rbp)
movl -0x1bc(%rbp), %ecx
movslq -0x1b4(%rbp), %rax
movl %ecx, -0x1b0(%rbp,%rax,4)
movq -0x128(%rbp), %rcx
addq $0x18, %rcx
movslq -0x1b4(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, (%rcx)
movb %al, -0x1bd(%rbp)
je 0x5e2fe
movq -0x128(%rbp), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movsd 0x8(%rax), %xmm1
movsd -0x10(%rbp), %xmm0
movb $0x1, %al
ucomisd %xmm1, %xmm0
movb %al, -0x1be(%rbp)
ja 0x5e2f2
movq -0x128(%rbp), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movsd 0x8(%rax), %xmm0
xorl %eax, %eax
ucomisd -0x10(%rbp), %xmm0
movb %al, -0x1bf(%rbp)
jne 0x5e2e6
jp 0x5e2e6
movq -0x128(%rbp), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x497e0
cmpl $0x0, %eax
setl %al
movb %al, -0x1bf(%rbp)
movb -0x1bf(%rbp), %al
movb %al, -0x1be(%rbp)
movb -0x1be(%rbp), %al
movb %al, -0x1bd(%rbp)
movb -0x1bd(%rbp), %al
testb $0x1, %al
jne 0x5e30a
jmp 0x5e363
movq -0x128(%rbp), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movslq -0x1b4(%rbp), %rax
addl -0x1b0(%rbp,%rax,4), %ecx
movl %ecx, -0x1b0(%rbp,%rax,4)
movq -0x128(%rbp), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x128(%rbp)
jmp 0x5e221
movq -0x128(%rbp), %rcx
movslq -0x1b4(%rbp), %rax
movq %rcx, -0x120(%rbp,%rax,8)
movl -0x1b4(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1b4(%rbp)
jmp 0x5e1ca
callq 0x5e100
movl %eax, -0x1b8(%rbp)
movl -0x1b8(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jle 0x5e43a
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x1b4(%rbp)
movl -0x1b4(%rbp), %eax
cmpl -0x1b8(%rbp), %eax
jge 0x5e42d
movslq -0x1b4(%rbp), %rax
movl $0x0, -0x1b0(%rbp,%rax,4)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movslq -0x1b4(%rbp), %rax
movq %rcx, -0x120(%rbp,%rax,8)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl %eax, %ecx
movslq -0x1b4(%rbp), %rax
movq -0x120(%rbp,%rax,8), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b4(%rbp)
jmp 0x5e3b8
movl -0x1b8(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x18(%rax)
movl -0x1b8(%rbp), %edi
movsd -0x10(%rbp), %xmm0
movq -0x18(%rbp), %rsi
callq 0x5df60
movq %rax, -0x128(%rbp)
movl $0x0, -0x1b4(%rbp)
movl -0x1b4(%rbp), %eax
cmpl -0x1b8(%rbp), %eax
jge 0x5e581
movslq -0x1b4(%rbp), %rax
movq -0x120(%rbp,%rax,8), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x128(%rbp), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x128(%rbp), %rcx
movslq -0x1b4(%rbp), %rax
movq -0x120(%rbp,%rax,8), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movslq -0x1b4(%rbp), %rax
movq -0x120(%rbp,%rax,8), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movl -0x1b0(%rbp), %eax
movslq -0x1b4(%rbp), %rdx
subl -0x1b0(%rbp,%rdx,4), %eax
subl %eax, %ecx
movq -0x128(%rbp), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movl -0x1b0(%rbp), %ecx
movslq -0x1b4(%rbp), %rax
subl -0x1b0(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movslq -0x1b4(%rbp), %rax
movq -0x120(%rbp,%rax,8), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b4(%rbp)
jmp 0x5e45f
movl -0x1b8(%rbp), %eax
movl %eax, -0x1b4(%rbp)
movl -0x1b4(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x5e5d7
movslq -0x1b4(%rbp), %rax
movq -0x120(%rbp,%rax,8), %rax
addq $0x18, %rax
movslq -0x1b4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b4(%rbp)
jmp 0x5e58d
movq -0x120(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x5e5f2
xorl %eax, %eax
movq %rax, -0x1c8(%rbp)
jmp 0x5e600
movq -0x120(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movq -0x1c8(%rbp), %rcx
movq -0x128(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x128(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x5e638
movq -0x128(%rbp), %rcx
movq -0x128(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x10(%rax)
jmp 0x5e647
movq -0x128(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x128(%rbp), %rax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopw (%rax,%rax)