// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelHandleConfiguration
char *sentinelHandleConfiguration(char **argv, int argc) {
    sentinelRedisInstance *ri;

    if (!strcasecmp(argv[0],"monitor") && argc == 5) {
        /* monitor <name> <host> <port> <quorum> */
        int quorum = atoi(argv[4]);

        if (quorum <= 0) return "Quorum must be 1 or greater.";
        if (createSentinelRedisInstance(argv[1],SRI_MASTER,argv[2],
                                        atoi(argv[3]),quorum,NULL) == NULL)
        {
            switch(errno) {
            case EBUSY: return "Duplicated master name.";
            case ENOENT: return "Can't resolve master instance hostname.";
            case EINVAL: return "Invalid port number";
            }
        }
    } else if (!strcasecmp(argv[0],"down-after-milliseconds") && argc == 3) {
        /* down-after-milliseconds <name> <milliseconds> */
        ri = sentinelGetMasterByName(argv[1]);
        if (!ri) return "No such master with specified name.";
        ri->down_after_period = atoi(argv[2]);
        if (ri->down_after_period <= 0)
            return "negative or zero time parameter.";
        sentinelPropagateDownAfterPeriod(ri);
    } else if (!strcasecmp(argv[0],"failover-timeout") && argc == 3) {
        /* failover-timeout <name> <milliseconds> */
        ri = sentinelGetMasterByName(argv[1]);
        if (!ri) return "No such master with specified name.";
        ri->failover_timeout = atoi(argv[2]);
        if (ri->failover_timeout <= 0)
            return "negative or zero time parameter.";
   } else if (!strcasecmp(argv[0],"parallel-syncs") && argc == 3) {
        /* parallel-syncs <name> <milliseconds> */
        ri = sentinelGetMasterByName(argv[1]);
        if (!ri) return "No such master with specified name.";
        ri->parallel_syncs = atoi(argv[2]);
   } else if (!strcasecmp(argv[0],"notification-script") && argc == 3) {
        /* notification-script <name> <path> */
        ri = sentinelGetMasterByName(argv[1]);
        if (!ri) return "No such master with specified name.";
        if (access(argv[2],X_OK) == -1)
            return "Notification script seems non existing or non executable.";
        ri->notification_script = sdsnew(argv[2]);
   } else if (!strcasecmp(argv[0],"client-reconfig-script") && argc == 3) {
        /* client-reconfig-script <name> <path> */
        ri = sentinelGetMasterByName(argv[1]);
        if (!ri) return "No such master with specified name.";
        if (access(argv[2],X_OK) == -1)
            return "Client reconfiguration script seems non existing or "
                   "non executable.";
        ri->client_reconfig_script = sdsnew(argv[2]);
   } else if (!strcasecmp(argv[0],"auth-pass") && argc == 3) {
        /* auth-pass <name> <password> */
        ri = sentinelGetMasterByName(argv[1]);
        if (!ri) return "No such master with specified name.";
        ri->auth_pass = sdsnew(argv[2]);
    } else if (!strcasecmp(argv[0],"current-epoch") && argc == 2) {
        /* current-epoch <epoch> */
        unsigned long long current_epoch = strtoull(argv[1],NULL,10);
        if (current_epoch > sentinel.current_epoch)
            sentinel.current_epoch = current_epoch;
    } else if (!strcasecmp(argv[0],"myid") && argc == 2) {
        if (strlen(argv[1]) != CONFIG_RUN_ID_SIZE)
            return "Malformed Sentinel id in myid option.";
        memcpy(sentinel.myid,argv[1],CONFIG_RUN_ID_SIZE);
    } else if (!strcasecmp(argv[0],"config-epoch") && argc == 3) {
        /* config-epoch <name> <epoch> */
        ri = sentinelGetMasterByName(argv[1]);
        if (!ri) return "No such master with specified name.";
        ri->config_epoch = strtoull(argv[2],NULL,10);
        /* The following update of current_epoch is not really useful as
         * now the current epoch is persisted on the config file, but
         * we leave this check here for redundancy. */
        if (ri->config_epoch > sentinel.current_epoch)
            sentinel.current_epoch = ri->config_epoch;
    } else if (!strcasecmp(argv[0],"leader-epoch") && argc == 3) {
        /* leader-epoch <name> <epoch> */
        ri = sentinelGetMasterByName(argv[1]);
        if (!ri) return "No such master with specified name.";
        ri->leader_epoch = strtoull(argv[2],NULL,10);
    } else if (!strcasecmp(argv[0],"known-slave") && argc == 4) {
        sentinelRedisInstance *slave;

        /* known-slave <name> <ip> <port> */
        ri = sentinelGetMasterByName(argv[1]);
        if (!ri) return "No such master with specified name.";
        if ((slave = createSentinelRedisInstance(NULL,SRI_SLAVE,argv[2],
                    atoi(argv[3]), ri->quorum, ri)) == NULL)
        {
            return "Wrong hostname or port for slave.";
        }
    } else if (!strcasecmp(argv[0],"known-sentinel") &&
               (argc == 4 || argc == 5)) {
        sentinelRedisInstance *si;

        if (argc == 5) { /* Ignore the old form without runid. */
            /* known-sentinel <name> <ip> <port> [runid] */
            ri = sentinelGetMasterByName(argv[1]);
            if (!ri) return "No such master with specified name.";
            if ((si = createSentinelRedisInstance(argv[4],SRI_SENTINEL,argv[2],
                        atoi(argv[3]), ri->quorum, ri)) == NULL)
            {
                return "Wrong hostname or port for sentinel.";
            }
            si->runid = sdsnew(argv[4]);
            sentinelTryConnectionSharing(si);
        }
    } else if (!strcasecmp(argv[0],"announce-ip") && argc == 2) {
        /* announce-ip <ip-address> */
        if (strlen(argv[1]))
            sentinel.announce_ip = sdsnew(argv[1]);
    } else if (!strcasecmp(argv[0],"announce-port") && argc == 2) {
        /* announce-port <port> */
        sentinel.announce_port = atoi(argv[1]);
    } else {
        return "Unrecognized sentinel configuration statement.";
    }
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %r14
leaq 0x5409b(%rip), %rsi     # 0xcc2fc
movq %r14, %rdi
callq 0x262f0
cmpl $0x5, %ebp
jne 0x782e5
testl %eax, %eax
jne 0x782e5
movq 0x20(%rbx), %rdi
callq 0x26760
testl %eax, %eax
jle 0x78385
movl %eax, %ebp
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %r15
movq 0x18(%rbx), %rdi
callq 0x26760
movq %r14, %rdi
movl $0x1, %esi
movq %r15, %rdx
movl %eax, %ecx
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x7798b
testq %rax, %rax
jne 0x7877f
callq 0x26880
movl (%rax), %eax
cmpl $0x16, %eax
je 0x78491
cmpl $0x10, %eax
je 0x78485
cmpl $0x2, %eax
jne 0x7877f
leaq 0x5425f(%rip), %rax     # 0xcc53f
jmp 0x78781
leaq 0x5428f(%rip), %rsi     # 0xcc57b
movq %r14, %rdi
callq 0x262f0
cmpl $0x3, %ebp
jne 0x78332
testl %eax, %eax
jne 0x78332
movq 0x8(%rbx), %rdi
callq 0x77d01
testq %rax, %rax
je 0x78717
movq %rax, %r14
movq 0x10(%rbx), %rdi
callq 0x26760
cltq
movq %rax, 0x58(%r14)
testl %eax, %eax
jle 0x78379
movq %r14, %rdi
callq 0x781a2
jmp 0x7877f
leaq 0x5429f(%rip), %rsi     # 0xcc5d8
movq %r14, %rdi
callq 0x262f0
cmpl $0x3, %ebp
jne 0x78391
testl %eax, %eax
jne 0x78391
movq 0x8(%rbx), %rdi
callq 0x77d01
testq %rax, %rax
je 0x78717
movq %rax, %r14
movq 0x10(%rbx), %rdi
callq 0x26760
cltq
movq %rax, 0x108(%r14)
testl %eax, %eax
jg 0x7877f
leaq 0x54237(%rip), %rax     # 0xcc5b7
jmp 0x78781
leaq 0x5417e(%rip), %rax     # 0xcc50a
jmp 0x78781
leaq 0x54251(%rip), %rsi     # 0xcc5e9
movq %r14, %rdi
callq 0x262f0
cmpl $0x3, %ebp
jne 0x783d3
testl %eax, %eax
jne 0x783d3
movq 0x8(%rbx), %rdi
callq 0x77d01
testq %rax, %rax
je 0x78717
movq %rax, %r14
movq 0x10(%rbx), %rdi
callq 0x26760
movl %eax, 0x94(%r14)
jmp 0x7877f
leaq 0x5421e(%rip), %rsi     # 0xcc5f8
movq %r14, %rdi
callq 0x262f0
cmpl $0x3, %ebp
jne 0x7842c
testl %eax, %eax
jne 0x7842c
movq 0x8(%rbx), %rdi
callq 0x77d01
testq %rax, %rax
je 0x78717
movq %rax, %r14
movq 0x10(%rbx), %rdi
movl $0x1, %esi
callq 0x26aa0
cmpl $-0x1, %eax
je 0x78520
movq 0x10(%rbx), %rdi
callq 0x362b0
movq %rax, 0x120(%r14)
jmp 0x7877f
leaq 0x54213(%rip), %rsi     # 0xcc646
movq %r14, %rdi
callq 0x262f0
cmpl $0x3, %ebp
jne 0x7849d
testl %eax, %eax
jne 0x7849d
movq 0x8(%rbx), %rdi
callq 0x77d01
testq %rax, %rax
je 0x78717
movq %rax, %r14
movq 0x10(%rbx), %rdi
movl $0x1, %esi
callq 0x26aa0
cmpl $-0x1, %eax
je 0x7857f
movq 0x10(%rbx), %rdi
callq 0x362b0
movq %rax, 0x128(%r14)
jmp 0x7877f
leaq 0x5409b(%rip), %rax     # 0xcc527
jmp 0x78781
leaq 0x540cf(%rip), %rax     # 0xcc567
jmp 0x78781
leaq 0x541fd(%rip), %rsi     # 0xcc6a1
movq %r14, %rdi
callq 0x262f0
cmpl $0x3, %ebp
jne 0x784df
testl %eax, %eax
jne 0x784df
movq 0x8(%rbx), %rdi
callq 0x77d01
testq %rax, %rax
je 0x78717
movq %rax, %r14
movq 0x10(%rbx), %rdi
callq 0x362b0
movq %rax, 0x98(%r14)
jmp 0x7877f
leaq 0x541c5(%rip), %rsi     # 0xcc6ab
movq %r14, %rdi
callq 0x262f0
cmpl $0x2, %ebp
jne 0x7852c
testl %eax, %eax
jne 0x7852c
movq 0x8(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x26a70
cmpq 0x9e1fa(%rip), %rax     # 0x116708
jbe 0x7877f
movq %rax, 0x9e1ed(%rip)     # 0x116708
jmp 0x7877f
leaq 0x540e5(%rip), %rax     # 0xcc60c
jmp 0x78781
leaq 0x5027d(%rip), %rsi     # 0xc87b0
movq %r14, %rdi
callq 0x262f0
cmpl $0x2, %ebp
jne 0x7858b
testl %eax, %eax
jne 0x7858b
movq 0x8(%rbx), %rbx
movq %rbx, %rdi
callq 0x26500
cmpq $0x28, %rax
jne 0x7861a
movq 0x20(%rbx), %rax
movq %rax, 0x9e193(%rip)     # 0x1166f8
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x9e175(%rip)    # 0x1166e8
movups %xmm0, 0x9e15e(%rip)    # 0x1166d8
jmp 0x7877f
leaq 0x540d7(%rip), %rax     # 0xcc65d
jmp 0x78781
leaq 0x50849(%rip), %rsi     # 0xc8ddb
movq %r14, %rdi
callq 0x262f0
cmpl $0x3, %ebp
jne 0x785d1
testl %eax, %eax
jne 0x785d1
movq 0x8(%rbx), %rdi
callq 0x77d01
testq %rax, %rax
je 0x78717
movq %rax, %r14
movq 0x10(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x26a70
movq %rax, 0x18(%r14)
jmp 0x78507
leaq 0x5487a(%rip), %rsi     # 0xcce52
movq %r14, %rdi
callq 0x262f0
cmpl $0x3, %ebp
jne 0x78626
testl %eax, %eax
jne 0x78626
movq 0x8(%rbx), %rdi
callq 0x77d01
testq %rax, %rax
je 0x78717
movq %rax, %r14
movq 0x10(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x26a70
movq %rax, 0xe0(%r14)
jmp 0x7877f
leaq 0x54098(%rip), %rax     # 0xcc6b9
jmp 0x78781
leaq 0x540b2(%rip), %rsi     # 0xcc6df
movq %r14, %rdi
callq 0x262f0
cmpl $0x4, %ebp
jne 0x78690
testl %eax, %eax
jne 0x78690
movq 0x8(%rbx), %rdi
callq 0x77d01
testq %rax, %rax
je 0x78717
movq %rax, %r14
movq 0x10(%rbx), %r15
movq 0x18(%rbx), %rdi
callq 0x26760
movl 0x90(%r14), %r8d
xorl %edi, %edi
movl $0x2, %esi
movq %r15, %rdx
movl %eax, %ecx
movq %r14, %r9
callq 0x7798b
testq %rax, %rax
jne 0x7877f
leaq 0x54060(%rip), %rax     # 0xcc6eb
jmp 0x78781
leaq 0x54076(%rip), %rsi     # 0xcc70d
movq %r14, %rdi
callq 0x262f0
movl %ebp, %ecx
andl $-0x2, %ecx
cmpl $0x4, %ecx
jne 0x78720
testl %eax, %eax
jne 0x78720
cmpl $0x5, %ebp
jne 0x7877f
movq 0x8(%rbx), %rdi
callq 0x77d01
testq %rax, %rax
je 0x78717
movq %rax, %r14
movq 0x20(%rbx), %r15
movq 0x10(%rbx), %r12
movq 0x18(%rbx), %rdi
callq 0x26760
movl 0x90(%r14), %r8d
movq %r15, %rdi
movl $0x4, %esi
movq %r12, %rdx
movl %eax, %ecx
movq %r14, %r9
callq 0x7798b
testq %rax, %rax
je 0x7878a
movq %rax, %r14
movq 0x20(%rbx), %rdi
callq 0x362b0
movq %rax, 0x10(%r14)
movq %r14, %rdi
callq 0x77648
jmp 0x7877f
leaq 0x53e75(%rip), %rax     # 0xcc593
jmp 0x78781
leaq 0x4c0c0(%rip), %rsi     # 0xc47e7
movq %r14, %rdi
callq 0x262f0
cmpl $0x2, %ebp
jne 0x7874f
testl %eax, %eax
jne 0x7874f
movq 0x8(%rbx), %rdi
cmpb $0x0, (%rdi)
je 0x7877f
callq 0x362b0
movq %rax, 0x9dfeb(%rip)     # 0x116738
jmp 0x7877f
leaq 0x4c0a3(%rip), %rsi     # 0xc47f9
movq %r14, %rdi
callq 0x262f0
movl %eax, %ecx
leaq 0x53fda(%rip), %rax     # 0xcc741
cmpl $0x2, %ebp
jne 0x78781
testl %ecx, %ecx
jne 0x78781
movq 0x8(%rbx), %rdi
callq 0x26760
movl %eax, 0x9dfc1(%rip)     # 0x116740
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x53f8b(%rip), %rax     # 0xcc71c
jmp 0x78781