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

    /* 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, ri->addr->ip, ri->addr->port);
            rewriteConfigRewriteLine(state,"sentinel",line,1);
        }
        dictReleaseIterator(di2);

        /* sentinel known-sentinel */
        di2 = dictGetIterator(master->sentinels);
        while((de = dictNext(di2)) != NULL) {
            ri = dictGetVal(de);
            line = sdscatprintf(sdsempty(),
                "sentinel known-sentinel %s %s %d%s%s",
                master->name, ri->addr->ip, ri->addr->port,
                ri->runid ? " " : "",
                ri->runid ? 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);

    dictReleaseIterator(di);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq 0xac0ca(%rip), %rdi     # 0x128240
callq 0x241d0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x24270
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x7c655
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x7b960
movq %rax, -0x40(%rbp)
callq 0x2c0c0
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 0xd0(%rax), %r9d
leaq 0x6d09c(%rip), %rsi     # 0xe927c
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6d4a4(%rip), %rsi     # 0xe969e
movl $0x1, %ecx
callq 0x5cb20
movq -0x30(%rbp), %rax
cmpq $0x7530, 0x98(%rax) # imm = 0x7530
je 0x7c25b
callq 0x2c0c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x98(%rax), %rcx
leaq 0x6d062(%rip), %rsi     # 0xe9299
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6d44d(%rip), %rsi     # 0xe969e
movl $0x1, %ecx
callq 0x5cb20
movq -0x30(%rbp), %rax
cmpq $0x2bf20, 0x148(%rax) # imm = 0x2BF20
je 0x7c2b2
callq 0x2c0c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x148(%rax), %rcx
leaq 0x6d033(%rip), %rsi     # 0xe92c1
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6d3f6(%rip), %rsi     # 0xe969e
movl $0x1, %ecx
callq 0x5cb20
movq -0x30(%rbp), %rax
cmpl $0x1, 0xd4(%rax)
je 0x7c304
callq 0x2c0c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movl 0xd4(%rax), %ecx
leaq 0x6d002(%rip), %rsi     # 0xe92e2
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6d3a4(%rip), %rsi     # 0xe969e
movl $0x1, %ecx
callq 0x5cb20
movq -0x30(%rbp), %rax
cmpq $0x0, 0x160(%rax)
je 0x7c358
callq 0x2c0c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x160(%rax), %rcx
leaq 0x6cfcc(%rip), %rsi     # 0xe9300
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6d350(%rip), %rsi     # 0xe969e
movl $0x1, %ecx
callq 0x5cb20
movq -0x30(%rbp), %rax
cmpq $0x0, 0x168(%rax)
je 0x7c3ac
callq 0x2c0c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x168(%rax), %rcx
leaq 0x6cf9b(%rip), %rsi     # 0xe9323
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6d2fc(%rip), %rsi     # 0xe969e
movl $0x1, %ecx
callq 0x5cb20
movq -0x30(%rbp), %rax
cmpq $0x0, 0xd8(%rax)
je 0x7c400
callq 0x2c0c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0xd8(%rax), %rcx
leaq 0x6cf6d(%rip), %rsi     # 0xe9349
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6d2a8(%rip), %rsi     # 0xe969e
movl $0x1, %ecx
callq 0x5cb20
callq 0x2c0c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0x6cf43(%rip), %rsi     # 0xe9362
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6d265(%rip), %rsi     # 0xe969e
movl $0x1, %ecx
callq 0x5cb20
callq 0x2c0c0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rcx
leaq 0x6cf1b(%rip), %rsi     # 0xe9380
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6d21f(%rip), %rsi     # 0xe969e
movl $0x1, %ecx
callq 0x5cb20
movq -0x30(%rbp), %rax
movq 0xc8(%rax), %rdi
callq 0x241d0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x24270
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x7c541
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 0x79ab0
cmpl $0x0, %eax
je 0x7c4ea
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x48(%rbp)
callq 0x2c0c0
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
leaq 0x6ce86(%rip), %rsi     # 0xe939e
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6d16c(%rip), %rsi     # 0xe969e
movl $0x1, %ecx
callq 0x5cb20
jmp 0x7c49d
movq -0x18(%rbp), %rdi
callq 0x243d0
movq -0x30(%rbp), %rax
movq 0xc0(%rax), %rdi
callq 0x241d0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x24270
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x7c647
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
callq 0x2c0c0
movq %rax, -0x70(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdx
leaq 0x64e37(%rip), %rax     # 0xe13f9
leaq 0x67f15(%rip), %rcx     # 0xe44de
cmpq $0x0, %rdx
cmovneq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x7c5ee
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x7c5fb
leaq 0x64e04(%rip), %rax     # 0xe13f9
movq %rax, -0x78(%rbp)
jmp 0x7c5fb
movq -0x50(%rbp), %r9
movl -0x54(%rbp), %r8d
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rax
leaq 0x6cda2(%rip), %rsi     # 0xe93bc
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6d066(%rip), %rsi     # 0xe969e
movl $0x1, %ecx
callq 0x5cb20
jmp 0x7c55e
movq -0x18(%rbp), %rdi
callq 0x243d0
jmp 0x7c17f
callq 0x2c0c0
movq %rax, %rdi
movq 0xabbd4(%rip), %rdx     # 0x128238
leaq 0x6cd76(%rip), %rsi     # 0xe93e1
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x6d019(%rip), %rsi     # 0xe969e
movl $0x1, %ecx
callq 0x5cb20
movq -0x10(%rbp), %rdi
callq 0x243d0
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)