// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: rewriteConfigSentinelOption
void rewriteConfigSentinelOption(struct rewriteConfigState *state) {
    dictIterator *di, *di2;
    dictEntry *de;
    sds line;

    /* sentinel unique ID. */
    line = sdscatprintf(sdsempty(), "sentinel myid %s", sentinel.myid);
    rewriteConfigRewriteLine(state,"sentinel",line,1);

    /* For every master emit a "sentinel monitor" config entry. */
    di = dictGetIterator(sentinel.masters);
    while((de = dictNext(di)) != NULL) {
        sentinelRedisInstance *master, *ri;
        sentinelAddr *master_addr;

        /* sentinel monitor */
        master = dictGetVal(de);
        master_addr = sentinelGetCurrentMasterAddress(master);
        line = sdscatprintf(sdsempty(),"sentinel monitor %s %s %d %d",
            master->name, master_addr->ip, master_addr->port,
            master->quorum);
        rewriteConfigRewriteLine(state,"sentinel",line,1);

        /* sentinel down-after-milliseconds */
        if (master->down_after_period != SENTINEL_DEFAULT_DOWN_AFTER) {
            line = sdscatprintf(sdsempty(),
                "sentinel down-after-milliseconds %s %ld",
                master->name, (long) master->down_after_period);
            rewriteConfigRewriteLine(state,"sentinel",line,1);
        }

        /* sentinel failover-timeout */
        if (master->failover_timeout != SENTINEL_DEFAULT_FAILOVER_TIMEOUT) {
            line = sdscatprintf(sdsempty(),
                "sentinel failover-timeout %s %ld",
                master->name, (long) master->failover_timeout);
            rewriteConfigRewriteLine(state,"sentinel",line,1);
        }

        /* sentinel parallel-syncs */
        if (master->parallel_syncs != SENTINEL_DEFAULT_PARALLEL_SYNCS) {
            line = sdscatprintf(sdsempty(),
                "sentinel parallel-syncs %s %d",
                master->name, master->parallel_syncs);
            rewriteConfigRewriteLine(state,"sentinel",line,1);
        }

        /* sentinel notification-script */
        if (master->notification_script) {
            line = sdscatprintf(sdsempty(),
                "sentinel notification-script %s %s",
                master->name, master->notification_script);
            rewriteConfigRewriteLine(state,"sentinel",line,1);
        }

        /* sentinel client-reconfig-script */
        if (master->client_reconfig_script) {
            line = sdscatprintf(sdsempty(),
                "sentinel client-reconfig-script %s %s",
                master->name, master->client_reconfig_script);
            rewriteConfigRewriteLine(state,"sentinel",line,1);
        }

        /* sentinel auth-pass */
        if (master->auth_pass) {
            line = sdscatprintf(sdsempty(),
                "sentinel auth-pass %s %s",
                master->name, master->auth_pass);
            rewriteConfigRewriteLine(state,"sentinel",line,1);
        }

        /* sentinel config-epoch */
        line = sdscatprintf(sdsempty(),
            "sentinel config-epoch %s %llu",
            master->name, (unsigned long long) master->config_epoch);
        rewriteConfigRewriteLine(state,"sentinel",line,1);

        /* sentinel leader-epoch */
        line = sdscatprintf(sdsempty(),
            "sentinel leader-epoch %s %llu",
            master->name, (unsigned long long) master->leader_epoch);
        rewriteConfigRewriteLine(state,"sentinel",line,1);

        /* sentinel known-slave */
        di2 = dictGetIterator(master->slaves);
        while((de = dictNext(di2)) != NULL) {
            sentinelAddr *slave_addr;

            ri = dictGetVal(de);
            slave_addr = ri->addr;

            /* If master_addr (obtained using sentinelGetCurrentMasterAddress()
             * so it may be the address of the promoted slave) is equal to this
             * slave's address, a failover is in progress and the slave was
             * already successfully promoted. So as the address of this slave
             * we use the old master address instead. */
            if (sentinelAddrIsEqual(slave_addr,master_addr))
                slave_addr = master->addr;
            line = sdscatprintf(sdsempty(),
                "sentinel known-slave %s %s %d",
                master->name, slave_addr->ip, slave_addr->port);
            rewriteConfigRewriteLine(state,"sentinel",line,1);
        }
        dictReleaseIterator(di2);

        /* sentinel known-sentinel */
        di2 = dictGetIterator(master->sentinels);
        while((de = dictNext(di2)) != NULL) {
            ri = dictGetVal(de);
            if (ri->runid == NULL) continue;
            line = sdscatprintf(sdsempty(),
                "sentinel known-sentinel %s %s %d %s",
                master->name, ri->addr->ip, ri->addr->port, ri->runid);
            rewriteConfigRewriteLine(state,"sentinel",line,1);
        }
        dictReleaseIterator(di2);
    }

    /* sentinel current-epoch is a global state valid for all the masters. */
    line = sdscatprintf(sdsempty(),
        "sentinel current-epoch %llu", (unsigned long long) sentinel.current_epoch);
    rewriteConfigRewriteLine(state,"sentinel",line,1);

    /* sentinel announce-ip. */
    if (sentinel.announce_ip) {
        line = sdsnew("sentinel announce-ip ");
        line = sdscatrepr(line, sentinel.announce_ip, sdslen(sentinel.announce_ip));
        rewriteConfigRewriteLine(state,"sentinel",line,1);
    }

    /* sentinel announce-port. */
    if (sentinel.announce_port) {
        line = sdscatprintf(sdsempty(),"sentinel announce-port %d",
                            sentinel.announce_port);
        rewriteConfigRewriteLine(state,"sentinel",line,1);
    }

    dictReleaseIterator(di);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
callq 0x384f0
movq %rax, %rdi
leaq 0xaef31(%rip), %rsi     # 0x14647c
leaq 0xf5ab6(%rip), %rdx     # 0x18d008
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaf366(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
movq 0xf5ac3(%rip), %rdi     # 0x18d040
callq 0x2e400
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x979f0
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x96bc0
movq %rax, -0x40(%rbp)
callq 0x384f0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x40(%rbp), %rax
movq (%rax), %rcx
movq -0x40(%rbp), %rax
movl 0x8(%rax), %r8d
movq -0x30(%rbp), %rax
movl 0x90(%rax), %r9d
leaq 0xaeea6(%rip), %rsi     # 0x14648d
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaf2d1(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
movq -0x30(%rbp), %rax
cmpq $0x7530, 0x58(%rax)     # imm = 0x7530
je 0x9765c
callq 0x384f0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x58(%rax), %rcx
leaq 0xaee72(%rip), %rsi     # 0x1464aa
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaf280(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
movq -0x30(%rbp), %rax
cmpq $0x2bf20, 0x108(%rax) # imm = 0x2BF20
je 0x976b3
callq 0x384f0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x108(%rax), %rcx
leaq 0xaee43(%rip), %rsi     # 0x1464d2
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaf229(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
movq -0x30(%rbp), %rax
cmpl $0x1, 0x94(%rax)
je 0x97705
callq 0x384f0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movl 0x94(%rax), %ecx
leaq 0xaee12(%rip), %rsi     # 0x1464f3
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaf1d7(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
movq -0x30(%rbp), %rax
cmpq $0x0, 0x120(%rax)
je 0x97759
callq 0x384f0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rcx
leaq 0xaeddc(%rip), %rsi     # 0x146511
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaf183(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
movq -0x30(%rbp), %rax
cmpq $0x0, 0x128(%rax)
je 0x977ad
callq 0x384f0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x128(%rax), %rcx
leaq 0xaedab(%rip), %rsi     # 0x146534
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaf12f(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
movq -0x30(%rbp), %rax
cmpq $0x0, 0x98(%rax)
je 0x97801
callq 0x384f0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x98(%rax), %rcx
leaq 0xaed7d(%rip), %rsi     # 0x14655a
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaf0db(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
callq 0x384f0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0xaed53(%rip), %rsi     # 0x146573
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaf098(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
callq 0x384f0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0xe0(%rax), %rcx
leaq 0xaed2b(%rip), %rsi     # 0x146591
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaf052(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
movq -0x30(%rbp), %rax
movq 0x88(%rax), %rdi
callq 0x2e400
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x9793a
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x94930
cmpl $0x0, %eax
je 0x978eb
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
callq 0x384f0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x48(%rbp), %rax
movq (%rax), %rcx
movq -0x48(%rbp), %rax
movl 0x8(%rax), %r8d
leaq 0xaec9e(%rip), %rsi     # 0x1465af
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaefa7(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
jmp 0x9789e
movq -0x18(%rbp), %rdi
callq 0x2e600
movq -0x30(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0x2e400
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2e4a0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x979e2
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x97983
jmp 0x97957
callq 0x384f0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rcx
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x8(%rax), %r8d
movq -0x38(%rbp), %rax
movq 0x10(%rax), %r9
leaq 0xaec14(%rip), %rsi     # 0x1465cd
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaeeff(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
jmp 0x97957
movq -0x18(%rbp), %rdi
callq 0x2e600
jmp 0x97586
callq 0x384f0
movq %rax, %rdi
movq 0xf5639(%rip), %rdx     # 0x18d038
leaq 0xaebeb(%rip), %rsi     # 0x1465f1
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaeeb2(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
cmpq $0x0, 0xf5636(%rip)     # 0x18d068
je 0x97a90
leaq 0xaebd2(%rip), %rdi     # 0x14660d
callq 0x38510
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq 0xf5615(%rip), %rax     # 0x18d068
movq %rax, -0x50(%rbp)
movq 0xf560a(%rip), %rdi     # 0x18d068
callq 0x97af0
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq %rax, %rdx
callq 0x3a2c0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaee4c(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
cmpl $0x0, 0xf55d9(%rip)     # 0x18d070
je 0x97ad2
callq 0x384f0
movq %rax, %rdi
movl 0xf55c9(%rip), %edx     # 0x18d070
leaq 0xaeb75(%rip), %rsi     # 0x146623
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xaee0a(%rip), %rsi     # 0x1468d2
movl $0x1, %ecx
callq 0x6ea90
movq -0x10(%rbp), %rdi
callq 0x2e600
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)