// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hfile_libcurl.c
// Function: libcurl_open
static hFILE *
libcurl_open(const char *url, const char *modes, http_headers *headers)
{
    hFILE_libcurl *fp;
    struct curl_slist *list;
    char mode;
    const char *s;
    CURLcode err;
    CURLMcode errm;
    int save, is_recursive;
    kstring_t in_header = {0, 0, NULL};
    long response;

    is_recursive = strchr(modes, 'R') != NULL;

    if ((s = strpbrk(modes, "rwa+")) != NULL) {
        mode = *s;
        if (strpbrk(&s[1], "rwa+")) mode = 'e';
    }
    else mode = '\0';

    if (mode != 'r' && mode != 'w') { errno = EINVAL; goto early_error; }

    fp = (hFILE_libcurl *) hfile_init(sizeof (hFILE_libcurl), modes, 0);
    if (fp == NULL) goto early_error;

    if (headers) {
        fp->headers = *headers;
    } else {
        memset(&fp->headers, 0, sizeof(fp->headers));
        fp->headers.fail_on_error = 1;
    }

    fp->file_size = -1;
    fp->buffer.ptr.rd = NULL;
    fp->buffer.len = 0;
    fp->final_result = (CURLcode) -1;
    fp->paused = fp->closing = fp->finished = fp->perform_again = 0;
    fp->can_seek = 1;
    fp->tried_seek = 0;
    fp->delayed_seek = fp->last_offset = -1;
    fp->preserved = NULL;
    fp->preserved_bytes = fp->preserved_size = 0;
    fp->is_recursive = is_recursive;
    fp->nrunning = 0;
    fp->easy = NULL;

    fp->multi = curl_multi_init();
    if (fp->multi == NULL) { errno = ENOMEM; goto error; }

    fp->easy = curl_easy_init();
    if (fp->easy == NULL) { errno = ENOMEM; goto error; }

    // Make a route to the hFILE_libcurl* given just a CURL* easy handle
    err = curl_easy_setopt(fp->easy, CURLOPT_PRIVATE, fp);

    // Avoid many repeated CWD calls with FTP, instead requesting the filename
    // by full path (but not strictly compliant with RFC1738).
    err |= curl_easy_setopt(fp->easy, CURLOPT_FTP_FILEMETHOD,
                            (long) CURLFTPMETHOD_NOCWD);

    if (mode == 'r') {
        err |= curl_easy_setopt(fp->easy, CURLOPT_WRITEFUNCTION, recv_callback);
        err |= curl_easy_setopt(fp->easy, CURLOPT_WRITEDATA, fp);
        fp->is_read = 1;
    }
    else {
        err |= curl_easy_setopt(fp->easy, CURLOPT_READFUNCTION, send_callback);
        err |= curl_easy_setopt(fp->easy, CURLOPT_READDATA, fp);
        err |= curl_easy_setopt(fp->easy, CURLOPT_UPLOAD, 1L);
        if (append_header(&fp->headers.fixed,
                          "Transfer-Encoding: chunked", 1) < 0)
            goto error;
        fp->is_read = 0;
    }

    err |= curl_easy_setopt(fp->easy, CURLOPT_SHARE, curl.share);
    err |= curl_easy_setopt(fp->easy, CURLOPT_URL, url);
    {
        char* env_curl_ca_bundle = getenv("CURL_CA_BUNDLE");
        if (env_curl_ca_bundle) {
            err |= curl_easy_setopt(fp->easy, CURLOPT_CAINFO, env_curl_ca_bundle);
        }
    }
    err |= curl_easy_setopt(fp->easy, CURLOPT_USERAGENT, curl.useragent.s);
    if (fp->headers.callback) {
        if (add_callback_headers(fp) != 0) goto error;
    }
    if (get_auth_token(fp, url) < 0)
        goto error;
    if ((list = get_header_list(fp)) != NULL)
        err |= curl_easy_setopt(fp->easy, CURLOPT_HTTPHEADER, list);

    if (hts_verbose <= 8 && fp->headers.fail_on_error)
        err |= curl_easy_setopt(fp->easy, CURLOPT_FAILONERROR, 1L);
    if (hts_verbose >= 8)
        err |= curl_easy_setopt(fp->easy, CURLOPT_VERBOSE, 1L);

    if (fp->headers.redirect) {
        err |= curl_easy_setopt(fp->easy, CURLOPT_HEADERFUNCTION, header_callback);
        err |= curl_easy_setopt(fp->easy, CURLOPT_HEADERDATA, (void *)&in_header);
    } else {
        err |= curl_easy_setopt(fp->easy, CURLOPT_FOLLOWLOCATION, 1L);
    }

    if (err != 0) { errno = ENOSYS; goto error; }

    errm = curl_multi_add_handle(fp->multi, fp->easy);
    if (errm != CURLM_OK) { errno = multi_errno(errm); goto error; }
    fp->nrunning++;

    while (! fp->paused && ! fp->finished) {
        if (wait_perform(fp) < 0) goto error_remove;
    }

    curl_easy_getinfo(fp->easy, CURLINFO_RESPONSE_CODE, &response);
    if (fp->headers.http_response_ptr) {
        *fp->headers.http_response_ptr = response;
    }

    if (fp->finished && fp->final_result != CURLE_OK) {
        errno = easy_errno(fp->easy, fp->final_result);
        goto error_remove;
    }

    if (fp->headers.redirect) {
        if (response >= 300 && response < 400) { // redirection
            kstring_t new_url = {0, 0, NULL};

            if (fp->headers.redirect(fp->headers.redirect_data, response,
                                     &in_header, &new_url)) {
                errno = ENOSYS;
                goto error;
            }

            err |= curl_easy_setopt(fp->easy, CURLOPT_URL, new_url.s);
            err |= curl_easy_setopt(fp->easy, CURLOPT_HEADERFUNCTION, NULL);
            err |= curl_easy_setopt(fp->easy, CURLOPT_HEADERDATA, NULL);
            free(ks_release(&in_header));

            if (err != 0) { errno = ENOSYS; goto error; }
            free(ks_release(&new_url));

            if (restart_from_position(fp, 0) < 0) {
                goto error_remove;
            }

            if (fp->headers.http_response_ptr) {
                curl_easy_getinfo(fp->easy, CURLINFO_RESPONSE_CODE,
                                  fp->headers.http_response_ptr);
            }

            if (fp->finished && fp->final_result != CURLE_OK) {
                errno = easy_errno(fp->easy, fp->final_result);
                goto error_remove;
            }
        } else {
            // we no longer need to look at the headers
            err |= curl_easy_setopt(fp->easy, CURLOPT_HEADERFUNCTION, NULL);
            err |= curl_easy_setopt(fp->easy, CURLOPT_HEADERDATA, NULL);
            free(ks_release(&in_header));

            if (err != 0) { errno = ENOSYS; goto error; }
        }
    }

    if (mode == 'r') {
#if LIBCURL_VERSION_NUM >= 0x073700 // 7.55.0
        curl_off_t offset;

        if (curl_easy_getinfo(fp->easy, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
                              &offset) == CURLE_OK && offset > 0)
            fp->file_size = (off_t) offset;
#else
        double dval;

        if (curl_easy_getinfo(fp->easy, CURLINFO_CONTENT_LENGTH_DOWNLOAD,
                              &dval) == CURLE_OK && dval >= 0.0)
            fp->file_size = (off_t) (dval + 0.1);
#endif
    }
    fp->base.backend = &libcurl_backend;
    return &fp->base;

error_remove:
    save = errno;
    (void) curl_multi_remove_handle(fp->multi, fp->easy);
    fp->nrunning--;
    errno = save;

error:
    if (fp->headers.redirect) free(in_header.s);
    save = errno;
    if (fp->easy) curl_easy_cleanup(fp->easy);
    if (fp->multi) curl_multi_cleanup(fp->multi);
    free_headers(&fp->headers.extra, 1);
    hfile_destroy((hFILE *) fp);
    errno = save;
    return NULL;

early_error:
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq %rsi, %rdi
movl $0x52, %esi
callq 0x4190
movq %rax, %r12
leaq 0x22ade(%rip), %rsi     # 0xa12c9
movq %rbx, %rdi
callq 0x48f0
testq %rax, %rax
je 0x7e812
movzbl (%rax), %ebp
incq %rax
leaq 0x22ac4(%rip), %rsi     # 0xa12c9
movq %rax, %rdi
callq 0x48f0
testq %rax, %rax
je 0x7e832
callq 0x4050
movl $0x16, (%rax)
xorl %r14d, %r14d
movq %r14, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x72, %ebp
je 0x7e83c
cmpl $0x77, %ebp
jne 0x7e812
xorl %r14d, %r14d
movl $0xf8, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xecc0
testq %rax, %rax
je 0x7e820
movq %rax, %rbx
leaq 0x70(%rax), %r14
testq %r13, %r13
je 0x7e86f
movl $0xc, %ecx
movq %r14, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
jmp 0x7e899
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%r14)
movups %xmm0, 0x40(%r14)
movups %xmm0, 0x30(%r14)
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x10(%r14)
movups %xmm0, (%r14)
movl $0x1, 0xc8(%rbx)
testq %r12, %r12
setne %al
movq $-0x1, 0x48(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rbx)
movl $0xffffffff, 0x60(%rbx) # imm = 0xFFFFFFFF
movb 0x64(%rbx), %cl
pcmpeqd %xmm1, %xmm1
movdqu %xmm1, 0xd0(%rbx)
shlb $0x6, %al
andb $0x10, %cl
orb %al, %cl
orb $0x20, %cl
movups %xmm0, 0xe0(%rbx)
xorl %eax, %eax
movq %rax, 0xf0(%rbx)
movb %cl, 0x64(%rbx)
movl $0x0, 0x68(%rbx)
movq %rax, 0x38(%rbx)
callq 0x4820
movq %rax, 0x40(%rbx)
testq %rax, %rax
je 0x7e985
callq 0x4670
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x7e985
movq %rax, %rdi
movl $0x2777, %esi           # imm = 0x2777
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4580
movl %eax, %r12d
movq 0x38(%rbx), %rdi
movl $0x2, %edx
movl $0x8a, %esi
xorl %eax, %eax
callq 0x4580
movl %ebp, %ecx
movl %eax, %ebp
movq 0x38(%rbx), %rdi
movl %ecx, 0x14(%rsp)
cmpl $0x72, %ecx
jne 0x7e9eb
leaq 0x8ca(%rip), %rdx       # 0x7f21d
movl $0x4e2b, %esi           # imm = 0x4E2B
xorl %eax, %eax
callq 0x4580
movl %eax, %r14d
movq 0x38(%rbx), %rdi
movl $0x2711, %esi           # imm = 0x2711
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4580
movl %eax, %r13d
orl %r14d, %r13d
movb 0x64(%rbx), %al
orb $0x10, %al
jmp 0x7ea63
callq 0x4050
movl $0xc, (%rax)
cmpq $0x0, 0xb0(%rbx)
je 0x7e9a4
movq 0x30(%rsp), %rdi
callq 0x45c0
callq 0x4050
movq %rax, %r14
movl (%rax), %ebp
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x7e9bc
callq 0x4620
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x7e9ca
callq 0x4850
movq %rbx, %rdi
subq $-0x80, %rdi
movl $0x1, %esi
callq 0x7fb64
movq %rbx, %rdi
callq 0xed72
movl %ebp, (%r14)
jmp 0x7e81d
movl %r12d, 0x18(%rsp)
leaq 0x871(%rip), %rdx       # 0x7f268
movl $0x4e2c, %esi           # imm = 0x4E2C
xorl %eax, %eax
callq 0x4580
movl %eax, 0x8(%rsp)
movq 0x38(%rbx), %rdi
movl $0x2719, %esi           # imm = 0x2719
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4580
movl %eax, %r13d
movq 0x38(%rbx), %rdi
movl $0x1, %edx
movl $0x2e, %esi
xorl %eax, %eax
callq 0x4580
movl %eax, %r12d
leaq 0x22892(%rip), %rsi     # 0xa12ce
movq %r14, %rdi
movl $0x1, %edx
callq 0x7f2be
testl %eax, %eax
js 0x7e990
orl 0x8(%rsp), %r13d
orl %r12d, %r13d
movb 0x64(%rbx), %al
andb $-0x11, %al
movl 0x18(%rsp), %r12d
orl %r12d, %ebp
orl %r13d, %ebp
movb %al, 0x64(%rbx)
movq 0x38(%rbx), %rdi
movq 0x386c1(%rip), %rdx     # 0xb7138
movl $0x2774, %esi           # imm = 0x2774
xorl %eax, %eax
callq 0x4580
movl %eax, %r12d
movq 0x38(%rbx), %rdi
movl $0x2712, %esi           # imm = 0x2712
movq %r15, %rdx
xorl %eax, %eax
callq 0x4580
movl %eax, %r14d
orl %r12d, %r14d
orl %ebp, %r14d
leaq 0x22840(%rip), %rdi     # 0xa12e9
callq 0x4600
testq %rax, %rax
je 0x7eac9
movq 0x38(%rbx), %rdi
movl $0x2751, %esi           # imm = 0x2751
movq %rax, %rdx
xorl %eax, %eax
callq 0x4580
orl %eax, %r14d
movq 0x38(%rbx), %rdi
movq 0x3865c(%rip), %rdx     # 0xb7130
movl $0x2722, %esi           # imm = 0x2722
xorl %eax, %eax
callq 0x4580
movl %eax, %r12d
cmpq $0x0, 0x90(%rbx)
je 0x7eafd
movq %rbx, %rdi
callq 0x7f40e
testl %eax, %eax
jne 0x7e990
movq 0x3863c(%rip), %rcx     # 0xb7140
testq %rcx, %rcx
je 0x7eb1c
testb $0x40, 0x64(%rbx)
jne 0x7eb1c
cmpl $0x0, 0xa8(%rbx)
je 0x7ec4a
orl %r14d, %r12d
movl $0x70, %eax
cmpl $0x0, 0x78(%rbx)
jne 0x7eb38
movl $0x80, %eax
cmpl $0x0, 0x88(%rbx)
je 0x7eb54
movq (%rbx,%rax), %rdx
testq %rdx, %rdx
je 0x7eb54
movq 0x38(%rbx), %rdi
movl $0x2727, %esi           # imm = 0x2727
xorl %eax, %eax
callq 0x4580
orl %eax, %r12d
leaq 0x37c25(%rip), %r14     # 0xb6780
movl (%r14), %eax
cmpl $0x8, %eax
jg 0x7eb8c
cmpl $0x0, 0xc8(%rbx)
je 0x7eb87
movq 0x38(%rbx), %rdi
movl $0x1, %edx
movl $0x2d, %esi
xorl %eax, %eax
callq 0x4580
orl %eax, %r12d
movl (%r14), %eax
cmpl $0x8, %eax
jl 0x7eba4
movq 0x38(%rbx), %rdi
movl $0x1, %edx
movl $0x29, %esi
xorl %eax, %eax
callq 0x4580
orl %eax, %r12d
cmpq $0x0, 0xb0(%rbx)
movq 0x38(%rbx), %rdi
je 0x7ebe0
leaq 0x9c4(%rip), %rdx       # 0x7f57d
movl $0x4e6f, %esi           # imm = 0x4E6F
xorl %eax, %eax
callq 0x4580
movl %eax, %ebp
movq 0x38(%rbx), %rdi
leaq 0x20(%rsp), %rdx
movl $0x272d, %esi           # imm = 0x272D
xorl %eax, %eax
callq 0x4580
orl %ebp, %eax
jmp 0x7ebf1
movl $0x1, %edx
movl $0x34, %esi
xorl %eax, %eax
callq 0x4580
movl 0x14(%rsp), %ebp
orl %r12d, %eax
je 0x7ec0a
callq 0x4050
movl $0x26, (%rax)
jmp 0x7e990
movq 0x38(%rbx), %rsi
movq 0x40(%rbx), %rdi
callq 0x4940
testl %eax, %eax
je 0x7ec30
movl %eax, %edi
callq 0x7f626
movl %eax, %ebp
callq 0x4050
movl %ebp, (%rax)
jmp 0x7e990
incl 0x68(%rbx)
testb $0x5, 0x64(%rbx)
jne 0x7ec94
movq %rbx, %rdi
callq 0x7f676
testl %eax, %eax
jns 0x7ec33
jmp 0x7ecdc
cmpl $0x0, 0x384ff(%rip)     # 0xb7150
je 0x7ee17
movq %rcx, 0x8(%rsp)
leaq 0x168d3(%rip), %rsi     # 0x95536
movq %r15, %rdi
callq 0x40e0
testq %rax, %rax
je 0x7ee3e
movq %rax, %r15
addq $0x3, %r15
leaq 0x16a0a(%rip), %rsi     # 0x9568c
movq %r15, %rdi
callq 0x4090
movq %rax, 0x18(%rsp)
jmp 0x7ee4a
movq 0x38(%rbx), %rdi
leaq 0x48(%rsp), %rdx
movl $0x200002, %esi         # imm = 0x200002
xorl %eax, %eax
callq 0x4290
movq 0xc0(%rbx), %rax
testq %rax, %rax
je 0x7ecbd
movq 0x48(%rsp), %rcx
movq %rcx, (%rax)
testb $0x4, 0x64(%rbx)
je 0x7ecfe
movl 0x60(%rbx), %esi
testl %esi, %esi
je 0x7ecfe
movq 0x38(%rbx), %rdi
callq 0x7e55c
movl %eax, %ebp
callq 0x4050
movl %ebp, (%rax)
callq 0x4050
movq %rax, %r14
movl (%rax), %ebp
movq 0x38(%rbx), %rsi
movq 0x40(%rbx), %rdi
callq 0x4160
decl 0x68(%rbx)
movl %ebp, (%r14)
jmp 0x7e990
movq 0xb0(%rbx), %rax
testq %rax, %rax
je 0x7f088
movq 0x48(%rsp), %rsi
leaq -0x12c(%rsi), %rcx
cmpq $0x63, %rcx
ja 0x7f037
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rcx
movaps %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
movq 0xb8(%rbx), %rdi
leaq 0x20(%rsp), %rdx
callq *%rax
testl %eax, %eax
jne 0x7ebfa
movq 0x38(%rbx), %rdi
movq 0x60(%rsp), %rdx
movl $0x2712, %esi           # imm = 0x2712
xorl %eax, %eax
callq 0x4580
movl %eax, %ebp
movq 0x38(%rbx), %rdi
movl $0x4e6f, %esi           # imm = 0x4E6F
xorl %edx, %edx
xorl %eax, %eax
callq 0x4580
movl %eax, %r14d
orl %ebp, %r14d
movq 0x38(%rbx), %rdi
movl $0x272d, %esi           # imm = 0x272D
xorl %edx, %edx
xorl %eax, %eax
callq 0x4580
movl %eax, %ebp
movq 0x30(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
callq 0x45c0
orl %r14d, %ebp
jne 0x7ebfa
movq 0x60(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
callq 0x45c0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7f86c
testl %eax, %eax
js 0x7ecdc
movq 0xc0(%rbx), %rdx
testq %rdx, %rdx
je 0x7edfd
movq 0x38(%rbx), %rdi
movl $0x200002, %esi         # imm = 0x200002
xorl %eax, %eax
callq 0x4290
testb $0x4, 0x64(%rbx)
je 0x7ee0e
movl 0x60(%rbx), %esi
testl %esi, %esi
jne 0x7ecca
movl 0x14(%rsp), %ebp
jmp 0x7f088
movq %rcx, %r13
leaq 0x16727(%rip), %rsi     # 0x95548
movl $0x8, %edx
movq %r15, %rdi
callq 0x4210
movq %r13, %rcx
testl %eax, %eax
jne 0x7eb1c
jmp 0x7ec57
xorl %r15d, %r15d
movq $0x0, 0x18(%rsp)
movl %r12d, 0x10(%rsp)
leaq 0x224b1(%rip), %rsi     # 0xa1307
movq 0x8(%rsp), %rdi
callq 0x40e0
testq %rax, %rax
je 0x7efc7
movq %r15, 0x68(%rsp)
xorl %edi, %edi
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x8(%rsp), %r15
movq %rax, %r12
subq %r15, %r12
cmpq $0x7fffffff, %r12       # imm = 0x7FFFFFFF
jg 0x7f149
cmpq $0x7fffffff, 0x18(%rsp) # imm = 0x7FFFFFFF
ja 0x7f149
movq %r15, %rsi
movq %rbp, %r15
addq %r12, %r15
jb 0x7f12a
movq %rax, 0x70(%rsp)
cmpq $0x1, %r15
movq %r15, %rax
adcq $0x0, %rax
cmpq %rax, %r13
jae 0x7ef0b
movq %rax, %rcx
shrq %rcx
movabsq $0x3fffffffffffffff, %rdx # imm = 0x3FFFFFFFFFFFFFFF
cmpq %rdx, %r15
movl $0x0, %r13d
cmovbeq %rcx, %r13
addq %rax, %r13
movq %rdi, 0x40(%rsp)
movq 0x40(%rsp), %rdi
movq %rsi, 0x8(%rsp)
movq %r13, %rsi
callq 0x4840
movq 0x40(%rsp), %rdi
movq 0x8(%rsp), %rsi
testq %rax, %rax
jne 0x7ef0e
jmp 0x7f149
movq %rdi, %rax
movq %rax, 0x8(%rsp)
addq %rax, %rbp
movq %rbp, %rdi
movq %r12, %rdx
callq 0x43c0
testl %r12d, %r12d
js 0x7f12f
movq %r15, %rbp
addq 0x18(%rsp), %rbp
jb 0x7f136
cmpq $0x1, %rbp
movq %rbp, %rax
adcq $0x0, %rax
cmpq %rax, %r13
jae 0x7ef87
movq %rax, %rcx
shrq %rcx
movabsq $0x3fffffffffffffff, %rdx # imm = 0x3FFFFFFFFFFFFFFF
cmpq %rdx, %rbp
movl $0x0, %r13d
cmovbeq %rcx, %r13
addq %rax, %r13
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x4840
movq %rax, %r12
movq 0x8(%rsp), %rdi
testq %rax, %rax
jne 0x7ef8c
jmp 0x7f149
movq 0x8(%rsp), %r12
addq %r12, %r15
movq %r15, %rdi
movq 0x68(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x43c0
movq 0x70(%rsp), %r15
addq $0x2, %r15
movq %r15, %rdi
leaq 0x22353(%rip), %rsi     # 0xa1307
callq 0x40e0
movq %r12, %rdi
testq %rax, %rax
jne 0x7ee7a
jmp 0x7efd4
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %r12d, %r12d
movq 0x8(%rsp), %r15
movq %r15, 0x8(%rsp)
movq %r15, %rdi
callq 0x41d0
movq %rax, %r15
addq %rbp, %rax
addq $0x2, %rax
cmpq %rbp, %rax
jbe 0x7f13b
cmpq %rax, %r13
jae 0x7f0d1
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %esi, %esi
testq %rcx, %rcx
cmoveq %rdx, %rsi
addq %rax, %rsi
movq %r12, %rdi
callq 0x4840
movq %rax, %r13
movq %r12, %rdi
testq %rax, %rax
movq 0x8(%rsp), %rsi
jne 0x7f0d9
jmp 0x7f149
movq 0x38(%rbx), %rdi
movl $0x4e6f, %esi           # imm = 0x4E6F
xorl %edx, %edx
xorl %eax, %eax
callq 0x4580
movl %eax, %ebp
movq 0x38(%rbx), %rdi
movl $0x272d, %esi           # imm = 0x272D
xorl %edx, %edx
xorl %eax, %eax
callq 0x4580
movl %eax, %r14d
movq 0x30(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
callq 0x45c0
orl %ebp, %r14d
movl 0x14(%rsp), %ebp
jne 0x7ebfa
cmpl $0x72, %ebp
jne 0x7f0be
movq 0x38(%rbx), %rdi
leaq 0x50(%rsp), %r14
movl $0x60000f, %esi         # imm = 0x60000F
movq %r14, %rdx
xorl %eax, %eax
callq 0x4290
testl %eax, %eax
sete %cl
movq (%r14), %rax
testq %rax, %rax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x7f0be
movq %rax, 0x48(%rbx)
leaq 0x368bb(%rip), %rax     # 0xb5980
movq %rax, 0x20(%rbx)
movq %rbx, %r14
jmp 0x7e820
movq %r12, %r13
movq 0x8(%rsp), %rsi
movq %r15, %r12
addq %rbp, %r12
addq %r13, %rbp
movq %rbp, %rdi
movq %r15, %rdx
callq 0x43c0
movb $0x0, (%r13,%r12)
testl %r15d, %r15d
js 0x7f153
leaq 0x38059(%rip), %rdi     # 0xb7158
callq 0x4750
movq 0x3803d(%rip), %r15     # 0xb7148
movq %r15, %rdi
movq %r13, %rsi
callq 0x7fbce
cmpl (%r15), %eax
jae 0x7f158
movq 0x20(%r15), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %r15
jmp 0x7f1e8
movq %rdi, %r12
jmp 0x7f13b
movq 0x8(%rsp), %rdi
jmp 0x7f149
movq 0x8(%rsp), %r12
callq 0x4050
movl $0x4b, (%rax)
movq %r12, %rdi
callq 0x45c0
jmp 0x7e990
movq %r13, %rdi
jmp 0x7f149
movl $0x1, %edi
movl $0x48, %esi
callq 0x4300
testq %rax, %rax
je 0x7f189
movq %rax, %r15
movq %rax, %rdi
addq $0x20, %rdi
xorl %esi, %esi
callq 0x4780
testl %eax, %eax
je 0x7f18e
movq %r15, %rdi
callq 0x45c0
xorl %r15d, %r15d
jmp 0x7f1e8
leaq 0x50(%rsp), %r12
movl $0xffffffff, (%r12)     # imm = 0xFFFFFFFF
movq %r13, (%r15)
movq $0x0, 0x8(%r15)
movq $0x1, 0x10(%r15)
movq 0x37f93(%rip), %rdi     # 0xb7148
movq %r13, %rsi
movq %r12, %rdx
callq 0x7fcbb
movl %eax, %ebp
cmpl $0x0, (%r12)
jns 0x7f1d4
movq %r15, %rdi
callq 0x7fecd
xorl %r15d, %r15d
movq 0x37f6d(%rip), %rax     # 0xb7148
movq 0x20(%rax), %rax
movl %ebp, %ecx
movq %r15, (%rax,%rcx,8)
xorl %r13d, %r13d
movl 0x10(%rsp), %r12d
leaq 0x37f64(%rip), %rdi     # 0xb7158
callq 0x4340
movq %r15, 0xa0(%rbx)
movq %r13, %rdi
callq 0x45c0
movq %rbx, %rdi
callq 0x7ff04
testl %eax, %eax
jns 0x7eb1c
jmp 0x7e990