// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/replication.c
// Function: replicationFeedMonitors
void replicationFeedMonitors(redisClient *c, list *monitors, int dictid, robj **argv, int argc) {
    listNode *ln;
    listIter li;
    int j;
    sds cmdrepr = sdsnew("+");
    robj *cmdobj;
    struct timeval tv;

    // 获取时间戳
    gettimeofday(&tv,NULL);
    cmdrepr = sdscatprintf(cmdrepr,"%ld.%06ld ",(long)tv.tv_sec,(long)tv.tv_usec);
    if (c->flags & REDIS_LUA_CLIENT) {
        cmdrepr = sdscatprintf(cmdrepr,"[%d lua] ",dictid);
    } else if (c->flags & REDIS_UNIX_SOCKET) {
        cmdrepr = sdscatprintf(cmdrepr,"[%d unix:%s] ",dictid,server.unixsocket);
    } else {
        cmdrepr = sdscatprintf(cmdrepr,"[%d %s] ",dictid,getClientPeerId(c));
    }

    // 获取命令和参数
    for (j = 0; j < argc; j++) {
        if (argv[j]->encoding == REDIS_ENCODING_INT) {
            cmdrepr = sdscatprintf(cmdrepr, "\"%ld\"", (long)argv[j]->ptr);
        } else {
            cmdrepr = sdscatrepr(cmdrepr,(char*)argv[j]->ptr,
                        sdslen(argv[j]->ptr));
        }
        if (j != argc-1)
            cmdrepr = sdscatlen(cmdrepr," ",1);
    }
    cmdrepr = sdscatlen(cmdrepr,"\r\n",2);
    cmdobj = createObject(REDIS_STRING,cmdrepr);

    // 将内容发送给所有 MONITOR 
    listRewind(monitors,&li);
    while((ln = listNext(&li))) {
        redisClient *monitor = ln->value;
        addReply(monitor,cmdobj);
    }
    decrRefCount(cmdobj);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %r15d
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, (%rsp)
movq %rdi, %r12
leaq 0x61296(%rip), %rdi     # 0x94c9b
callq 0x28486
movq %rax, %r13
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1f2f0
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
leaq 0x63dc9(%rip), %rsi     # 0x977f3
movq %r13, %rdi
xorl %eax, %eax
callq 0x28a5e
movq %rax, %r13
movl 0x90(%r12), %eax
btl $0x8, %eax
jb 0x33a64
btl $0xb, %eax
jb 0x33a79
movq %r12, %rdi
callq 0x2f4c0
leaq 0x63dbc(%rip), %rsi     # 0x97816
movq %r13, %rdi
movl %ebp, %edx
movq %rax, %rcx
jmp 0x33a93
leaq 0x63d93(%rip), %rsi     # 0x977fe
movq %r13, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x28a5e
jmp 0x33a9a
leaq 0x96528(%rip), %rax     # 0xc9fa8
movq 0x118(%rax), %rcx
leaq 0x63d7a(%rip), %rsi     # 0x97808
movq %r13, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x28a5e
testl %r15d, %r15d
jle 0x33b08
leal -0x1(%r15), %ebx
movl %r15d, %r13d
movl $0xf0, %ebp
leaq 0x6695d(%rip), %r12     # 0x9a40f
xorl %r15d, %r15d
movq (%r14,%r15,8), %rcx
movl (%rcx), %esi
andl %ebp, %esi
movq 0x8(%rcx), %rdx
cmpl $0x10, %esi
jne 0x33ad9
movq %rax, %rdi
leaq 0x63d4f(%rip), %rsi     # 0x9781f
xorl %eax, %eax
callq 0x28a5e
jmp 0x33aeb
movslq -0x8(%rdx), %rcx
movq %rax, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x29259
cmpq %r15, %rbx
je 0x33b00
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x28689
incq %r15
cmpq %r15, %r13
jne 0x33ab5
leaq 0x65c00(%rip), %rsi     # 0x9970f
movl $0x2, %edx
movq %rax, %rdi
callq 0x28689
xorl %edi, %edi
movq %rax, %rsi
callq 0x3059c
movq %rax, %r14
leaq 0x8(%rsp), %rbx
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x20637
movq %rbx, %rdi
callq 0x20654
testq %rax, %rax
je 0x33b65
leaq 0x8(%rsp), %rbx
movq 0x10(%rax), %rdi
movq %r14, %rsi
callq 0x2d97c
movq %rbx, %rdi
callq 0x20654
testq %rax, %rax
jne 0x33b4c
movq %r14, %rdi
callq 0x30b0c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq