// File: /workspace/github_c_makefile_star2_O0/zhou-yuxin[P]redis-aof-no-cow/src/redis-benchmark.c
// Function: createClient
static client createClient(char *cmd, size_t len, client from) {
    int j;
    client c = zmalloc(sizeof(struct _client));

    if (config.hostsocket == NULL) {
        c->context = redisConnectNonBlock(config.hostip,config.hostport);
    } else {
        c->context = redisConnectUnixNonBlock(config.hostsocket);
    }
    if (c->context->err) {
        fprintf(stderr,"Could not connect to Redis at ");
        if (config.hostsocket == NULL)
            fprintf(stderr,"%s:%d: %s\n",config.hostip,config.hostport,c->context->errstr);
        else
            fprintf(stderr,"%s: %s\n",config.hostsocket,c->context->errstr);
        exit(1);
    }
    /* Suppress hiredis cleanup of unused buffers for max speed. */
    c->context->reader->maxbuf = 0;

    /* Build the request buffer:
     * Queue N requests accordingly to the pipeline size, or simply clone
     * the example client buffer. */
    c->obuf = sdsempty();
    /* Prefix the request buffer with AUTH and/or SELECT commands, if applicable.
     * These commands are discarded after the first response, so if the client is
     * reused the commands will not be used again. */
    c->prefix_pending = 0;
    if (config.auth) {
        char *buf = NULL;
        int len = redisFormatCommand(&buf, "AUTH %s", config.auth);
        c->obuf = sdscatlen(c->obuf, buf, len);
        free(buf);
        c->prefix_pending++;
    }

    /* If a DB number different than zero is selected, prefix our request
     * buffer with the SELECT command, that will be discarded the first
     * time the replies are received, so if the client is reused the
     * SELECT command will not be used again. */
    if (config.dbnum != 0) {
        c->obuf = sdscatprintf(c->obuf,"*2\r\n$6\r\nSELECT\r\n$%d\r\n%s\r\n",
            (int)sdslen(config.dbnumstr),config.dbnumstr);
        c->prefix_pending++;
    }
    c->prefixlen = sdslen(c->obuf);
    /* Append the request itself. */
    if (from) {
        c->obuf = sdscatlen(c->obuf,
            from->obuf+from->prefixlen,
            sdslen(from->obuf)-from->prefixlen);
    } else {
        for (j = 0; j < config.pipeline; j++)
            c->obuf = sdscatlen(c->obuf,cmd,len);
    }

    c->written = 0;
    c->pending = config.pipeline+c->prefix_pending;
    c->randptr = NULL;
    c->randlen = 0;

    /* Find substrings in the output buffer that need to be randomized. */
    if (config.randomkeys) {
        if (from) {
            c->randlen = from->randlen;
            c->randfree = 0;
            c->randptr = zmalloc(sizeof(char*)*c->randlen);
            /* copy the offsets. */
            for (j = 0; j < (int)c->randlen; j++) {
                c->randptr[j] = c->obuf + (from->randptr[j]-from->obuf);
                /* Adjust for the different select prefix length. */
                c->randptr[j] += c->prefixlen - from->prefixlen;
            }
        } else {
            char *p = c->obuf;

            c->randlen = 0;
            c->randfree = RANDPTR_INITIAL_SIZE;
            c->randptr = zmalloc(sizeof(char*)*c->randfree);
            while ((p = strstr(p,"__rand_int__")) != NULL) {
                if (c->randfree == 0) {
                    c->randptr = zrealloc(c->randptr,sizeof(char*)*c->randlen*2);
                    c->randfree += c->randlen;
                }
                c->randptr[c->randlen++] = p;
                c->randfree--;
                p += 12; /* 12 is strlen("__rand_int__). */
            }
        }
    }
    if (config.idlemode == 0)
        aeCreateFileEvent(config.el,c->context->fd,AE_WRITABLE,writeHandler,c);
    listAddNodeTail(config.clients,c);
    config.liveclients++;
    return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x50, %edi
callq 0x10cc0
movq %rax, -0x28(%rbp)
cmpq $0x0, 0x94016(%rip)     # 0xa3430
jne 0xf43a
movq 0x93ffd(%rip), %rdi     # 0xa3420
movl 0x93fff(%rip), %esi     # 0xa3428
callq 0x13050
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
jmp 0xf450
movq 0x93fef(%rip), %rdi     # 0xa3430
callq 0x131f0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, (%rax)
je 0xf4e8
movq 0x93b91(%rip), %rax     # 0xa2ff8
movq (%rax), %rdi
leaq 0x7faf9(%rip), %rsi     # 0x8ef6a
movb $0x0, %al
callq 0xb2e0
cmpq $0x0, 0x93fb0(%rip)     # 0xa3430
jne 0xf4b4
movq 0x93b6f(%rip), %rax     # 0xa2ff8
movq (%rax), %rdi
movq 0x93f8d(%rip), %rdx     # 0xa3420
movl 0x93f8f(%rip), %ecx     # 0xa3428
movq -0x28(%rbp), %rax
movq (%rax), %r8
addq $0x4, %r8
leaq 0x7fade(%rip), %rsi     # 0x8ef89
movb $0x0, %al
callq 0xb2e0
jmp 0xf4de
movq 0x93b3d(%rip), %rax     # 0xa2ff8
movq (%rax), %rdi
movq 0x93f6b(%rip), %rdx     # 0xa3430
movq -0x28(%rbp), %rax
movq (%rax), %rcx
addq $0x4, %rcx
leaq 0x7fabd(%rip), %rsi     # 0x8ef94
movb $0x0, %al
callq 0xb2e0
movl $0x1, %edi
callq 0xb4f0
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq 0x98(%rax), %rax
movq $0x0, 0xa0(%rax)
callq 0x14ff0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x44(%rax)
cmpq $0x0, 0x93f94(%rip)     # 0xa34b8
je 0xf580
movq $0x0, -0x30(%rbp)
movq 0x93f83(%rip), %rdx     # 0xa34b8
leaq -0x30(%rbp), %rdi
leaq 0x7fa5c(%rip), %rsi     # 0x8ef9c
movb $0x0, %al
callq 0x12ad0
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x30(%rbp), %rsi
movslq -0x34(%rbp), %rdx
callq 0x15b40
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rdi
callq 0xb040
movq -0x28(%rbp), %rax
movl 0x44(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x44(%rax)
cmpl $0x0, 0x93f19(%rip)     # 0xa34a0
je 0xf5d4
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq 0x93f0c(%rip), %rdi     # 0xa34a8
callq 0xf9d0
movq -0x48(%rbp), %rdi
movl %eax, %edx
movq 0x93efa(%rip), %rcx     # 0xa34a8
leaq 0x7f9ef(%rip), %rsi     # 0x8efa4
movb $0x0, %al
callq 0x160b0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
movl 0x44(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x44(%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xf9d0
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x48(%rax)
cmpq $0x0, -0x18(%rbp)
je 0xf649
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movslq 0x48(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xf9d0
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq %rax, %rdx
movq -0x18(%rbp), %rax
movslq 0x48(%rax), %rax
subq %rax, %rdx
callq 0x15b40
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0xf688
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl 0x93e07(%rip), %eax     # 0xa3460
jge 0xf686
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x15b40
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xf650
jmp 0xf688
movq -0x28(%rbp), %rax
movq $0x0, 0x28(%rax)
movl 0x93dc6(%rip), %ecx     # 0xa3460
movq -0x28(%rbp), %rax
addl 0x44(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x18(%rax)
cmpl $0x0, 0x93d8d(%rip)     # 0xa3454
je 0xf880
cmpq $0x0, -0x18(%rbp)
je 0xf794
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
shlq $0x3, %rdi
callq 0x10cc0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x28(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpl %ecx, %eax
jge 0xf78f
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
addq %rax, %rdx
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
movl 0x48(%rax), %esi
movq -0x18(%rbp), %rax
subl 0x48(%rax), %esi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movslq %esi, %rsi
addq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xf717
jmp 0xf87e
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x28(%rbp), %rax
movq $0x8, 0x20(%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rdi
shlq $0x3, %rdi
callq 0x10cc0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rdi
leaq 0x7f598(%rip), %rsi     # 0x8ed77
callq 0xb570
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0xf87c
movq -0x28(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xf838
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rsi
shlq $0x3, %rsi
shlq %rsi
callq 0x10e30
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x28(%rbp), %rax
addq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x40(%rbp), %rdx
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x28(%rbp), %rsi
movq 0x18(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x18(%rsi)
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x20(%rax)
movq -0x40(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x40(%rbp)
jmp 0xf7d4
jmp 0xf87e
jmp 0xf880
cmpl $0x0, 0x93c15(%rip)     # 0xa349c
jne 0xf8b2
movq 0x93b88(%rip), %rdi     # 0xa3418
movq -0x28(%rbp), %rax
movq (%rax), %rax
movl 0x84(%rax), %esi
movq -0x28(%rbp), %r8
movl $0x2, %edx
leaq 0x1b3(%rip), %rcx       # 0xfa60
callq 0xbaf0
movq 0x93bcf(%rip), %rdi     # 0xa3488
movq -0x28(%rbp), %rsi
callq 0x10600
movl 0x93b74(%rip), %eax     # 0xa343c
addl $0x1, %eax
movl %eax, 0x93b6b(%rip)     # 0xa343c
movq -0x28(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)