LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/bitops.c
// Function: checkSignedBitfieldOverflow
int checkSignedBitfieldOverflow(int64_t value, int64_t incr, uint64_t bits, int owtype, int64_t *limit) {
    int64_t max = (bits == 64) ? INT64_MAX : (((int64_t)1<<(bits-1))-1);
    int64_t min = (-max)-1;

    /* Note that maxincr and minincr could overflow, but we use the values
     * only after checking 'value' range, so when we use it no overflow
     * happens. */
    int64_t maxincr = max-value;
    int64_t minincr = min-value;

    if (value > max || (bits != 64 && incr > maxincr) || (value >= 0 && incr > 0 && incr > maxincr))
    {
        if (limit) {
            if (owtype == BFOVERFLOW_WRAP) {
                goto handle_wrap;
            } else if (owtype == BFOVERFLOW_SAT) {
                *limit = max;
            }
        }
        return 1;
    } else if (value < min || (bits != 64 && incr < minincr) || (value < 0 && incr < 0 && incr < minincr)) {
        if (limit) {
            if (owtype == BFOVERFLOW_WRAP) {
                goto handle_wrap;
            } else if (owtype == BFOVERFLOW_SAT) {
                *limit = min;
            }
        }
        return -1;
    }
    return 0;

handle_wrap:
    {
        uint64_t mask = ((uint64_t)-1) << bits;
        uint64_t msb = (uint64_t)1 << (bits-1);
        uint64_t a = value, b = incr, c;
        c = a+b; /* Perform addition as unsigned so that's defined. */

        /* If the sign bit is set, propagate to all the higher order
         * bits, to cap the negative value. If it's clear, mask to
         * the positive integer limit. */
        if (c & msb) {
            c |= mask;
        } else {
            c &= ~mask;
        }
        *limit = c;
    }
    return 1;
}

// Assembly:
movl %ecx, %r9d
leal -0x1(%rdx), %ecx
movl $0x1, %r11d
shlq %cl, %r11
leaq -0x1(%r11), %rax
cmpq $0x40, %rdx
movabsq $0x7fffffffffffffff, %r10 # imm = 0x7FFFFFFFFFFFFFFF
cmovneq %rax, %r10
movq %r10, %rax
subq %rdi, %rax
jl 0x73ce9
cmpq $0x40, %rdx
je 0x73cda
cmpq %rsi, %rax
jl 0x73ce9
testq %rdi, %rdi
js 0x73cff
testq %rsi, %rsi
jle 0x73cff
cmpq %rsi, %rax
jge 0x73cff
movl $0x1, %eax
testq %r8, %r8
je 0x73cfe
testl %r9d, %r9d
je 0x73d39
cmpl $0x1, %r9d
je 0x73d61
retq
notq %r10
cmpq %rdi, %r10
jg 0x73d24
movq %r10, %rcx
subq %rdi, %rcx
cmpq $0x40, %rdx
je 0x73d18
cmpq %rsi, %rcx
jg 0x73d24
xorl %eax, %eax
testq %rdi, %rsi
jns 0x73cfe
cmpq %rsi, %rcx
jle 0x73cfe
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r8, %r8
je 0x73cfe
cmpl $0x1, %r9d
je 0x73d68
testl %r9d, %r9d
jne 0x73cfe
movq $-0x1, %r10
movl %edx, %ecx
shlq %cl, %r10
addq %rdi, %rsi
movq %r10, %rax
orq %rsi, %rax
notq %r10
andq %rsi, %r10
testq %rsi, %r11
cmovneq %rax, %r10
movl $0x1, %r9d
movq %r10, (%r8)
movl %r9d, %eax
retq
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
jmp 0x73d61
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/bitops.c
// Function: printBits
void printBits(unsigned char *p, unsigned long count) {
    unsigned long j, i, byte;

    for (j = 0; j < count; j++) {
        byte = p[j];
        for (i = 0x80; i > 0; i /= 2)
            printf("%c", (byte & i) ? '1' : '0');
        printf("|");
    }
    printf("\n");
}

// Assembly:
testq %rsi, %rsi
je 0x73ddb
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movzbl (%r14,%r15), %r12d
movl $0x80, %r13d
movl $0x80, %ebp
movl %r13d, %eax
andl %r12d, %eax
cmpl $0x1, %eax
movl $0x31, %edi
sbbl $0x0, %edi
callq 0x26320
shrq %rbp
cmpq $0x1, %r13
movq %rbp, %r13
ja 0x73d99
movl $0x7c, %edi
callq 0x26320
incq %r15
cmpq %rbx, %r15
jne 0x73d89
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
movl $0xa, %edi
jmp 0x26320
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/bitops.c
// Function: getBitOffsetFromArgument
int getBitOffsetFromArgument(client *c, robj *o, size_t *offset, int hash, int bits) {
    long long loffset;
    char *err = "bit offset is not an integer or out of range";
    char *p = o->ptr;
    size_t plen = sdslen(p);
    int usehash = 0;

    /* Handle #<offset> form. */
    if (p[0] == '#' && hash && bits > 0) usehash = 1;

    if (string2ll(p+usehash,plen-usehash,&loffset) == 0) {
        addReplyError(c,err);
        return C_ERR;
    }

    /* Adjust the offset by 'bits' for #<offset> form. */
    if (usehash) loffset *= bits;

    /* Limit offset to 512MB in bytes */
    if ((loffset < 0) || ((unsigned long long)loffset >> 3) >= (512*1024*1024))
    {
        addReplyError(c,err);
        return C_ERR;
    }

    *offset = (size_t)loffset;
    return C_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %ebp
movq %rdx, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rdi
movzbl -0x1(%rdi), %esi
movl %esi, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x73e33
leaq 0x57fc2(%rip), %rdx     # 0xcbdd0
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
shrl $0x3, %esi
jmp 0x73e35
movq -0x11(%rdi), %rsi
jmp 0x73e35
movzwl -0x5(%rdi), %esi
jmp 0x73e35
movl -0x9(%rdi), %esi
jmp 0x73e35
movzbl -0x3(%rdi), %esi
jmp 0x73e35
xorl %esi, %esi
cmpb $0x23, (%rdi)
sete %al
testl %ecx, %ecx
setne %cl
testl %ebp, %ebp
setg %r15b
andb %cl, %r15b
andb %al, %r15b
movzbl %r15b, %eax
addq %rax, %rdi
subq %rax, %rsi
movq %rsp, %rdx
callq 0x40065
testl %eax, %eax
je 0x73e81
testb %r15b, %r15b
je 0x73e74
movl %ebp, %eax
imulq (%rsp), %rax
movq %rax, (%rsp)
jmp 0x73e78
movq (%rsp), %rax
movq %rax, %rcx
shrq $0x20, %rcx
je 0x73e97
leaq 0x580d1(%rip), %rsi     # 0xcbf59
movq %rbx, %rdi
callq 0x3cc06
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x73e9c
movq %rax, (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/bitops.c
// Function: getBitfieldTypeFromArgument
int getBitfieldTypeFromArgument(client *c, robj *o, int *sign, int *bits) {
    char *p = o->ptr;
    char *err = "Invalid bitfield type. Use something like i16 u8. Note that u64 is not supported but i64 is.";
    long long llbits;

    if (p[0] == 'i') {
        *sign = 1;
    } else if (p[0] == 'u') {
        *sign = 0;
    } else {
        addReplyError(c,err);
        return C_ERR;
    }

    if ((string2ll(p+1,strlen(p+1),&llbits)) == 0 ||
        llbits < 1 ||
        (*sign == 1 && llbits > 64) ||
        (*sign == 0 && llbits > 63))
    {
        addReplyError(c,err);
        return C_ERR;
    }
    *bits = llbits;
    return C_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %rbx
movq 0x8(%rsi), %r12
movzbl (%r12), %eax
cmpl $0x69, %eax
je 0x73ed4
cmpl $0x75, %eax
jne 0x73f36
xorl %eax, %eax
jmp 0x73ed9
movl $0x1, %eax
movl %eax, (%r15)
incq %r12
movq %r12, %rdi
callq 0x26500
leaq 0x8(%rsp), %r13
movq %r12, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x40065
testl %eax, %eax
sete %cl
movq (%r13), %rax
testq %rax, %rax
setle %dl
orb %cl, %dl
jne 0x73f36
movl (%r15), %ecx
cmpl $0x1, %ecx
sete %dl
cmpq $0x41, %rax
setae %sil
testb %sil, %dl
jne 0x73f36
testl %ecx, %ecx
sete %cl
cmpq $0x40, %rax
setae %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x73f58
leaq 0x58049(%rip), %rsi     # 0xcbf86
movq %rbx, %rdi
callq 0x3cc06
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movl %eax, (%r14)
xorl %eax, %eax
jmp 0x73f4a
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/bitops.c
// Function: lookupStringForBitCommand
robj *lookupStringForBitCommand(client *c, size_t maxbit) {
    size_t byte = maxbit >> 3;
    robj *o = lookupKeyWrite(c->db,c->argv[1]);

    if (o == NULL) {
        o = createObject(OBJ_STRING,sdsnewlen(NULL, byte+1));
        dbAdd(c->db,c->argv[1],o);
    } else {
        if (checkType(c,o,OBJ_STRING)) return NULL;
        o = dbUnshareStringValue(c->db,c->argv[1],o);
        o->ptr = sdsgrowzero(o->ptr,byte+1);
    }
    return o;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
shrq $0x3, %rbx
movq 0x10(%rdi), %rdi
movq 0x40(%r14), %rax
movq 0x8(%rax), %rsi
callq 0x41ad6
testq %rax, %rax
je 0x73fca
movq %rax, %r12
xorl %r15d, %r15d
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x40d47
testl %eax, %eax
jne 0x73ff8
movq 0x10(%r14), %rdi
movq 0x40(%r14), %rax
movq 0x8(%rax), %rsi
movq %r12, %rdx
callq 0x41f24
movq %rax, %r15
movq 0x8(%rax), %rdi
incq %rbx
movq %rbx, %rsi
callq 0x36a02
movq %rax, 0x8(%r15)
jmp 0x73ff8
incq %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0x36178
xorl %edi, %edi
movq %rax, %rsi
callq 0x40650
movq %rax, %r15
movq 0x10(%r14), %rdi
movq 0x40(%r14), %rax
movq 0x8(%rax), %rsi
movq %r15, %rdx
callq 0x41b77
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/bitops.c
// Function: getObjectReadOnlyString
unsigned char *getObjectReadOnlyString(robj *o, long *len, char *llbuf) {
    serverAssert(o->type == OBJ_STRING);
    unsigned char *p = NULL;

    /* Set the 'p' pointer to the string, that can be just a stack allocated
     * array if our string was integer encoded. */
    if (o && o->encoding == OBJ_ENCODING_INT) {
        p = (unsigned char*) llbuf;
        if (len) *len = ll2string(llbuf,LONG_STR_SIZE,(long)o->ptr);
    } else if (o) {
        p = (unsigned char*) o->ptr;
        if (len) *len = sdslen(o->ptr);
    } else {
        if (len) *len = 0;
    }
    return p;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl (%rdi), %eax
testb $0xf, %al
jne 0x74090
movq %rsi, %r14
andl $0xf0, %eax
cmpl $0x10, %eax
jne 0x7403e
movq %rdx, %rbx
testq %r14, %r14
je 0x7406a
movq 0x8(%rdi), %rdx
movl $0x15, %esi
movq %rbx, %rdi
callq 0x3ff83
cltq
movq %rax, (%r14)
jmp 0x7406a
movq 0x8(%rdi), %rbx
testq %r14, %r14
je 0x7406a
movzbl -0x1(%rbx), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x7408c
leaq 0x57d88(%rip), %rdx     # 0xcbde4
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %eax
jmp 0x74039
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq -0x11(%rbx), %rax
jmp 0x74039
movzwl -0x5(%rbx), %eax
jmp 0x74039
movl -0x9(%rbx), %eax
jmp 0x74039
movzbl -0x3(%rbx), %eax
jmp 0x74039
xorl %eax, %eax
jmp 0x74039
leaq 0x4bea9(%rip), %rdi     # 0xbff40
leaq 0x57eb2(%rip), %rsi     # 0xcbf50
movl $0x1f4, %edx            # imm = 0x1F4
callq 0x61908
movl $0x1, %edi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/bitops.c
// Function: setbitCommand
void setbitCommand(client *c) {
    robj *o;
    char *err = "bit is not an integer or out of range";
    size_t bitoffset;
    ssize_t byte, bit;
    int byteval, bitval;
    long on;

    if (getBitOffsetFromArgument(c,c->argv[2],&bitoffset,0,0) != C_OK)
        return;

    if (getLongFromObjectOrReply(c,c->argv[3],&on,err) != C_OK)
        return;

    /* Bits can only be set or cleared... */
    if (on & ~1) {
        addReplyError(c,err);
        return;
    }

    if ((o = lookupStringForBitCommand(c,bitoffset)) == NULL) return;

    /* Get current values */
    byte = bitoffset >> 3;
    byteval = ((uint8_t*)o->ptr)[byte];
    bit = 7 - (bitoffset & 0x7);
    bitval = byteval & (1 << bit);

    /* Update byte with new bit value and return original value */
    byteval &= ~(1 << bit);
    byteval |= ((on & 0x1) << bit);
    ((uint8_t*)o->ptr)[byte] = byteval;
    signalModifiedKey(c->db,c->argv[1]);
    notifyKeyspaceEvent(NOTIFY_STRING,"setbit",c->argv[1],c->db->id);
    server.dirty++;
    addReply(c, bitval ? shared.cone : shared.czero);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movq 0x10(%rax), %rsi
leaq 0x8(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x73de5
testl %eax, %eax
jne 0x741bf
movq 0x40(%rbx), %rax
movq 0x18(%rax), %rsi
leaq 0x57ef8(%rip), %rcx     # 0xcbfe3
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x41718
testl %eax, %eax
jne 0x741bf
cmpq $0x2, (%rsp)
jae 0x741b0
movq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x73f5f
testq %rax, %rax
je 0x741bf
movq %r14, %rdx
shrq $0x3, %rdx
movq 0x8(%rax), %rax
movzbl (%rax,%rdx), %ebp
notb %r14b
andb $0x7, %r14b
movl %ebp, %esi
btrl %r14d, %esi
movl (%rsp), %edi
andl $0x1, %edi
movl %r14d, %ecx
shll %cl, %edi
orl %esi, %edi
movb %dil, (%rax,%rdx)
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x41d90
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x4840a(%rip), %rsi     # 0xbc580
movl $0x8, %edi
callq 0x7c665
leaq 0x8d721(%rip), %rax     # 0x1018a8
incq 0x720(%rax)
movzbl %r14b, %eax
xorl %ecx, %ecx
btl %eax, %ebp
setb %cl
leaq 0x8e16f(%rip), %rax     # 0x102310
movq 0x20(%rax,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x3c854
jmp 0x741bf
leaq 0x57e2c(%rip), %rsi     # 0xcbfe3
movq %rbx, %rdi
callq 0x3cc06
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/bitops.c
// Function: getbitCommand
void getbitCommand(client *c) {
    robj *o;
    char llbuf[32];
    size_t bitoffset;
    size_t byte, bit;
    size_t bitval = 0;

    if (getBitOffsetFromArgument(c,c->argv[2],&bitoffset,0,0) != C_OK)
        return;

    if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
        checkType(c,o,OBJ_STRING)) return;

    byte = bitoffset >> 3;
    bit = 7 - (bitoffset & 0x7);
    if (sdsEncodedObject(o)) {
        if (byte < sdslen(o->ptr))
            bitval = ((uint8_t*)o->ptr)[byte] & (1 << bit);
    } else {
        if (byte < (size_t)ll2string(llbuf,sizeof(llbuf),(long)o->ptr))
            bitval = llbuf[byte] & (1 << bit);
    }

    addReply(c, bitval ? shared.cone : shared.czero);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movq 0x10(%rax), %rsi
leaq 0x8(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x73de5
testl %eax, %eax
je 0x74201
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
leaq 0x8e100(%rip), %r12     # 0x102310
movq 0x20(%r12), %rdx
movq %rbx, %rdi
callq 0x41af9
testq %rax, %rax
je 0x741f3
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x40d47
testl %eax, %eax
jne 0x741f3
movq 0x8(%rsp), %r14
movq %r14, %r13
shrq $0x3, %r13
movl (%r15), %eax
shrl $0x4, %eax
testb $0x7, %al
jne 0x74273
movq 0x8(%r15), %rax
movzbl -0x1(%rax), %ecx
movl %ecx, %edx
andl $0x7, %edx
cmpl $0x4, %edx
ja 0x742d6
leaq 0x57b93(%rip), %rsi     # 0xcbdf8
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
shrl $0x3, %ecx
jmp 0x742ac
movq 0x8(%r15), %rdx
leaq 0x10(%rsp), %rdi
movl $0x20, %esi
callq 0x3ff83
cltq
cmpq %rax, %r13
jae 0x742d6
leaq (%rsp,%r13), %rax
addq $0x10, %rax
jmp 0x742b4
movq -0x11(%rax), %rcx
jmp 0x742ac
movzwl -0x5(%rax), %ecx
jmp 0x742ac
movl -0x9(%rax), %ecx
jmp 0x742ac
movzbl -0x3(%rax), %ecx
cmpq %rcx, %r13
jae 0x742d6
addq %r13, %rax
movzbl (%rax), %eax
notb %r14b
andb $0x7, %r14b
movl $0x1, %edx
movl %r14d, %ecx
shll %cl, %edx
xorl %ecx, %ecx
andl %eax, %edx
setne %cl
movq 0x20(%r12,%rcx,8), %rsi
jmp 0x742db
movq 0x20(%r12), %rsi
movq %rbx, %rdi
callq 0x3c854
jmp 0x741f3
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: releaseSentinelRedisInstance
void releaseSentinelRedisInstance(sentinelRedisInstance *ri) {
    /* Release all its slaves or sentinels if any. */
    dictRelease(ri->sentinels);
    dictRelease(ri->slaves);

    /* Disconnect the instance. */
    releaseInstanceLink(ri->link,ri);

    /* Free other resources. */
    sdsfree(ri->name);
    sdsfree(ri->runid);
    sdsfree(ri->notification_script);
    sdsfree(ri->client_reconfig_script);
    sdsfree(ri->slave_master_host);
    sdsfree(ri->leader);
    sdsfree(ri->auth_pass);
    sdsfree(ri->info);
    releaseSentinelAddr(ri->addr);

    /* Clear state into the master if needed. */
    if ((ri->flags & SRI_SLAVE) && (ri->flags & SRI_PROMOTED) && ri->master)
        ri->master->promoted_slave = NULL;

    zfree(ri);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x80(%rdi), %rdi
callq 0x2eef3
movq 0x88(%rbx), %rdi
callq 0x2eef3
movq 0x28(%rbx), %rdi
movq %rbx, %rsi
callq 0x7759c
movq 0x8(%rbx), %rdi
callq 0x36330
movq 0x10(%rbx), %rdi
callq 0x36330
movq 0x120(%rbx), %rdi
callq 0x36330
movq 0x128(%rbx), %rdi
callq 0x36330
movq 0xc0(%rbx), %rdi
callq 0x36330
movq 0xd8(%rbx), %rdi
callq 0x36330
movq 0x98(%rbx), %rdi
callq 0x36330
movq 0x130(%rbx), %rdi
callq 0x36330
movq 0x20(%rbx), %r14
movq (%r14), %rdi
callq 0x36330
movq %r14, %rdi
callq 0x38413
movl (%rbx), %eax
notl %eax
testb $-0x7e, %al
jne 0x75550
movq 0xb8(%rbx), %rax
testq %rax, %rax
je 0x75550
movq $0x0, 0x118(%rax)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x38413
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelPublishCommand
void sentinelPublishCommand(client *c) {
    if (strcmp(c->argv[1]->ptr,SENTINEL_HELLO_CHANNEL)) {
        addReplyError(c, "Only HELLO messages are accepted by Sentinel instances.");
        return;
    }
    sentinelProcessHelloMessage(c->argv[2]->ptr,sdslen(c->argv[2]->ptr));
    addReplyLongLong(c,1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x40(%rdi), %r14
movq 0x8(%r14), %rax
movq 0x8(%rax), %rdi
leaq 0x568fb(%rip), %rsi     # 0xcc9f1
callq 0x268f0
testl %eax, %eax
je 0x76115
leaq 0x572ec(%rip), %rsi     # 0xcd3f2
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3cc06
movq 0x10(%r14), %rax
movq 0x8(%rax), %rdi
movzbl -0x1(%rdi), %esi
movl %esi, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x76157
leaq 0x55f6a(%rip), %rcx     # 0xcc09c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %esi
jmp 0x76159
movq -0x11(%rdi), %rsi
jmp 0x76159
movzwl -0x5(%rdi), %esi
jmp 0x76159
movl -0x9(%rdi), %esi
jmp 0x76159
movzbl -0x3(%rdi), %esi
jmp 0x76159
xorl %esi, %esi
callq 0x79e8d
movl $0x1, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3d23f
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelRoleCommand
void sentinelRoleCommand(client *c) {
    dictIterator *di;
    dictEntry *de;

    addReplyMultiBulkLen(c,2);
    addReplyBulkCBuffer(c,"sentinel",8);
    addReplyMultiBulkLen(c,dictSize(sentinel.masters));

    di = dictGetIterator(sentinel.masters);
    while((de = dictNext(di)) != NULL) {
        sentinelRedisInstance *ri = dictGetVal(de);

        addReplyBulkCString(c,ri->name);
    }
    dictReleaseIterator(di);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x2, %esi
callq 0x3d274
leaq 0x5658b(%rip), %rsi     # 0xccbc6
movl $0x8, %edx
movq %rbx, %rdi
callq 0x3d346
movq 0xa00c1(%rip), %rax     # 0x116710
movq 0x48(%rax), %rsi
addq 0x28(%rax), %rsi
movq %rbx, %rdi
callq 0x3d274
movq 0xa00aa(%rip), %rdi     # 0x116710
callq 0x2efbb
movq %rax, %r14
movq %rax, %rdi
callq 0x2f015
testq %rax, %rax
je 0x76690
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x3d0f2
movq %r14, %rdi
jmp 0x76671
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2f0dd
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: initSentinel
void initSentinel(void) {
    unsigned int j;

    /* Remove usual Redis commands from the command table, then just add
     * the SENTINEL command. */
    dictEmpty(server.commands,NULL);
    for (j = 0; j < sizeof(sentinelcmds)/sizeof(sentinelcmds[0]); j++) {
        int retval;
        struct redisCommand *cmd = sentinelcmds+j;

        retval = dictAdd(server.commands, sdsnew(cmd->name), cmd);
        serverAssert(retval == DICT_OK);
    }

    /* Initialize various data structures. */
    sentinel.current_epoch = 0;
    sentinel.masters = dictCreate(&instancesDictType,NULL);
    sentinel.tilt = 0;
    sentinel.tilt_start_time = 0;
    sentinel.previous_time = mstime();
    sentinel.running_scripts = 0;
    sentinel.scripts_queue = listCreate();
    sentinel.announce_ip = NULL;
    sentinel.announce_port = 0;
    sentinel.simfailure_flags = SENTINEL_SIMFAILURE_NONE;
    memset(sentinel.myid,0,sizeof(sentinel.myid));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x8b1e7(%rip), %r15     # 0x1018a8
movq 0x30(%r15), %rdi
xorl %r12d, %r12d
xorl %esi, %esi
callq 0x2f51e
leaq 0x8ac3a(%rip), %r13     # 0x101310
leaq (%r12,%r13), %rbx
movq 0x30(%r15), %r14
movq (%r12,%r13), %rdi
callq 0x362b0
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x2e9b8
testl %eax, %eax
jne 0x76789
addq $0x50, %r12
cmpq $0x370, %r12            # imm = 0x370
jne 0x766d6
xorl %ebx, %ebx
movq %rbx, 0x9fff5(%rip)     # 0x116708
leaq 0x8ab96(%rip), %rdi     # 0x1012b0
xorl %esi, %esi
callq 0x2e68c
movq %rax, 0x9ffe8(%rip)     # 0x116710
movl %ebx, 0x9ffea(%rip)     # 0x116718
movq %rbx, 0x9ffeb(%rip)     # 0x116720
callq 0x2ffce
movq %rax, 0x9ffe7(%rip)     # 0x116728
movl %ebx, 0x9ffd5(%rip)     # 0x11671c
callq 0x2b17c
movq %rax, 0x9ffdd(%rip)     # 0x116730
movq %rbx, 0x9ffde(%rip)     # 0x116738
movl %ebx, 0x9ffe0(%rip)     # 0x116740
movq %rbx, 0x9ffe1(%rip)     # 0x116748
xorps %xmm0, %xmm0
movups %xmm0, 0x9ff67(%rip)    # 0x1166d8
movups %xmm0, 0x9ff70(%rip)    # 0x1166e8
movups %xmm0, 0x9ff72(%rip)    # 0x1166f1
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x4a7a0(%rip), %rdi     # 0xc0f30
leaq 0x55ab9(%rip), %rsi     # 0xcc250
movl $0x1c9, %edx            # imm = 0x1C9
callq 0x61908
movl $0x1, %edi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelIsRunning
void sentinelIsRunning(void) {
    int j;

    if (server.configfile == NULL) {
        serverLog(LL_WARNING,
            "Sentinel started without a config file. Exiting...");
        exit(1);
    } else if (access(server.configfile,W_OK) == -1) {
        serverLog(LL_WARNING,
            "Sentinel config file %s is not writable: %s. Exiting...",
            server.configfile,strerror(errno));
        exit(1);
    }

    /* If this Sentinel has yet no ID set in the configuration file, we
     * pick a random one and persist the config on disk. From now on this
     * will be this Sentinel ID across restarts. */
    for (j = 0; j < CONFIG_RUN_ID_SIZE; j++)
        if (sentinel.myid[j] != 0) break;

    if (j == CONFIG_RUN_ID_SIZE) {
        /* Pick ID and presist the config. */
        getRandomHexChars(sentinel.myid,CONFIG_RUN_ID_SIZE);
        sentinelFlushConfig();
    }

    /* Log its ID to make debugging of issues simpler. */
    serverLog(LL_WARNING,"Sentinel ID is %s", sentinel.myid);

    /* We want to generate a +monitor event for every configured master
     * at startup. */
    sentinelGenerateInitialMonitorEvents();
}

// Assembly:
pushq %rbx
leaq 0x8b0f5(%rip), %rbx     # 0x1018a8
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x76819
movl $0x2, %esi
callq 0x26aa0
cmpl $-0x1, %eax
je 0x7682e
xorl %eax, %eax
leaq 0x9ff04(%rip), %rcx     # 0x1166d8
cmpb $0x0, (%rax,%rcx)
jne 0x767f9
incq %rax
cmpq $0x28, %rax
jne 0x767d4
leaq 0x9feee(%rip), %rdi     # 0x1166d8
movl $0x28, %esi
callq 0x40256
callq 0x76861
leaq 0x55ac6(%rip), %rsi     # 0xcc2c6
leaq 0x9fed1(%rip), %rdx     # 0x1166d8
movl $0x3, %edi
xorl %eax, %eax
callq 0x2fdad
popq %rbx
jmp 0x768e8
leaq 0x55a3b(%rip), %rsi     # 0xcc25b
movl $0x3, %edi
xorl %eax, %eax
callq 0x2fdad
jmp 0x76857
movq 0x8(%rbx), %rbx
callq 0x26880
movl (%rax), %edi
callq 0x26680
leaq 0x55a49(%rip), %rsi     # 0xcc28e
movl $0x3, %edi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2fdad
movl $0x1, %edi
callq 0x262c0
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelFlushConfig
void sentinelFlushConfig(void) {
    int fd = -1;
    int saved_hz = server.hz;
    int rewrite_status;

    server.hz = CONFIG_DEFAULT_HZ;
    rewrite_status = rewriteConfig(server.configfile);
    server.hz = saved_hz;

    if (rewrite_status == -1) goto werr;
    if ((fd = open(server.configfile,O_RDONLY)) == -1) goto werr;
    if (fsync(fd) == -1) goto werr;
    if (close(fd) == EOF) goto werr;
    return;

werr:
    if (fd != -1) close(fd);
    serverLog(LL_WARNING,"WARNING: Sentinel was not able to save the new configuration on disk!!!: %s", strerror(errno));
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
leaq 0x8b03d(%rip), %rbx     # 0x1018a8
movl 0x20(%rbx), %ebp
movl $0xa, 0x20(%rbx)
movq 0x8(%rbx), %rdi
callq 0x5c3c8
movl %ebp, 0x20(%rbx)
cmpl $-0x1, %eax
je 0x768c0
movq 0x8(%rbx), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x26690
cmpl $-0x1, %eax
je 0x768c0
movl %eax, %ebx
movl %eax, %edi
callq 0x26600
cmpl $-0x1, %eax
je 0x768b9
movl %ebx, %edi
callq 0x26180
cmpl $-0x1, %eax
je 0x768b9
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl %ebx, %edi
callq 0x26180
callq 0x26880
movl (%rax), %edi
callq 0x26680
leaq 0x5605e(%rip), %rsi     # 0xcc931
movl $0x3, %edi
movq %rax, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2fdad
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelGenerateInitialMonitorEvents
void sentinelGenerateInitialMonitorEvents(void) {
    dictIterator *di;
    dictEntry *de;

    di = dictGetIterator(sentinel.masters);
    while((de = dictNext(di)) != NULL) {
        sentinelRedisInstance *ri = dictGetVal(de);
        sentinelEvent(LL_WARNING,"+monitor",ri,"%@ quorum %d",ri->quorum);
    }
    dictReleaseIterator(di);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x9fe1c(%rip), %rdi     # 0x116710
callq 0x2efbb
movq %rax, %rbx
movq %rax, %rdi
callq 0x2f015
testq %rax, %rax
je 0x76941
leaq 0x559eb(%rip), %r14     # 0xcc2fb
leaq 0x559ed(%rip), %r15     # 0xcc304
movq 0x8(%rax), %rdx
movl 0x90(%rdx), %r8d
movl $0x3, %edi
movq %r14, %rsi
movq %r15, %rcx
xorl %eax, %eax
callq 0x76a24
movq %rbx, %rdi
callq 0x2f015
testq %rax, %rax
jne 0x76917
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2f0dd
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: createSentinelAddr
sentinelAddr *createSentinelAddr(char *hostname, int port) {
    char ip[NET_IP_STR_LEN];
    sentinelAddr *sa;

    if (port < 0 || port > 65535) {
        errno = EINVAL;
        return NULL;
    }
    if (anetResolve(NULL,hostname,ip,sizeof(ip)) == ANET_ERR) {
        errno = ENOENT;
        return NULL;
    }
    sa = zmalloc(sizeof(*sa));
    sa->ip = sdsnew(ip);
    sa->port = port;
    return sa;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movl %esi, %ebx
cmpl $0x10000, %esi          # imm = 0x10000
jb 0x7696c
callq 0x26880
movl $0x16, (%rax)
jmp 0x769ac
movq %rdi, %rsi
movq %rsp, %rdx
movl $0x2e, %ecx
xorl %edi, %edi
callq 0x2da43
cmpl $-0x1, %eax
je 0x769a1
movl $0x10, %edi
callq 0x382d1
movq %rax, %r14
movq %rsp, %rdi
callq 0x362b0
movq %rax, (%r14)
movl %ebx, 0x8(%r14)
jmp 0x769af
callq 0x26880
movl $0x2, (%rax)
xorl %r14d, %r14d
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: dupSentinelAddr
sentinelAddr *dupSentinelAddr(sentinelAddr *src) {
    sentinelAddr *sa;

    sa = zmalloc(sizeof(*sa));
    sa->ip = sdsnew(src->ip);
    sa->port = src->port;
    return sa;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x10, %edi
callq 0x382d1
movq %rax, %r14
movq (%rbx), %rdi
callq 0x362b0
movq %rax, (%r14)
movl 0x8(%rbx), %eax
movl %eax, 0x8(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelReleaseScriptJob
void sentinelReleaseScriptJob(sentinelScriptJob *sj) {
    int j = 0;

    while(sj->argv[j]) sdsfree(sj->argv[j++]);
    zfree(sj->argv);
    zfree(sj);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x76efa
movl $0x8, %r14d
callq 0x36330
movq 0x8(%rbx), %rax
movq (%rax,%r14), %rdi
addq $0x8, %r14
testq %rdi, %rdi
jne 0x76ee4
movq %rax, %rdi
callq 0x38413
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x38413
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelGetScriptListNodeByPid
listNode *sentinelGetScriptListNodeByPid(pid_t pid) {
    listNode *ln;
    listIter li;

    listRewind(sentinel.scripts_queue,&li);
    while ((ln = listNext(&li)) != NULL) {
        sentinelScriptJob *sj = ln->value;

        if ((sj->flags & SENTINEL_SCRIPT_RUNNING) && sj->pid == pid)
            return ln;
    }
    return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
movq 0x9f80f(%rip), %rdi     # 0x116730
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x2b3b7
movq %r14, %rdi
callq 0x2b3d4
testq %rax, %rax
je 0x76f5b
leaq 0x8(%rsp), %r14
movq 0x10(%rax), %rcx
testb $0x1, (%rcx)
je 0x76f4e
cmpl %ebx, 0x18(%rcx)
je 0x76f5d
movq %r14, %rdi
callq 0x2b3d4
testq %rax, %rax
jne 0x76f40
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelRunPendingScripts
void sentinelRunPendingScripts(void) {
    listNode *ln;
    listIter li;
    mstime_t now = mstime();

    /* Find jobs that are not running and run them, from the top to the
     * tail of the queue, so we run older jobs first. */
    listRewind(sentinel.scripts_queue,&li);
    while (sentinel.running_scripts < SENTINEL_SCRIPT_MAX_RUNNING &&
           (ln = listNext(&li)) != NULL)
    {
        sentinelScriptJob *sj = ln->value;
        pid_t pid;

        /* Skip if already running. */
        if (sj->flags & SENTINEL_SCRIPT_RUNNING) continue;

        /* Skip if it's a retry, but not enough time has elapsed. */
        if (sj->start_time && sj->start_time > now) continue;

        sj->flags |= SENTINEL_SCRIPT_RUNNING;
        sj->start_time = mstime();
        sj->retry_num++;
        pid = fork();

        if (pid == -1) {
            /* Parent (fork error).
             * We report fork errors as signal 99, in order to unify the
             * reporting with other kind of errors. */
            sentinelEvent(LL_WARNING,"-script-error",NULL,
                          "%s %d %d", sj->argv[0], 99, 0);
            sj->flags &= ~SENTINEL_SCRIPT_RUNNING;
            sj->pid = 0;
        } else if (pid == 0) {
            /* Child */
            execve(sj->argv[0],sj->argv,environ);
            /* If we are here an error occurred. */
            _exit(2); /* Don't retry execution. */
        } else {
            sentinel.running_scripts++;
            sj->pid = pid;
            sentinelEvent(LL_DEBUG,"+script-child",NULL,"%ld",(long)pid);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
callq 0x2ffce
movq %rax, %rbx
movq 0x9f7ae(%rip), %rdi     # 0x116730
leaq 0x8(%rsp), %rsi
callq 0x2b3b7
cmpl $0xf, 0x9f789(%rip)     # 0x11671c
jg 0x7706f
leaq 0x8(%rsp), %r14
xorl %r15d, %r15d
leaq 0x553b7(%rip), %r13     # 0xcc35f
leaq 0x45bdf(%rip), %rbp     # 0xbcb8e
movq %r14, %rdi
callq 0x2b3d4
testq %rax, %rax
je 0x7706f
movq 0x10(%rax), %r12
movl (%r12), %eax
testb $0x1, %al
jne 0x77062
movq 0x10(%r12), %rcx
testq %rcx, %rcx
setne %dl
cmpq %rbx, %rcx
setg %cl
testb %cl, %dl
jne 0x77062
orl $0x1, %eax
movl %eax, (%r12)
callq 0x2ffce
movq %rax, 0x10(%r12)
incl 0x4(%r12)
callq 0x26ab0
cmpl $-0x1, %eax
je 0x7702a
testl %eax, %eax
je 0x7707e
incl 0x9f70d(%rip)           # 0x11671c
movl %eax, 0x18(%r12)
movslq %eax, %r8
xorl %edi, %edi
movq %r13, %rsi
xorl %edx, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x76a24
jmp 0x77062
movq 0x8(%r12), %rax
movq (%rax), %r8
movl %r15d, (%rsp)
movl $0x3, %edi
leaq 0x5530f(%rip), %rsi     # 0xcc351
xorl %edx, %edx
leaq 0x5574a(%rip), %rcx     # 0xcc795
movl $0x63, %r9d
xorl %eax, %eax
callq 0x76a24
andb $-0x2, (%r12)
movl %r15d, 0x18(%r12)
cmpl $0x10, 0x9f6b3(%rip)    # 0x11671c
jl 0x76faf
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r12), %rsi
movq (%rsi), %rdi
movq 0x85e93(%rip), %rax     # 0xfcf20
movq (%rax), %rdx
callq 0x26780
movl $0x2, %edi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelKillTimedoutScripts
void sentinelKillTimedoutScripts(void) {
    listNode *ln;
    listIter li;
    mstime_t now = mstime();

    listRewind(sentinel.scripts_queue,&li);
    while ((ln = listNext(&li)) != NULL) {
        sentinelScriptJob *sj = ln->value;

        if (sj->flags & SENTINEL_SCRIPT_RUNNING &&
            (now - sj->start_time) > SENTINEL_SCRIPT_MAX_RUNTIME)
        {
            sentinelEvent(LL_WARNING,"-script-timeout",NULL,"%s %ld",
                sj->argv[0], (long)sj->pid);
            kill(sj->pid,SIGKILL);
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
callq 0x2ffce
movq %rax, %rbx
movq 0x9f503(%rip), %rdi     # 0x116730
movq %rsp, %r14
movq %r14, %rsi
callq 0x2b3b7
movq %r14, %rdi
callq 0x2b3d4
testq %rax, %rax
je 0x772aa
movq %rsp, %r14
leaq 0x55181(%rip), %r15     # 0xcc3d0
leaq 0x4daa6(%rip), %r12     # 0xc4cfc
movq 0x10(%rax), %r13
testb $0x1, (%r13)
je 0x7729d
movq %rbx, %rax
subq 0x10(%r13), %rax
cmpq $0xea61, %rax           # imm = 0xEA61
jl 0x7729d
movq 0x8(%r13), %rax
movq (%rax), %r8
movslq 0x18(%r13), %r9
movl $0x3, %edi
movq %r15, %rsi
xorl %edx, %edx
movq %r12, %rcx
xorl %eax, %eax
callq 0x76a24
movl 0x18(%r13), %edi
movl $0x9, %esi
callq 0x26660
movq %r14, %rdi
callq 0x2b3d4
testq %rax, %rax
jne 0x77256
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelCallClientReconfScript
void sentinelCallClientReconfScript(sentinelRedisInstance *master, int role, char *state, sentinelAddr *from, sentinelAddr *to) {
    char fromport[32], toport[32];

    if (master->client_reconfig_script == NULL) return;
    ll2string(fromport,sizeof(fromport),from->port);
    ll2string(toport,sizeof(toport),to->port);
    sentinelScheduleScriptExecution(master->client_reconfig_script,
        master->name,
        (role == SENTINEL_LEADER) ? "leader" : "observer",
        state, from->ip, fromport, to->ip, toport, NULL);
}

// Assembly:
cmpq $0x0, 0x128(%rdi)
je 0x774f3
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r13
movslq 0x8(%rcx), %rdx
movq %rsp, %rdi
movl $0x20, %esi
callq 0x3ff83
movslq 0x8(%rbx), %rdx
leaq 0x20(%rsp), %r12
movl $0x20, %esi
movq %r12, %rdi
callq 0x3ff83
movq 0x8(%r13), %rsi
movq 0x128(%r13), %rdi
cmpl $0x20000, %ebp          # imm = 0x20000
leaq 0x55c92(%rip), %rax     # 0xcd150
leaq 0x54f45(%rip), %rdx     # 0xcc40a
cmoveq %rax, %rdx
movq (%r15), %r8
subq $0x8, %rsp
movq %r14, %rcx
leaq 0x8(%rsp), %r9
xorl %eax, %eax
pushq $0x0
pushq %r12
pushq (%rbx)
callq 0x76cec
addq $0x68, %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/sentinel.c
// Function: createInstanceLink
instanceLink *createInstanceLink(void) {
    instanceLink *link = zmalloc(sizeof(*link));

    link->refcount = 1;
    link->disconnected = 1;
    link->pending_commands = 0;
    link->cc = NULL;
    link->pc = NULL;
    link->cc_conn_time = 0;
    link->pc_conn_time = 0;
    link->last_reconn_time = 0;
    link->pc_last_activity = 0;
    /* We set the act_ping_time to "now" even if we actually don't have yet
     * a connection with the node, nor we sent a ping.
     * This is useful to detect a timeout in case we'll not be able to connect
     * with the node at all. */
    link->act_ping_time = mstime();
    link->last_ping_time = 0;
    link->last_avail_time = mstime();
    link->last_pong_time = mstime();
    return link;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x60, %edi
callq 0x382d1
movq %rax, %rbx
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, (%rbx)
movl $0x0, 0x8(%rbx)
xorl %r14d, %r14d
movq %r14, 0x58(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movq %r14, 0x30(%rbx)
callq 0x2ffce
movq %rax, 0x40(%rbx)
movq %r14, 0x48(%rbx)
callq 0x2ffce
movq %rax, 0x38(%rbx)
callq 0x2ffce
movq %rax, 0x50(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: instanceLinkCloseConnection
void instanceLinkCloseConnection(instanceLink *link, redisAsyncContext *c) {
    if (c == NULL) return;

    if (link->cc == c) {
        link->cc = NULL;
        link->pending_commands = 0;
    }
    if (link->pc == c) link->pc = NULL;
    c->data = NULL;
    link->disconnected = 1;
    redisAsyncFree(c);
}

// Assembly:
testq %rsi, %rsi
je 0x7759b
cmpq %rsi, 0x10(%rdi)
jne 0x77573
movq $0x0, 0x10(%rdi)
movl $0x0, 0x8(%rdi)
cmpq %rsi, 0x18(%rdi)
jne 0x77581
movq $0x0, 0x18(%rdi)
movq $0x0, 0xb0(%rsi)
movl $0x1, 0x4(%rdi)
movq %rsi, %rdi
jmp 0x82157
retq
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: releaseInstanceLink
instanceLink *releaseInstanceLink(instanceLink *link, sentinelRedisInstance *ri)
{
    serverAssert(link->refcount > 0);
    link->refcount--;
    if (link->refcount != 0) {
        if (ri && ri->link->cc) {
            /* This instance may have pending callbacks in the hiredis async
             * context, having as 'privdata' the instance that we are going to
             * free. Let's rewrite the callback list, directly exploiting
             * hiredis internal data structures, in order to bind them with
             * a callback that will ignore the reply at all. */
            redisCallback *cb;
            redisCallbackList *callbacks = &link->cc->replies;

            cb = callbacks->head;
            while(cb) {
                if (cb->privdata == ri) {
                    cb->fn = sentinelDiscardReplyCallback;
                    cb->privdata = NULL; /* Not strictly needed. */
                }
                cb = cb->next;
            }
        }
        return link; /* Other active users. */
    }

    instanceLinkCloseConnection(link,link->cc);
    instanceLinkCloseConnection(link,link->pc);
    zfree(link);
    return NULL;
}

// Assembly:
pushq %rbx
movl (%rdi), %eax
testl %eax, %eax
jle 0x77616
movq %rdi, %rbx
decl %eax
movl %eax, (%rdi)
je 0x775ef
testq %rsi, %rsi
je 0x77611
movq 0x28(%rsi), %rax
cmpq $0x0, 0x10(%rax)
je 0x77611
movq 0x10(%rbx), %rax
movq 0xf8(%rax), %rax
testq %rax, %rax
je 0x77611
leaq 0x65(%rip), %rcx        # 0x77638
cmpq %rsi, 0x10(%rax)
jne 0x775e5
movq %rcx, 0x8(%rax)
movq $0x0, 0x10(%rax)
movq (%rax), %rax
testq %rax, %rax
jne 0x775d3
jmp 0x77611
movq 0x10(%rbx), %rsi
movq %rbx, %rdi
callq 0x77559
movq 0x18(%rbx), %rsi
movq %rbx, %rdi
callq 0x77559
movq %rbx, %rdi
callq 0x38413
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
leaq 0x54df6(%rip), %rdi     # 0xcc413
leaq 0x54c2c(%rip), %rsi     # 0xcc250
movl $0x3d0, %edx            # imm = 0x3D0
callq 0x61908
movl $0x1, %edi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelTryConnectionSharing
int sentinelTryConnectionSharing(sentinelRedisInstance *ri) {
    serverAssert(ri->flags & SRI_SENTINEL);
    dictIterator *di;
    dictEntry *de;

    if (ri->runid == NULL) return C_ERR; /* No way to identify it. */
    if (ri->link->refcount > 1) return C_ERR; /* Already shared. */

    di = dictGetIterator(sentinel.masters);
    while((de = dictNext(di)) != NULL) {
        sentinelRedisInstance *master = dictGetVal(de), *match;
        /* We want to share with the same physical Sentinel referenced
         * in other masters, so skip our master. */
        if (master == ri->master) continue;
        match = getSentinelRedisInstanceByAddrAndRunID(master->sentinels,
                                                       NULL,0,ri->runid);
        if (match == NULL) continue; /* No match. */
        if (match == ri) continue; /* Should never happen but... safer. */

        /* We identified a matching Sentinel, great! Let's free our link
         * and use the one of the matching Sentinel. */
        releaseInstanceLink(ri->link,NULL);
        ri->link = match->link;
        match->link->refcount++;
        return C_OK;
    }
    dictReleaseIterator(di);
    return C_ERR;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testb $0x4, (%rdi)
je 0x776fa
movq %rdi, %r14
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpq $0x0, 0x10(%rdi)
je 0x776ec
movq 0x28(%r14), %rax
cmpl $0x1, (%rax)
jg 0x776ec
movq 0x9f094(%rip), %rdi     # 0x116710
callq 0x2efbb
movq %rax, %r15
movq %rax, %rdi
callq 0x2f015
testq %rax, %rax
je 0x776ca
movq 0x8(%rax), %rax
cmpq 0xb8(%r14), %rax
je 0x776c5
movq 0x80(%rax), %rdi
movq 0x10(%r14), %rcx
xorl %esi, %esi
xorl %edx, %edx
callq 0x7771c
movq %rax, %r12
testq %rax, %rax
sete %al
cmpq %r14, %r12
sete %cl
orb %al, %cl
je 0x776d4
movq %r15, %rdi
jmp 0x77687
movq %r15, %rdi
callq 0x2f0dd
jmp 0x776ec
movq 0x28(%r14), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x7759c
movq 0x28(%r12), %rax
movq %rax, 0x28(%r14)
incl (%rax)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x54d25(%rip), %rdi     # 0xcc426
leaq 0x54b48(%rip), %rsi     # 0xcc250
movl $0x3fb, %edx            # imm = 0x3FB
callq 0x61908
movl $0x1, %edi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: getSentinelRedisInstanceByAddrAndRunID
sentinelRedisInstance *getSentinelRedisInstanceByAddrAndRunID(dict *instances, char *ip, int port, char *runid) {
    dictIterator *di;
    dictEntry *de;
    sentinelRedisInstance *instance = NULL;

    serverAssert(ip || runid);   /* User must pass at least one search param. */
    di = dictGetIterator(instances);
    while((de = dictNext(di)) != NULL) {
        sentinelRedisInstance *ri = dictGetVal(de);

        if (runid && !ri->runid) continue;
        if ((runid == NULL || strcmp(ri->runid, runid) == 0) &&
            (ip == NULL || (strcmp(ri->addr->ip, ip) == 0 &&
                            ri->addr->port == port)))
        {
            instance = ri;
            break;
        }
    }
    dictReleaseIterator(di);
    return instance;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rax
orq %rcx, %rax
je 0x777ad
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
callq 0x2efbb
movq %rax, %rbx
movq %rax, %rdi
callq 0x2f015
testq %rax, %rax
je 0x77790
movq 0x8(%rax), %r12
testq %r14, %r14
je 0x7776b
movq 0x10(%r12), %rdi
testq %rdi, %rdi
je 0x7778b
movq %r14, %rsi
callq 0x268f0
testl %eax, %eax
jne 0x7778b
testq %r15, %r15
je 0x77793
movq 0x20(%r12), %r13
movq (%r13), %rdi
movq %r15, %rsi
callq 0x268f0
testl %eax, %eax
jne 0x7778b
cmpl %ebp, 0x8(%r13)
je 0x77793
movq %rbx, %rdi
jmp 0x77742
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x2f0dd
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x54d32(%rip), %rdi     # 0xcc4e6
leaq 0x54a95(%rip), %rsi     # 0xcc250
movl $0x533, %edx            # imm = 0x533
callq 0x61908
movl $0x1, %edi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelUpdateSentinelAddressInAllMasters
int sentinelUpdateSentinelAddressInAllMasters(sentinelRedisInstance *ri) {
    serverAssert(ri->flags & SRI_SENTINEL);
    dictIterator *di;
    dictEntry *de;
    int reconfigured = 0;

    di = dictGetIterator(sentinel.masters);
    while((de = dictNext(di)) != NULL) {
        sentinelRedisInstance *master = dictGetVal(de), *match;
        match = getSentinelRedisInstanceByAddrAndRunID(master->sentinels,
                                                       NULL,0,ri->runid);
        /* If there is no match, this master does not know about this
         * Sentinel, try with the next one. */
        if (match == NULL) continue;

        /* Disconnect the old links if connected. */
        if (match->link->cc != NULL)
            instanceLinkCloseConnection(match->link,match->link->cc);
        if (match->link->pc != NULL)
            instanceLinkCloseConnection(match->link,match->link->pc);

        if (match == ri) continue; /* Address already updated for it. */

        /* Update the address of the matching Sentinel by copying the address
         * of the Sentinel object that received the address update. */
        releaseSentinelAddr(match->addr);
        match->addr = dupSentinelAddr(ri->addr);
        reconfigured++;
    }
    dictReleaseIterator(di);
    if (reconfigured)
        sentinelEvent(LL_NOTICE,"+sentinel-address-update", ri,
                    "%@ %d additional matching instances", reconfigured);
    return reconfigured;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testb $0x4, (%rdi)
je 0x778f3
movq %rdi, %rbx
movq 0x9ef23(%rip), %rdi     # 0x116710
callq 0x2efbb
movq %rax, %r15
movq %rax, %rdi
callq 0x2f015
testq %rax, %rax
je 0x778d6
xorl %r14d, %r14d
movq 0x8(%rax), %rax
movq 0x80(%rax), %rdi
movq 0x10(%rbx), %rcx
xorl %esi, %esi
xorl %edx, %edx
callq 0x7771c
testq %rax, %rax
je 0x77896
movq %rax, %r12
movq 0x28(%rax), %rdi
movq 0x10(%rdi), %rsi
testq %rsi, %rsi
je 0x77840
callq 0x77559
movq 0x28(%r12), %rdi
movq 0x18(%rdi), %rsi
testq %rsi, %rsi
je 0x7784e
callq 0x77559
cmpq %rbx, %r12
je 0x77896
movq 0x20(%r12), %r13
movq (%r13), %rdi
callq 0x36330
movq %r13, %rdi
callq 0x38413
movq 0x20(%rbx), %rbp
movl $0x10, %edi
callq 0x382d1
movq %rax, %r13
movq (%rbp), %rdi
callq 0x362b0
movq %rax, (%r13)
movl 0x8(%rbp), %eax
movl %eax, 0x8(%r13)
movq %r13, 0x20(%r12)
incl %r14d
movq %r15, %rdi
callq 0x2f015
testq %rax, %rax
jne 0x77809
movq %r15, %rdi
callq 0x2f0dd
testl %r14d, %r14d
je 0x778de
leaq 0x54b84(%rip), %rsi     # 0xcc43f
leaq 0x54b96(%rip), %rcx     # 0xcc458
movl $0x2, %edi
movq %rbx, %rdx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x76a24
jmp 0x778e1
movq %r15, %rdi
callq 0x2f0dd
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x54b2c(%rip), %rdi     # 0xcc426
leaq 0x5494f(%rip), %rsi     # 0xcc250
movl $0x41f, %edx            # imm = 0x41F
callq 0x61908
movl $0x1, %edi
callq 0x263c0
// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelRedisInstanceLookupSlave
sentinelRedisInstance *sentinelRedisInstanceLookupSlave(
                sentinelRedisInstance *ri, char *ip, int port)
{
    sds key;
    sentinelRedisInstance *slave;
    char buf[NET_PEER_ID_LEN];

    serverAssert(ri->flags & SRI_MASTER);
    anetFormatAddr(buf,sizeof(buf),ip,port);
    key = sdsnew(buf);
    slave = dictFetchValue(ri->slaves,key);
    sdsfree(key);
    return slave;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
testb $0x1, (%rdi)
je 0x77c60
movl %edx, %ecx
movq %rsi, %rdx
movq %rdi, %rbx
movq %rsp, %r14
movl $0x4e, %esi
movq %r14, %rdi
callq 0x2e363
movq %r14, %rdi
callq 0x362b0
movq %rax, %r14
movq 0x88(%rbx), %rdi
movq %rax, %rsi
callq 0x2ef19
movq %rax, %rbx
movq %r14, %rdi
callq 0x36330
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
leaq 0x54868(%rip), %rdi     # 0xcc4cf
leaq 0x545e2(%rip), %rsi     # 0xcc250
movl $0x4f9, %edx            # imm = 0x4F9
callq 0x61908
movl $0x1, %edi
callq 0x263c0