// File: /workspace/github_c_makefile_star2_O1/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 0x616c2(%rip), %rdi     # 0x94c4b
callq 0x281da
movq %rax, %r13
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1f2f0
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
leaq 0x641d5(%rip), %rsi     # 0x97783
movq %r13, %rdi
xorl %eax, %eax
callq 0x28760
movq %rax, %r13
movl 0x90(%r12), %eax
btl $0x8, %eax
jb 0x335e8
btl $0xb, %eax
jb 0x335fd
movq %r12, %rdi
callq 0x2f1cd
leaq 0x641c8(%rip), %rsi     # 0x977a6
movq %r13, %rdi
movl %ebp, %edx
movq %rax, %rcx
jmp 0x33617
leaq 0x6419f(%rip), %rsi     # 0x9778e
movq %r13, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x28760
jmp 0x3361e
leaq 0x969a4(%rip), %rax     # 0xc9fa8
movq 0x118(%rax), %rcx
leaq 0x64186(%rip), %rsi     # 0x97798
movq %r13, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x28760
testl %r15d, %r15d
jle 0x3368c
leal -0x1(%r15), %ebx
movl %r15d, %r13d
movl $0xf0, %ebp
leaq 0x66d91(%rip), %r12     # 0x9a3c7
xorl %r15d, %r15d
movq (%r14,%r15,8), %rcx
movl (%rcx), %esi
andl %ebp, %esi
movq 0x8(%rcx), %rdx
cmpl $0x10, %esi
jne 0x3365d
movq %rax, %rdi
leaq 0x6415b(%rip), %rsi     # 0x977af
xorl %eax, %eax
callq 0x28760
jmp 0x3366f
movslq -0x8(%rdx), %rcx
movq %rax, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x28f45
cmpq %r15, %rbx
je 0x33684
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x28380
incq %r15
cmpq %r15, %r13
jne 0x33639
leaq 0x66034(%rip), %rsi     # 0x996c7
movl $0x2, %edx
movq %rax, %rdi
callq 0x28380
xorl %edi, %edi
movq %rax, %rsi
callq 0x302c4
movq %rax, %r14
leaq 0x8(%rsp), %rbx
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x205d2
movq %rbx, %rdi
callq 0x205ef
testq %rax, %rax
je 0x336e9
leaq 0x8(%rsp), %rbx
movq 0x10(%rax), %rdi
movq %r14, %rsi
callq 0x2d6f0
movq %rbx, %rdi
callq 0x205ef
testq %rax, %rax
jne 0x336d0
movq %r14, %rdi
callq 0x30834
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq