// File: /workspace/github_c_makefile_star2_O0/Genymobile[P]hiredis/test.c
// Function: test_reply_reader
static void test_reply_reader(void) {
    redisReader *reader;
    void *reply;
    int ret;
    int i;

    test("Error handling in reply parser: ");
    reader = redisReaderCreate();
    redisReaderFeed(reader,(char*)"@foo\r\n",6);
    ret = redisReaderGetReply(reader,NULL);
    test_cond(ret == REDIS_ERR &&
              strcasecmp(reader->errstr,"Protocol error, got \"@\" as reply type byte") == 0);
    redisReaderFree(reader);

    /* when the reply already contains multiple items, they must be free'd
     * on an error. valgrind will bark when this doesn't happen. */
    test("Memory cleanup in reply parser: ");
    reader = redisReaderCreate();
    redisReaderFeed(reader,(char*)"*2\r\n",4);
    redisReaderFeed(reader,(char*)"$5\r\nhello\r\n",11);
    redisReaderFeed(reader,(char*)"@foo\r\n",6);
    ret = redisReaderGetReply(reader,NULL);
    test_cond(ret == REDIS_ERR &&
              strcasecmp(reader->errstr,"Protocol error, got \"@\" as reply type byte") == 0);
    redisReaderFree(reader);

    test("Set error on nested multi bulks with depth > 7: ");
    reader = redisReaderCreate();

    for (i = 0; i < 9; i++) {
        redisReaderFeed(reader,(char*)"*1\r\n",4);
    }

    ret = redisReaderGetReply(reader,NULL);
    test_cond(ret == REDIS_ERR &&
              strncasecmp(reader->errstr,"No support for",14) == 0);
    redisReaderFree(reader);

    test("Works with NULL functions for reply: ");
    reader = redisReaderCreate();
    reader->fn = NULL;
    redisReaderFeed(reader,(char*)"+OK\r\n",5);
    ret = redisReaderGetReply(reader,&reply);
    test_cond(ret == REDIS_OK && reply == (void*)REDIS_REPLY_STATUS);
    redisReaderFree(reader);

    test("Works when a single newline (\\r\\n) covers two calls to feed: ");
    reader = redisReaderCreate();
    reader->fn = NULL;
    redisReaderFeed(reader,(char*)"+OK\r",4);
    ret = redisReaderGetReply(reader,&reply);
    assert(ret == REDIS_OK && reply == NULL);
    redisReaderFeed(reader,(char*)"\n",1);
    ret = redisReaderGetReply(reader,&reply);
    test_cond(ret == REDIS_OK && reply == (void*)REDIS_REPLY_STATUS);
    redisReaderFree(reader);

    test("Don't reset state after protocol error: ");
    reader = redisReaderCreate();
    reader->fn = NULL;
    redisReaderFeed(reader,(char*)"x",1);
    ret = redisReaderGetReply(reader,&reply);
    assert(ret == REDIS_ERR);
    ret = redisReaderGetReply(reader,&reply);
    test_cond(ret == REDIS_ERR && reply == NULL);
    redisReaderFree(reader);

    /* Regression test for issue #45 on GitHub. */
    test("Don't do empty allocation for empty multi bulk: ");
    reader = redisReaderCreate();
    redisReaderFeed(reader,(char*)"*0\r\n",4);
    ret = redisReaderGetReply(reader,&reply);
    test_cond(ret == REDIS_OK &&
        ((redisReply*)reply)->type == REDIS_REPLY_ARRAY &&
        ((redisReply*)reply)->elements == 0);
    freeReplyObject(reply);
    redisReaderFree(reader);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl 0xeb12(%rip), %esi      # 0x121c0
addl $0x1, %esi
movl %esi, 0xeb09(%rip)      # 0x121c0
leaq 0x9a70(%rip), %rdi      # 0xd12e
movb $0x0, %al
callq 0x20f0
leaq 0xa0a1(%rip), %rdi      # 0xd76d
movb $0x0, %al
callq 0x20f0
callq 0x6c40
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xa0a7(%rip), %rsi      # 0xd78e
movl $0x6, %edx
callq 0xa410
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa5a0
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x3730
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
leaq 0xa07f(%rip), %rsi      # 0xd795
callq 0x2040
cmpl $0x0, %eax
jne 0x3730
leaq 0x9a61(%rip), %rdi      # 0xd188
movb $0x0, %al
callq 0x20f0
jmp 0x374d
leaq 0x9a66(%rip), %rdi      # 0xd19d
movb $0x0, %al
callq 0x20f0
movl 0xea78(%rip), %eax      # 0x121bc
addl $0x1, %eax
movl %eax, 0xea6f(%rip)      # 0x121bc
movq -0x8(%rbp), %rdi
callq 0xa380
movl 0xea64(%rip), %esi      # 0x121c0
addl $0x1, %esi
movl %esi, 0xea5b(%rip)      # 0x121c0
leaq 0x99c2(%rip), %rdi      # 0xd12e
movb $0x0, %al
callq 0x20f0
leaq 0xa046(%rip), %rdi      # 0xd7c0
movb $0x0, %al
callq 0x20f0
callq 0x6c40
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xa04c(%rip), %rsi      # 0xd7e1
movl $0x4, %edx
callq 0xa410
movq -0x8(%rbp), %rdi
leaq 0xa03c(%rip), %rsi      # 0xd7e6
movl $0xb, %edx
callq 0xa410
movq -0x8(%rbp), %rdi
leaq 0x9fcf(%rip), %rsi      # 0xd78e
movl $0x6, %edx
callq 0xa410
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa5a0
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x3808
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
leaq 0x9fa7(%rip), %rsi      # 0xd795
callq 0x2040
cmpl $0x0, %eax
jne 0x3808
leaq 0x9989(%rip), %rdi      # 0xd188
movb $0x0, %al
callq 0x20f0
jmp 0x3825
leaq 0x998e(%rip), %rdi      # 0xd19d
movb $0x0, %al
callq 0x20f0
movl 0xe9a0(%rip), %eax      # 0x121bc
addl $0x1, %eax
movl %eax, 0xe997(%rip)      # 0x121bc
movq -0x8(%rbp), %rdi
callq 0xa380
movl 0xe98c(%rip), %esi      # 0x121c0
addl $0x1, %esi
movl %esi, 0xe983(%rip)      # 0x121c0
leaq 0x98ea(%rip), %rdi      # 0xd12e
movb $0x0, %al
callq 0x20f0
leaq 0x9fa0(%rip), %rdi      # 0xd7f2
movb $0x0, %al
callq 0x20f0
callq 0x6c40
movq %rax, -0x8(%rbp)
movl $0x0, -0x18(%rbp)
cmpl $0x9, -0x18(%rbp)
jge 0x388f
movq -0x8(%rbp), %rdi
leaq 0x9fa9(%rip), %rsi      # 0xd823
movl $0x4, %edx
callq 0xa410
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x3869
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa5a0
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x38d3
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
leaq 0x9f74(%rip), %rsi      # 0xd828
movl $0xe, %edx
callq 0x2200
cmpl $0x0, %eax
jne 0x38d3
leaq 0x98be(%rip), %rdi      # 0xd188
movb $0x0, %al
callq 0x20f0
jmp 0x38f0
leaq 0x98c3(%rip), %rdi      # 0xd19d
movb $0x0, %al
callq 0x20f0
movl 0xe8d5(%rip), %eax      # 0x121bc
addl $0x1, %eax
movl %eax, 0xe8cc(%rip)      # 0x121bc
movq -0x8(%rbp), %rdi
callq 0xa380
movl 0xe8c1(%rip), %esi      # 0x121c0
addl $0x1, %esi
movl %esi, 0xe8b8(%rip)      # 0x121c0
leaq 0x981f(%rip), %rdi      # 0xd12e
movb $0x0, %al
callq 0x20f0
leaq 0x9f1a(%rip), %rdi      # 0xd837
movb $0x0, %al
callq 0x20f0
callq 0x6c40
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, 0x220(%rax)
movq -0x8(%rbp), %rdi
leaq 0x9f16(%rip), %rsi      # 0xd85d
movl $0x5, %edx
callq 0xa410
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0xa5a0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x3982
movl $0x5, %eax
cmpq %rax, -0x10(%rbp)
jne 0x3982
leaq 0x980f(%rip), %rdi      # 0xd188
movb $0x0, %al
callq 0x20f0
jmp 0x399f
leaq 0x9814(%rip), %rdi      # 0xd19d
movb $0x0, %al
callq 0x20f0
movl 0xe826(%rip), %eax      # 0x121bc
addl $0x1, %eax
movl %eax, 0xe81d(%rip)      # 0x121bc
movq -0x8(%rbp), %rdi
callq 0xa380
movl 0xe812(%rip), %esi      # 0x121c0
addl $0x1, %esi
movl %esi, 0xe809(%rip)      # 0x121c0
leaq 0x9770(%rip), %rdi      # 0xd12e
movb $0x0, %al
callq 0x20f0
leaq 0x9e97(%rip), %rdi      # 0xd863
movb $0x0, %al
callq 0x20f0
callq 0x6c40
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, 0x220(%rax)
movq -0x8(%rbp), %rdi
leaq 0x9eab(%rip), %rsi      # 0xd8a1
movl $0x4, %edx
callq 0xa410
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0xa5a0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x3a1f
cmpq $0x0, -0x10(%rbp)
jne 0x3a1f
jmp 0x3a3e
leaq 0x9e80(%rip), %rdi      # 0xd8a6
leaq 0x9e9a(%rip), %rsi      # 0xd8c7
movl $0x12a, %edx            # imm = 0x12A
leaq 0x9e95(%rip), %rcx      # 0xd8ce
callq 0x2130
movq -0x8(%rbp), %rdi
leaq 0x97eb(%rip), %rsi      # 0xd234
movl $0x1, %edx
callq 0xa410
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0xa5a0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x3a84
movl $0x5, %eax
cmpq %rax, -0x10(%rbp)
jne 0x3a84
leaq 0x970d(%rip), %rdi      # 0xd188
movb $0x0, %al
callq 0x20f0
jmp 0x3aa1
leaq 0x9712(%rip), %rdi      # 0xd19d
movb $0x0, %al
callq 0x20f0
movl 0xe724(%rip), %eax      # 0x121bc
addl $0x1, %eax
movl %eax, 0xe71b(%rip)      # 0x121bc
movq -0x8(%rbp), %rdi
callq 0xa380
movl 0xe710(%rip), %esi      # 0x121c0
addl $0x1, %esi
movl %esi, 0xe707(%rip)      # 0x121c0
leaq 0x966e(%rip), %rdi      # 0xd12e
movb $0x0, %al
callq 0x20f0
leaq 0x9e1d(%rip), %rdi      # 0xd8eb
movb $0x0, %al
callq 0x20f0
callq 0x6c40
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, 0x220(%rax)
movq -0x8(%rbp), %rdi
leaq 0xad93(%rip), %rsi      # 0xe88b
movl $0x1, %edx
callq 0xa410
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0xa5a0
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x3b1a
jmp 0x3b39
leaq 0x9df3(%rip), %rdi      # 0xd914
leaq 0x9d9f(%rip), %rsi      # 0xd8c7
movl $0x135, %edx            # imm = 0x135
leaq 0x9d9a(%rip), %rcx      # 0xd8ce
callq 0x2130
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0xa5a0
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x3b66
cmpq $0x0, -0x10(%rbp)
jne 0x3b66
leaq 0x962b(%rip), %rdi      # 0xd188
movb $0x0, %al
callq 0x20f0
jmp 0x3b83
leaq 0x9630(%rip), %rdi      # 0xd19d
movb $0x0, %al
callq 0x20f0
movl 0xe642(%rip), %eax      # 0x121bc
addl $0x1, %eax
movl %eax, 0xe639(%rip)      # 0x121bc
movq -0x8(%rbp), %rdi
callq 0xa380
movl 0xe62e(%rip), %esi      # 0x121c0
addl $0x1, %esi
movl %esi, 0xe625(%rip)      # 0x121c0
leaq 0x958c(%rip), %rdi      # 0xd12e
movb $0x0, %al
callq 0x20f0
leaq 0x9d75(%rip), %rdi      # 0xd925
movb $0x0, %al
callq 0x20f0
callq 0x6c40
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x9d8b(%rip), %rsi      # 0xd956
movl $0x4, %edx
callq 0xa410
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0xa5a0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x3c0f
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x3c0f
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x3c0f
leaq 0x9582(%rip), %rdi      # 0xd188
movb $0x0, %al
callq 0x20f0
jmp 0x3c2c
leaq 0x9587(%rip), %rdi      # 0xd19d
movb $0x0, %al
callq 0x20f0
movl 0xe599(%rip), %eax      # 0x121bc
addl $0x1, %eax
movl %eax, 0xe590(%rip)      # 0x121bc
movq -0x10(%rbp), %rdi
callq 0x5880
movq -0x8(%rbp), %rdi
callq 0xa380
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)