LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/intset.c
// Function: intsetSearch
static uint8_t intsetSearch(intset *is, int64_t value, uint32_t *pos) {
    int min = 0, max = intrev32ifbe(is->length)-1, mid = -1;
    int64_t cur = -1;

    /* The value can never be found when the set is empty */
    if (intrev32ifbe(is->length) == 0) {
        if (pos) *pos = 0;
        return 0;
    } else {
        /* Check for the case where we know we cannot find the value,
         * but do know the insert position. */
        if (value > _intsetGet(is,intrev32ifbe(is->length)-1)) {
            if (pos) *pos = intrev32ifbe(is->length);
            return 0;
        } else if (value < _intsetGet(is,0)) {
            if (pos) *pos = 0;
            return 0;
        }
    }

    while(max >= min) {
        mid = ((unsigned int)min + (unsigned int)max) >> 1;
        cur = _intsetGet(is,mid);
        if (value > cur) {
            min = mid+1;
        } else if (value < cur) {
            max = mid-1;
        } else {
            break;
        }
    }

    if (value == cur) {
        if (pos) *pos = mid;
        return 1;
    } else {
        if (pos) *pos = min;
        return 0;
    }
}

// Assembly:
movl 0x4(%rdi), %ecx
movl %ecx, %eax
subl $0x1, %eax
jae 0x64c11
xorl %ecx, %ecx
movl $0x0, %eax
jmp 0x64cc7
movzbl (%rdi), %r8d
movslq %eax, %r9
cmpl $0x4, %r8d
je 0x64c2b
cmpl $0x8, %r8d
jne 0x64c32
movq 0x8(%rdi,%r9,8), %r9
jmp 0x64c38
movslq 0x8(%rdi,%r9,4), %r9
jmp 0x64c38
movswq 0x8(%rdi,%r9,2), %r9
cmpq %rsi, %r9
jge 0x64c44
xorl %eax, %eax
jmp 0x64cc7
movzbl %r8b, %r9d
cmpb $0x4, %r9b
je 0x64c5a
cmpl $0x8, %r9d
jne 0x64c60
movq 0x8(%rdi), %rcx
jmp 0x64c65
movslq 0x8(%rdi), %rcx
jmp 0x64c65
movswq 0x8(%rdi), %rcx
cmpq %rsi, %rcx
jg 0x64c05
testl %eax, %eax
js 0x64cae
xorl %ecx, %ecx
leal (%rax,%rcx), %r10d
shrl %r10d
cmpb $0x4, %r8b
je 0x64c8a
cmpl $0x8, %r9d
jne 0x64c91
movq 0x8(%rdi,%r10,8), %r11
jmp 0x64c97
movslq 0x8(%rdi,%r10,4), %r11
jmp 0x64c97
movswq 0x8(%rdi,%r10,2), %r11
cmpq %rsi, %r11
jge 0x64ca2
leal 0x1(%r10), %ecx
jmp 0x64ca8
jle 0x64cbd
leal -0x1(%r10), %eax
cmpl %ecx, %eax
jge 0x64c70
jmp 0x64cbd
movq $-0x1, %r11
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
xorl %ecx, %ecx
cmpq %rsi, %r11
sete %al
cmovel %r10d, %ecx
testq %rdx, %rdx
je 0x64cce
movl %ecx, (%rdx)
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/intset.c
// Function: intsetRemove
intset *intsetRemove(intset *is, int64_t value, int *success) {
    uint8_t valenc = _intsetValueEncoding(value);
    uint32_t pos;
    if (success) *success = 0;

    if (valenc <= intrev32ifbe(is->encoding) && intsetSearch(is,value,&pos)) {
        uint32_t len = intrev32ifbe(is->length);

        /* We know we can delete */
        if (success) *success = 1;

        /* Overwrite value with tail and update length */
        if (pos < (len-1)) intsetMoveTail(is,pos+1,pos);
        is = intsetResize(is,len-1);
        is->length = intrev32ifbe(len-1);
    }
    return is;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rdi, %rbx
leaq -0x80000000(%rsi), %rax
movswq %si, %rcx
xorl %edx, %edx
cmpq %rsi, %rcx
setne %dl
leal 0x2(,%rdx,2), %ecx
testq %r15, %r15
je 0x64d02
movl $0x0, (%r15)
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rax
movl $0x8, %eax
cmovbl %eax, %ecx
movl (%rbx), %r14d
cmpl %ecx, %r14d
jb 0x64dbb
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0x64bfb
testb %al, %al
je 0x64dbb
movl 0x4(%rbx), %ebp
testq %r15, %r15
je 0x64d4a
movl $0x1, (%r15)
movl (%rbx), %r14d
movl 0x4(%rsp), %ecx
decl %ebp
cmpl %ebp, %ecx
jae 0x64da2
leaq 0x1(%rcx), %rax
movl 0x4(%rbx), %edx
leaq 0x8(%rbx), %rdi
cmpl $0x4, %r14d
je 0x64d7a
cmpl $0x8, %r14d
jne 0x64d89
leaq (%rdi,%rax,8), %rsi
leaq (%rdi,%rcx,8), %rdi
movl $0x3, %ecx
jmp 0x64d96
leaq (%rdi,%rax,4), %rsi
leaq (%rdi,%rcx,4), %rdi
movl $0x2, %ecx
jmp 0x64d96
leaq (%rdi,%rax,2), %rsi
leaq (%rdi,%rcx,2), %rdi
movl $0x1, %ecx
subl %eax, %edx
shll %cl, %edx
callq 0x267e0
movl (%rbx), %r14d
imull %ebp, %r14d
addq $0x8, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3837d
movq %rax, %rbx
movl %ebp, 0x4(%rax)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/intset.c
// Function: intsetGet
uint8_t intsetGet(intset *is, uint32_t pos, int64_t *value) {
    if (pos < intrev32ifbe(is->length)) {
        *value = _intsetGet(is,pos);
        return 1;
    }
    return 0;
}

// Assembly:
cmpl %esi, 0x4(%rdi)
jbe 0x64e45
movzbl (%rdi), %ecx
movslq %esi, %rax
cmpl $0x4, %ecx
je 0x64e48
cmpl $0x8, %ecx
jne 0x64e4f
movq 0x8(%rdi,%rax,8), %rax
jmp 0x64e55
xorl %eax, %eax
retq
movslq 0x8(%rdi,%rax,4), %rax
jmp 0x64e55
movswq 0x8(%rdi,%rax,2), %rax
movq %rax, (%rdx)
movb $0x1, %al
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/syncio.c
// Function: syncWrite
ssize_t syncWrite(int fd, char *ptr, ssize_t size, long long timeout) {
    ssize_t nwritten, ret = size;
    long long start = mstime();
    long long remaining = timeout;

    while(1) {
        long long wait = (remaining > SYNCIO__RESOLUTION) ?
                          remaining : SYNCIO__RESOLUTION;
        long long elapsed;

        /* Optimistically try to write before checking if the file descriptor
         * is actually writable. At worst we get EAGAIN. */
        nwritten = write(fd,ptr,size);
        if (nwritten == -1) {
            if (errno != EAGAIN) return -1;
        } else {
            ptr += nwritten;
            size -= nwritten;
        }
        if (size == 0) return ret;

        /* Wait */
        aeWait(fd,AE_WRITABLE,wait);
        elapsed = mstime() - start;
        if (elapsed >= timeout) {
            errno = ETIMEDOUT;
            return -1;
        }
        remaining = timeout - elapsed;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %r15
movl %edi, %ebp
callq 0x2ffce
movq %rax, %r12
movq %r13, (%rsp)
movq %rbx, %r14
cmpq $0xb, %r14
movl $0xa, %eax
cmovlq %rax, %r14
movl %ebp, %edi
movq %r15, %rsi
movq %r13, %rdx
callq 0x26bb0
cmpq $-0x1, %rax
je 0x64eb9
addq %rax, %r15
subq %rax, %r13
jmp 0x64ec3
callq 0x26880
cmpl $0xb, (%rax)
jne 0x64ef2
testq %r13, %r13
je 0x64efb
movl %ebp, %edi
movl $0x2, %esi
movq %r14, %rdx
callq 0x2d4e5
callq 0x2ffce
subq %r12, %rax
movq %rbx, %r14
subq %rax, %r14
jg 0x64e91
callq 0x26880
movl $0x6e, (%rax)
movq $-0x1, %rax
jmp 0x64eff
movq (%rsp), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/syncio.c
// Function: syncRead
ssize_t syncRead(int fd, char *ptr, ssize_t size, long long timeout) {
    ssize_t nread, totread = 0;
    long long start = mstime();
    long long remaining = timeout;

    if (size == 0) return 0;
    while(1) {
        long long wait = (remaining > SYNCIO__RESOLUTION) ?
                          remaining : SYNCIO__RESOLUTION;
        long long elapsed;

        /* Optimistically try to read before checking if the file descriptor
         * is actually readable. At worst we get EAGAIN. */
        nread = read(fd,ptr,size);
        if (nread == 0) return -1; /* short read. */
        if (nread == -1) {
            if (errno != EAGAIN) return -1;
        } else {
            ptr += nread;
            size -= nread;
            totread += nread;
        }
        if (size == 0) return totread;

        /* Wait */
        aeWait(fd,AE_READABLE,wait);
        elapsed = mstime() - start;
        if (elapsed >= timeout) {
            errno = ETIMEDOUT;
            return -1;
        }
        remaining = timeout - elapsed;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
callq 0x2ffce
movq %rax, 0x10(%rsp)
testq %r14, %r14
je 0x64fb1
xorl %r13d, %r13d
movq %rbx, 0x8(%rsp)
movq $-0x1, %r12
cmpq $0xb, %rbx
movl $0xa, %eax
cmovlq %rax, %rbx
movl %ebp, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x26340
cmpq $-0x1, %rax
je 0x64f77
testq %rax, %rax
je 0x64fb9
addq %rax, %r13
subq %rax, %r14
je 0x64fb6
addq %rax, %r15
jmp 0x64f81
callq 0x26880
cmpl $0xb, (%rax)
jne 0x64fb9
movl %ebp, %edi
movl $0x1, %esi
movq %rbx, %rdx
callq 0x2d4e5
callq 0x2ffce
subq 0x10(%rsp), %rax
movq 0x8(%rsp), %rbx
subq %rax, %rbx
jg 0x64f45
callq 0x26880
movl $0x6e, (%rax)
jmp 0x64fb9
xorl %r12d, %r12d
jmp 0x64fb9
movq %r13, %r12
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/syncio.c
// Function: syncReadLine
ssize_t syncReadLine(int fd, char *ptr, ssize_t size, long long timeout) {
    ssize_t nread = 0;

    size--;
    while(size) {
        char c;

        if (syncRead(fd,&c,1,timeout) == -1) return -1;
        if (c == '\n') {
            *ptr = '\0';
            if (nread && *(ptr-1) == '\r') *(ptr-1) = '\0';
            return nread;
        } else {
            *ptr++ = c;
            *ptr = '\0';
            nread++;
        }
        size--;
    }
    return nread;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
decq %rbx
je 0x65022
movq %rcx, %r15
movq %rsi, %r14
movl %edi, %ebp
xorl %r13d, %r13d
leaq 0x7(%rsp), %r12
movl $0x1, %edx
movl %ebp, %edi
movq %r12, %rsi
movq %r15, %rcx
callq 0x64f0e
cmpq $-0x1, %rax
je 0x65026
movb 0x7(%rsp), %al
cmpb $0xa, %al
je 0x6502f
movb %al, (%r14,%r13)
movb $0x0, 0x1(%r14,%r13)
incq %r13
cmpq %r13, %rbx
jne 0x64fee
jmp 0x6504f
xorl %ebx, %ebx
jmp 0x6504f
movq $-0x1, %r13
jmp 0x6504c
movb $0x0, (%r14,%r13)
testq %r13, %r13
je 0x65049
cmpb $0xd, -0x1(%r14,%r13)
jne 0x6504c
movb $0x0, -0x1(%r14,%r13)
jmp 0x6504c
xorl %r13d, %r13d
movq %r13, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterLookupNode
clusterNode *clusterLookupNode(char *name) {
    sds s = sdsnewlen(name, CLUSTER_NAMELEN);
    dictEntry *de;

    de = dictFind(server.cluster->nodes,s);
    sdsfree(s);
    if (de == NULL) return NULL;
    return dictGetVal(de);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x28, %esi
callq 0x36178
movq %rax, %r14
leaq 0x9c134(%rip), %rax     # 0x1018a8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
movq %r14, %rsi
callq 0x2ebca
movq %rax, %rbx
movq %r14, %rdi
callq 0x36330
testq %rbx, %rbx
je 0x6579d
movq 0x8(%rbx), %rax
jmp 0x6579f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: createClusterNode
clusterNode *createClusterNode(char *nodename, int flags) {
    clusterNode *node = zmalloc(sizeof(*node));

    if (nodename)
        memcpy(node->name, nodename, CLUSTER_NAMELEN);
    else
        getRandomHexChars(node->name, CLUSTER_NAMELEN);
    node->ctime = mstime();
    node->configEpoch = 0;
    node->flags = flags;
    memset(node->slots,0,sizeof(node->slots));
    node->numslots = 0;
    node->numslaves = 0;
    node->slaves = NULL;
    node->slaveof = NULL;
    node->ping_sent = node->pong_received = 0;
    node->fail_time = 0;
    node->link = NULL;
    memset(node->ip,0,sizeof(node->ip));
    node->port = 0;
    node->fail_reports = listCreate();
    node->voted_time = 0;
    node->orphaned_time = 0;
    node->repl_offset_time = 0;
    node->repl_offset = 0;
    listSetFreeMethod(node->fail_reports,zfree);
    return node;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %r14
movl $0x8d8, %edi            # imm = 0x8D8
callq 0x382d1
movq %rax, %rbx
leaq 0x8(%rax), %rdi
testq %r14, %r14
je 0x657e0
movq 0x20(%r14), %rax
movq %rax, 0x20(%rdi)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%rdi)
movups %xmm0, (%rdi)
jmp 0x657ea
movl $0x28, %esi
callq 0x40256
callq 0x2ffce
movq %rax, (%rbx)
xorl %eax, %eax
movq %rax, 0x38(%rbx)
movl %ebp, 0x30(%rbx)
movq %rbx, %rdi
addq $0x40, %rdi
movq %rax, 0x8c8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x890(%rbx)
movups %xmm0, 0x8a0(%rbx)
movups %xmm0, 0x8ae(%rbx)
movl $0x0, 0x8c0(%rbx)
movl $0x830, %edx            # imm = 0x830
xorl %esi, %esi
callq 0x26110
callq 0x2b17c
movq %rax, 0x8d0(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x870(%rbx)
movups %xmm0, 0x880(%rbx)
leaq -0x2d448(%rip), %rcx    # 0x38413
movq %rcx, 0x18(%rax)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterAddNode
int clusterAddNode(clusterNode *node) {
    int retval;

    retval = dictAdd(server.cluster->nodes,
            sdsnewlen(node->name,CLUSTER_NAMELEN), node);
    return (retval == DICT_OK) ? C_OK : C_ERR;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x9c033(%rip), %rax     # 0x1018a8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %r14
addq $0x8, %rdi
movl $0x28, %esi
callq 0x36178
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x2e9b8
xorl %ecx, %ecx
negl %eax
sbbl %ecx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterNodeAddSlave
int clusterNodeAddSlave(clusterNode *master, clusterNode *slave) {
    int j;

    /* If it's already a slave, don't add it again. */
    for (j = 0; j < master->numslaves; j++)
        if (master->slaves[j] == slave) return C_ERR;
    master->slaves = zrealloc(master->slaves,
        sizeof(clusterNode*)*(master->numslaves+1));
    master->slaves[master->numslaves] = slave;
    master->numslaves++;
    master->flags |= CLUSTER_NODE_MIGRATE_TO;
    return C_OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x844(%rdi), %rax
movq 0x848(%rdi), %rdi
testq %rax, %rax
jle 0x658d9
xorl %ecx, %ecx
cmpq %r14, (%rdi,%rcx,8)
je 0x65909
incq %rcx
cmpq %rcx, %rax
jne 0x658cb
leaq 0x8(,%rax,8), %rsi
callq 0x3837d
movq %rax, 0x848(%rbx)
movslq 0x844(%rbx), %rcx
movq %r14, (%rax,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x844(%rbx)
orb $0x1, 0x31(%rbx)
xorl %eax, %eax
jmp 0x6590e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterAddSlot
int clusterAddSlot(clusterNode *n, int slot) {
    if (server.cluster->slots[slot]) return C_ERR;
    clusterNodeSetSlotBit(n,slot);
    server.cluster->slots[slot] = n;
    return C_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0x9bf86(%rip), %r15     # 0x1018a8
movq 0x9b0(%r15), %rcx
movslq %esi, %r14
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $0x0, 0x40028(%rcx,%r14,8)
jne 0x65958
movq %rdi, %rbx
movl %r14d, %esi
callq 0x6a187
movq 0x9b0(%r15), %rax
movq %rbx, 0x40028(%rax,%r14,8)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterGetMaxEpoch
uint64_t clusterGetMaxEpoch(void) {
    uint64_t max = 0;
    dictIterator *di;
    dictEntry *de;

    di = dictGetSafeIterator(server.cluster->nodes);
    while((de = dictNext(di)) != NULL) {
        clusterNode *node = dictGetVal(de);
        if (node->configEpoch > max) max = node->configEpoch;
    }
    dictReleaseIterator(di);
    if (max < server.cluster->currentEpoch) max = server.cluster->currentEpoch;
    return max;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0x9bf3e(%rip), %r14     # 0x1018a8
movq 0x9b0(%r14), %rax
movq 0x18(%rax), %rdi
callq 0x2efe5
movq %rax, %rbx
movq %rax, %rdi
callq 0x2f015
xorl %r15d, %r15d
testq %rax, %rax
je 0x659a6
movq 0x8(%rax), %rax
movq 0x38(%rax), %rax
cmpq %r15, %rax
cmovaq %rax, %r15
movq %rbx, %rdi
callq 0x2f015
jmp 0x65988
movq %rbx, %rdi
callq 0x2f0dd
movq 0x9b0(%r14), %rax
movq 0x8(%rax), %rax
cmpq %rax, %r15
cmovaq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterGenNodesDescription
sds clusterGenNodesDescription(int filter) {
    sds ci = sdsempty(), ni;
    dictIterator *di;
    dictEntry *de;

    di = dictGetSafeIterator(server.cluster->nodes);
    while((de = dictNext(di)) != NULL) {
        clusterNode *node = dictGetVal(de);

        if (node->flags & filter) continue;
        ni = clusterGenNodeDescription(node);
        ci = sdscatsds(ci,ni);
        sdsfree(ni);
        ci = sdscatlen(ci,"\n",1);
    }
    dictReleaseIterator(di);
    return ci;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edi, %ebx
callq 0x3628d
movq %rax, %r15
leaq 0x9bcac(%rip), %rax     # 0x1018a8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x2efe5
movq %rax, %r14
movq %rax, %rdi
callq 0x2f015
testq %rax, %rax
je 0x65c6a
leaq 0x592a6(%rip), %r12     # 0xbeec9
movq 0x8(%rax), %rdi
testl %ebx, 0x30(%rdi)
jne 0x65c5d
callq 0x6a36c
movq %rax, %r13
movq %r15, %rdi
movq %rax, %rsi
callq 0x36bc3
movq %rax, %r15
movq %r13, %rdi
callq 0x36330
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x36ad1
movq %rax, %r15
movq %r14, %rdi
callq 0x2f015
testq %rax, %rax
jne 0x65c23
movq %r14, %rdi
callq 0x2f0dd
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterLockConfig
int clusterLockConfig(char *filename) {
/* flock() does not exist on Solaris
 * and a fcntl-based solution won't help, as we constantly re-open that file,
 * which will release _all_ locks anyway
 */
#if !defined(__sun)
    /* To lock it, we need to open the file in a way it is created if
     * it does not exist, otherwise there is a race condition with other
     * processes. */
    int fd = open(filename,O_WRONLY|O_CREAT,0644);
    if (fd == -1) {
        serverLog(LL_WARNING,
            "Can't open %s in order to acquire a lock: %s",
            filename, strerror(errno));
        return C_ERR;
    }

    if (flock(fd,LOCK_EX|LOCK_NB) == -1) {
        if (errno == EWOULDBLOCK) {
            serverLog(LL_WARNING,
                 "Sorry, the cluster configuration file %s is already used "
                 "by a different Redis Cluster node. Please make sure that "
                 "different nodes use different cluster configuration "
                 "files.", filename);
        } else {
            serverLog(LL_WARNING,
                "Impossible to lock %s: %s", filename, strerror(errno));
        }
        close(fd);
        return C_ERR;
    }
    /* Lock acquired: leak the 'fd' by not closing it, so that we'll retain the
     * lock to the file as long as the process exists. */
#endif /* __sun */

    return C_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
movl $0x41, %esi
movl $0x1a4, %edx            # imm = 0x1A4
xorl %eax, %eax
callq 0x26690
cmpl $-0x1, %eax
je 0x65d38
movl %eax, %ebp
movl %eax, %edi
movl $0x6, %esi
callq 0x26650
cmpl $-0x1, %eax
jne 0x65d8a
callq 0x26880
movl (%rax), %edi
cmpl $0xb, %edi
jne 0x65d5f
leaq 0x61b18(%rip), %rsi     # 0xc783f
movl $0x3, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2fdad
jmp 0x65d7d
callq 0x26880
movl (%rax), %edi
callq 0x26680
leaq 0x61ac7(%rip), %rsi     # 0xc7812
movl $0x3, %edi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2fdad
jmp 0x65d84
callq 0x26680
leaq 0x61b81(%rip), %rsi     # 0xc78ec
movl $0x3, %edi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2fdad
movl %ebp, %edi
callq 0x26180
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterAcceptHandler
void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
    int cport, cfd;
    int max = MAX_CLUSTER_ACCEPTS_PER_CALL;
    char cip[NET_IP_STR_LEN];
    clusterLink *link;
    UNUSED(el);
    UNUSED(mask);
    UNUSED(privdata);

    /* If the server is starting up, don't accept cluster connections:
     * UPDATE messages may interact with the database content. */
    if (server.masterhost == NULL && server.loading) return;

    while(max--) {
        cfd = anetTcpAccept(server.neterr, fd, cip, sizeof(cip), &cport);
        if (cfd == ANET_ERR) {
            if (errno != EWOULDBLOCK)
                serverLog(LL_VERBOSE,
                    "Error accepting cluster node: %s", server.neterr);
            return;
        }
        anetNonBlock(NULL,cfd);
        anetEnableTcpNoDelay(NULL,cfd);

        /* Use non-blocking I/O for cluster messages. */
        serverLog(LL_VERBOSE,"Accepted cluster node %s:%d", cip, cport);
        /* Create a link object we use to handle the connection.
         * It gets passed to the readable handler when data is available.
         * Initiallly the link->node pointer is set to NULL as we don't know
         * which node is, but the right node is references once we know the
         * node identity. */
        link = createClusterLink(NULL);
        link->fd = cfd;
        aeCreateFileEvent(server.el,cfd,AE_READABLE,clusterReadHandler,link);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebx
leaq 0x9b85b(%rip), %r12     # 0x1018a8
cmpq $0x0, 0x828(%r12)
jne 0x66067
cmpl $0x0, 0x31c(%r12)
jne 0x66120
movl $0xfffffc18, %ebp       # imm = 0xFFFFFC18
movl $0x208, %r14d           # imm = 0x208
addq 0x96f3f(%rip), %r14     # 0xfcfb8
leaq 0x10(%rsp), %r15
movl $0x2e, %ecx
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
leaq 0xc(%rsp), %r8
callq 0x2e17c
cmpl $-0x1, %eax
je 0x660f7
movl %eax, %r13d
xorl %edi, %edi
movl %eax, %esi
callq 0x2d6a1
xorl %edi, %edi
movl %r13d, %esi
callq 0x2d7d3
movl 0xc(%rsp), %ecx
movl $0x1, %edi
leaq 0x619b4(%rip), %rsi     # 0xc7a74
movq %r15, %rdx
xorl %eax, %eax
callq 0x2fdad
xorl %edi, %edi
callq 0x664d7
movl %r13d, 0x8(%rax)
movq 0x40(%r12), %rdi
movl %r13d, %esi
movl $0x1, %edx
leaq 0x4a5(%rip), %rcx       # 0x6658e
movq %rax, %r8
callq 0x2ce46
incl %ebp
jne 0x6607e
jmp 0x66120
callq 0x26880
cmpl $0xb, (%rax)
je 0x66120
movl $0x208, %edx            # imm = 0x208
addq 0x96eab(%rip), %rdx     # 0xfcfb8
leaq 0x6193f(%rip), %rsi     # 0xc7a53
movl $0x1, %edi
xorl %eax, %eax
callq 0x2fdad
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: resetManualFailover
void resetManualFailover(void) {
    if (server.cluster->mf_end && clientsArePaused()) {
        server.clients_pause_end_time = 0;
        clientsArePaused(); /* Just use the side effect of the function. */
    }
    server.cluster->mf_end = 0; /* No manual failover in progress. */
    server.cluster->mf_can_start = 0;
    server.cluster->mf_slave = NULL;
    server.cluster->mf_master_offset = 0;
}

// Assembly:
pushq %rbx
leaq 0x9b771(%rip), %rbx     # 0x1018a8
movq 0x9b0(%rbx), %rax
cmpq $0x0, 0x60058(%rax)
je 0x66161
callq 0x3e869
testl %eax, %eax
je 0x66161
movq $0x0, 0x200(%rbx)
callq 0x3e869
movq 0x9b0(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x60064(%rax)
movups %xmm0, 0x60058(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterSetNodeAsMaster
void clusterSetNodeAsMaster(clusterNode *n) {
    if (nodeIsMaster(n)) return;

    if (n->slaveof) {
        clusterNodeRemoveSlave(n->slaveof,n);
        if (n != myself) n->flags |= CLUSTER_NODE_MIGRATE_TO;
    }
    n->flags &= ~CLUSTER_NODE_SLAVE;
    n->flags |= CLUSTER_NODE_MASTER;
    n->slaveof = NULL;

    /* Update config and state. */
    clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG|
                         CLUSTER_TODO_UPDATE_STATE);
}

// Assembly:
movl 0x30(%rdi), %eax
testb $0x1, %al
jne 0x66372
pushq %rbx
movq %rdi, %rbx
movq 0x850(%rdi), %rdi
testq %rdi, %rdi
je 0x66349
movq %rbx, %rsi
callq 0x668e9
movl 0x30(%rbx), %ecx
movl %ecx, %eax
orl $0x100, %eax            # imm = 0x100
cmpq %rbx, 0xafeea(%rip)     # 0x116230
cmovel %ecx, %eax
andl $-0x4, %eax
incl %eax
movl %eax, 0x30(%rbx)
movq $0x0, 0x850(%rbx)
leaq 0x9b545(%rip), %rax     # 0x1018a8
movq 0x9b0(%rax), %rax
orl $0x6, 0x60080(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterDelSlot
int clusterDelSlot(int slot) {
    clusterNode *n = server.cluster->slots[slot];

    if (!n) return C_ERR;
    serverAssert(clusterNodeClearSlotBit(n,slot) == 1);
    server.cluster->slots[slot] = NULL;
    return C_OK;
}

// Assembly:
leaq 0x9b52e(%rip), %rax     # 0x1018a8
movq 0x9b0(%rax), %rcx
movslq %edi, %rdx
movq 0x40028(%rcx,%rdx,8), %rsi
testq %rsi, %rsi
je 0x663e3
leal 0x7(%rdi), %ecx
testl %edi, %edi
cmovnsl %edi, %ecx
sarl $0x3, %ecx
movslq %ecx, %r8
movzbl 0x40(%rsi,%r8), %r9d
movl %edi, %ecx
andb $0x7, %cl
movl $0x1, %r10d
shll %cl, %r10d
notb %r10b
andb %r9b, %r10b
movb %r10b, 0x40(%rsi,%r8)
andl $0x7, %edi
btl %edi, %r9d
jae 0x663e9
decl 0x840(%rsi)
movq 0x9b0(%rax), %rax
movq $0x0, 0x40028(%rax,%rdx,8)
xorl %eax, %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
pushq %rax
leaq 0x621be(%rip), %rdi     # 0xc85af
leaq 0x6131d(%rip), %rsi     # 0xc7715
movl $0xd69, %edx            # imm = 0xD69
callq 0x61908
movl $0x1, %edi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterDelNode
void clusterDelNode(clusterNode *delnode) {
    int j;
    dictIterator *di;
    dictEntry *de;

    /* 1) Mark slots as unassigned. */
    for (j = 0; j < CLUSTER_SLOTS; j++) {
        if (server.cluster->importing_slots_from[j] == delnode)
            server.cluster->importing_slots_from[j] = NULL;
        if (server.cluster->migrating_slots_to[j] == delnode)
            server.cluster->migrating_slots_to[j] = NULL;
        if (server.cluster->slots[j] == delnode)
            clusterDelSlot(j);
    }

    /* 2) Remove failure reports. */
    di = dictGetSafeIterator(server.cluster->nodes);
    while((de = dictNext(di)) != NULL) {
        clusterNode *node = dictGetVal(de);

        if (node == delnode) continue;
        clusterNodeDelFailureReport(node,delnode);
    }
    dictReleaseIterator(di);

    /* 3) Free the node, unlinking it from the cluster. */
    freeClusterNode(delnode);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x9b48d(%rip), %r15     # 0x1018a8
movq 0x9b0(%r15), %rax
xorl %r14d, %r14d
cmpq %rbx, 0x20028(%rax,%r14,8)
jne 0x66442
movq $0x0, 0x20028(%rax,%r14,8)
movq 0x9b0(%r15), %rax
cmpq %rbx, 0x28(%rax,%r14,8)
jne 0x66459
movq $0x0, 0x28(%rax,%r14,8)
movq 0x9b0(%r15), %rax
cmpq %rbx, 0x40028(%rax,%r14,8)
jne 0x66472
movl %r14d, %edi
callq 0x66373
movq 0x9b0(%r15), %rax
incq %r14
cmpq $0x4000, %r14           # imm = 0x4000
jne 0x66425
movq 0x18(%rax), %rdi
callq 0x2efe5
movq %rax, %r14
movq %rax, %rdi
callq 0x2f015
testq %rax, %rax
je 0x664ad
movq 0x8(%rax), %rdi
cmpq %rbx, %rdi
je 0x664a8
movq %rbx, %rsi
callq 0x6686e
movq %r14, %rdi
jmp 0x6648d
movq %r14, %rdi
callq 0x2f0dd
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x6698b
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: createClusterLink
clusterLink *createClusterLink(clusterNode *node) {
    clusterLink *link = zmalloc(sizeof(*link));
    link->ctime = mstime();
    link->sndbuf = sdsempty();
    link->rcvbuf = sdsempty();
    link->node = node;
    link->fd = -1;
    return link;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x28, %edi
callq 0x382d1
movq %rax, %r14
callq 0x2ffce
movq %rax, (%r14)
callq 0x3628d
movq %rax, 0x10(%r14)
callq 0x3628d
movq %rax, 0x18(%r14)
movq %rbx, 0x20(%r14)
movl $0xffffffff, 0x8(%r14)  # imm = 0xFFFFFFFF
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: freeClusterLink
void freeClusterLink(clusterLink *link) {
    if (link->fd != -1) {
        aeDeleteFileEvent(server.el, link->fd, AE_WRITABLE);
        aeDeleteFileEvent(server.el, link->fd, AE_READABLE);
    }
    sdsfree(link->sndbuf);
    sdsfree(link->rcvbuf);
    if (link->node)
        link->node->link = NULL;
    close(link->fd);
    zfree(link);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x8(%rdi), %esi
cmpl $-0x1, %esi
je 0x66551
leaq 0x9b376(%rip), %r14     # 0x1018a8
movq 0x40(%r14), %rdi
movl $0x2, %edx
callq 0x2cf0e
movq 0x40(%r14), %rdi
movl 0x8(%rbx), %esi
movl $0x1, %edx
callq 0x2cf0e
movq 0x10(%rbx), %rdi
callq 0x36330
movq 0x18(%rbx), %rdi
callq 0x36330
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x66577
movq $0x0, 0x8c8(%rax)
movl 0x8(%rbx), %edi
callq 0x26180
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x38413
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: keyHashSlot
unsigned int keyHashSlot(char *key, int keylen) {
    int s, e; /* start-end indexes of { and } */

    for (s = 0; s < keylen; s++)
        if (key[s] == '{') break;

    /* No '{' ? Hash the whole key. This is the base case. */
    if (s == keylen) return crc16(key,keylen) & 0x3FFF;

    /* '{' found? Check if we have the corresponding '}'. */
    for (e = s+1; e < keylen; e++)
        if (key[e] == '}') break;

    /* No '}' or nothing betweeen {} ? Hash the whole key. */
    if (e == keylen || e == s+1) return crc16(key,keylen) & 0x3FFF;

    /* If we are here there is both a { and a } on its right. Hash
     * what is in the middle between { and }. */
    return crc16(key+s+1,e-s-1) & 0x3FFF;
}

// Assembly:
pushq %rax
testl %esi, %esi
jle 0x6671a
movl %esi, %eax
xorl %ecx, %ecx
cmpb $0x7b, (%rdi,%rcx)
je 0x6671c
incq %rcx
cmpq %rcx, %rax
jne 0x6670a
jmp 0x66762
xorl %ecx, %ecx
cmpl %esi, %ecx
je 0x66762
movl %ecx, %edx
leaq 0x1(%rdx), %r8
cmpl %esi, %r8d
jge 0x66762
leaq (%rdi,%r8), %r9
xorl %eax, %eax
cmpb $0x7d, (%r9,%rax)
je 0x66746
incq %rax
leal (%rax,%r8), %r10d
cmpl %esi, %r10d
jl 0x66731
jmp 0x66762
notl %ecx
addl %esi, %ecx
cmpl %eax, %ecx
setne %cl
testl %eax, %eax
setne %r8b
testb %r8b, %cl
je 0x66762
addq %rdx, %rdi
incq %rdi
movl %eax, %esi
callq 0x6d0ec
andl $0x3fff, %eax           # imm = 0x3FFF
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterNodeAddFailureReport
int clusterNodeAddFailureReport(clusterNode *failing, clusterNode *sender) {
    list *l = failing->fail_reports;
    listNode *ln;
    listIter li;
    clusterNodeFailReport *fr;

    /* If a failure report from the same sender already exists, just update
     * the timestamp. */
    listRewind(l,&li);
    while ((ln = listNext(&li)) != NULL) {
        fr = ln->value;
        if (fr->node == sender) {
            fr->time = mstime();
            return 0;
        }
    }

    /* Otherwise create a new report. */
    fr = zmalloc(sizeof(*fr));
    fr->node = sender;
    fr->time = mstime();
    listAddNodeTail(l,fr);
    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq 0x8d0(%rdi), %rbx
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2b3b7
movq %r15, %rdi
callq 0x2b3d4
testq %rax, %rax
je 0x667b8
movq 0x10(%rax), %r12
cmpq %r14, (%r12)
jne 0x66793
callq 0x2ffce
movq %rax, 0x8(%r12)
xorl %eax, %eax
jmp 0x667e1
movl $0x10, %edi
callq 0x382d1
movq %rax, %r15
movq %r14, (%rax)
callq 0x2ffce
movq %rax, 0x8(%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2b24b
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterNodeCleanupFailureReports
void clusterNodeCleanupFailureReports(clusterNode *node) {
    list *l = node->fail_reports;
    listNode *ln;
    listIter li;
    clusterNodeFailReport *fr;
    mstime_t maxtime = server.cluster_node_timeout *
                     CLUSTER_FAIL_REPORT_VALIDITY_MULT;
    mstime_t now = mstime();

    listRewind(l,&li);
    while ((ln = listNext(&li)) != NULL) {
        fr = ln->value;
        if (now - fr->time > maxtime) listDelNode(l,ln);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x8d0(%rdi), %rbx
leaq 0x9b0a2(%rip), %rax     # 0x1018a8
movq 0x9a0(%rax), %r12
callq 0x2ffce
movq %rax, %r14
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2b3b7
movq %r15, %rdi
callq 0x2b3d4
testq %rax, %rax
je 0x66862
addq %r12, %r12
leaq 0x8(%rsp), %r15
movq 0x10(%rax), %rcx
movq %r14, %rdx
subq 0x8(%rcx), %rdx
cmpq %r12, %rdx
jle 0x66855
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2b331
movq %r15, %rdi
callq 0x2b3d4
testq %rax, %rax
jne 0x6683a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterNodeDelFailureReport
int clusterNodeDelFailureReport(clusterNode *node, clusterNode *sender) {
    list *l = node->fail_reports;
    listNode *ln;
    listIter li;
    clusterNodeFailReport *fr;

    /* Search for a failure report from this sender. */
    listRewind(l,&li);
    while ((ln = listNext(&li)) != NULL) {
        fr = ln->value;
        if (fr->node == sender) break;
    }
    if (!ln) return 0; /* No failure report from this sender. */

    /* Remove the failure report. */
    listDelNode(l,ln);
    clusterNodeCleanupFailureReports(node);
    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8d0(%rdi), %r14
leaq 0x8(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x2b3b7
movq %r12, %rdi
callq 0x2b3d4
testq %rax, %rax
je 0x668c6
movq 0x10(%rax), %rcx
cmpq %r15, (%rcx)
jne 0x66896
movq %r14, %rdi
movq %rax, %rsi
callq 0x2b331
movq %rbx, %rdi
callq 0x667ed
movl $0x1, %eax
jmp 0x668c8
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterNodeRemoveSlave
int clusterNodeRemoveSlave(clusterNode *master, clusterNode *slave) {
    int j;

    for (j = 0; j < master->numslaves; j++) {
        if (master->slaves[j] == slave) {
            if ((j+1) < master->numslaves) {
                int remaining_slaves = (master->numslaves - j) - 1;
                memmove(master->slaves+j,master->slaves+(j+1),
                        (sizeof(*master->slaves) * remaining_slaves));
            }
            master->numslaves--;
            if (master->numslaves == 0)
                master->flags &= ~CLUSTER_NODE_MIGRATE_TO;
            return C_OK;
        }
    }
    return C_ERR;
}

// Assembly:
movl 0x844(%rdi), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jle 0x66954
pushq %rbx
movq %rdi, %rbx
movq 0x848(%rdi), %rdx
xorl %r8d, %r8d
cmpq %rsi, (%rdx,%r8,8)
je 0x66916
incq %r8
cmpq %r8, %rcx
jne 0x66906
jmp 0x66953
leal 0x1(%r8), %eax
cmpl %ecx, %eax
jge 0x66943
leaq (%rdx,%r8,8), %rdi
movl %r8d, %eax
notl %eax
addl %ecx, %eax
leaq (%rdx,%r8,8), %rsi
addq $0x8, %rsi
movslq %eax, %rdx
shlq $0x3, %rdx
callq 0x267e0
movl 0x844(%rbx), %ecx
xorl %eax, %eax
decl %ecx
movl %ecx, 0x844(%rbx)
jne 0x66953
andb $-0x2, 0x31(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterCountNonFailingSlaves
int clusterCountNonFailingSlaves(clusterNode *n) {
    int j, okslaves = 0;

    for (j = 0; j < n->numslaves; j++)
        if (!nodeFailed(n->slaves[j])) okslaves++;
    return okslaves;
}

// Assembly:
movslq 0x844(%rdi), %rcx
testq %rcx, %rcx
jle 0x66988
movq 0x848(%rdi), %rdx
xorl %esi, %esi
xorl %eax, %eax
movq (%rdx,%rsi,8), %rdi
movb 0x30(%rdi), %dil
andb $0x8, %dil
cmpb $0x1, %dil
adcl $0x0, %eax
incq %rsi
cmpq %rsi, %rcx
jne 0x6696c
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: freeClusterNode
void freeClusterNode(clusterNode *n) {
    sds nodename;
    int j;

    /* If the node has associated slaves, we have to set
     * all the slaves->slaveof fields to NULL (unknown). */
    for (j = 0; j < n->numslaves; j++)
        n->slaves[j]->slaveof = NULL;

    /* Remove this node from the list of slaves of its master. */
    if (nodeIsSlave(n) && n->slaveof) clusterNodeRemoveSlave(n->slaveof,n);

    /* Unlink from the set of nodes. */
    nodename = sdsnewlen(n->name, CLUSTER_NAMELEN);
    serverAssert(dictDelete(server.cluster->nodes,nodename) == DICT_OK);
    sdsfree(nodename);

    /* Release link and associated data structures. */
    if (n->link) freeClusterLink(n->link);
    listRelease(n->fail_reports);
    zfree(n->slaves);
    zfree(n);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x844(%rdi), %rax
testq %rax, %rax
jle 0x669be
movq 0x848(%rbx), %rcx
xorl %edx, %edx
movq (%rcx,%rdx,8), %rsi
movq $0x0, 0x850(%rsi)
incq %rdx
cmpq %rdx, %rax
jne 0x669a7
testb $0x2, 0x30(%rbx)
je 0x669d8
movq 0x850(%rbx), %rdi
testq %rdi, %rdi
je 0x669d8
movq %rbx, %rsi
callq 0x668e9
leaq 0x8(%rbx), %rdi
movl $0x28, %esi
callq 0x36178
movq %rax, %r14
leaq 0x9aeb8(%rip), %rax     # 0x1018a8
movq 0x9b0(%rax), %rax
movq 0x18(%rax), %rdi
movq %r14, %rsi
callq 0x2ecb5
testl %eax, %eax
jne 0x66a47
movq %r14, %rdi
callq 0x36330
movq 0x8c8(%rbx), %rdi
testq %rdi, %rdi
je 0x66a20
callq 0x6651c
movq 0x8d0(%rbx), %rdi
callq 0x2b19c
movq 0x848(%rbx), %rdi
callq 0x38413
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x38413
leaq 0x61042(%rip), %rdi     # 0xc7a90
leaq 0x60cc0(%rip), %rsi     # 0xc7715
movl $0x340, %edx            # imm = 0x340
callq 0x61908
movl $0x1, %edi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterRenameNode
void clusterRenameNode(clusterNode *node, char *newname) {
    int retval;
    sds s = sdsnewlen(node->name, CLUSTER_NAMELEN);

    serverLog(LL_DEBUG,"Renaming node %.40s into %.40s",
        node->name, newname);
    retval = dictDelete(server.cluster->nodes, s);
    sdsfree(s);
    serverAssert(retval == DICT_OK);
    memcpy(node->name, newname, CLUSTER_NAMELEN);
    clusterAddNode(node);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movl $0x28, %esi
movq %r14, %rdi
callq 0x36178
movq %rax, %r12
leaq 0x61031(%rip), %rsi     # 0xc7ac6
xorl %edi, %edi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x2fdad
leaq 0x9adfd(%rip), %r13     # 0x1018a8
movq 0x9b0(%r13), %rax
movq 0x18(%rax), %rdi
movq %r12, %rsi
callq 0x2ecb5
movl %eax, %ebp
movq %r12, %rdi
callq 0x36330
testl %ebp, %ebp
jne 0x66b1a
movq 0x20(%r15), %rax
movq %rax, 0x20(%r14)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
movq 0x9b0(%r13), %rax
movq 0x18(%rax), %r15
movl $0x28, %esi
movq %r14, %rdi
callq 0x36178
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2e9b8
leaq 0x5a40f(%rip), %rdi     # 0xc0f30
leaq 0x60bed(%rip), %rsi     # 0xc7715
movl $0x392, %edx            # imm = 0x392
callq 0x61908
movl $0x1, %edi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterBumpConfigEpochWithoutConsensus
int clusterBumpConfigEpochWithoutConsensus(void) {
    uint64_t maxEpoch = clusterGetMaxEpoch();

    if (myself->configEpoch == 0 ||
        myself->configEpoch != maxEpoch)
    {
        server.cluster->currentEpoch++;
        myself->configEpoch = server.cluster->currentEpoch;
        clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG|
                             CLUSTER_TODO_FSYNC_CONFIG);
        serverLog(LL_WARNING,
            "New configEpoch set to %llu",
            (unsigned long long) myself->configEpoch);
        return C_OK;
    } else {
        return C_ERR;
    }
}

// Assembly:
pushq %rbx
callq 0x6595e
movq 0xaf6e7(%rip), %rcx     # 0x116230
movq 0x38(%rcx), %rdx
testq %rdx, %rdx
setne %sil
cmpq %rax, %rdx
sete %al
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb %al, %sil
jne 0x66b9d
leaq 0x9ad3d(%rip), %rax     # 0x1018a8
movq 0x9b0(%rax), %rax
movq 0x8(%rax), %rdx
incq %rdx
movq %rdx, 0x8(%rax)
movq %rdx, 0x38(%rcx)
orb $0xc, 0x60080(%rax)
leaq 0x60f56(%rip), %rsi     # 0xc7ae5
xorl %ebx, %ebx
movl $0x3, %edi
xorl %eax, %eax
callq 0x2fdad
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterHandleConfigEpochCollision
void clusterHandleConfigEpochCollision(clusterNode *sender) {
    /* Prerequisites: nodes have the same configEpoch and are both masters. */
    if (sender->configEpoch != myself->configEpoch ||
        !nodeIsMaster(sender) || !nodeIsMaster(myself)) return;
    /* Don't act if the colliding node has a smaller Node ID. */
    if (memcmp(sender->name,myself->name,CLUSTER_NAMELEN) <= 0) return;
    /* Get the next ID available at the best of this node knowledge. */
    server.cluster->currentEpoch++;
    myself->configEpoch = server.cluster->currentEpoch;
    clusterSaveConfigOrDie(1);
    serverLog(LL_VERBOSE,
        "WARNING: configEpoch collision with node %.40s."
        " configEpoch set to %llu",
        sender->name,
        (unsigned long long) myself->configEpoch);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x38(%rdi), %rax
movq 0xaf680(%rip), %r14     # 0x116230
cmpq 0x38(%r14), %rax
jne 0x66bdf
movq %rdi, %rbx
testb $0x1, 0x30(%rdi)
je 0x66bdf
testb $0x1, 0x30(%r14)
je 0x66bdf
addq $0x8, %rbx
leaq 0x8(%r14), %rsi
movl $0x28, %edx
movq %rbx, %rdi
callq 0x269b0
testl %eax, %eax
jg 0x66be7
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x9acba(%rip), %rax     # 0x1018a8
movq 0x9b0(%rax), %rax
movq 0x8(%rax), %rcx
incq %rcx
movq %rcx, 0x8(%rax)
movq %rcx, 0x38(%r14)
movl $0x1, %edi
callq 0x65cb7
movq 0xaf61b(%rip), %rax     # 0x116230
movq 0x38(%rax), %rcx
leaq 0x60ee1(%rip), %rsi     # 0xc7b01
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2fdad
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterBlacklistCleanup
void clusterBlacklistCleanup(void) {
    dictIterator *di;
    dictEntry *de;

    di = dictGetSafeIterator(server.cluster->nodes_black_list);
    while((de = dictNext(di)) != NULL) {
        int64_t expire = dictGetUnsignedIntegerVal(de);

        if (expire < server.unixtime)
            dictDelete(server.cluster->nodes_black_list,dictGetKey(de));
    }
    dictReleaseIterator(di);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x9ac67(%rip), %r14     # 0x1018a8
movq 0x9b0(%r14), %rax
movq 0x20(%rax), %rdi
callq 0x2efe5
movq %rax, %rbx
movq %rax, %rdi
callq 0x2f015
testq %rax, %rax
je 0x66c86
movq 0x8(%rax), %rcx
cmpq 0x978(%r14), %rcx
jge 0x66c81
movq 0x9b0(%r14), %rcx
movq 0x20(%rcx), %rdi
movq (%rax), %rsi
callq 0x2ecb5
movq %rbx, %rdi
jmp 0x66c57
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2f0dd
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterBlacklistAddNode
void clusterBlacklistAddNode(clusterNode *node) {
    dictEntry *de;
    sds id = sdsnewlen(node->name,CLUSTER_NAMELEN);

    clusterBlacklistCleanup();
    if (dictAdd(server.cluster->nodes_black_list,id,NULL) == DICT_OK) {
        /* If the key was added, duplicate the sds string representation of
         * the key for the next lookup. We'll free it at the end. */
        id = sdsdup(id);
    }
    de = dictFind(server.cluster->nodes_black_list,id);
    dictSetUnsignedIntegerVal(de,time(NULL)+CLUSTER_BLACKLIST_TTL);
    sdsfree(id);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
addq $0x8, %rdi
movl $0x28, %esi
callq 0x36178
movq %rax, %rbx
callq 0x66c36
leaq 0x9abf2(%rip), %r14     # 0x1018a8
movq 0x9b0(%r14), %rax
movq 0x20(%rax), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2e9b8
testl %eax, %eax
jne 0x66cda
movq %rbx, %rdi
callq 0x362e0
movq %rax, %rbx
movq 0x9b0(%r14), %rax
movq 0x20(%rax), %rdi
movq %rbx, %rsi
callq 0x2ebca
movq %rax, %r14
xorl %edi, %edi
callq 0x26cd0
addq $0x3c, %rax
movq %rax, 0x8(%r14)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x36330
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterBlacklistExists
int clusterBlacklistExists(char *nodeid) {
    sds id = sdsnewlen(nodeid,CLUSTER_NAMELEN);
    int retval;

    clusterBlacklistCleanup();
    retval = dictFind(server.cluster->nodes_black_list,id) != NULL;
    sdsfree(id);
    return retval;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl $0x28, %esi
callq 0x36178
movq %rax, %rbx
callq 0x66c36
leaq 0x9ab7e(%rip), %rax     # 0x1018a8
movq 0x9b0(%rax), %rax
movq 0x20(%rax), %rdi
movq %rbx, %rsi
callq 0x2ebca
xorl %ebp, %ebp
testq %rax, %rax
setne %bpl
movq %rbx, %rdi
callq 0x36330
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: markNodeAsFailingIfNeeded
void markNodeAsFailingIfNeeded(clusterNode *node) {
    int failures;
    int needed_quorum = (server.cluster->size / 2) + 1;

    if (!nodeTimedOut(node)) return; /* We can reach it. */
    if (nodeFailed(node)) return; /* Already FAILing. */

    failures = clusterNodeFailureReportsCount(node);
    /* Also count myself as a voter if I'm a master. */
    if (nodeIsMaster(myself)) failures++;
    if (failures < needed_quorum) return; /* No weak agreement from masters. */

    serverLog(LL_NOTICE,
        "Marking node %.40s as failing (quorum reached).", node->name);

    /* Mark the node as failing. */
    node->flags &= ~CLUSTER_NODE_PFAIL;
    node->flags |= CLUSTER_NODE_FAIL;
    node->fail_time = mstime();

    /* Broadcast the failing node name to everybody, forcing all the other
     * reachable nodes to flag the node as FAIL. */
    if (nodeIsMaster(myself)) clusterSendFail(node->name);
    clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|CLUSTER_TODO_SAVE_CONFIG);
}

// Assembly:
movl 0x30(%rdi), %eax
andl $0xc, %eax
cmpl $0x4, %eax
jne 0x66e4d
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x10d8, %rsp           # imm = 0x10D8
movq %rdi, %rbx
leaq 0x9ab2b(%rip), %r15     # 0x1018a8
movq 0x9b0(%r15), %rax
movl 0x14(%rax), %eax
movl %eax, %ebp
shrl $0x1f, %ebp
addl %eax, %ebp
sarl %ebp
callq 0x667ed
movq 0x8d0(%rbx), %rax
movq 0xaf48d(%rip), %rcx     # 0x116230
movl 0x30(%rcx), %ecx
andl $0x1, %ecx
addl 0x28(%rax), %ecx
cmpl %ebp, %ecx
jle 0x66e40
leaq 0x8(%rbx), %r14
leaq 0x60d8a(%rip), %rsi     # 0xc7b49
movl $0x2, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2fdad
movl 0x30(%rbx), %eax
andl $-0xd, %eax
orl $0x8, %eax
movl %eax, 0x30(%rbx)
callq 0x2ffce
movq %rax, 0x868(%rbx)
movq 0xaf443(%rip), %rax     # 0x116230
testb $0x1, 0x30(%rax)
je 0x66e32
movq %rsp, %rbx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x68b27
movq 0x20(%r14), %rax
movq %rax, 0x8c0(%rbx)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movaps %xmm1, 0x8b0(%rbx)
movaps %xmm0, 0x8a0(%rbx)
movl 0x4(%rbx), %esi
bswapl %esi
movq %rbx, %rdi
callq 0x68ac2
movq 0x9b0(%r15), %rax
orl $0x6, 0x60080(%rax)
addq $0x10d8, %rsp           # imm = 0x10D8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterSendFail
void clusterSendFail(char *nodename) {
    unsigned char buf[sizeof(clusterMsg)];
    clusterMsg *hdr = (clusterMsg*) buf;

    clusterBuildMessageHdr(hdr,CLUSTERMSG_TYPE_FAIL);
    memcpy(hdr->data.fail.about.nodename,nodename,CLUSTER_NAMELEN);
    clusterBroadcastMessage(buf,ntohl(hdr->totlen));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x10d8, %rsp           # imm = 0x10D8
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
movl $0x3, %esi
callq 0x68b27
movq 0x20(%rbx), %rax
movq %rax, 0x8c0(%r14)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movaps %xmm1, 0x8b0(%r14)
movaps %xmm0, 0x8a0(%r14)
movl 0x4(%r14), %esi
bswapl %esi
movq %r14, %rdi
callq 0x68ac2
addq $0x10d8, %rsp           # imm = 0x10D8
popq %rbx
popq %r14
retq