// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/hfile_libcurl.c
// Function: easy_errno
static int easy_errno(CURL *easy, CURLcode err)
{
    long lval;

    switch (err) {
    case CURLE_OK:
        return 0;

    case CURLE_UNSUPPORTED_PROTOCOL:
    case CURLE_URL_MALFORMAT:
        return EINVAL;

#if LIBCURL_VERSION_NUM >= 0x071505
    case CURLE_NOT_BUILT_IN:
        return ENOSYS;
#endif

    case CURLE_COULDNT_RESOLVE_PROXY:
    case CURLE_COULDNT_RESOLVE_HOST:
    case CURLE_FTP_CANT_GET_HOST:
        return EDESTADDRREQ; // Lookup failure

    case CURLE_COULDNT_CONNECT:
    case CURLE_SEND_ERROR:
    case CURLE_RECV_ERROR:
        if (curl_easy_getinfo(easy, CURLINFO_OS_ERRNO, &lval) == CURLE_OK)
            return lval;
        else
            return ECONNABORTED;

    case CURLE_REMOTE_ACCESS_DENIED:
    case CURLE_LOGIN_DENIED:
    case CURLE_TFTP_PERM:
        return EACCES;

    case CURLE_PARTIAL_FILE:
        return EPIPE;

    case CURLE_HTTP_RETURNED_ERROR:
        if (curl_easy_getinfo(easy, CURLINFO_RESPONSE_CODE, &lval) == CURLE_OK)
            return http_status_errno(lval);
        else
            return EIO;

    case CURLE_OUT_OF_MEMORY:
        return ENOMEM;

    case CURLE_OPERATION_TIMEDOUT:
        return ETIMEDOUT;

    case CURLE_RANGE_ERROR:
        return ESPIPE;

    case CURLE_SSL_CONNECT_ERROR:
        // TODO return SSL error buffer messages
        return ECONNABORTED;

    case CURLE_FILE_COULDNT_READ_FILE:
    case CURLE_TFTP_NOTFOUND:
        return ENOENT;

    case CURLE_TOO_MANY_REDIRECTS:
        return ELOOP;

    case CURLE_FILESIZE_EXCEEDED:
        return EFBIG;

    case CURLE_REMOTE_DISK_FULL:
        return ENOSPC;

    case CURLE_REMOTE_FILE_EXISTS:
        return EEXIST;

    default:
        hts_log_error("Libcurl reported error %d (%s)", (int) err,
                      curl_easy_strerror(err));
        return EIO;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq %rax, -0x28(%rbp)
subq $0x49, %rax
ja 0xcee86
movq -0x28(%rbp), %rax
leaq 0x28671(%rip), %rcx     # 0xf73ec
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x4(%rbp)
jmp 0xceebb
movl $0x16, -0x4(%rbp)
jmp 0xceebb
movl $0x26, -0x4(%rbp)
jmp 0xceebb
movl $0x59, -0x4(%rbp)
jmp 0xceebb
movq -0x10(%rbp), %rdi
movl $0x200019, %esi         # imm = 0x200019
leaq -0x20(%rbp), %rdx
movb $0x0, %al
callq 0x4280
cmpl $0x0, %eax
jne 0xcedd9
movq -0x20(%rbp), %rax
movl %eax, -0x4(%rbp)
jmp 0xceebb
movl $0x67, -0x4(%rbp)
jmp 0xceebb
movl $0xd, -0x4(%rbp)
jmp 0xceebb
movl $0x20, -0x4(%rbp)
jmp 0xceebb
movq -0x10(%rbp), %rdi
movl $0x200002, %esi         # imm = 0x200002
leaq -0x20(%rbp), %rdx
movb $0x0, %al
callq 0x4280
cmpl $0x0, %eax
jne 0xcee29
movq -0x20(%rbp), %rax
movl %eax, %edi
callq 0xd37b0
movl %eax, -0x4(%rbp)
jmp 0xceebb
movl $0x5, -0x4(%rbp)
jmp 0xceebb
movl $0xc, -0x4(%rbp)
jmp 0xceebb
movl $0x6e, -0x4(%rbp)
jmp 0xceebb
movl $0x1d, -0x4(%rbp)
jmp 0xceebb
movl $0x67, -0x4(%rbp)
jmp 0xceebb
movl $0x2, -0x4(%rbp)
jmp 0xceebb
movl $0x28, -0x4(%rbp)
jmp 0xceebb
movl $0x1b, -0x4(%rbp)
jmp 0xceebb
movl $0x1c, -0x4(%rbp)
jmp 0xceebb
movl $0x11, -0x4(%rbp)
jmp 0xceebb
movl -0x14(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x14(%rbp), %edi
callq 0x46f0
movl -0x2c(%rbp), %ecx
movq %rax, %r8
movl $0x1, %edi
leaq 0x288fd(%rip), %rsi     # 0xf77a3
leaq 0x28789(%rip), %rdx     # 0xf7636
movb $0x0, %al
callq 0x1b030
movl $0x5, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)