// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/hfile_libcurl.c
// Function: wait_perform
static int wait_perform(hFILE_libcurl *fp)
{
    fd_set rd, wr, ex;
    int maxfd, nrunning;
    long timeout;
    CURLMcode errm;

    if (!fp->perform_again) {
        FD_ZERO(&rd);
        FD_ZERO(&wr);
        FD_ZERO(&ex);
        if (curl_multi_fdset(fp->multi, &rd, &wr, &ex, &maxfd) != CURLM_OK)
            maxfd = -1, timeout = 1000;
        else {
            if (curl_multi_timeout(fp->multi, &timeout) != CURLM_OK)
                timeout = 1000;
            else if (timeout < 0) {
                timeout = 10000;  // as recommended by curl_multi_timeout(3)
            }
        }
        if (maxfd < 0) {
            if (timeout > 100)
                timeout = 100; // as recommended by curl_multi_fdset(3)
#ifdef _WIN32
            /* Windows ignores the first argument of select, so calling select
             * with maxfd=-1 does not give the expected result of sleeping for
             * timeout milliseconds in the conditional block below.
             * So sleep here and skip the next block.
             */
            Sleep(timeout);
            timeout = 0;
#endif
        }

        if (timeout > 0) {
            struct timeval tval;
            tval.tv_sec  = (timeout / 1000);
            tval.tv_usec = (timeout % 1000) * 1000;

            if (select(maxfd + 1, &rd, &wr, &ex, &tval) < 0) return -1;
        }
    }

    errm = curl_multi_perform(fp->multi, &nrunning);
    fp->perform_again = 0;
    if (errm == CURLM_CALL_MULTI_PERFORM) fp->perform_again = 1;
    else if (errm != CURLM_OK) { errno = multi_errno(errm); return -1; }

    if (nrunning < fp->nrunning) process_messages(fp);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movb 0x64(%rax), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xd06a5
jmp 0xd0499
leaq -0x90(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movl $0x0, -0x1a8(%rbp)
movl -0x1a8(%rbp), %eax
cmpq $0x10, %rax
jae 0xd04e3
movq -0x1b0(%rbp), %rax
movl -0x1a8(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x1a8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1a8(%rbp)
jmp 0xd04b1
jmp 0xd04e5
jmp 0xd04e7
leaq -0x110(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movl $0x0, -0x1b4(%rbp)
movl -0x1b4(%rbp), %eax
cmpq $0x10, %rax
jae 0xd0531
movq -0x1c0(%rbp), %rax
movl -0x1b4(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b4(%rbp)
jmp 0xd04ff
jmp 0xd0533
jmp 0xd0535
leaq -0x190(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movl $0x0, -0x1c4(%rbp)
movl -0x1c4(%rbp), %eax
cmpq $0x10, %rax
jae 0xd057f
movq -0x1d0(%rbp), %rax
movl -0x1c4(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x1c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c4(%rbp)
jmp 0xd054d
jmp 0xd0581
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
leaq -0x90(%rbp), %rsi
leaq -0x110(%rbp), %rdx
leaq -0x190(%rbp), %rcx
leaq -0x194(%rbp), %r8
callq 0x44e0
cmpl $0x0, %eax
je 0xd05c6
movl $0xffffffff, -0x194(%rbp) # imm = 0xFFFFFFFF
movq $0x3e8, -0x1a0(%rbp) # imm = 0x3E8
jmp 0xd0605
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x4100
cmpl $0x0, %eax
je 0xd05ec
movq $0x3e8, -0x1a0(%rbp) # imm = 0x3E8
jmp 0xd0603
cmpq $0x0, -0x1a0(%rbp)
jge 0xd0601
movq $0x2710, -0x1a0(%rbp) # imm = 0x2710
jmp 0xd0603
jmp 0xd0605
cmpl $0x0, -0x194(%rbp)
jge 0xd0625
cmpq $0x64, -0x1a0(%rbp)
jle 0xd0623
movq $0x64, -0x1a0(%rbp)
jmp 0xd0625
cmpq $0x0, -0x1a0(%rbp)
jle 0xd06a3
movq -0x1a0(%rbp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
movq %rax, -0x1e0(%rbp)
movq -0x1a0(%rbp), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
imulq $0x3e8, %rdx, %rax      # imm = 0x3E8
movq %rax, -0x1d8(%rbp)
movl -0x194(%rbp), %edi
addl $0x1, %edi
leaq -0x90(%rbp), %rsi
leaq -0x110(%rbp), %rdx
leaq -0x190(%rbp), %rcx
leaq -0x1e0(%rbp), %r8
callq 0x4470
cmpl $0x0, %eax
jge 0xd06a1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd073b
jmp 0xd06a3
jmp 0xd06a5
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
leaq -0x198(%rbp), %rsi
callq 0x4350
movl %eax, -0x1a4(%rbp)
movq -0x10(%rbp), %rax
movb 0x64(%rax), %cl
andb $-0x9, %cl
orb $0x0, %cl
movb %cl, 0x64(%rax)
cmpl $-0x1, -0x1a4(%rbp)
jne 0xd06ea
movq -0x10(%rbp), %rax
movb 0x64(%rax), %cl
andb $-0x9, %cl
orb $0x8, %cl
movb %cl, 0x64(%rax)
jmp 0xd071c
cmpl $0x0, -0x1a4(%rbp)
je 0xd071a
movl -0x1a4(%rbp), %edi
callq 0xd03d0
movl %eax, -0x1e4(%rbp)
callq 0x4050
movl -0x1e4(%rbp), %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd073b
jmp 0xd071c
movl -0x198(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x68(%rcx), %eax
jge 0xd0734
movq -0x10(%rbp), %rdi
callq 0xd24e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
nopw (%rax,%rax)