LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/multi.c
// Function: watchCommand
void watchCommand(client *c) {
    int j;

    if (c->flags & CLIENT_MULTI) {
        addReplyError(c,"WATCH inside MULTI is not allowed");
        return;
    }
    for (j = 1; j < c->argc; j++)
        watchForKey(c,c->argv[j]);
    addReply(c,shared.ok);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testb $0x8, 0x98(%rdi)
jne 0x64d1e
cmpl $0x2, 0x38(%rbx)
jl 0x64d04
movl $0x1, %r14d
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rsi
movq %rbx, %rdi
callq 0x64ae7
incq %r14
movslq 0x38(%rbx), %rax
cmpq %rax, %r14
jl 0x64ce8
leaq 0xa25a5(%rip), %rax     # 0x1072b0
movq 0x8(%rax), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3fc19
leaq 0x640ee(%rip), %rsi     # 0xc8e13
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3ffcb
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/./sds.h
// Function: sdsavail
static inline size_t sdsavail(const sds s) {
    unsigned char flags = s[-1];
    switch(flags&SDS_TYPE_MASK) {
        case SDS_TYPE_5: {
            return 0;
        }
        case SDS_TYPE_8: {
            SDS_HDR_VAR(8,s);
            return sh->alloc - sh->len;
        }
        case SDS_TYPE_16: {
            SDS_HDR_VAR(16,s);
            return sh->alloc - sh->len;
        }
        case SDS_TYPE_32: {
            SDS_HDR_VAR(32,s);
            return sh->alloc - sh->len;
        }
        case SDS_TYPE_64: {
            SDS_HDR_VAR(64,s);
            return sh->alloc - sh->len;
        }
    }
    return 0;
}

// Assembly:
movzbl -0x1(%rdi), %eax
andl $0x7, %eax
decl %eax
cmpl $0x3, %eax
ja 0x66407
leaq 0x62ad8(%rip), %rcx     # 0xc8eb0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl -0x2(%rdi), %eax
movzbl -0x3(%rdi), %ecx
jmp 0x66403
movl -0x5(%rdi), %eax
subl -0x9(%rdi), %eax
retq
movq -0x9(%rdi), %rax
subq -0x11(%rdi), %rax
retq
movzwl -0x3(%rdi), %eax
movzwl -0x5(%rdi), %ecx
subq %rcx, %rax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/debug.c
// Function: bugReportStart
void bugReportStart(void) {
    if (server.bug_report_start == 0) {
        serverLogRaw(LL_WARNING|LL_RAW,
        "\n\n=== REDIS BUG REPORT START: Cut & paste starting from here ===\n");
        server.bug_report_start = 1;
    }
}

// Assembly:
pushq %rbx
leaq 0xa0446(%rip), %rbx     # 0x106858
cmpl $0x0, 0xa2c(%rbx)
jne 0x66436
leaq 0x637ca(%rip), %rsi     # 0xc9bec
movl $0x403, %edi            # imm = 0x403
callq 0x32d0c
movl $0x1, 0xa2c(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/debug.c
// Function: openDirectLogFiledes
int openDirectLogFiledes(void) {
    int log_to_stdout = server.logfile[0] == '\0';
    int fd = log_to_stdout ?
        STDOUT_FILENO :
        open(server.logfile, O_APPEND|O_CREAT|O_WRONLY, 0644);
    return fd;
}

// Assembly:
leaq 0x9fec7(%rip), %rax     # 0x106858
movq 0x790(%rax), %rdi
cmpb $0x0, (%rdi)
je 0x669ae
movl $0x441, %esi            # imm = 0x441
movl $0x1a4, %edx            # imm = 0x1A4
xorl %eax, %eax
jmp 0x266a0
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/debug.c
// Function: logStackTrace
void logStackTrace(ucontext_t *uc) {
    void *trace[101];
    int trace_size = 0, fd = openDirectLogFiledes();

    if (fd == -1) return; /* If we can't log there is anything to do. */

    /* Generate the stack trace */
    trace_size = backtrace(trace+1, 100);

    if (getMcontextEip(uc) != NULL) {
        char *msg1 = "EIP:\n";
        char *msg2 = "\nBacktrace:\n";
        if (write(fd,msg1,strlen(msg1)) == -1) {/* Avoid warning. */};
        trace[0] = getMcontextEip(uc);
        backtrace_symbols_fd(trace, 1, fd);
        if (write(fd,msg2,strlen(msg2)) == -1) {/* Avoid warning. */};
    }

    /* Write symbols to log file */
    backtrace_symbols_fd(trace+1, trace_size, fd);

    /* Cleanup */
    closeDirectLogFiledes(fd);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x330, %rsp            # imm = 0x330
movq %rdi, %r14
leaq 0x9fe73(%rip), %r12     # 0x106858
movq 0x790(%r12), %rdi
cmpb $0x0, (%rdi)
je 0x66a07
movl $0x441, %esi            # imm = 0x441
movl $0x1a4, %edx            # imm = 0x1A4
xorl %eax, %eax
callq 0x266a0
movl %eax, %ebx
jmp 0x66a0c
movl $0x1, %ebx
cmpl $-0x1, %ebx
je 0x66a8e
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movl $0x64, %esi
callq 0x26140
movl %eax, %ebp
cmpq $0x0, 0xa8(%r14)
je 0x66a6e
leaq 0x632fa(%rip), %rsi     # 0xc9d30
movl $0x5, %edx
movl %ebx, %edi
callq 0x26bc0
movq 0xa8(%r14), %rax
movq %rsp, %rdi
movq %rax, (%rdi)
movl $0x1, %esi
movl %ebx, %edx
callq 0x26a10
leaq 0x632d4(%rip), %rsi     # 0xc9d36
movl $0xc, %edx
movl %ebx, %edi
callq 0x26bc0
movq %r15, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x26a10
movq 0x790(%r12), %rax
cmpb $0x0, (%rax)
je 0x66a8e
movl %ebx, %edi
callq 0x26180
addq $0x330, %rsp            # imm = 0x330
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/debug.c
// Function: logCurrentClient
void logCurrentClient(void) {
    if (server.current_client == NULL) return;

    client *cc = server.current_client;
    sds client;
    int j;

    serverLogRaw(LL_WARNING|LL_RAW, "\n------ CURRENT CLIENT INFO ------\n");
    client = catClientInfoString(sdsempty(),cc);
    serverLog(LL_WARNING|LL_RAW,"%s\n", client);
    sdsfree(client);
    for (j = 0; j < cc->argc; j++) {
        robj *decoded;

        decoded = getDecodedObject(cc->argv[j]);
        serverLog(LL_WARNING|LL_RAW,"argv[%d]: '%s'\n", j,
            (char*)decoded->ptr);
        decrRefCount(decoded);
    }
    /* Check if the first argument, usually a key, is found inside the
     * selected DB, and if so print info about the associated object. */
    if (cc->argc >= 1) {
        robj *val, *key;
        dictEntry *de;

        key = getDecodedObject(cc->argv[1]);
        de = dictFind(cc->db->dict, key->ptr);
        if (de) {
            val = dictGetVal(de);
            serverLog(LL_WARNING,"key '%s' found in DB containing the following object:", (char*)key->ptr);
            serverLogObjectDebugInfo(val);
        }
        decrRefCount(key);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0x9fdab(%rip), %rax     # 0x106858
movq 0x1f0(%rax), %rbx
testq %rbx, %rbx
je 0x66bac
leaq 0x6327f(%rip), %rsi     # 0xc9d43
movl $0x403, %edi            # imm = 0x403
callq 0x32d0c
callq 0x39222
movq %rax, %rdi
movq %rbx, %rsi
callq 0x41cda
movq %rax, %r14
leaq 0x70755(%rip), %rsi     # 0xd723d
movl $0x403, %edi            # imm = 0x403
movq %rax, %rdx
xorl %eax, %eax
callq 0x32ea6
movq %r14, %rdi
callq 0x392b6
cmpl $0x0, 0x38(%rbx)
jle 0x66bac
leaq 0x63257(%rip), %r14     # 0xc9d67
xorl %r15d, %r15d
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x444b2
movq %rax, %r12
movq 0x8(%rax), %rcx
movl $0x403, %edi            # imm = 0x403
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x32ea6
movq %r12, %rdi
callq 0x440f3
incq %r15
movslq 0x38(%rbx), %rax
cmpq %rax, %r15
jl 0x66b13
testl %eax, %eax
jle 0x66bac
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rdi
callq 0x444b2
movq %rax, %r14
movq 0x10(%rbx), %rax
movq (%rax), %rdi
movq 0x8(%r14), %rsi
callq 0x31cca
testq %rax, %rax
je 0x66b99
movq 0x8(%rax), %rbx
movq 0x8(%r14), %rdx
leaq 0x631f2(%rip), %rsi     # 0xc9d77
movl $0x3, %edi
xorl %eax, %eax
callq 0x32ea6
movq %rbx, %rdi
callq 0x66566
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x440f3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/debug.c
// Function: dumpX86Calls
void dumpX86Calls(void *addr, size_t len) {
    size_t j;
    unsigned char *p = addr;
    Dl_info info;
    /* Hash table to best-effort avoid printing the same symbol
     * multiple times. */
    unsigned long ht[256] = {0};

    if (len < 5) return;
    for (j = 0; j < len-4; j++) {
        if (p[j] != 0xE8) continue; /* Not an E8 CALL opcode. */
        unsigned long target = (unsigned long)addr+j+5;
        target += *((int32_t*)(p+j+1));
        if (dladdr((void*)target, &info) != 0 && info.dli_sname != NULL) {
            if (ht[target&0xff] != target) {
                printf("Function at 0x%lx is %s\n",target,info.dli_sname);
                ht[target&0xff] = target;
            }
            j += 4; /* Skip the 32 bit immediate. */
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x838, %rsp            # imm = 0x838
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rsp), %rdi
movl $0x800, %edx            # imm = 0x800
xorl %esi, %esi
callq 0x26110
cmpq $0x5, %rbx
jb 0x66f0d
addq $-0x4, %rbx
je 0x66f0d
leaq 0x5(%r14), %rbp
leaq 0x10(%rsp), %r15
xorl %r12d, %r12d
movq %rbp, 0x8(%rsp)
cmpb $-0x18, (%r14,%r12)
jne 0x66f05
movslq 0x1(%r14,%r12), %r13
leaq (%r12,%rbp), %rax
addq %rax, %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x26870
testl %eax, %eax
setne %al
movq 0x20(%rsp), %rdx
testq %rdx, %rdx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x66f05
movq %r15, %rbp
movzbl %r13b, %r15d
movl %r15d, %eax
cmpq %r13, 0x30(%rsp,%rax,8)
je 0x66ef9
leaq 0x62f25(%rip), %rdi     # 0xc9e0f
movq %r13, %rsi
xorl %eax, %eax
callq 0x260a0
movq %r13, 0x30(%rsp,%r15,8)
addq $0x4, %r12
movq %rbp, %r15
movq 0x8(%rsp), %rbp
incq %r12
cmpq %rbx, %r12
jb 0x66e9d
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 %rbx
leaq 0x9f146(%rip), %rbx     # 0x106858
cmpl $0x0, 0x924(%rbx)
je 0x67744
cmpl $0x0, 0x928(%rbx)
je 0x6776c
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x67782
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x67789
cmpl $0x0, 0x92c(%rbx)
je 0x677a0
movq %rax, %rsi
jmp 0x6777b
movsd 0x8(%rdi), %xmm0
movsd 0x8(%rsi), %xmm1
movl $0x1, %eax
ucomisd %xmm1, %xmm0
ja 0x677ad
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
ucomisd %xmm0, %xmm1
ja 0x677ad
movq (%rdi), %rdi
movq (%rsi), %rsi
jmp 0x6777b
cmpl $0x0, 0x92c(%rbx)
movq (%rdi), %rdi
movq (%rsi), %rsi
je 0x67799
callq 0x446ab
jmp 0x677ad
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x6778e
movl $0x1, %ecx
xorl %eax, %eax
cmpq 0x8(%rsi), %rdi
cmovnel %ecx, %eax
jmp 0x677ad
callq 0x446b5
jmp 0x677ad
movq 0x8(%rdi), %rdi
movq 0x8(%rax), %rsi
callq 0x260e0
movl %eax, %ecx
negl %ecx
cmpl $0x0, 0x920(%rbx)
cmovel %eax, %ecx
movl %ecx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/intset.c
// Function: intsetNew
intset *intsetNew(void) {
    intset *is = zmalloc(sizeof(intset));
    is->encoding = intrev32ifbe(INTSET_ENC_INT16);
    is->length = 0;
    return is;
}

// Assembly:
pushq %rax
movl $0x8, %edi
callq 0x3b29d
movq $0x2, (%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x68836
xorl %ecx, %ecx
movl $0x0, %eax
jmp 0x688ec
movzbl (%rdi), %r8d
movslq %eax, %r9
cmpl $0x4, %r8d
je 0x68850
cmpl $0x8, %r8d
jne 0x68857
movq 0x8(%rdi,%r9,8), %r9
jmp 0x6885d
movslq 0x8(%rdi,%r9,4), %r9
jmp 0x6885d
movswq 0x8(%rdi,%r9,2), %r9
cmpq %rsi, %r9
jge 0x68869
xorl %eax, %eax
jmp 0x688ec
movzbl %r8b, %r9d
cmpb $0x4, %r9b
je 0x6887f
cmpl $0x8, %r9d
jne 0x68885
movq 0x8(%rdi), %rcx
jmp 0x6888a
movslq 0x8(%rdi), %rcx
jmp 0x6888a
movswq 0x8(%rdi), %rcx
cmpq %rsi, %rcx
jg 0x6882a
testl %eax, %eax
js 0x688d3
xorl %ecx, %ecx
leal (%rax,%rcx), %r10d
shrl %r10d
cmpb $0x4, %r8b
je 0x688af
cmpl $0x8, %r9d
jne 0x688b6
movq 0x8(%rdi,%r10,8), %r11
jmp 0x688bc
movslq 0x8(%rdi,%r10,4), %r11
jmp 0x688bc
movswq 0x8(%rdi,%r10,2), %r11
cmpq %rsi, %r11
jge 0x688c7
leal 0x1(%r10), %ecx
jmp 0x688cd
jle 0x688e2
leal -0x1(%r10), %eax
cmpl %ecx, %eax
jge 0x68895
jmp 0x688e2
movq $-0x1, %r11
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
xorl %ecx, %ecx
cmpq %rsi, %r11
sete %al
cmovel %r10d, %ecx
testq %rdx, %rdx
je 0x688f3
movl %ecx, (%rdx)
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r14
movq %rdi, %rbx
leaq -0x80000000(%rsi), %rax
movswq %si, %rcx
xorl %edx, %edx
cmpq %rsi, %rcx
setne %dl
leal 0x2(,%rdx,2), %ecx
testq %r14, %r14
je 0x68928
movl $0x0, (%r14)
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rax
movl $0x8, %eax
cmovbl %eax, %ecx
cmpl %ecx, (%rbx)
jb 0x689d0
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
callq 0x68820
testb %al, %al
je 0x689d0
movl 0x4(%rbx), %ebp
testq %r14, %r14
je 0x68965
movl $0x1, (%r14)
movl 0xc(%rsp), %eax
decl %ebp
cmpl %ebp, %eax
jae 0x689b9
leal 0x1(%rax), %ecx
movl (%rbx), %esi
movl 0x4(%rbx), %edx
subl %ecx, %edx
leaq 0x8(%rbx), %rdi
cmpl $0x4, %esi
je 0x68996
cmpl $0x8, %esi
jne 0x689a5
leaq (%rdi,%rcx,8), %rsi
leaq (%rdi,%rax,8), %rdi
movl $0x3, %ecx
jmp 0x689b2
leaq (%rdi,%rcx,4), %rsi
leaq (%rdi,%rax,4), %rdi
movl $0x2, %ecx
jmp 0x689b2
leaq (%rdi,%rcx,2), %rsi
leaq (%rdi,%rax,2), %rdi
movl $0x1, %ecx
shll %cl, %edx
callq 0x267f0
movl (%rbx), %esi
imull %ebp, %esi
addq $0x8, %rsi
movq %rbx, %rdi
callq 0x3b349
movq %rax, %rbx
movl %ebp, 0x4(%rax)
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x68a58
movzbl (%rdi), %ecx
movslq %esi, %rax
cmpl $0x4, %ecx
je 0x68a5b
cmpl $0x8, %ecx
jne 0x68a62
movq 0x8(%rdi,%rax,8), %rax
jmp 0x68a68
xorl %eax, %eax
retq
movslq 0x8(%rdi,%rax,4), %rax
jmp 0x68a68
movswq 0x8(%rdi,%rax,2), %rax
movq %rax, (%rdx)
movb $0x1, %al
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x3910c
movq %rax, %r14
leaq 0x9d46f(%rip), %rax     # 0x106858
movq 0x9a0(%rax), %rax
movq 0x18(%rax), %rdi
movq %r14, %rsi
callq 0x31cca
movq %rax, %rbx
movq %r14, %rdi
callq 0x392b6
testq %rbx, %rbx
je 0x69412
movq 0x8(%rbx), %rax
jmp 0x69414
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x3b29d
movq %rax, %rbx
leaq 0x8(%rax), %rdi
testq %r14, %r14
je 0x69455
movq 0x20(%r14), %rax
movq %rax, 0x20(%rdi)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%rdi)
movups %xmm0, (%rdi)
jmp 0x6945f
movl $0x28, %esi
callq 0x43699
callq 0x330c8
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 0x2e33c
movq %rax, 0x8d0(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x870(%rbx)
movups %xmm0, 0x880(%rbx)
leaq -0x2e0f1(%rip), %rcx    # 0x3b3df
movq %rcx, 0x18(%rax)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x9d36e(%rip), %rax     # 0x106858
movq 0x9a0(%rax), %rax
movq 0x18(%rax), %r14
addq $0x8, %rdi
movl $0x28, %esi
callq 0x3910c
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x31a95
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_O1/zhou-yuxin[P]redis-aof-no-cow/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
testq %rax, %rax
jle 0x6954e
movq 0x848(%rbx), %rcx
xorl %edx, %edx
cmpq %r14, (%rcx,%rdx,8)
je 0x69585
incq %rdx
cmpq %rdx, %rax
jne 0x69540
movq 0x848(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x3b349
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 0x6958a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x9d2ba(%rip), %r15     # 0x106858
movq 0x9a0(%r15), %rcx
movslq %esi, %r14
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $0x0, 0x40028(%rcx,%r14,8)
jne 0x695d4
movq %rdi, %rbx
movl %r14d, %esi
callq 0x6dccc
movq 0x9a0(%r15), %rax
movq %rbx, 0x40028(%rax,%r14,8)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x9cb94(%rip), %r12     # 0x106858
cmpq $0x0, 0x818(%r12)
jne 0x69cde
cmpl $0x0, 0x31c(%r12)
jne 0x69d97
movl $0xfffffc18, %ebp       # imm = 0xFFFFFC18
movl $0x208, %r14d           # imm = 0x208
addq 0x982c8(%rip), %r14     # 0x101fb8
leaq 0x10(%rsp), %r15
movl $0x2e, %ecx
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
leaq 0xc(%rsp), %r8
callq 0x3125a
cmpl $-0x1, %eax
je 0x69d6e
movl %eax, %r13d
xorl %edi, %edi
movl %eax, %esi
callq 0x30779
xorl %edi, %edi
movl %r13d, %esi
callq 0x308ab
movl 0xc(%rsp), %ecx
movl $0x1, %edi
leaq 0x60cb5(%rip), %rsi     # 0xca9ec
movq %r15, %rdx
xorl %eax, %eax
callq 0x32ea6
xorl %edi, %edi
callq 0x6a149
movl %r13d, 0x8(%rax)
movq 0x40(%r12), %rdi
movl %r13d, %esi
movl $0x1, %edx
leaq 0x4a0(%rip), %rcx       # 0x6a200
movq %rax, %r8
callq 0x2fee7
incl %ebp
jne 0x69cf5
jmp 0x69d97
callq 0x26890
cmpl $0xb, (%rax)
je 0x69d97
movl $0x208, %edx            # imm = 0x208
addq 0x98234(%rip), %rdx     # 0x101fb8
leaq 0x60c40(%rip), %rsi     # 0xca9cb
movl $0x1, %edi
xorl %eax, %eax
callq 0x32ea6
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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:
testb $0x1, 0x30(%rdi)
jne 0x69fe4
pushq %rbx
movq %rdi, %rbx
movq 0x850(%rdi), %rdi
testq %rdi, %rdi
je 0x69fb8
movq %rbx, %rsi
callq 0x6a560
cmpq %rbx, 0xb121e(%rip)     # 0x11b1d0
je 0x69fb8
orb $0x1, 0x31(%rbx)
movl 0x30(%rbx), %eax
andl $-0x4, %eax
incl %eax
movl %eax, 0x30(%rbx)
movq $0x0, 0x850(%rbx)
leaq 0x9c883(%rip), %rax     # 0x106858
movq 0x9a0(%rax), %rax
orl $0x6, 0x60080(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x9c86c(%rip), %rax     # 0x106858
movq 0x9a0(%rax), %rcx
movslq %edi, %rdx
movq 0x40028(%rcx,%rdx,8), %rsi
testq %rsi, %rsi
je 0x6a055
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 0x6a05b
decl 0x840(%rsi)
movq 0x9a0(%rax), %rax
movq $0x0, 0x40028(%rax,%rdx,8)
xorl %eax, %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
pushq %rax
leaq 0x614c4(%rip), %rdi     # 0xcb527
leaq 0x60623(%rip), %rsi     # 0xca68d
movl $0xd68, %edx            # imm = 0xD68
callq 0x654e1
movl $0x1, %edi
callq 0x263d0
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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
xorl %r14d, %r14d
leaq 0x9c7c8(%rip), %r15     # 0x106858
movq 0x9a0(%r15), %rax
cmpq %rbx, 0x20028(%rax,%r14,8)
jne 0x6a0ad
movq $0x0, 0x20028(%rax,%r14,8)
movq 0x9a0(%r15), %rax
cmpq %rbx, 0x28(%rax,%r14,8)
jne 0x6a0c4
movq $0x0, 0x28(%rax,%r14,8)
movq 0x9a0(%r15), %rax
cmpq %rbx, 0x40028(%rax,%r14,8)
jne 0x6a0dd
movl %r14d, %edi
callq 0x69fe5
incq %r14
cmpq $0x4000, %r14           # imm = 0x4000
jne 0x6a090
movq 0x9a0(%r15), %rax
movq 0x18(%rax), %rdi
callq 0x320e5
movq %rax, %r14
movq %rax, %rdi
callq 0x32116
testq %rax, %rax
je 0x6a11f
movq 0x8(%rax), %rdi
cmpq %rbx, %rdi
je 0x6a11a
movq %rbx, %rsi
callq 0x6a4e5
movq %r14, %rdi
jmp 0x6a0ff
movq %r14, %rdi
callq 0x321d3
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x6a5fc
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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:
movslq 0x844(%rdi), %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rcx, %rcx
jle 0x6a5c5
pushq %rbx
movq %rdi, %rbx
movq 0x848(%rdi), %rdx
xorl %r8d, %r8d
cmpq %rsi, (%rdx,%r8,8)
je 0x6a58f
incq %r8
cmpq %r8, %rcx
jne 0x6a57f
jmp 0x6a5c4
leal 0x1(%r8), %eax
cmpl %ecx, %eax
jge 0x6a5b6
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 0x267f0
xorl %eax, %eax
decl 0x844(%rbx)
jne 0x6a5c4
andb $-0x2, 0x31(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x6a62f
movq 0x848(%rbx), %rcx
xorl %edx, %edx
movq (%rcx,%rdx,8), %rsi
movq $0x0, 0x850(%rsi)
incq %rdx
cmpq %rdx, %rax
jne 0x6a618
testb $0x2, 0x30(%rbx)
je 0x6a649
movq 0x850(%rbx), %rdi
testq %rdi, %rdi
je 0x6a649
movq %rbx, %rsi
callq 0x6a560
leaq 0x8(%rbx), %rdi
movl $0x28, %esi
callq 0x3910c
movq %rax, %r14
leaq 0x9c1f7(%rip), %rax     # 0x106858
movq 0x9a0(%rax), %rax
movq 0x18(%rax), %rdi
movq %r14, %rsi
callq 0x31dba
testl %eax, %eax
jne 0x6a6b8
movq %r14, %rdi
callq 0x392b6
movq 0x8c8(%rbx), %rdi
testq %rdi, %rdi
je 0x6a691
callq 0x6a18e
movq 0x8d0(%rbx), %rdi
callq 0x2e360
movq 0x848(%rbx), %rdi
callq 0x3b3df
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3b3df
leaq 0x60349(%rip), %rdi     # 0xcaa08
leaq 0x5ffc7(%rip), %rsi     # 0xca68d
movl $0x341, %edx            # imm = 0x341
callq 0x654e1
movl $0x1, %edi
callq 0x263d0
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x695da
movq 0xb0a16(%rip), %rcx     # 0x11b1d0
movq 0x38(%rcx), %rdx
testq %rdx, %rdx
setne %sil
cmpq %rax, %rdx
sete %al
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb %al, %sil
jne 0x6a80e
leaq 0x9c07c(%rip), %rax     # 0x106858
movq 0x9a0(%rax), %rax
movq 0x8(%rax), %rdx
incq %rdx
movq %rdx, 0x8(%rax)
movq %rdx, 0x38(%rcx)
orb $0xc, 0x60080(%rax)
leaq 0x6025d(%rip), %rsi     # 0xcaa5d
xorl %ebx, %ebx
movl $0x3, %edi
xorl %eax, %eax
callq 0x32ea6
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0xb09af(%rip), %r14     # 0x11b1d0
cmpq 0x38(%r14), %rax
jne 0x6a850
movq %rdi, %rbx
testb $0x1, 0x30(%rdi)
je 0x6a850
testb $0x1, 0x30(%r14)
je 0x6a850
addq $0x8, %rbx
leaq 0x8(%r14), %rsi
movl $0x28, %edx
movq %rbx, %rdi
callq 0x269c0
testl %eax, %eax
jg 0x6a858
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x9bff9(%rip), %rax     # 0x106858
movq 0x9a0(%rax), %rax
movq 0x8(%rax), %rcx
incq %rcx
movq %rcx, 0x8(%rax)
movq %rcx, 0x38(%r14)
movl $0x1, %edi
callq 0x6992e
movq 0xb094a(%rip), %rax     # 0x11b1d0
movq 0x38(%rax), %rcx
leaq 0x601e8(%rip), %rsi     # 0xcaa79
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x32ea6
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x3910c
movq %rax, %rbx
callq 0x6a8a7
leaq 0x9bf31(%rip), %r14     # 0x106858
movq 0x9a0(%r14), %rax
movq 0x20(%rax), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x31a95
testl %eax, %eax
jne 0x6a94b
movq %rbx, %rdi
callq 0x39266
movq %rax, %rbx
movq 0x9a0(%r14), %rax
movq 0x20(%rax), %rdi
movq %rbx, %rsi
callq 0x31cca
movq %rax, %r14
xorl %edi, %edi
callq 0x26ce0
addq $0x3c, %rax
movq %rax, 0x8(%r14)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x392b6
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x6aabe
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x10d8, %rsp           # imm = 0x10D8
movq %rdi, %rbx
leaq 0x9be6a(%rip), %r15     # 0x106858
movq 0x9a0(%r15), %rax
movl 0x14(%rax), %eax
movl %eax, %ebp
shrl $0x1f, %ebp
addl %eax, %ebp
sarl %ebp
callq 0x6a464
movq 0x8d0(%rbx), %rax
movq 0xb07bc(%rip), %rcx     # 0x11b1d0
movl 0x30(%rcx), %ecx
andl $0x1, %ecx
addl 0x28(%rax), %ecx
cmpl %ebp, %ecx
jle 0x6aab1
leaq 0x8(%rbx), %r14
leaq 0x60091(%rip), %rsi     # 0xcaac1
movl $0x2, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x32ea6
movl 0x30(%rbx), %eax
andl $-0xd, %eax
orl $0x8, %eax
movl %eax, 0x30(%rbx)
callq 0x330c8
movq %rax, 0x868(%rbx)
movq 0xb0772(%rip), %rax     # 0x11b1d0
testb $0x1, 0x30(%rax)
je 0x6aaa3
movq %rsp, %rbx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x6c66e
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 0x6c609
movq 0x9a0(%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_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x6c66e
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 0x6c609
addq $0x10d8, %rsp           # imm = 0x10D8
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/cluster.c
// Function: clearNodeFailureIfNeeded
void clearNodeFailureIfNeeded(clusterNode *node) {
    mstime_t now = mstime();

    serverAssert(nodeFailed(node));

    /* For slaves we always clear the FAIL flag if we can contact the
     * node again. */
    if (nodeIsSlave(node) || node->numslots == 0) {
        serverLog(LL_NOTICE,
            "Clear FAIL state for node %.40s: %s is reachable again.",
                node->name,
                nodeIsSlave(node) ? "slave" : "master without slots");
        node->flags &= ~CLUSTER_NODE_FAIL;
        clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|CLUSTER_TODO_SAVE_CONFIG);
    }

    /* If it is a master and...
     * 1) The FAIL state is old enough.
     * 2) It is yet serving slots from our point of view (not failed over).
     * Apparently no one is going to fix these slots, clear the FAIL flag. */
    if (nodeIsMaster(node) && node->numslots > 0 &&
        (now - node->fail_time) >
        (server.cluster_node_timeout * CLUSTER_FAIL_UNDO_TIME_MULT))
    {
        serverLog(LL_NOTICE,
            "Clear FAIL state for node %.40s: is reachable again and nobody is serving its slots after some time.",
                node->name);
        node->flags &= ~CLUSTER_NODE_FAIL;
        clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|CLUSTER_TODO_SAVE_CONFIG);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x330c8
movq %rax, %r14
movl 0x30(%rbx), %eax
testb $0x8, %al
je 0x6abda
testb $0x2, %al
jne 0x6ab48
cmpl $0x0, 0x840(%rbx)
jne 0x6ab7f
leaq 0x5fff4(%rip), %rcx     # 0xcab3a
jmp 0x6ab4f
leaq 0x6111e(%rip), %rcx     # 0xcbc6d
leaq 0x8(%rbx), %rdx
leaq 0x5ffa8(%rip), %rsi     # 0xcab02
movl $0x2, %edi
xorl %eax, %eax
callq 0x32ea6
andb $-0x9, 0x30(%rbx)
leaq 0x9bce7(%rip), %rax     # 0x106858
movq 0x9a0(%rax), %rax
orl $0x6, 0x60080(%rax)
testb $0x1, 0x30(%rbx)
je 0x6abd4
cmpl $0x0, 0x840(%rbx)
jle 0x6abd4
subq 0x868(%rbx), %r14
leaq 0x9bcbc(%rip), %r15     # 0x106858
movq 0x990(%r15), %rax
addq %rax, %rax
cmpq %rax, %r14
jle 0x6abd4
leaq 0x8(%rbx), %rdx
leaq 0x5ff99(%rip), %rsi     # 0xcab4f
movl $0x2, %edi
xorl %eax, %eax
callq 0x32ea6
andb $-0x9, 0x30(%rbx)
movq 0x9a0(%r15), %rax
orl $0x6, 0x60080(%rax)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x5ff10(%rip), %rdi     # 0xcaaf1
leaq 0x5faa5(%rip), %rsi     # 0xca68d
movl $0x49f, %edx            # imm = 0x49F
callq 0x654e1
movl $0x1, %edi
callq 0x263d0
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/cluster.c
// Function: representClusterNodeFlags
sds representClusterNodeFlags(sds ci, uint16_t flags) {
    if (flags == 0) {
        ci = sdscat(ci,"noflags,");
    } else {
        int i, size = sizeof(redisNodeFlagsTable)/sizeof(struct redisNodeFlags);
        for (i = 0; i < size; i++) {
            struct redisNodeFlags *nodeflag = redisNodeFlagsTable + i;
            if (flags & nodeflag->flag) ci = sdscat(ci, nodeflag->name);
        }
    }
    sdsIncrLen(ci,-1); /* Remove trailing comma. */
    return ci;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x6afed
movl %esi, %ebp
movl $0x8, %r14d
leaq 0x93ba6(%rip), %r15     # 0xfeb70
testw %bp, -0x8(%r14,%r15)
je 0x6afe1
movq (%r14,%r15), %rsi
movq %rbx, %rdi
callq 0x39b26
movq %rax, %rbx
addq $0x10, %r14
cmpq $0x78, %r14
jne 0x6afca
jmp 0x6afff
leaq 0x60638(%rip), %rsi     # 0xcb62c
movq %rbx, %rdi
callq 0x39b26
movq %rax, %rbx
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x397b3
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/cluster.c
// Function: nodeUpdateAddressIfNeeded
int nodeUpdateAddressIfNeeded(clusterNode *node, clusterLink *link, int port) {
    char ip[NET_IP_STR_LEN] = {0};

    /* We don't proceed if the link is the same as the sender link, as this
     * function is designed to see if the node link is consistent with the
     * symmetric link that is used to receive PINGs from the node.
     *
     * As a side effect this function never frees the passed 'link', so
     * it is safe to call during packet processing. */
    if (link == node->link) return 0;

    nodeIp2String(ip,link);
    if (node->port == port && strcmp(ip,node->ip) == 0) return 0;

    /* IP / port is different, update it. */
    memcpy(node->ip,ip,sizeof(ip));
    node->port = port;
    if (node->link) freeClusterLink(node->link);
    node->flags &= ~CLUSTER_NODE_NOADDR;
    serverLog(LL_WARNING,"Address updated for node %.40s, now %s:%d",
        node->name, node->ip, node->port);

    /* Check if this is our master and we have to change the
     * replication target as well. */
    if (nodeIsSlave(myself) && myself->slaveof == node)
        replicationSetMaster(node->ip, node->port);
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
xorps %xmm0, %xmm0
movups %xmm0, 0x1e(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
cmpq %rsi, 0x8c8(%rdi)
je 0x6b122
movl %edx, %ebp
movq %rdi, %rbx
movl 0x8(%rsi), %edi
xorl %r14d, %r14d
movq %rsp, %rsi
movl $0x2e, %edx
xorl %ecx, %ecx
callq 0x31360
cmpl %ebp, 0x8c0(%rbx)
jne 0x6b090
leaq 0x890(%rbx), %rsi
movq %rsp, %rdi
callq 0x26900
testl %eax, %eax
je 0x6b125
leaq 0x890(%rbx), %r15
movups 0x1e(%rsp), %xmm0
movups %xmm0, 0x8ae(%rbx)
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
movups %xmm1, 0x8a0(%rbx)
movups %xmm0, 0x890(%rbx)
movl %ebp, 0x8c0(%rbx)
movq 0x8c8(%rbx), %rdi
testq %rdi, %rdi
je 0x6b0d1
callq 0x6a18e
andb $-0x41, 0x30(%rbx)
leaq 0x8(%rbx), %rdx
movl 0x8c0(%rbx), %r8d
leaq 0x5fb43(%rip), %rsi     # 0xcac2a
movl $0x3, %edi
movq %r15, %rcx
xorl %eax, %eax
callq 0x32ea6
movq 0xb00d3(%rip), %rax     # 0x11b1d0
movl $0x1, %r14d
testb $0x2, 0x30(%rax)
je 0x6b125
cmpq %rbx, 0x850(%rax)
jne 0x6b125
movl 0x8c0(%rbx), %esi
movq %r15, %rdi
callq 0x49ef3
jmp 0x6b125
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/cluster.c
// Function: clusterSetMaster
void clusterSetMaster(clusterNode *n) {
    serverAssert(n != myself);
    serverAssert(myself->numslots == 0);

    if (nodeIsMaster(myself)) {
        myself->flags &= ~(CLUSTER_NODE_MASTER|CLUSTER_NODE_MIGRATE_TO);
        myself->flags |= CLUSTER_NODE_SLAVE;
        clusterCloseAllSlots();
    } else {
        if (myself->slaveof)
            clusterNodeRemoveSlave(myself->slaveof,myself);
    }
    myself->slaveof = n;
    clusterNodeAddSlave(n,myself);
    replicationSetMaster(n->ip, n->port);
    resetManualFailover();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0xafea7(%rip), %rsi     # 0x11b1d0
cmpq %rdi, %rsi
je 0x6b3d4
cmpl $0x0, 0x840(%rsi)
jne 0x6b3e9
movq %rdi, %rbx
movl 0x30(%rsi), %eax
testb $0x1, %al
jne 0x6b35c
movq 0x850(%rsi), %rdi
testq %rdi, %rdi
je 0x6b39d
callq 0x6a560
jmp 0x6b39d
andl $0xfffffefc, %eax       # imm = 0xFFFFFEFC
orl $0x2, %eax
movl %eax, 0x30(%rsi)
leaq 0x9b4ea(%rip), %r14     # 0x106858
movq 0x9a0(%r14), %rdi
addq $0x28, %rdi
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
callq 0x26110
movl $0x20028, %edi          # imm = 0x20028
addq 0x9a0(%r14), %rdi
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
callq 0x26110
movq 0xafe2c(%rip), %rsi     # 0x11b1d0
movq %rbx, 0x850(%rsi)
movq %rbx, %rdi
callq 0x69521
movl 0x8c0(%rbx), %esi
addq $0x890, %rbx            # imm = 0x890
movq %rbx, %rdi
callq 0x49ef3
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x69da6
leaq 0x6022f(%rip), %rdi     # 0xcb60a
leaq 0x5f2ab(%rip), %rsi     # 0xca68d
movl $0xe37, %edx            # imm = 0xE37
jmp 0x6b3fc
leaq 0x60226(%rip), %rdi     # 0xcb616
leaq 0x5f296(%rip), %rsi     # 0xca68d
movl $0xe38, %edx            # imm = 0xE38
callq 0x654e1
movl $0x1, %edi
callq 0x263d0
// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/cluster.c
// Function: clusterDelNodeSlots
int clusterDelNodeSlots(clusterNode *node) {
    int deleted = 0, j;

    for (j = 0; j < CLUSTER_SLOTS; j++) {
        if (clusterNodeGetSlotBit(node,j)) clusterDelSlot(j);
        deleted++;
    }
    return deleted;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %ebp, %ebp
movl %ebp, %eax
shrl $0x3, %eax
movzbl 0x40(%rbx,%rax), %eax
movl %ebp, %ecx
andl $0x7, %ecx
btl %ecx, %eax
jae 0x6c16f
movl %ebp, %edi
callq 0x69fe5
incl %ebp
cmpl $0x4000, %ebp           # imm = 0x4000
jne 0x6c154
movl $0x4000, %eax           # imm = 0x4000
addq $0x8, %rsp
popq %rbx
popq %rbp
retq