// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
leaq 0x9f7ee(%rip), %rdi     # 0xdecc3
callq 0x2c0e0
movq %rax, -0x50(%rbp)
leaq -0x68(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1f300
movq -0x50(%rbp), %rdi
movq -0x68(%rbp), %rdx
movq -0x60(%rbp), %rcx
leaq 0xa23c1(%rip), %rsi     # 0xe18bf
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movl 0x90(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x3f538
movq -0x50(%rbp), %rdi
movl -0x14(%rbp), %edx
leaq 0xa239f(%rip), %rsi     # 0xe18ca
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x50(%rbp)
jmp 0x3f5aa
movq -0x8(%rbp), %rax
movl 0x90(%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x3f575
movq -0x50(%rbp), %rdi
movl -0x14(%rbp), %edx
leaq 0xd439e(%rip), %rax     # 0x1138f8
movq 0x118(%rax), %rcx
leaq 0xa236c(%rip), %rsi     # 0xe18d4
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x50(%rbp)
jmp 0x3f5a8
movq -0x50(%rbp), %rax
movq %rax, -0x80(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x74(%rbp)
movq -0x8(%rbp), %rdi
callq 0x38330
movq -0x80(%rbp), %rdi
movl -0x74(%rbp), %edx
movq %rax, %rcx
leaq 0xa2345(%rip), %rsi     # 0xe18e2
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x50(%rbp)
jmp 0x3f5aa
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x3f685
movq -0x20(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x1, %eax
jne 0x3f5fe
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdx
leaq 0xa22fa(%rip), %rsi     # 0xe18eb
movb $0x0, %al
callq 0x2cad0
movq %rax, -0x50(%rbp)
jmp 0x3f64f
movq -0x50(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x20(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x20(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
callq 0x3ed00
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq %rax, %rdx
callq 0x2d820
movq %rax, -0x50(%rbp)
movl -0x44(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0x3f675
movq -0x50(%rbp), %rdi
leaq 0xa4e77(%rip), %rsi     # 0xe44de
movl $0x1, %edx
callq 0x2c500
movq %rax, -0x50(%rbp)
jmp 0x3f677
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3f5b1
movq -0x50(%rbp), %rdi
leaq 0xa414e(%rip), %rsi     # 0xe37de
movl $0x2, %edx
callq 0x2c500
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rsi
xorl %edi, %edi
callq 0x3a0d0
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x202b0
leaq -0x40(%rbp), %rdi
callq 0x20310
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x3f6e8
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x35a70
jmp 0x3f6ba
movq -0x58(%rbp), %rdi
callq 0x3aaa0
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)