// File: /workspace/github_c_makefile_star2_O2/erikdubbelboer[P]discnt/src/discnt-benchmark.c
// Function: readHandler
static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
    client c = privdata;
    void *reply = NULL;
    UNUSED(el);
    UNUSED(fd);
    UNUSED(mask);

    /* Calculate latency only for the first read event. This means that the
     * server already sent the reply and we need to parse it. Parsing overhead
     * is not part of the latency, so calculate it only once, here. */
    if (c->latency < 0) c->latency = ustime()-(c->start);

    if (redisBufferRead(c->context) != REDIS_OK) {
        fprintf(stderr,"Error: %s\n",c->context->errstr);
        exit(1);
    } else {
        while(c->pending) {
            if (redisGetReply(c->context,&reply) != REDIS_OK) {
                fprintf(stderr,"Error: %s\n",c->context->errstr);
                exit(1);
            }
            if (reply != NULL) {
                if (reply == (void*)REDIS_REPLY_ERROR) {
                    fprintf(stderr,"Unexpected error reply, exiting...\n");
                    exit(1);
                }

                freeReplyObject(reply);
                /* This is an OK for prefix commands such as auth and select.*/
                if (c->prefix_pending > 0) {
                    c->prefix_pending--;
                    c->pending--;
                    /* Discard prefix commands on first response.*/
                    if (c->prefixlen > 0) {
                        size_t j;
                        sdsrange(c->obuf, c->prefixlen, -1);
                        /* We also need to fix the pointers to the strings
                        * we need to randomize. */
                        for (j = 0; j < c->randlen; j++)
                            c->randptr[j] -= c->prefixlen;
                        c->prefixlen = 0;
                    }
                    continue;                
                }

                if (config.requests_finished < config.requests)
                    config.latency[config.requests_finished++] = c->latency;
                c->pending--;
                if (c->pending == 0) {
                    clientDone(c);
                    break;
                }
            } else {
                break;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
andq $0x0, 0x8(%rsp)
movq %rdx, %rbx
cmpq $0x0, 0x38(%rdx)
jns 0xcebc
callq 0xce74
subq 0x30(%rbx), %rax
movq %rax, 0x38(%rbx)
movq (%rbx), %rdi
callq 0xebd1
testl %eax, %eax
jne 0xd032
leaq 0x8(%rsp), %r14
pushq $-0x1
popq %rbp
cmpl $0x0, 0x40(%rbx)
je 0xd029
movq (%rbx), %rdi
movq %r14, %rsi
callq 0xed7d
testl %eax, %eax
jne 0xd032
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd029
cmpq $0x6, %rdi
je 0xd053
callq 0xd854
movl 0x44(%rbx), %eax
testl %eax, %eax
jle 0xcf51
decl %eax
movl %eax, 0x44(%rbx)
decl 0x40(%rbx)
movl 0x48(%rbx), %esi
testl %esi, %esi
jle 0xced4
movq 0x8(%rbx), %rdi
movl %ebp, %edx
callq 0x10362
movq 0x18(%rbx), %rax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0xcf4b
movslq 0x48(%rbx), %rdx
movq 0x10(%rbx), %rsi
subq %rdx, (%rsi,%rcx,8)
incq %rcx
jmp 0xcf35
andl $0x0, 0x48(%rbx)
jmp 0xced4
movl 0x364c1(%rip), %eax     # 0x43418
movl 0x364b3(%rip), %ecx     # 0x43410
cmpl %ecx, %eax
jge 0xcf7b
movslq %eax, %rdx
movq 0x38(%rbx), %rsi
movq 0x364d9(%rip), %rdi     # 0x43448
incl %eax
movl %eax, 0x364a1(%rip)     # 0x43418
movq %rsi, (%rdi,%rdx,8)
decl 0x40(%rbx)
jne 0xced4
cmpl %ecx, %eax
jne 0xcfa1
movq %rbx, %rdi
callq 0xcdd5
movq 0x36451(%rip), %rdi     # 0x433e8
callq 0xa8e0
jmp 0xd029
cmpl $0x0, 0x36484(%rip)     # 0x4342c
je 0xd00d
movq 0x36437(%rip), %rdi     # 0x433e8
movq (%rbx), %rax
movl 0x84(%rax), %esi
pushq $0x2
popq %rbp
movl %ebp, %edx
callq 0xa9a9
movq 0x3641d(%rip), %rdi     # 0x433e8
movq (%rbx), %rax
movl 0x84(%rax), %esi
pushq $0x1
popq %rdx
callq 0xa9a9
movq 0x36405(%rip), %rdi     # 0x433e8
movq (%rbx), %rax
movl 0x84(%rax), %esi
leaq -0x390(%rip), %rcx      # 0xcc63
movl %ebp, %edx
movq %rbx, %r8
callq 0xa8e8
andq $0x0, 0x28(%rbx)
movl 0x36428(%rip), %eax     # 0x43430
movl %eax, 0x40(%rbx)
jmp 0xd029
decl 0x363f9(%rip)           # 0x4340c
movq %rbx, %rdi
callq 0xc9c5
incl 0x363eb(%rip)           # 0x4340c
movq %rbx, %rdi
callq 0xcdd5
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x35fb7(%rip), %rax     # 0x42ff0
movq (%rax), %rdi
movq (%rbx), %rdx
addq $0x4, %rdx
leaq 0x24380(%rip), %rsi     # 0x313ca
xorl %eax, %eax
callq 0xa300
jmp 0xd06f
movq 0x35f96(%rip), %rax     # 0x42ff0
movq (%rax), %rcx
leaq 0x24371(%rip), %rdi     # 0x313d5
pushq $0x23
popq %rsi
pushq $0x1
popq %rdx
callq 0xa510
pushq $0x1
popq %rdi
callq 0xa4f0