// File: /workspace/github_c_makefile_star2_O2/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, %r14d
movq %rcx, %r15
movl %edx, %ebp
movq %rsi, (%rsp)
movq %rdi, %r12
leaq 0x593cc(%rip), %rdi     # 0x8ac5b
callq 0x271cd
movq %rax, %r13
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1f2f0
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
leaq 0x5bf03(%rip), %rsi     # 0x8d7b7
movq %r13, %rdi
xorl %eax, %eax
callq 0x2763d
movq %rax, %r13
movl 0x90(%r12), %eax
btl $0x8, %eax
jb 0x318ee
btl $0xb, %eax
jb 0x31903
movq %r12, %rdi
callq 0x2d9c6
leaq 0x5bef6(%rip), %rsi     # 0x8d7da
movq %r13, %rdi
movl %ebp, %edx
movq %rax, %rcx
jmp 0x3191d
leaq 0x5becd(%rip), %rsi     # 0x8d7c2
movq %r13, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2763d
jmp 0x31924
leaq 0x9569e(%rip), %rax     # 0xc6fa8
movq 0x118(%rax), %rcx
leaq 0x5beb4(%rip), %rsi     # 0x8d7cc
movq %r13, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2763d
leal -0x1(%r14), %ebx
xorl %ecx, %ecx
testl %r14d, %r14d
cmovlel %ecx, %r14d
movl $0xf0, %r12d
pushq $0x1
popq %rbp
xorl %r13d, %r13d
cmpq %r13, %r14
je 0x31995
movq (%r15,%r13,8), %rcx
movl (%rcx), %esi
andl %r12d, %esi
movq 0x8(%rcx), %rdx
cmpl $0x10, %esi
jne 0x31967
movq %rax, %rdi
leaq 0x5be85(%rip), %rsi     # 0x8d7e3
xorl %eax, %eax
callq 0x2763d
jmp 0x31979
movslq -0x8(%rdx), %rcx
movq %rax, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x27d51
cmpq %r13, %rbx
je 0x31990
movq %rax, %rdi
leaq 0x5ea4b(%rip), %rsi     # 0x903d3
movq %rbp, %rdx
callq 0x2736d
incq %r13
jmp 0x3193d
leaq 0x5dd37(%rip), %rsi     # 0x8f6d3
pushq $0x2
popq %rdx
movq %rax, %rdi
callq 0x2736d
xorl %edi, %edi
movq %rax, %rsi
callq 0x2e9b4
movq %rax, %r14
leaq 0x18(%rsp), %r15
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x1ffac
movq %r15, %rdi
callq 0x1ffc6
testq %rax, %rax
je 0x319e0
movq 0x10(%rax), %rdi
movq %r14, %rsi
callq 0x2c10d
jmp 0x319c5
movq %r14, %rdi
callq 0x2ee1f
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq