// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/intset.c
// Function: intsetAdd
intset *intsetAdd(intset *is, int64_t value, uint8_t *success) {
    uint8_t valenc = _intsetValueEncoding(value);
    uint32_t pos;
    if (success) *success = 1;

    /* Upgrade encoding if necessary. If we need to upgrade, we know that
     * this value should be either appended (if > 0) or prepended (if < 0),
     * because it lies outside the range of existing values. */
    if (valenc > intrev32ifbe(is->encoding)) {
        /* This always succeeds, so we don't need to curry *success. */
        return intsetUpgradeAndAdd(is,value);
    } else {
        /* Abort if the value is already present in the set.
         * This call will populate "pos" with the right position to insert
         * the value when it cannot be found. */
        if (intsetSearch(is,value,&pos)) {
            if (success) *success = 0;
            return is;
        }

        is = intsetResize(is,intrev32ifbe(is->length)+1);
        if (pos < intrev32ifbe(is->length)) intsetMoveTail(is,pos,pos+1);
    }

    _intsetSet(is,pos,value);
    is->length = intrev32ifbe(intrev32ifbe(is->length)+1);
    return is;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x80000000(%rsi), %rax
movswq %r14w, %rcx
xorl %edx, %edx
cmpq %rsi, %rcx
setne %dl
leal 0x2(,%rdx,2), %ecx
testq %r15, %r15
je 0x64a4b
movb $0x1, (%r15)
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rax
movl $0x8, %esi
cmovbl %esi, %ecx
movl (%rbx), %ebp
cmpl %ecx, %ebp
jae 0x64b11
leaq -0x8000(%r14), %rsi
movslq 0x4(%rbx), %r15
xorl %edi, %edi
cmpq $-0x10000, %rsi         # imm = 0xFFFF0000
adcb $0x1, %dil
leal 0x1(%r15), %esi
cmpq %rdx, %rax
movl %ecx, (%rbx)
movzbl %dil, %eax
movl $0x3, %ecx
cmovael %eax, %ecx
shll %cl, %esi
addq $0x8, %rsi
movq %rbx, %rdi
callq 0x3837d
movq %rax, %rbx
testq %r15, %r15
je 0x64b01
movq %r14, %rax
shrq $0x3f, %rax
addq %r15, %rax
movzbl %bpl, %ecx
cmpb $0x4, %bpl
je 0x64acc
cmpl $0x8, %ecx
jne 0x64ad3
movq (%rbx,%r15,8), %rdx
jmp 0x64ad9
movslq 0x4(%rbx,%r15,4), %rdx
jmp 0x64ad9
movswq 0x6(%rbx,%r15,2), %rdx
movl (%rbx), %esi
cmpl $0x4, %esi
je 0x64aeb
cmpl $0x8, %esi
jne 0x64af1
movq %rdx, (%rbx,%rax,8)
jmp 0x64af6
movl %edx, 0x4(%rbx,%rax,4)
jmp 0x64af6
movw %dx, 0x6(%rbx,%rax,2)
decq %r15
decq %rax
testq %r15, %r15
jne 0x64abb
testq %r14, %r14
js 0x64b37
movslq 0x4(%rbx), %rax
movl (%rbx), %ecx
jmp 0x64bcc
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x64bfb
testb %al, %al
je 0x64b4c
testq %r15, %r15
je 0x64bed
movb $0x0, (%r15)
jmp 0x64bed
movl (%rbx), %eax
cmpl $0x4, %eax
je 0x64b94
cmpl $0x8, %eax
jne 0x64b9a
movq %r14, 0x8(%rbx)
jmp 0x64bea
movl 0x4(%rbx), %esi
incl %esi
imull %ebp, %esi
addq $0x8, %rsi
movq %rbx, %rdi
callq 0x3837d
movq %rax, %rbx
movl 0x4(%rsp), %eax
movl 0x4(%rbx), %edx
subl %eax, %edx
jbe 0x64bc8
leaq 0x1(%rax), %rcx
movl (%rbx), %esi
movq %rbx, %rdi
addq $0x8, %rdi
cmpl $0x4, %esi
je 0x64ba1
cmpl $0x8, %esi
jne 0x64bb0
leaq (%rdi,%rax,8), %rsi
leaq (%rdi,%rcx,8), %rdi
movl $0x3, %ecx
jmp 0x64bbd
movl %r14d, 0x8(%rbx)
jmp 0x64bea
movw %r14w, 0x8(%rbx)
jmp 0x64bea
leaq (%rdi,%rax,4), %rsi
leaq (%rdi,%rcx,4), %rdi
movl $0x2, %ecx
jmp 0x64bbd
leaq (%rdi,%rax,2), %rsi
leaq (%rdi,%rcx,2), %rdi
movl $0x1, %ecx
shll %cl, %edx
callq 0x267e0
movl 0x4(%rsp), %eax
movl (%rbx), %ecx
cltq
cmpl $0x4, %ecx
je 0x64bdd
cmpl $0x8, %ecx
jne 0x64be4
movq %r14, 0x8(%rbx,%rax,8)
jmp 0x64bea
movl %r14d, 0x8(%rbx,%rax,4)
jmp 0x64bea
movw %r14w, 0x8(%rbx,%rax,2)
incl 0x4(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq