// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
pushq $-0x1
popq %rbp
cmpw $0x0, (%rdi)
je 0x9dac
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rbx
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x9ed7
leaq 0x6cc65(%rip), %r13     # 0x76a28
pushq $0x3
popq %rbp
xorl %r12d, %r12d
cmpl $0x0, 0x68(%rax)
jne 0xa1fa
movq 0x20(%rax), %rdi
callq 0x2bca5
movq %rax, %r14
testq %rax, %rax
je 0x9e7e
movq %r14, %rdi
callq 0x2bfc2
testq %rax, %rax
je 0x9e7e
movq %rax, %r15
movl 0x20018(%rax), %eax
testl %eax, %eax
jne 0x9e75
cmpl $0x0, 0x20028(%r15)
je 0x9e50
movl (%rbx), %eax
testl $0x20040000, %eax       # imm = 0x20040000
jne 0xa0da
orl $0x40000, %eax          # imm = 0x40000
movl %eax, (%rbx)
movl %ebp, %edi
leaq 0x6cbb3(%rip), %rsi     # 0x769e0
movq %r13, %rdx
xorl %eax, %eax
callq 0x110c6
cmpl $0x0, 0x20028(%r15)
movq 0x48(%rbx), %rax
movl $0x1, 0x68(%rax)
jne 0xa0e8
cmpq $0x0, 0x20010(%r15)
jne 0xa0d5
orb $0x20, 0x3(%rbx)
movq %r14, %rdi
xorl %esi, %esi
callq 0x2bfa2
movq 0x48(%rbx), %rax
jmp 0x9dc9
cmpl $0x10, %eax
jne 0xa09d
movq 0x48(%rbx), %r15
cmpq $0x0, 0x60(%r15)
jne 0x9eaa
movl $0x20000, %edi          # imm = 0x20000
callq 0x4680
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0xa33e
addq $0x10000, %rax          # imm = 0x10000
movq %rax, 0x30(%rbx)
movq %r15, %rdi
callq 0xa64f
testl %eax, %eax
jns 0x9ebb
movw $0x4, (%rbx)
andq $0x0, 0x48(%rbx)
movq %r14, %rdi
xorl %esi, %esi
callq 0x2bfa2
cmpw $0x0, (%rbx)
pushq $-0x1
popq %rbp
jne 0x9d9b
movq %rbx, %rdi
callq 0xa7e5
movq %rax, %r15
movl (%rbx), %eax
btl $0x1e, %eax
jb 0x9f20
movq 0x28(%rbx), %rsi
movq 0x40(%rbx), %rdi
movl $0x10000, %edx          # imm = 0x10000
callq 0xa82f
testl %eax, %eax
js 0xa02d
je 0xa1fa
cmpl $0x0, 0x8(%rbx)
je 0x9f14
andl $0x0, 0x10(%rbx)
movq %r15, 0x18(%rbx)
movl %eax, 0x8(%rbx)
jmp 0xa1fe
testl %eax, %eax
js 0xa076
cmpl $0x0, 0x4(%rbx)
je 0x9f43
movq %rbx, %rdi
movq %r15, %rsi
callq 0xaa53
xorl %ebp, %ebp
testl %eax, %eax
jne 0x9d9b
leaq 0x20(%rsp), %r13
movq 0x40(%rbx), %rdi
movq %r13, %rsi
pushq $0x12
popq %rdx
callq 0xa82f
cmpl $0x12, %eax
jne 0xa1c3
movq %r13, %rdi
callq 0xab58
cmpl $-0x1, %eax
je 0xa205
cmpl $-0x2, %eax
je 0xa291
movzwl 0x30(%rsp), %ebp
cmpl $0x10, %ebp
jbe 0xa2bb
movq 0x30(%rbx), %rsi
movzwl 0x30(%rsp), %eax
movw %ax, 0x10(%rsi)
movdqa 0x20(%rsp), %xmm0
movdqu %xmm0, (%rsi)
leal -0x11(%rbp), %r12d
movq 0x40(%rbx), %rdi
addq $0x12, %rsi
movq %r12, %rdx
callq 0xa82f
movq %rax, %r14
cmpl %r14d, %r12d
jne 0xa2db
movq $0x10000, 0x18(%rsp)    # imm = 0x10000
movq 0x28(%rbx), %rdi
movq 0x30(%rbx), %rdx
movl %ebp, %eax
movl -0x7(%rdx,%rax), %r8d
addq $0x12, %rdx
leaq 0x18(%rsp), %rsi
movq %r12, %rcx
callq 0xcaf7
testl %eax, %eax
js 0xa301
movq 0x18(%rsp), %r12
testl %r12d, %r12d
js 0xa313
sete %al
movzbl %al, %eax
shll $0x1d, %eax
movl (%rbx), %ecx
movl $0xdfffffff, %edx       # imm = 0xDFFFFFFF
andl %edx, %ecx
orl %eax, %ecx
movl %ecx, (%rbx)
testl %r12d, %r12d
jne 0xa346
movq %rbx, %rdi
callq 0xa7e5
movq %rax, %r15
jmp 0x9f48
callq 0x4050
movl (%rax), %edi
testl %edi, %edi
leaq 0x6dd19(%rip), %rax     # 0x77d56
leaq 0x6dec3(%rip), %r14     # 0x77f07
cmoveq %rax, %r14
callq 0x4150
leaq 0x6c98c(%rip), %rsi     # 0x769e0
leaq 0x6c9fe(%rip), %rdx     # 0x76a59
pushq $0x1
popq %rdi
movq %r15, %rcx
movq %r14, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0x110c6
orb $0x4, (%rbx)
jmp 0x9d9b
cmpq $0x0, 0x60(%rbx)
je 0x9f28
movq %rbx, %rdi
callq 0xa898
testl %eax, %eax
js 0xa436
movl %eax, 0x8(%rbx)
movq %r15, 0x18(%rbx)
jmp 0xa1fe
movw %ax, (%rbx)
movl 0x20018(%r15), %ecx
movq 0x20020(%r15), %r8
leaq 0x6c92b(%rip), %rsi     # 0x769e0
leaq 0x6c934(%rip), %rdx     # 0x769f0
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
movq %r14, %rdi
xorl %esi, %esi
callq 0x2bfa2
jmp 0xa33e
movb $0x1, %r12b
jmp 0xa0e8
movq 0x48(%rbx), %rax
movl $0x1, 0x68(%rax)
xorl %r12d, %r12d
cmpl $0x0, 0x8(%rbx)
je 0xa0f2
andl $0x0, 0x10(%rbx)
testb %r12b, %r12b
je 0xa102
movq 0x20020(%r15), %rax
movq %rax, 0x18(%rbx)
movl 0x10008(%r15), %eax
movl %eax, 0xc(%rbx)
movl 0x20010(%r15), %eax
movl %eax, 0x8(%rbx)
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
shll $0x1d, %ecx
movl $0xdfffffff, %eax       # imm = 0xDFFFFFFF
andl (%rbx), %eax
orl %ecx, %eax
movl %eax, (%rbx)
cmpq $0x0, 0x20010(%r15)
je 0xa155
movq (%r15), %rdi
cmpl $0x0, 0x58(%rdi)
je 0xa155
callq 0xa757
movq 0x20010(%r15), %rax
movq (%r15), %rcx
movq 0x50(%rcx), %rcx
addq %rax, 0x10(%rcx)
movq 0x48(%rbx), %rdi
cmpq $0x0, 0x8(%rdi)
je 0xa18a
addq $0x30, %rdi
callq 0x4750
movq 0x48(%rbx), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x4924e
movq 0x48(%rbx), %rdi
addq $0x30, %rdi
callq 0x4340
movq 0x48(%rbx), %rdi
movq %r15, %rax
addq $0x10010, %rax          # imm = 0x10010
movq %rax, 0x28(%rbx)
movq %r15, 0x8(%rdi)
movq 0x60(%rdi), %rdi
testq %rdi, %rdi
je 0xa1b2
callq 0x45c0
movq 0x48(%rbx), %rax
andq $0x0, 0x60(%rax)
xorl %ebp, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0x2bfa2
jmp 0x9d9b
testl %eax, %eax
leaq 0x6c90e(%rip), %rcx     # 0x76ada
jne 0xa298
movl (%rbx), %eax
testl $0xa0040000, %eax       # imm = 0xA0040000
jne 0xa1fa
orl $0x40000, %eax          # imm = 0x40000
movl %eax, (%rbx)
leaq 0x6c7f7(%rip), %rsi     # 0x769e0
leaq 0x6c838(%rip), %rdx     # 0x76a28
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x110c6
andl $0x0, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0x9d9b
movq 0x30(%rbx), %r12
movzwl 0x30(%rsp), %eax
movw %ax, 0x10(%r12)
movdqa 0x20(%rsp), %xmm0
movdqu %xmm0, (%r12)
movq 0x40(%rbx), %rdi
leaq 0x12(%r12), %rsi
movl $0xfeee, %edx           # imm = 0xFEEE
callq 0xa82f
movq %rax, %r14
orb $-0x80, 0x3(%rbx)
pushq $0x1
popq %rdi
pushq $0x70
popq %rsi
callq 0x4300
movq %rax, 0x60(%rbx)
leaq 0x6c720(%rip), %rdx     # 0x76970
pushq $0x1f
popq %rsi
pushq $0x70
popq %rcx
movq %rax, %rdi
callq 0x43e0
testl %eax, %eax
je 0xa405
movq 0x60(%rbx), %rsi
movl %eax, %edi
callq 0x9cf6
leaq 0x6c768(%rip), %rsi     # 0x769e0
leaq 0x6c86a(%rip), %rdx     # 0x76ae9
pushq $0x1
popq %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x110c6
jmp 0xa33b
leaq 0x6c83a(%rip), %rcx     # 0x76ad2
orb $0x2, (%rbx)
leaq 0x6c73e(%rip), %rsi     # 0x769e0
leaq 0x6c80c(%rip), %rdx     # 0x76ab5
pushq $0x1
popq %rdi
movq %r15, %r8
xorl %eax, %eax
callq 0x110c6
jmp 0xa33e
leaq 0x6c71e(%rip), %rsi     # 0x769e0
leaq 0x6c840(%rip), %rdx     # 0x76b09
pushq $0x1
popq %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x110c6
orb $0x2, (%rbx)
jmp 0xa33e
leaq 0x6c6fe(%rip), %rsi     # 0x769e0
leaq 0x6c848(%rip), %rdx     # 0x76b31
pushq $0x1
popq %rdi
movq %r15, %rcx
movl %r12d, %r8d
movl %r14d, %r9d
xorl %eax, %eax
callq 0x110c6
orb $0x4, (%rbx)
jmp 0xa33e
cmpl $-0x2, %eax
pushq $0x20
popq %rax
pushq $0x1
popq %rcx
cmovel %eax, %ecx
orl %ecx, (%rbx)
pushq $-0x1
popq %r12
movl %r12d, %edi
xorl %esi, %esi
callq 0x9cf6
leaq 0x6c6bc(%rip), %rsi     # 0x769e0
leaq 0x6c858(%rip), %rdx     # 0x76b83
pushq $0x5
popq %rdi
movq %r15, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x110c6
orb $0x1, (%rbx)
pushq $-0x1
popq %rbp
jmp 0x9d9b
cmpl $0x0, 0x8(%rbx)
je 0xa350
andl $0x0, 0x10(%rbx)
movq %r15, 0x18(%rbx)
movl %r12d, 0x8(%rbx)
cmpl $0x0, 0x58(%rbx)
pushq $0x3
popq %r13
je 0xa379
movq %rbx, %rdi
callq 0xa757
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movq 0x50(%rbx), %rax
addq %r12, 0x10(%rax)
movl 0x4(%rbx), %ecx
xorl %ebp, %ebp
cmpl $0x10001, %ecx          # imm = 0x10001
jl 0x9d9b
cmpl $0x10000, 0x8(%rbx)     # imm = 0x10000
ja 0x9d9b
movq 0x38(%rbx), %rax
movq (%rax), %r15
movl 0x4(%r15), %r12d
movl %r12d, %edx
shll $0x10, %edx
addl $0x10000, %edx          # imm = 0x10000
cmpl %ecx, %edx
jbe 0xa459
movl 0x8(%rax), %esi
movl (%r15), %edx
cmpl %edx, %esi
jb 0xa3c6
andl $0x0, 0x8(%rax)
xorl %esi, %esi
leal 0x1(%rsi), %edi
xorl %r8d, %r8d
cmpl %edx, %edi
cmovael %r8d, %edi
cmpl %esi, %edi
je 0xa48e
movq 0x10(%r15), %r9
leal (%rdi,%rdi), %ecx
andl $0x1e, %ecx
movl %r13d, %r11d
shll %cl, %r11d
movl %edi, %r10d
shrl $0x4, %r10d
testl %r11d, (%r9,%r10,4)
je 0xa496
incl %edi
cmpl %edx, %edi
cmovel %r8d, %edi
jmp 0xa3d2
addl $0x12, %r14d
movq 0x60(%rbx), %rax
movl %r14d, 0x8(%rax)
movq %r12, (%rax)
movq %rbx, %rdi
callq 0xa898
testl %eax, %eax
pushq $-0x1
popq %rbp
js 0xa436
movl %eax, 0x8(%rbx)
movq %r15, 0x18(%rbx)
xorl %ebp, %ebp
cmpl 0x58(%rbx), %ebp
sbbl %ebp, %ebp
jmp 0x9d9b
leaq 0x6c5a3(%rip), %rsi     # 0x769e0
leaq 0x6c648(%rip), %rdx     # 0x76a8c
pushq $0x1
popq %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x110c6
orb $0x1, (%rbx)
jmp 0x9d9b
movl $0x10000, %edi          # imm = 0x10000
callq 0x4680
testq %rax, %rax
je 0x9d9b
movq %rax, 0x10(%rsp)
movq 0x18(%rbx), %r13
movl 0x8(%r15), %eax
cmpl 0xc(%r15), %eax
jb 0xa4db
movl (%r15), %esi
addl %r12d, %r12d
cmpl %r12d, %esi
jbe 0xa4c9
decl %esi
jmp 0xa4cb
movl %esi, 0x8(%rax)
jmp 0xa1fe
movl %edi, 0x8(%rax)
movq 0x20(%r15), %rax
movl %edi, %esi
imulq $0x18, %rsi, %rsi
movq 0x8(%rax,%rsi), %rax
cmpl %edi, %edx
je 0xa463
movl (%r9,%r10,4), %edx
testl %r11d, %edx
jne 0xa463
btsl %ecx, %edx
movl %edx, (%r9,%r10,4)
movl 0x4(%r15), %r12d
decl %r12d
movl %r12d, 0x4(%r15)
jmp 0xa463
incl %esi
movq %r15, %rdi
callq 0xcc84
testl %eax, %eax
js 0xa5bb
movl (%r15), %edx
leal -0x1(%rdx), %r8d
movq %r13, %rdi
shrq $0x21, %rdi
movl %r13d, %eax
shll $0xb, %eax
xorl %eax, %edi
xorl %r13d, %edi
andl %r8d, %edi
movq 0x10(%r15), %rax
movl %edi, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %esi
leal (%rdi,%rdi), %ecx
shrl %cl, %esi
testb $0x2, %sil
je 0xa515
movl %edi, %esi
jmp 0xa59b
pushq $0x1
popq %r10
movl %edi, %r9d
movq %rdx, 0x8(%rsp)
movl %edx, %esi
movl %r9d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %r11d
leal (%r9,%r9), %ecx
andl $0x1e, %ecx
movl %r11d, %r12d
shrl %cl, %r12d
testb $0x2, %r12b
jne 0xa579
testb $0x1, %r12b
jne 0xa553
movq 0x18(%r15), %r12
movl %r9d, %edx
cmpq %r13, (%r12,%rdx,8)
je 0xa579
btl %ecx, %r11d
cmovbl %r9d, %esi
addl %r10d, %r9d
andl %r8d, %r9d
incl %r10d
cmpl %edi, %r9d
jne 0xa523
movb $0x1, %cl
movq 0x8(%rsp), %rdx
movl %edx, %r8d
cmpl %edx, %esi
je 0xa589
jmp 0xa59b
shrl %cl, %r11d
testb $0x2, %r11b
sete %cl
movl %esi, %r8d
movl %r9d, %edi
cmpl 0x8(%rsp), %r8d
cmovel %edi, %r8d
testb %cl, %cl
cmovnel %edi, %r8d
movl %r8d, %esi
movl %esi, %edx
shrl $0x4, %edx
movl (%rax,%rdx,4), %edi
leal (%rsi,%rsi), %ecx
andl $0x1e, %ecx
movl %edi, %r8d
shrl %cl, %r8d
testb $0x2, %r8b
jne 0xa5ca
testb $0x1, %r8b
jne 0xa5fa
movq 0x10(%rsp), %rdi
callq 0x45c0
jmp 0x9d9b
movq 0x18(%r15), %r8
movl %esi, %esi
pushq $0x3
popq %r9
shll %cl, %r9d
movq %r13, (%r8,%rsi,8)
notl %r9d
andl %r9d, %edi
movl %edi, (%rax,%rdx,4)
movq 0x4(%r15), %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, 0x4(%r15)
jmp 0xa618
movq 0x18(%r15), %r8
pushq $0x3
popq %r9
shll %cl, %r9d
movl %esi, %esi
movq %r13, (%r8,%rsi,8)
notl %r9d
andl %r9d, %edi
movl %edi, (%rax,%rdx,4)
incl 0x4(%r15)
movq 0x20(%r15), %rax
imulq $0x18, %rsi, %rcx
movslq 0x8(%rbx), %rdx
movl %edx, (%rax,%rcx)
addl $0x12, %r14d
movslq %r14d, %rsi
addq 0x18(%rbx), %rsi
movq %rsi, 0x10(%rax,%rcx)
movq 0x10(%rsp), %rdi
movq %rdi, 0x8(%rax,%rcx)
movq 0x28(%rbx), %rsi
callq 0x43c0
jmp 0x9d9b