// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/bgzf.c
// Function: bgzf_read_block
int bgzf_read_block(BGZF *fp)
{
    hts_tpool_result *r;

    if (fp->errcode) return -1;

    if (fp->mt) {
    again:
        if (fp->mt->hit_eof) {
            // Further reading at EOF will always return 0
            fp->block_length = 0;
            return 0;
        }
        r = hts_tpool_next_result_wait(fp->mt->out_queue);
        bgzf_job *j = r ? (bgzf_job *)hts_tpool_result_data(r) : NULL;

        if (!j || j->errcode == BGZF_ERR_MT) {
            if (!fp->mt->free_block) {
                fp->uncompressed_block = malloc(2 * BGZF_MAX_BLOCK_SIZE);
                if (fp->uncompressed_block == NULL) return -1;
                fp->compressed_block = (char *)fp->uncompressed_block + BGZF_MAX_BLOCK_SIZE;
            } // else it's already allocated with malloc, maybe even in-use.
            if (mt_destroy(fp->mt) < 0) {
                fp->errcode = BGZF_ERR_IO;
            }
            fp->mt = NULL;
            hts_tpool_delete_result(r, 0);
            if (fp->errcode) {
                return -1;
            }
            goto single_threaded;
        }

        if (j->errcode) {
            fp->errcode = j->errcode;
            hts_log_error("BGZF decode jobs returned error %d "
                          "for block offset %"PRId64,
                          j->errcode, j->block_address);
            hts_tpool_delete_result(r, 0);
            return -1;
        }

        if (j->hit_eof) {
            if (!fp->last_block_eof && !fp->no_eof_block) {
                fp->no_eof_block = 1;
                hts_log_warning("EOF marker is absent. The input may be truncated");
            }
            fp->mt->hit_eof = 1;
        }

        // Zero length blocks in the middle of a file are (wrongly)
        // considered as EOF by many callers.  We work around this by
        // trying again to see if we hit a genuine EOF.
        if (!j->hit_eof && j->uncomp_len == 0) {
            fp->last_block_eof = 1;
            hts_tpool_delete_result(r, 0);
            goto again;
        }

        // block_length=0 and block_offset set by bgzf_seek.
        if (fp->block_length != 0) fp->block_offset = 0;
        if (!j->hit_eof) fp->block_address = j->block_address;
        fp->block_clength = j->comp_len;
        fp->block_length = j->uncomp_len;
        // bgzf_read() can change fp->block_length
        fp->last_block_eof = (fp->block_length == 0);

        if ( j->uncomp_len && j->fp->idx_build_otf )
        {
            bgzf_index_add_block(j->fp);
            j->fp->idx->ublock_addr += j->uncomp_len;
        }

        // Steal the data block as it's quicker than a memcpy.
        // We just need to make sure we delay the pool free.
        if (fp->mt->curr_job) {
            pthread_mutex_lock(&fp->mt->job_pool_m);
            pool_free(fp->mt->job_pool, fp->mt->curr_job);
            pthread_mutex_unlock(&fp->mt->job_pool_m);
        }
        fp->uncompressed_block = j->uncomp_data;
        fp->mt->curr_job = j;
        if (fp->mt->free_block) {
            free(fp->mt->free_block); // clear up last non-mt block
            fp->mt->free_block = NULL;
        }

        hts_tpool_delete_result(r, 0);
        return 0;
    }

    uint8_t header[BLOCK_HEADER_LENGTH], *compressed_block;
    int count, size, block_length, remaining;

 single_threaded:
    size = 0;

    int64_t block_address;
    block_address = bgzf_htell(fp);

    // Reading an uncompressed file
    if ( !fp->is_compressed )
    {
        count = hread(fp->fp, fp->uncompressed_block, BGZF_MAX_BLOCK_SIZE);
        if (count < 0)  // Error
        {
            hts_log_error("Failed to read uncompressed data "
                          "at offset %"PRId64"%s%s",
                          block_address, errno ? ": " : "", strerror(errno));
            fp->errcode |= BGZF_ERR_IO;
            return -1;
        }
        else if (count == 0)  // EOF
        {
            fp->block_length = 0;
            return 0;
        }
        if (fp->block_length != 0) fp->block_offset = 0;
        fp->block_address = block_address;
        fp->block_length = count;
        return 0;
    }

    // Reading compressed file
    if ( fp->is_gzip && fp->gz_stream ) // is this is an initialized gzip stream?
    {
        count = inflate_gzip_block(fp);
        if ( count<0 )
        {
            hts_log_error("Reading GZIP stream failed at offset %"PRId64,
                          block_address);
            fp->errcode |= BGZF_ERR_ZLIB;
            return -1;
        }
        fp->block_length = count;
        fp->block_address = block_address;
        return 0;
    }
    if (fp->cache_size && load_block_from_cache(fp, block_address)) return 0;

    // loop to skip empty bgzf blocks
    while (1)
    {
        count = hread(fp->fp, header, sizeof(header));
        if (count == 0) { // no data read
            if (!fp->last_block_eof && !fp->no_eof_block && !fp->is_gzip) {
                fp->no_eof_block = 1;
                hts_log_warning("EOF marker is absent. The input may be truncated");
            }
            fp->block_length = 0;
            return 0;
        }
        int ret = 0;
        if ( count != sizeof(header) || (ret=check_header(header))==-2 )
        {
            fp->errcode |= BGZF_ERR_HEADER;
            hts_log_error("%s BGZF header at offset %"PRId64,
                          ret ? "Invalid" : "Failed to read",
                          block_address);
            return -1;
        }
        if ( ret==-1 )
        {
            // GZIP, not BGZF
            uint8_t *cblock = (uint8_t*)fp->compressed_block;
            memcpy(cblock, header, sizeof(header));
            count = hread(fp->fp, cblock+sizeof(header), BGZF_BLOCK_SIZE - sizeof(header)) + sizeof(header);

            fp->is_gzip = 1;
            fp->gz_stream = (z_stream*) calloc(1,sizeof(z_stream));
            // Set up zlib, using a window size of 15, and its built-in GZIP header processing (+16).
            int ret = inflateInit2(fp->gz_stream, 15 + 16);
            if (ret != Z_OK)
            {
                hts_log_error("Call to inflateInit2 failed: %s", bgzf_zerr(ret, fp->gz_stream));
                fp->errcode |= BGZF_ERR_ZLIB;
                return -1;
            }
            fp->gz_stream->avail_in = count;
            fp->gz_stream->next_in  = cblock;
            count = inflate_gzip_block(fp);
            if ( count<0 )
            {
                hts_log_error("Reading GZIP stream failed at offset %"PRId64,
                              block_address);
                fp->errcode |= BGZF_ERR_ZLIB;
                return -1;
            }
            fp->block_length = count;
            fp->block_address = block_address;
            if ( fp->idx_build_otf ) return -1; // cannot build index for gzip
            return 0;
        }
        size = count;
        block_length = unpackInt16((uint8_t*)&header[16]) + 1; // +1 because when writing this number, we used "-1"
        if (block_length < BLOCK_HEADER_LENGTH)
        {
            hts_log_error("Invalid BGZF block length at offset %"PRId64,
                          block_address);
            fp->errcode |= BGZF_ERR_HEADER;
            return -1;
        }
        compressed_block = (uint8_t*)fp->compressed_block;
        memcpy(compressed_block, header, BLOCK_HEADER_LENGTH);
        remaining = block_length - BLOCK_HEADER_LENGTH;
        count = hread(fp->fp, &compressed_block[BLOCK_HEADER_LENGTH], remaining);
        if (count != remaining) {
            hts_log_error("Failed to read BGZF block data at offset %"PRId64
                          " expected %d bytes; hread returned %d",
                          block_address, remaining, count);
            fp->errcode |= BGZF_ERR_IO;
            return -1;
        }
        size += count;
        if ((count = inflate_block(fp, block_length)) < 0) {
            hts_log_debug("Inflate block operation failed for "
                          "block at offset %"PRId64": %s",
                          block_address, bgzf_zerr(count, NULL));
            fp->errcode |= BGZF_ERR_ZLIB;
            return -1;
        }
        fp->last_block_eof = (count == 0);
        if ( count ) break;     // otherwise an empty bgzf block
        block_address = bgzf_htell(fp); // update for new block start
    }
    if (fp->block_length != 0) fp->block_offset = 0; // Do not reset offset if this read follows a seek.
    fp->block_address = block_address;
    fp->block_length = count;
    if ( fp->idx_build_otf )
    {
        bgzf_index_add_block(fp);
        fp->idx->ublock_addr += count;
    }
    cache_block(fp, size);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
cmpl $0x0, %eax
je 0xcedb
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0xd2ae
jmp 0xceec
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x0, 0x68(%rax)
je 0xcf11
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xd9b1
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x20(%rax), %rdi
callq 0x4cf90
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xcf3c
movq -0x18(%rbp), %rdi
callq 0x4d460
movq %rax, -0x80(%rbp)
jmp 0xcf44
xorl %eax, %eax
movq %rax, -0x80(%rbp)
jmp 0xcf44
movq -0x80(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xcf64
movq -0x20(%rbp), %rax
cmpl $0x10, 0x20018(%rax)
jne 0xd011
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, 0x60(%rax)
jne 0xcfb6
movl $0x20000, %edi          # imm = 0x20000
callq 0x4650
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0xcf9f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
addq $0x10000, %rcx          # imm = 0x10000
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0xd9c0
cmpl $0x0, %eax
jge 0xcfd9
movq -0x10(%rbp), %rax
movl (%rax), %ecx
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl $0x4, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x4d410
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
cmpl $0x0, %eax
je 0xd00c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
jmp 0xd2b0
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20018(%rax)
je 0xd084
movq -0x20(%rbp), %rax
movl 0x20018(%rax), %edx
movq -0x10(%rbp), %rax
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movl 0x20018(%rax), %ecx
movq -0x20(%rbp), %rax
movq 0x20020(%rax), %r8
movl $0x1, %edi
leaq 0xe1b96(%rip), %rsi     # 0xeebf5
leaq 0xe1b9f(%rip), %rdx     # 0xeec05
movb $0x0, %al
callq 0x1b030
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x4d410
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20028(%rax)
je 0xd0f0
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x1d, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xd0e1
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x12, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xd0e1
movq -0x10(%rbp), %rax
movl (%rax), %ecx
andl $0xfffbffff, %ecx       # imm = 0xFFFBFFFF
orl $0x40000, %ecx          # imm = 0x40000
movl %ecx, (%rax)
movl $0x3, %edi
leaq 0xe1b22(%rip), %rsi     # 0xeebf5
leaq 0xe1b63(%rip), %rdx     # 0xeec3d
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movl $0x1, 0x68(%rax)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20028(%rax)
jne 0xd12f
movq -0x20(%rbp), %rax
cmpq $0x0, 0x20010(%rax)
jne 0xd12f
movq -0x10(%rbp), %rax
movl (%rax), %ecx
andl $0xdfffffff, %ecx       # imm = 0xDFFFFFFF
orl $0x20000000, %ecx       # imm = 0x20000000
movl %ecx, (%rax)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x4d410
jmp 0xceec
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0xd144
movq -0x10(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20028(%rax)
jne 0xd164
movq -0x20(%rbp), %rax
movq 0x20020(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movq 0x10008(%rax), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x20(%rbp), %rax
movq 0x20010(%rax), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
sete %al
andb $0x1, %al
movzbl %al, %edx
movq -0x10(%rbp), %rax
movl (%rax), %ecx
andl $0x1, %edx
shll $0x1d, %edx
andl $0xdfffffff, %ecx       # imm = 0xDFFFFFFF
orl %edx, %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x20010(%rax)
je 0xd1f7
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x58(%rax)
je 0xd1f7
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0xdb40
movq -0x20(%rbp), %rax
movq 0x20010(%rax), %rcx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq 0x50(%rax), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0xd244
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
addq $0x30, %rdi
callq 0x4730
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x822f0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
addq $0x30, %rdi
callq 0x4330
movq -0x20(%rbp), %rcx
addq $0x10010, %rcx          # imm = 0x10010
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, 0x60(%rax)
je 0xd297
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x60(%rax), %rdi
callq 0x45a0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq $0x0, 0x60(%rax)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x4d410
movl $0x0, -0x4(%rbp)
jmp 0xd9b1
jmp 0xd2b0
movl $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0xdd80
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xd3e8
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
movl $0x10000, %edx          # imm = 0x10000
callq 0xde00
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jge 0xd392
movq -0x60(%rbp), %rax
movq %rax, -0x90(%rbp)
callq 0x4050
movl (%rax), %edx
leaq 0xe2c5c(%rip), %rax     # 0xeff75
leaq 0xe2e2e(%rip), %rcx     # 0xf014e
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x88(%rbp)
callq 0x4050
movl (%rax), %edi
callq 0x4130
movq -0x90(%rbp), %rcx
movq -0x88(%rbp), %r8
movq %rax, %r9
movl $0x1, %edi
leaq 0xe189e(%rip), %rsi     # 0xeebf5
leaq 0xe1910(%rip), %rdx     # 0xeec6e
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x4, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
cmpl $0x0, -0x4c(%rbp)
jne 0xd3af
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xd9b1
jmp 0xd3b1
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0xd3c6
movq -0x10(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x60(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x4c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xd9b1
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xd484
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0xd484
movq -0x10(%rbp), %rdi
callq 0xdeb0
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jge 0xd462
movq -0x60(%rbp), %rcx
movl $0x1, %edi
leaq 0xe17ce(%rip), %rsi     # 0xeebf5
leaq 0xe1873(%rip), %rdx     # 0xeeca1
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x1, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
movl -0x4c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x60(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xd9b1
movq -0x10(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0xd4ac
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0xe160
cmpl $0x0, %eax
je 0xd4ac
movl $0x0, -0x4(%rbp)
jmp 0xd9b1
jmp 0xd4ae
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
leaq -0x40(%rbp), %rsi
movl $0x12, %edx
callq 0xde00
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jne 0xd542
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x1d, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xd52b
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x12, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xd52b
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0xd52b
movq -0x10(%rbp), %rax
movl (%rax), %ecx
andl $0xfffbffff, %ecx       # imm = 0xFFFBFFFF
orl $0x40000, %ecx          # imm = 0x40000
movl %ecx, (%rax)
movl $0x3, %edi
leaq 0xe16d8(%rip), %rsi     # 0xeebf5
leaq 0xe1719(%rip), %rdx     # 0xeec3d
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xd9b1
movl $0x0, -0x64(%rbp)
movslq -0x4c(%rbp), %rax
cmpq $0x12, %rax
jne 0xd564
leaq -0x40(%rbp), %rdi
callq 0xe270
movl %eax, -0x64(%rbp)
cmpl $-0x2, %eax
jne 0xd5c7
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x2, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl -0x64(%rbp), %edx
leaq 0xe1760(%rip), %rcx     # 0xeecef
leaq 0xe1751(%rip), %rax     # 0xeece7
cmpl $0x0, %edx
cmovneq %rax, %rcx
movq -0x60(%rbp), %r8
movl $0x1, %edi
leaq 0xe1648(%rip), %rsi     # 0xeebf5
leaq 0xe1716(%rip), %rdx     # 0xeecca
movb $0x0, %al
callq 0x1b030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
cmpl $-0x1, -0x64(%rbp)
jne 0xd77a
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
movq %rcx, 0x8(%rax)
movw -0x30(%rbp), %cx
movw %cx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x70(%rbp), %rsi
addq $0x12, %rsi
movl $0xfeee, %edx           # imm = 0xFEEE
callq 0xde00
addq $0x12, %rax
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, (%rax)
movl $0x1, %edi
movl $0x70, %esi
callq 0x42f0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
movl $0x1f, %esi
leaq 0xe152a(%rip), %rdx     # 0xeeb85
movl $0x70, %ecx
callq 0x43d0
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
je 0xd6c8
movl -0x74(%rbp), %edi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rsi
callq 0xcd40
movq %rax, %rcx
movl $0x1, %edi
leaq 0xe1568(%rip), %rsi     # 0xeebf5
leaq 0xe166a(%rip), %rdx     # 0xeecfe
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x1, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
movl -0x4c(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movl %ecx, 0x8(%rax)
movq -0x70(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
callq 0xdeb0
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jge 0xd742
movq -0x60(%rbp), %rcx
movl $0x1, %edi
leaq 0xe14ee(%rip), %rsi     # 0xeebf5
leaq 0xe1593(%rip), %rdx     # 0xeeca1
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x1, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
movl -0x4c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x60(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x58(%rax)
je 0xd76e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
movl $0x0, -0x4(%rbp)
jmp 0xd9b1
movl -0x4c(%rbp), %eax
movl %eax, -0x50(%rbp)
leaq -0x40(%rbp), %rdi
addq $0x10, %rdi
callq 0xe340
addl $0x1, %eax
movl %eax, -0x54(%rbp)
cmpl $0x12, -0x54(%rbp)
jge 0xd7e4
movq -0x60(%rbp), %rcx
movl $0x1, %edi
leaq 0xe144c(%rip), %rsi     # 0xeebf5
leaq 0xe156e(%rip), %rdx     # 0xeed1e
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x2, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
movq %rcx, 0x8(%rax)
movw -0x30(%rbp), %cx
movw %cx, 0x10(%rax)
movl -0x54(%rbp), %eax
subl $0x12, %eax
movl %eax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x48(%rbp), %rsi
addq $0x12, %rsi
movslq -0x58(%rbp), %rdx
callq 0xde00
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x58(%rbp), %eax
je 0xd88b
movq -0x60(%rbp), %rcx
movl -0x58(%rbp), %r8d
movl -0x4c(%rbp), %r9d
movl $0x1, %edi
leaq 0xe13a5(%rip), %rsi     # 0xeebf5
leaq 0xe14ef(%rip), %rdx     # 0xeed46
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x4, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
movl -0x4c(%rbp), %eax
addl -0x50(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0xe360
movl %eax, -0x4c(%rbp)
cmpl $0x0, %eax
jge 0xd910
movq -0x60(%rbp), %rax
movq %rax, -0x98(%rbp)
movl -0x4c(%rbp), %edi
xorl %eax, %eax
movl %eax, %esi
callq 0xcd40
movq -0x98(%rbp), %rcx
movq %rax, %r8
movl $0x5, %edi
leaq 0xe1320(%rip), %rsi     # 0xeebf5
leaq 0xe14bc(%rip), %rdx     # 0xeed98
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x1, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd9b1
cmpl $0x0, -0x4c(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %edx
movq -0x10(%rbp), %rax
movl (%rax), %ecx
andl $0x1, %edx
shll $0x1d, %edx
andl $0xdfffffff, %ecx       # imm = 0xDFFFFFFF
orl %edx, %ecx
movl %ecx, (%rax)
cmpl $0x0, -0x4c(%rbp)
je 0xd93a
jmp 0xd94c
movq -0x10(%rbp), %rdi
callq 0xdd80
movq %rax, -0x60(%rbp)
jmp 0xd4ae
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0xd961
movq -0x10(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x60(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x4c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x58(%rax)
je 0xd99e
movq -0x10(%rbp), %rdi
callq 0xdb40
movslq -0x4c(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0xe430
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)