// File: /workspace/github_c_makefile_star2_O3/Genymobile[P]hiredis/test.c
// Function: test_blocking_connection_timeouts
static void test_blocking_connection_timeouts(struct config config) {
    redisContext *c;
    redisReply *reply;
    ssize_t s;
    const char *cmd = "DEBUG SLEEP 3\r\n";
    struct timeval tv;

    c = connect(config);
    test("Successfully completes a command when the timeout is not exceeded: ");
    reply = redisCommand(c,"SET foo fast");
    freeReplyObject(reply);
    tv.tv_sec = 0;
    tv.tv_usec = 10000;
    redisSetTimeout(c, tv);
    reply = redisCommand(c, "GET foo");
    test_cond(reply != NULL && reply->type == REDIS_REPLY_STRING && memcmp(reply->str, "fast", 4) == 0);
    freeReplyObject(reply);
    disconnect(c, 0);

    c = connect(config);
    test("Does not return a reply when the command times out: ");
    s = write(c->fd, cmd, strlen(cmd));
    tv.tv_sec = 0;
    tv.tv_usec = 10000;
    redisSetTimeout(c, tv);
    reply = redisCommand(c, "GET foo");
    test_cond(s > 0 && reply == NULL && c->err == REDIS_ERR_IO && strcmp(c->errstr, "Resource temporarily unavailable") == 0);
    freeReplyObject(reply);

    test("Reconnect properly reconnects after a timeout: ");
    redisReconnect(c);
    reply = redisCommand(c, "PING");
    test_cond(reply != NULL && reply->type == REDIS_REPLY_STATUS && strcmp(reply->str, "PONG") == 0);
    freeReplyObject(reply);

    test("Reconnect properly uses owned parameters: ");
    config.tcp.host = "foo";
    config.unix.path = "foo";
    redisReconnect(c);
    reply = redisCommand(c, "PING");
    test_cond(reply != NULL && reply->type == REDIS_REPLY_STATUS && strcmp(reply->str, "PONG") == 0);
    freeReplyObject(reply);

    disconnect(c, 0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
leaq 0x50(%rsp), %r15
movaps (%r15), %xmm0
movaps 0x10(%r15), %xmm1
movaps 0x20(%r15), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x4df8
movq %rax, %rbx
movl 0xae52(%rip), %esi      # 0xf1d8
incl %esi
movl %esi, 0xae4a(%rip)      # 0xf1d8
leaq 0x5d76(%rip), %rdi      # 0xa10b
xorl %eax, %eax
callq 0x2100
leaq 0x69a5(%rip), %rdi      # 0xad48
xorl %eax, %eax
callq 0x2100
leaq 0x69db(%rip), %rsi      # 0xad8c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x655d
movq %rax, %rdi
callq 0x4fb0
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5f7e
leaq 0x678f(%rip), %rsi      # 0xab68
movq %rbx, %rdi
xorl %eax, %eax
callq 0x655d
movq %rax, %r14
testq %rax, %rax
je 0x4401
cmpl $0x1, (%r14)
jne 0x4401
movq 0x18(%r14), %rax
cmpl $0x74736166, (%rax)     # imm = 0x74736166
je 0x460e
leaq 0x6e43(%rip), %rdi      # 0xb24b
callq 0x2090
incl 0xadc1(%rip)            # 0xf1d4
movq %r14, %rdi
callq 0x4fb0
movq %rbx, %rdi
callq 0x4f2a
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x4df8
movq %rax, %rbx
movl 0xad8b(%rip), %esi      # 0xf1d8
incl %esi
movl %esi, 0xad83(%rip)      # 0xf1d8
leaq 0x5caf(%rip), %rdi      # 0xa10b
xorl %eax, %eax
callq 0x2100
leaq 0x692f(%rip), %rdi      # 0xad99
xorl %eax, %eax
callq 0x2100
movl 0x84(%rbx), %edi
leaq 0x68ba(%rip), %rsi      # 0xad38
movl $0xf, %edx
callq 0x20d0
movq %rax, %r15
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5f7e
leaq 0x66c7(%rip), %rsi      # 0xab68
movq %rbx, %rdi
xorl %eax, %eax
callq 0x655d
movq %rax, %r14
testq %r15, %r15
setg %al
testq %r14, %r14
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x44e1
cmpl $0x1, (%rbx)
jne 0x44e1
movq %rbx, %rdi
addq $0x4, %rdi
leaq 0x68fa(%rip), %rsi      # 0xadce
callq 0x21c0
testl %eax, %eax
je 0x463e
leaq 0x6d63(%rip), %rdi      # 0xb24b
callq 0x2090
incl 0xace1(%rip)            # 0xf1d4
movq %r14, %rdi
callq 0x4fb0
movl 0xacd7(%rip), %esi      # 0xf1d8
incl %esi
movl %esi, 0xaccf(%rip)      # 0xf1d8
leaq 0x5bfb(%rip), %rdi      # 0xa10b
xorl %eax, %eax
callq 0x2100
leaq 0x68d1(%rip), %rdi      # 0xadef
xorl %eax, %eax
callq 0x2100
movq %rbx, %rdi
callq 0x5c18
leaq 0x65d4(%rip), %rsi      # 0xab08
movq %rbx, %rdi
xorl %eax, %eax
callq 0x655d
movq %rax, %r14
testq %rax, %rax
je 0x4564
cmpl $0x5, (%r14)
jne 0x4564
movq 0x18(%r14), %rdi
leaq 0x68c8(%rip), %rsi      # 0xae1f
callq 0x21c0
testl %eax, %eax
je 0x461f
leaq 0x6ce0(%rip), %rdi      # 0xb24b
callq 0x2090
incl 0xac5e(%rip)            # 0xf1d4
movq %r14, %rdi
callq 0x4fb0
movl 0xac54(%rip), %esi      # 0xf1d8
incl %esi
movl %esi, 0xac4c(%rip)      # 0xf1d8
leaq 0x5b78(%rip), %rdi      # 0xa10b
xorl %eax, %eax
callq 0x2100
leaq 0x6883(%rip), %rdi      # 0xae24
xorl %eax, %eax
callq 0x2100
movq %rbx, %rdi
callq 0x5c18
leaq 0x6551(%rip), %rsi      # 0xab08
movq %rbx, %rdi
xorl %eax, %eax
callq 0x655d
movq %rax, %r14
testq %rax, %rax
je 0x45e3
cmpl $0x5, (%r14)
jne 0x45e3
movq 0x18(%r14), %rdi
leaq 0x6845(%rip), %rsi      # 0xae1f
callq 0x21c0
testl %eax, %eax
je 0x4630
leaq 0x6c61(%rip), %rdi      # 0xb24b
callq 0x2090
incl 0xabdf(%rip)            # 0xf1d4
movq %r14, %rdi
callq 0x4fb0
movq %rbx, %rdi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x4f2a
leaq 0x6c4a(%rip), %rdi      # 0xb25f
callq 0x2090
jmp 0x4413
leaq 0x6c39(%rip), %rdi      # 0xb25f
callq 0x2090
jmp 0x4576
leaq 0x6c28(%rip), %rdi      # 0xb25f
callq 0x2090
jmp 0x45f5
leaq 0x6c1a(%rip), %rdi      # 0xb25f
callq 0x2090
jmp 0x44f3