// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x38, %rsp
leaq 0x60(%rsp), %r12
movaps (%r12), %xmm0
movaps 0x10(%r12), %xmm1
movaps 0x20(%r12), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x4e8a
movq %rax, %rbx
movl 0xadd6(%rip), %esi      # 0xf1d8
incl %esi
movl %esi, 0xadce(%rip)      # 0xf1d8
leaq 0x5d03(%rip), %rdi      # 0xa114
xorl %eax, %eax
callq 0x2100
leaq 0x6932(%rip), %rdi      # 0xad51
xorl %eax, %eax
callq 0x2100
leaq 0x6968(%rip), %rsi      # 0xad95
movq %rbx, %rdi
xorl %eax, %eax
callq 0x66dc
movq %rax, %rdi
callq 0x5040
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
xorl %esi, %esi
callq 0x60eb
leaq 0x671c(%rip), %rsi      # 0xab71
movq %rbx, %rdi
xorl %eax, %eax
callq 0x66dc
movq %rax, %r14
testq %rax, %rax
je 0x447d
cmpl $0x1, (%r14)
jne 0x447d
movq 0x18(%r14), %rax
cmpl $0x74736166, (%rax)     # imm = 0x74736166
je 0x46a0
leaq 0x6dd0(%rip), %rdi      # 0xb254
callq 0x2090
incl 0xad45(%rip)            # 0xf1d4
movq %r14, %rdi
callq 0x5040
movq %rbx, %rdi
callq 0x4fbc
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x4e8a
movq %rax, %rbx
movl 0xad0c(%rip), %esi      # 0xf1d8
incl %esi
movl %esi, 0xad04(%rip)      # 0xf1d8
leaq 0x5c39(%rip), %rdi      # 0xa114
xorl %eax, %eax
callq 0x2100
leaq 0x68b9(%rip), %rdi      # 0xada2
xorl %eax, %eax
callq 0x2100
movl 0x84(%rbx), %edi
leaq 0x6844(%rip), %rsi      # 0xad41
movl $0xf, %edx
callq 0x20d0
movq %rax, %r15
movl $0x2710, %edx           # imm = 0x2710
movq %rbx, %rdi
xorl %esi, %esi
callq 0x60eb
leaq 0x6651(%rip), %rsi      # 0xab71
movq %rbx, %rdi
xorl %eax, %eax
callq 0x66dc
movq %rax, %r14
testq %r15, %r15
setg %al
testq %r14, %r14
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x4560
cmpl $0x1, (%rbx)
jne 0x4560
movq %rbx, %rdi
addq $0x4, %rdi
leaq 0x6884(%rip), %rsi      # 0xadd7
callq 0x21c0
testl %eax, %eax
je 0x46d0
leaq 0x6ced(%rip), %rdi      # 0xb254
callq 0x2090
incl 0xac62(%rip)            # 0xf1d4
movq %r14, %rdi
callq 0x5040
movl 0xac58(%rip), %esi      # 0xf1d8
incl %esi
movl %esi, 0xac50(%rip)      # 0xf1d8
leaq 0x5b85(%rip), %rdi      # 0xa114
xorl %eax, %eax
callq 0x2100
leaq 0x685b(%rip), %rdi      # 0xadf8
xorl %eax, %eax
callq 0x2100
movq %rbx, %rdi
callq 0x5d51
leaq 0x655e(%rip), %rsi      # 0xab11
movq %rbx, %rdi
xorl %eax, %eax
callq 0x66dc
movq %rax, %r14
testq %rax, %rax
je 0x45e3
cmpl $0x5, (%r14)
jne 0x45e3
movq 0x18(%r14), %rdi
leaq 0x6852(%rip), %rsi      # 0xae28
callq 0x21c0
testl %eax, %eax
je 0x46b1
leaq 0x6c6a(%rip), %rdi      # 0xb254
callq 0x2090
incl 0xabdf(%rip)            # 0xf1d4
movq %r14, %rdi
callq 0x5040
movl 0xabd5(%rip), %esi      # 0xf1d8
incl %esi
movl %esi, 0xabcd(%rip)      # 0xf1d8
leaq 0x5b02(%rip), %rdi      # 0xa114
xorl %eax, %eax
callq 0x2100
leaq 0x680d(%rip), %rdi      # 0xae2d
xorl %eax, %eax
callq 0x2100
leaq 0x6547(%rip), %rax      # 0xab75
movq %rax, 0x8(%r12)
movq %rax, 0x28(%r12)
movq %rbx, %rdi
callq 0x5d51
leaq 0x64ca(%rip), %rsi      # 0xab11
movq %rbx, %rdi
xorl %eax, %eax
callq 0x66dc
movq %rax, %r14
testq %rax, %rax
je 0x4673
cmpl $0x5, (%r14)
jne 0x4673
movq 0x18(%r14), %rdi
leaq 0x67be(%rip), %rsi      # 0xae28
callq 0x21c0
testl %eax, %eax
je 0x46c2
leaq 0x6bda(%rip), %rdi      # 0xb254
callq 0x2090
incl 0xab4f(%rip)            # 0xf1d4
movq %r14, %rdi
callq 0x5040
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4fbc
leaq 0x6bc1(%rip), %rdi      # 0xb268
callq 0x2090
jmp 0x448f
leaq 0x6bb0(%rip), %rdi      # 0xb268
callq 0x2090
jmp 0x45f5
leaq 0x6b9f(%rip), %rdi      # 0xb268
callq 0x2090
jmp 0x4685
leaq 0x6b91(%rip), %rdi      # 0xb268
callq 0x2090
jmp 0x4572