// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq $0x0, (%rsp)
cmpq $0x0, 0x38(%rdx)
jns 0x11205
leaq 0x8(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0xa1f0
imulq $0xf4240, (%r14), %rax  # imm = 0xF4240
addq 0x8(%r14), %rax
subq 0x30(%rbx), %rax
movq %rax, 0x38(%rbx)
movq (%rbx), %rdi
callq 0x13200
testl %eax, %eax
jne 0x113a3
cmpl $0x0, 0x40(%rbx)
je 0x112d8
movq %rsp, %r14
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x13537
testl %eax, %eax
jne 0x11396
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x112d8
cmpq $0x6, %rdi
je 0x1139e
callq 0x11c34
movl 0x44(%rbx), %eax
testl %eax, %eax
jle 0x112a0
decl %eax
movl %eax, 0x44(%rbx)
decl 0x40(%rbx)
movl 0x48(%rbx), %esi
testl %esi, %esi
jle 0x112ce
movq 0x8(%rbx), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1544a
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x11297
movslq 0x48(%rbx), %rcx
negq %rcx
xorl %edx, %edx
movq 0x10(%rbx), %rsi
addq %rcx, (%rsi,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x11287
movl $0x0, 0x48(%rbx)
jmp 0x112ce
movslq 0x35171(%rip), %rcx     # 0x46418
movl 0x35163(%rip), %eax     # 0x46410
cmpl %eax, %ecx
jge 0x112c9
movq 0x38(%rbx), %rdx
movq 0x3518c(%rip), %rsi     # 0x46448
leal 0x1(%rcx), %edi
movl %edi, 0x35153(%rip)     # 0x46418
movq %rdx, (%rsi,%rcx,8)
decl 0x40(%rbx)
je 0x112e0
cmpl $0x0, 0x40(%rbx)
jne 0x11222
addq $0x18, %rsp
popq %rbx
popq %r14
retq
cmpl %eax, 0x35132(%rip)     # 0x46418
jne 0x112fe
movq %rbx, %rdi
callq 0x11127
movq 0x350f1(%rip), %rdi     # 0x463e8
callq 0xe87b
jmp 0x112d8
cmpl $0x0, 0x35127(%rip)     # 0x4642c
je 0x11375
movq 0x350da(%rip), %rdi     # 0x463e8
movq (%rbx), %rax
movl 0x84(%rax), %esi
movl $0x2, %edx
callq 0xe949
movq 0x350c0(%rip), %rdi     # 0x463e8
movq (%rbx), %rax
movl 0x84(%rax), %esi
movl $0x1, %edx
callq 0xe949
movq 0x350a6(%rip), %rdi     # 0x463e8
movq (%rbx), %rax
movl 0x84(%rax), %esi
leaq -0x459(%rip), %rcx      # 0x10ef9
movl $0x2, %edx
movq %rbx, %r8
callq 0xe883
movq $0x0, 0x28(%rbx)
movl 0x350c3(%rip), %eax     # 0x46430
movl %eax, 0x40(%rbx)
jmp 0x112d8
decl 0x35091(%rip)           # 0x4640c
movq %rbx, %rdi
callq 0x10bfb
incl 0x35083(%rip)           # 0x4640c
movq %rbx, %rdi
callq 0x11127
jmp 0x112d8
movq %rbx, %rdi
callq 0xa6f8
callq 0xa723
movq %rbx, %rdi
callq 0xa6cd