// File: /workspace/github_c_makefile_star2_O2/nilyang[P]redis-tdd-annotation/src/networking.c
// Function: catClientInfoString
sds catClientInfoString(sds s, redisClient *client) {
    char flags[16], events[3], *p;
    int emask;

    p = flags;
    if (client->flags & REDIS_SLAVE) {
        if (client->flags & REDIS_MONITOR)
            *p++ = 'O';
        else
            *p++ = 'S';
    }
    if (client->flags & REDIS_MASTER) *p++ = 'M';
    if (client->flags & REDIS_MULTI) *p++ = 'x';
    if (client->flags & REDIS_BLOCKED) *p++ = 'b';
    if (client->flags & REDIS_DIRTY_CAS) *p++ = 'd';
    if (client->flags & REDIS_CLOSE_AFTER_REPLY) *p++ = 'c';
    if (client->flags & REDIS_UNBLOCKED) *p++ = 'u';
    if (client->flags & REDIS_CLOSE_ASAP) *p++ = 'A';
    if (client->flags & REDIS_UNIX_SOCKET) *p++ = 'U';
    if (client->flags & REDIS_READONLY) *p++ = 'r';
    if (p == flags) *p++ = 'N';
    *p++ = '\0';

    emask = client->fd == -1 ? 0 : aeGetFileEvents(server.el,client->fd);
    p = events;
    if (emask & AE_READABLE) *p++ = 'r';
    if (emask & AE_WRITABLE) *p++ = 'w';
    *p = '\0';
    return sdscatfmt(s,
        "addr=%s fd=%i name=%s age=%I idle=%I flags=%s db=%i sub=%i psub=%i multi=%i qbuf=%U qbuf-free=%U obl=%U oll=%U omem=%U events=%s cmd=%s",
        getClientPeerId(client),
        client->fd,
        client->name ? (char*)client->name->ptr : "",
        (long long)(server.unixtime - client->ctime),
        (long long)(server.unixtime - client->lastinteraction),
        flags,
        client->db->id,
        (int) dictSize(client->pubsub_channels),
        (int) listLength(client->pubsub_patterns),
        (client->flags & REDIS_MULTI) ? client->mstate.count : -1,
        (unsigned long long) sdslen(client->querybuf),
        (unsigned long long) sdsavail(client->querybuf),
        (unsigned long long) client->bufpos,
        (unsigned long long) listLength(client->reply),
        (unsigned long long) getClientOutputBufferMemoryUsage(client),
        events,
        client->lastcmd ? client->lastcmd->name : "NULL");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, 0x40(%rsp)
movl 0x90(%rsi), %ecx
testb $0x1, %cl
jne 0x2d64b
leaq 0x10(%rsp), %rax
jmp 0x2d661
leaq 0x11(%rsp), %rax
testb $0x4, %cl
jne 0x2d65c
movb $0x53, 0x10(%rsp)
jmp 0x2d661
movb $0x4f, 0x10(%rsp)
testb $0x2, %cl
je 0x2d66c
movb $0x4d, (%rax)
incq %rax
testb $0x8, %cl
je 0x2d67e
movb $0x78, (%rax)
incq %rax
movl 0x90(%r14), %ecx
testb $0x10, %cl
je 0x2d690
movb $0x62, (%rax)
incq %rax
movl 0x90(%r14), %ecx
testb $0x20, %cl
je 0x2d6a2
movb $0x64, (%rax)
incq %rax
movl 0x90(%r14), %ecx
testb $0x40, %cl
je 0x2d6b4
movb $0x63, (%rax)
incq %rax
movl 0x90(%r14), %ecx
testb %cl, %cl
jns 0x2d6c5
movb $0x75, (%rax)
incq %rax
movl 0x90(%r14), %ecx
btl $0xa, %ecx
jae 0x2d6d8
movb $0x41, (%rax)
incq %rax
movl 0x90(%r14), %ecx
btl $0xb, %ecx
jae 0x2d6eb
movb $0x55, (%rax)
incq %rax
movl 0x90(%r14), %ecx
btl $0x11, %ecx
jae 0x2d6f7
movb $0x72, (%rax)
incq %rax
leaq 0x10(%rsp), %rcx
cmpq %rcx, %rax
jne 0x2d707
movb $0x4e, (%rax)
incq %rax
movb $0x0, (%rax)
movl (%r14), %esi
cmpl $-0x1, %esi
je 0x2d72d
leaq 0x9988f(%rip), %rax     # 0xc6fa8
movq 0x28(%rax), %rdi
callq 0x20487
testb $0x1, %al
jne 0x2d734
leaq 0xd(%rsp), %rcx
jmp 0x2d73d
leaq 0xd(%rsp), %rcx
jmp 0x2d747
leaq 0xe(%rsp), %rcx
movb $0x72, -0x1(%rcx)
testb $0x2, %al
je 0x2d747
movb $0x77, (%rcx)
incq %rcx
movb $0x0, (%rcx)
movq %r14, %rdi
callq 0x2d9c6
movq 0x18(%r14), %rcx
testq %rcx, %rcx
je 0x2d761
movq 0x8(%rcx), %r8
jmp 0x2d768
leaq 0x5fba9(%rip), %r8      # 0x8d311
leaq 0x99839(%rip), %rdx     # 0xc6fa8
movq 0x8(%r14), %rdi
movq 0x158(%r14), %r10
movq 0x160(%r14), %r11
testb $0x8, 0x90(%r14)
jne 0x2d790
pushq $-0x1
popq %rcx
jmp 0x2d797
movl 0x108(%r14), %ecx
movq %rcx, 0x20(%rsp)
movl (%r14), %ecx
movq 0x798(%rdx), %r9
movq 0x78(%r14), %rdx
movq 0x80(%r14), %rsi
movl 0x30(%rdi), %edi
movq %rdi, 0x38(%rsp)
movq 0x28(%r10), %rdi
movq 0x48(%r10), %r12
movq 0x28(%r11), %r10
movq %r10, 0x30(%rsp)
movq 0x20(%r14), %r10
movq 0x48(%r14), %r11
movslq -0x8(%r10), %rbx
movq %rbx, 0x28(%rsp)
movslq -0x4(%r10), %rbx
movslq 0x170(%r14), %r15
movq 0x60(%r14), %r10
movq 0x28(%r10), %r10
movq 0x68(%r14), %r14
testq %r11, %r11
je 0x2d7fc
movq (%r11), %r11
jmp 0x2d803
leaq 0x61abd(%rip), %r11     # 0x8f2c0
imulq $0x28, %r10, %r13
addq %r14, %r13
addl %edi, %r12d
movq %r9, %r14
subq %rsi, %r14
subq %rdx, %r9
subq $0x8, %rsp
leaq 0x15(%rsp), %rbp
leaq 0x5f845(%rip), %rsi     # 0x8d06b
movq 0x48(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
pushq %r11
pushq %rbp
pushq %r13
pushq %r10
pushq %r15
pushq %rbx
pushq 0x60(%rsp)
pushq 0x60(%rsp)
pushq 0x78(%rsp)
pushq %r12
pushq 0x90(%rsp)
leaq 0x70(%rsp), %r10
pushq %r10
pushq %r14
callq 0x276c1
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq