LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/regidx.c
// Function: regidx_build_index
int _regidx_build_index(regidx_t *idx)
{
    int iseq;
    for (iseq=0; iseq<idx->nseq; iseq++)
    {
        reglist_t *list = &idx->seq[iseq];
        int j,k, imax = 0;   // max index bin
        for (j=0; j<list->nregs; j++)
        {
            int ibeg = list->regs[j].start >> LIDX_SHIFT;
            int iend = list->regs[j].end >> LIDX_SHIFT;
            if ( imax < iend + 1 )
            {
                int old_imax = imax; 
                imax = iend + 1;
                kroundup32(imax);
                list->idx = (int*) realloc(list->idx, imax*sizeof(int));
                for (k=old_imax; k<imax; k++) list->idx[k] = -1;
            }
            if ( ibeg==iend )
            {
                if ( list->idx[ibeg]<0 ) list->idx[ibeg] = j;
            }
            else
            {
                for (k=ibeg; k<=iend; k++)
                    if ( list->idx[k]<0 ) list->idx[k] = j;
            }
            list->nidx = iend + 1;
        }
    }
    return 0;
}

// Assembly:
cmpl $0x0, (%rdi)
jle 0x1241e
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %ecx, %ecx
movq %rdi, 0x10(%rsp)
movq 0x8(%rdi), %rax
movq %rcx, 0x18(%rsp)
leaq (%rcx,%rcx,4), %rcx
cmpl $0x0, 0xc(%rax,%rcx,8)
jle 0x123f7
leaq (%rax,%rcx,8), %r15
xorl %r12d, %r12d
xorl %edx, %edx
movq %r15, 0x20(%rsp)
movq 0x18(%r15), %rax
movl (%rax,%r12,8), %ebx
movl 0x4(%rax,%r12,8), %r14d
movl %r14d, %r13d
shrl $0xd, %r13d
cmpl %r13d, %edx
jg 0x123a6
movl %r14d, %eax
shrl $0xe, %eax
orl %r13d, %eax
movl %eax, %ecx
shrl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %ebp
shrl $0x10, %ebp
orl %ecx, %ebp
leal 0x1(%rbp), %eax
movl %eax, 0xc(%rsp)
movq (%r15), %rdi
leaq 0x4(,%rbp,4), %rsi
movl %edx, %r15d
callq 0x37b0
movl %r15d, %ecx
movq 0x20(%rsp), %r15
movq %rax, (%r15)
subl %ecx, %ebp
jl 0x123a2
movl %ecx, %ecx
leaq (%rax,%rcx,4), %rdi
leaq 0x4(,%rbp,4), %rdx
movl $0xff, %esi
callq 0x3090
movl 0xc(%rsp), %edx
movl %ebx, %eax
shrl $0xd, %eax
cmpl %r13d, %eax
jne 0x123bf
movq (%r15), %rcx
cmpl $0x0, (%rcx,%rax,4)
jns 0x123e0
movl %r12d, (%rcx,%rax,4)
jmp 0x123e0
ja 0x123e0
movq (%r15), %rax
shrl $0xd, %ebx
shrl $0xd, %r14d
incq %r14
cmpl $0x0, (%rax,%rbx,4)
jns 0x123d8
movl %r12d, (%rax,%rbx,4)
incq %rbx
cmpq %rbx, %r14
jne 0x123ce
incl %r13d
movl %r13d, 0x8(%r15)
incq %r12
movslq 0xc(%r15), %rax
cmpq %rax, %r12
jl 0x12323
movq 0x18(%rsp), %rcx
incq %rcx
movq 0x10(%rsp), %rdi
movslq (%rdi), %rax
cmpq %rax, %rcx
jl 0x122fd
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/regidx.c
// Function: regidx_parse_tab
int regidx_parse_tab(const char *line, char **chr_beg, char **chr_end, reg_t *reg, void *payload, void *usr)
{
    char *ss = (char*) line;
    while ( *ss && isspace(*ss) ) ss++;
    if ( !*ss ) return -1;      // skip blank lines
    if ( *ss=='#' ) return -1;  // skip comments
    
    char *se = ss;
    while ( *se && !isspace(*se) ) se++;
    if ( !*se ) { fprintf(stderr,"Could not parse bed line: %s\n", line); return -2; }

    *chr_beg = ss;
    *chr_end = se-1;

    ss = se+1;
    reg->start = hts_parse_decimal(ss, &se, 0) - 1;
    if ( ss==se ) { fprintf(stderr,"Could not parse bed line: %s\n", line); return -2; }

    if ( !se[0] || !se[1] )
        reg->end = reg->start;
    else
    {
        ss = se+1;
        reg->end = hts_parse_decimal(ss, &se, 0);
        if ( ss==se ) reg->end = reg->start;
        else reg->end--;
    }
    
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movb (%rdi), %bl
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %bl, %bl
je 0x12d91
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movq %rcx, 0x10(%rsp)
callq 0x3410
movq (%rax), %rax
leaq 0x1(%r14), %r13
movsbq %bl, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x12c93
movb (%r13), %bl
incq %r13
testb %bl, %bl
jne 0x12c78
jmp 0x12d91
testb %bl, %bl
je 0x12d91
movzbl %bl, %eax
cmpl $0x23, %eax
je 0x12d91
leaq -0x1(%r13), %rax
movq %rax, (%rsp)
movsbq (%rax), %rbp
testq %rbp, %rbp
sete %bl
je 0x12d6a
movq %rax, 0x8(%rsp)
callq 0x3410
movq 0x8(%rsp), %rsi
movq (%rax), %rcx
testb $0x20, 0x1(%rcx,%rbp,2)
movq %rsi, %rbp
jne 0x12cff
movq %r13, (%rsp)
movsbq (%r13), %rcx
testq %rcx, %rcx
sete %bl
je 0x12d6a
movq (%rax), %rdx
incq %r13
testb $0x20, 0x1(%rdx,%rcx,2)
je 0x12cdb
decq %r13
movq %r13, %rbp
testb %bl, %bl
jne 0x12d6a
movq %rsi, (%r12)
leaq -0x1(%rbp), %rax
movq %rax, (%r15)
incq %rbp
movq %rsp, %r15
movq %rbp, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x10e09
decl %eax
movq 0x10(%rsp), %rbx
movl %eax, (%rbx)
movq (%r15), %r15
cmpq %r15, %rbp
je 0x12d6a
cmpb $0x0, (%r15)
je 0x12d63
cmpb $0x0, 0x1(%r15)
je 0x12d63
incq %r15
movq %rsp, %r14
xorl %ebp, %ebp
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x10e09
movl %eax, 0x4(%rbx)
cmpq (%r14), %r15
je 0x12d8c
decl %eax
movl %eax, 0x4(%rbx)
jmp 0x12d91
movl %eax, 0x4(%rbx)
xorl %ebp, %ebp
jmp 0x12d91
movq 0x4b277(%rip), %rax     # 0x5dfe8
movq (%rax), %rdi
leaq 0x3ba7c(%rip), %rsi     # 0x4e7f7
movq %r14, %rdx
xorl %eax, %eax
callq 0x37e0
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
jmp 0x12d91
movl (%rbx), %eax
movl %eax, 0x4(%rbx)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/regidx.c
// Function: regidx_destroy
void regidx_destroy(regidx_t *idx)
{
    int i, j;
    for (i=0; i<idx->nseq; i++)
    {
        reglist_t *list = &idx->seq[i];
        if ( idx->free )
        {
            for (j=0; j<list->nregs; j++)
                idx->free(list->payload + idx->payload_size*j);
        }
        free(list->payload);
        free(list->regs);
        free(list->idx);
    }
    free(idx->seq_names);
    free(idx->seq);
    free(idx->str.s);
    free(idx->payload);
    khash_str2int_destroy_free(idx->seq2regs);
    free(idx);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, (%rdi)
jle 0x12f60
xorl %r14d, %r14d
leaq (%r14,%r14,4), %r15
shlq $0x3, %r15
addq 0x8(%rbx), %r15
cmpq $0x0, 0x20(%rbx)
je 0x12f3b
cmpl $0x0, 0xc(%r15)
jle 0x12f3b
xorl %r12d, %r12d
movslq 0x5c(%rbx), %rdi
movslq %r12d, %r12
imulq %r12, %rdi
addq 0x20(%r15), %rdi
callq *0x20(%rbx)
incl %r12d
cmpl 0xc(%r15), %r12d
jl 0x12f20
movq 0x20(%r15), %rdi
callq 0x3370
movq 0x18(%r15), %rdi
callq 0x3370
movq (%r15), %rdi
callq 0x3370
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x12f03
movq 0x18(%rbx), %rdi
callq 0x3370
movq 0x8(%rbx), %rdi
callq 0x3370
movq 0x48(%rbx), %rdi
callq 0x3370
movq 0x60(%rbx), %rdi
callq 0x3370
movq 0x10(%rbx), %r14
testq %r14, %r14
je 0x12ff1
cmpl $0x0, (%r14)
je 0x12fce
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x10(%r14), %rax
movl %r12d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %r15d, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x12fbf
movq 0x18(%r14), %rax
movq (%rax,%r12,8), %rdi
callq 0x3370
incq %r12
movl (%r14), %eax
addl $0x2, %r15d
cmpq %rax, %r12
jb 0x12f99
movq 0x18(%r14), %rdi
callq 0x3370
movq 0x10(%r14), %rdi
callq 0x3370
movq 0x20(%r14), %rdi
callq 0x3370
movq %r14, %rdi
callq 0x3370
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3370
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/bgzf.c
// Function: inflate_block
static int inflate_block(BGZF* fp, int block_length)
{
    z_stream zs;
    zs.zalloc = NULL;
    zs.zfree = NULL;
    zs.msg = NULL;
    zs.next_in = (Bytef*)fp->compressed_block + 18;
    zs.avail_in = block_length - 16;
    zs.next_out = (Bytef*)fp->uncompressed_block;
    zs.avail_out = BGZF_MAX_BLOCK_SIZE;

    int ret = inflateInit2(&zs, -15);
    if (ret != Z_OK) {
        if (hts_verbose >= 1) {
            fprintf(stderr, "[E::%s] inflateInit2 failed: %s\n",
                    __func__, bgzf_zerr(ret, &zs));
        }
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    if ((ret = inflate(&zs, Z_FINISH)) != Z_STREAM_END) {
        if (hts_verbose >= 1) {
            fprintf(stderr, "[E::%s] inflate failed: %s\n",
                    __func__, bgzf_zerr(ret, ret == Z_DATA_ERROR ? &zs : NULL));
        }
        if ((ret = inflateEnd(&zs)) != Z_OK) {
            if (hts_verbose >= 2) {
                fprintf(stderr, "[E::%s] inflateEnd failed: %s\n",
                        __func__, bgzf_zerr(ret, NULL));
            }
        }
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    if ((ret = inflateEnd(&zs)) != Z_OK) {
        if (hts_verbose >= 1) {
            fprintf(stderr, "[E::%s] inflateEnd failed: %s\n",
                    __func__, bgzf_zerr(ret, NULL));
        }
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    return zs.total_out;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
movq $0x0, 0x30(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rdi)
movq 0x28(%rbx), %rax
addq $0x12, %rax
movq %rax, (%rdi)
addl $-0x10, %esi
movl %esi, 0x8(%rdi)
movq 0x20(%rbx), %rax
movq %rax, 0x18(%rdi)
movl $0x10000, 0x20(%rdi)    # imm = 0x10000
leaq 0x26879(%rip), %rdx     # 0x4e6fd
movl $0xfffffff1, %esi       # imm = 0xFFFFFFF1
movl $0x70, %ecx
callq 0x32e0
testl %eax, %eax
je 0x27eb3
leaq 0x365ea(%rip), %rcx     # 0x5e488
cmpl $0x0, (%rcx)
jg 0x27f1a
orb $0x1, (%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x78, %rsp
popq %rbx
popq %r14
retq
leaq 0x8(%rsp), %rdi
movl $0x4, %esi
callq 0x3310
cmpl $0x1, %eax
jne 0x27eea
leaq 0x8(%rsp), %rdi
callq 0x30e0
testl %eax, %eax
je 0x27f14
leaq 0x365ac(%rip), %rcx     # 0x5e488
cmpl $0x0, (%rcx)
jle 0x27ea3
movl %eax, %edi
callq 0x48af
jmp 0x27ea3
leaq 0x36597(%rip), %r14     # 0x5e488
cmpl $0x0, (%r14)
jg 0x27f2b
leaq 0x8(%rsp), %rdi
callq 0x30e0
testl %eax, %eax
je 0x27ea3
cmpl $0x2, (%r14)
jl 0x27ea3
movl %eax, %edi
callq 0x4880
jmp 0x27ea3
movl 0x30(%rsp), %eax
jmp 0x27eab
leaq 0x8(%rsp), %rsi
movl %eax, %edi
callq 0x481d
jmp 0x27ea3
leaq 0x8(%rsp), %rsi
movl %eax, %edi
callq 0x484a
jmp 0x27ef7
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/bgzf.c
// Function: bgzf_read
ssize_t bgzf_read(BGZF *fp, void *data, size_t length)
{
    ssize_t bytes_read = 0;
    uint8_t *output = (uint8_t*)data;
    if (length <= 0) return 0;
    assert(fp->is_write == 0);
    while (bytes_read < length) {
        int copy_length, available = fp->block_length - fp->block_offset;
        uint8_t *buffer;
        if (available <= 0) {
            int ret = bgzf_read_block(fp);
            if (ret != 0) {
                if (hts_verbose >= 2) {
                    fprintf(stderr, "[E::%s] bgzf_read_block error %d after %zd of %zu bytes\n", __func__, ret, bytes_read, length);
                }
                fp->errcode |= BGZF_ERR_ZLIB;
                return -1;
            }
            available = fp->block_length - fp->block_offset;
            if (available <= 0) break;
        }
        copy_length = length - bytes_read < available? length - bytes_read : available;
        buffer = (uint8_t*)fp->uncompressed_block;
        memcpy(output, buffer + fp->block_offset, copy_length);
        fp->block_offset += copy_length;
        output += copy_length;
        bytes_read += copy_length;
    }
    if (fp->block_offset == fp->block_length) {
        fp->block_address = htell(fp->fp);
        fp->block_offset = fp->block_length = 0;
    }
    fp->uncompressed_address += bytes_read;
    return bytes_read;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x2834e
movq %rdi, %rbx
testb $0x3, 0x2(%rdi)
jne 0x2836c
movq %rdx, %r15
movq %rsi, %r12
xorl %r14d, %r14d
movq %r15, %r13
subq %r14, %r13
jbe 0x28325
movl 0x8(%rbx), %ebp
subl 0xc(%rbx), %ebp
jg 0x282c5
movq %rbx, %rdi
callq 0x277d2
testl %eax, %eax
je 0x282ae
leaq 0x361eb(%rip), %rcx     # 0x5e488
cmpl $0x2, (%rcx)
jge 0x282f7
orb $0x1, (%rbx)
movl $0x1, %eax
xorl %ecx, %ecx
jmp 0x282c1
movl 0x8(%rbx), %ebp
subl 0xc(%rbx), %ebp
setg %cl
xorl %eax, %eax
testl %ebp, %ebp
setle %al
leal (%rax,%rax,2), %eax
testb %cl, %cl
je 0x282f1
movslq %ebp, %rax
cmpq %rax, %r13
cmovbq %r13, %rax
movslq 0xc(%rbx), %rsi
addq 0x20(%rbx), %rsi
movslq %eax, %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x3850
addl %r13d, 0xc(%rbx)
addq %r13, %r12
addq %r13, %r14
xorl %eax, %eax
testl %eax, %eax
je 0x28276
jmp 0x28320
movq 0x35cea(%rip), %rcx     # 0x5dfe8
movq (%rcx), %rdi
leaq 0x27ad2(%rip), %rsi     # 0x4fdda
leaq 0x27b04(%rip), %rdx     # 0x4fe13
movl %eax, %ecx
movq %r14, %r8
movq %r15, %r9
xorl %eax, %eax
callq 0x37e0
jmp 0x282a2
cmpl $0x3, %eax
jne 0x28353
movl 0xc(%rbx), %eax
cmpl 0x8(%rbx), %eax
jne 0x28348
movq 0x38(%rbx), %rax
movq 0x28(%rax), %rcx
addq 0x8(%rax), %rcx
subq (%rax), %rcx
movq %rcx, 0x10(%rbx)
movq $0x0, 0x8(%rbx)
addq %r14, 0x18(%rbx)
jmp 0x2835a
xorl %r14d, %r14d
jmp 0x2835a
movq $-0x1, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x27a2b(%rip), %rdi     # 0x4fd9e
leaq 0x278eb(%rip), %rsi     # 0x4fc65
leaq 0x27a2f(%rip), %rcx     # 0x4fdb0
movl $0x2b2, %edx            # imm = 0x2B2
callq 0x3180
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/bgzf.c
// Function: bgzf_flush
int bgzf_flush(BGZF *fp)
{
    if (!fp->is_write) return 0;
#ifdef BGZF_MT
    if (fp->mt) {
        if (fp->block_offset) mt_queue(fp); // guaranteed that assertion does not fail
        return mt_flush_queue(fp);
    }
#endif
    while (fp->block_offset > 0) {
        int block_length;
        if ( fp->idx_build_otf )
        {
            bgzf_index_add_block(fp);
            fp->idx->ublock_addr += fp->block_offset;
        }
        block_length = deflate_block(fp, fp->block_offset);
        if (block_length < 0) {
            if (hts_verbose >= 3) fprintf(stderr, "[E::%s] deflate_block error %d\n", __func__, block_length);
            return -1;
        }
        if (hwrite(fp->fp, fp->compressed_block, block_length) != block_length) {
            if (hts_verbose >= 1) fprintf(stderr, "[E::%s] hwrite error (wrong size)\n", __func__);
            fp->errcode |= BGZF_ERR_IO; // possibly truncated file
            return -1;
        }
        fp->block_address += block_length;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testb $0x3, 0x2(%rdi)
je 0x28673
movq %rdi, %r14
cmpq $0x0, 0x40(%rdi)
movl 0xc(%rdi), %eax
je 0x285e4
testl %eax, %eax
je 0x285ce
movq %r14, %rdi
callq 0x286d8
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x28742
testl %eax, %eax
jle 0x28673
cmpl $0x0, 0x50(%r14)
je 0x28607
movq %r14, %rdi
callq 0x27f39
movslq 0xc(%r14), %rax
movq 0x48(%r14), %rcx
addq %rax, 0x10(%rcx)
movl 0xc(%r14), %esi
movq %r14, %rdi
callq 0x2888d
testl %eax, %eax
js 0x28686
movq 0x28(%r14), %r13
movq 0x38(%r14), %rbp
movl %eax, %r15d
movq 0x8(%rbp), %rdi
movq 0x18(%rbp), %rbx
subq %rdi, %rbx
cmpq %r15, %rbx
movq %r15, %r12
cmovbq %rbx, %r12
movq %r13, %rsi
movq %r12, %rdx
callq 0x3850
addq %r12, 0x8(%rbp)
cmpq %r15, %rbx
jae 0x2865f
movq %rbp, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x2bcc6
movq %rax, %r12
cmpq %r15, %r12
jne 0x286ba
addq %r15, 0x10(%r14)
cmpl $0x0, 0xc(%r14)
jg 0x285ec
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x35dfb(%rip), %rcx     # 0x5e488
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rcx)
jl 0x28675
movq 0x3594a(%rip), %rcx     # 0x5dfe8
movq (%rcx), %rdi
leaq 0x27775(%rip), %rsi     # 0x4fe1d
leaq 0x2778e(%rip), %rdx     # 0x4fe3d
movl %eax, %ecx
xorl %eax, %eax
callq 0x37e0
jmp 0x28675
leaq 0x35dc7(%rip), %rax     # 0x5e488
cmpl $0x0, (%rax)
jg 0x286d1
orb $0x4, (%r14)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x28675
callq 0x48de
jmp 0x286c6
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/bgzf.c
// Function: deflate_block
static int deflate_block(BGZF *fp, int block_length)
{
    size_t comp_size = BGZF_MAX_BLOCK_SIZE;
    int ret;
    if ( !fp->is_gzip )
        ret = bgzf_compress(fp->compressed_block, &comp_size, fp->uncompressed_block, block_length, fp->compress_level);
    else
        ret = bgzf_gzip_compress(fp, fp->compressed_block, &comp_size, fp->uncompressed_block, block_length, fp->compress_level);

    if ( ret != 0 )
    {
        if (hts_verbose >= 3) {
            fprintf(stderr, "[E::%s] compression error %d\n", __func__, ret);
        }
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    fp->block_offset = 0;
    return comp_size;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq $0x10000, (%rsp)        # imm = 0x10000
movl (%rdi), %r8d
movq 0x28(%rdi), %rdi
movq 0x20(%rbx), %rdx
testl %r8d, %r8d
js 0x288c5
movslq %esi, %rcx
shll $0x3, %r8d
sarl $0x17, %r8d
movq %rsp, %rsi
callq 0x275fd
testl %eax, %eax
jne 0x28901
jmp 0x28927
movq 0x58(%rbx), %r14
xorl %eax, %eax
testl %esi, %esi
sete %al
shll $0x2, %eax
movq %rdx, (%r14)
movl %esi, 0x8(%r14)
movq %rdi, 0x18(%r14)
movl $0x10000, 0x20(%r14)    # imm = 0x10000
movq %r14, %rdi
movl %eax, %esi
callq 0x31f0
cmpl $-0x2, %eax
jne 0x28917
leaq 0x35b8c(%rip), %rax     # 0x5e488
cmpl $0x0, (%rax)
jg 0x28940
leaq 0x35b80(%rip), %rax     # 0x5e488
cmpl $0x3, (%rax)
jge 0x28939
orb $0x1, (%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x28931
movl 0x20(%r14), %eax
movl $0x10000, %ecx          # imm = 0x10000
subq %rax, %rcx
movq %rcx, (%rsp)
movl $0x0, 0xc(%rbx)
movl (%rsp), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x4923
jmp 0x2890d
callq 0x48fd
jmp 0x28901
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/bgzf.c
// Function: worker_aux
static int worker_aux(worker_t *w)
{
    int i, stop = 0;
    // wait for condition: to process or all done
    pthread_mutex_lock(&w->mt->lock);
    while (!w->toproc && !w->mt->done)
        pthread_cond_wait(&w->mt->cv, &w->mt->lock);
    if (w->mt->done) stop = 1;
    w->toproc = 0;
    pthread_mutex_unlock(&w->mt->lock);
    if (stop) return 1; // to quit the thread
    w->errcode = 0;
    for (i = w->i; i < w->mt->curr; i += w->mt->n_threads) {
        size_t clen = BGZF_MAX_BLOCK_SIZE;
        int ret = bgzf_compress(w->buf, &clen, w->mt->blk[i], w->mt->len[i], w->compress_level);
        if (ret != 0) {
            if (hts_verbose >= 2) fprintf(stderr, "[E::%s] bgzf_compress error %d\n", __func__, ret);
            w->errcode |= BGZF_ERR_ZLIB; // Report error
            // We're not going to do any more, so set remaining lengths to 0
            for (; i < w->mt->curr; i += w->mt->n_threads) w->mt->len[i] = 0;
            break; // Give up
        } else {
            memcpy(w->mt->blk[i], w->buf, clen);
            w->mt->len[i] = clen;
        }
    }
    __sync_fetch_and_add(&w->mt->proc_cnt, 1);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
addq $0x38, %rdi
callq 0x37a0
cmpl $0x0, 0x18(%rbx)
jne 0x29be1
movq (%rbx), %rsi
cmpl $0x0, 0xc(%rsi)
jne 0x29be1
leaq 0x60(%rsi), %rdi
addq $0x38, %rsi
callq 0x3670
jmp 0x29bc3
movq (%rbx), %rdi
movl 0xc(%rdi), %ebp
movl $0x0, 0x18(%rbx)
addq $0x38, %rdi
callq 0x3840
movl $0x1, %eax
testl %ebp, %ebp
jne 0x29ccf
movl $0x0, 0x14(%rbx)
movl 0x10(%rbx), %r12d
movq (%rbx), %rax
cmpl 0x8(%rax), %r12d
jge 0x29cc6
movq %rsp, %r14
movq $0x10000, (%rsp)        # imm = 0x10000
movq 0x8(%rbx), %rdi
movslq %r12d, %r13
movq 0x18(%rax), %rcx
movq 0x20(%rax), %rax
movq (%rcx,%r13,8), %rdx
movslq (%rax,%r13,4), %rcx
movl 0x1c(%rbx), %r8d
movq %r14, %rsi
callq 0x275fd
movl %eax, %ebp
testl %eax, %eax
je 0x29c83
leaq 0x34831(%rip), %rax     # 0x5e488
cmpl $0x2, (%rax)
jge 0x29cbf
orb $0x1, 0x14(%rbx)
movq (%rbx), %rax
cmpl 0x8(%rax), %r12d
jge 0x29ca9
movq 0x20(%rax), %rcx
movslq %r12d, %r12
movl $0x0, (%rcx,%r12,4)
addl (%rax), %r12d
cmpl 0x8(%rax), %r12d
jl 0x29c6d
jmp 0x29ca9
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movq 0x18(%rax), %rax
movq (%rax,%r13,8), %rdi
movq (%rsp), %r15
movq %r15, %rdx
callq 0x3850
movq (%rbx), %rax
movq 0x20(%rax), %rax
movl %r15d, (%rax,%r13,4)
testl %ebp, %ebp
jne 0x29cc6
movq (%rbx), %rax
addl (%rax), %r12d
cmpl 0x8(%rax), %r12d
jl 0x29c1f
jmp 0x29cc6
callq 0x4b31
jmp 0x29c5c
movq (%rbx), %rax
lock
incl 0x10(%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/hfile.c
// Function: hfile_exit
static void hfile_exit()
{
    pthread_mutex_lock(&plugins_lock);

    kh_destroy(scheme_string, schemes);

    while (plugins != NULL) {
        struct hFILE_plugin_list *p = plugins;
        if (p->plugin.destroy) p->plugin.destroy();
#ifdef ENABLE_PLUGINS
        if (p->plugin.obj) close_plugin(p->plugin.obj);
#endif
        plugins = p->next;
        free(p);
    }

    pthread_mutex_unlock(&plugins_lock);
    pthread_mutex_destroy(&plugins_lock);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x31a28(%rip), %rdi     # 0x5e578
callq 0x37a0
movq 0x31a14(%rip), %rbx     # 0x5e570
testq %rbx, %rbx
je 0x2cb84
movq 0x18(%rbx), %rdi
callq 0x3370
movq 0x10(%rbx), %rdi
callq 0x3370
movq 0x20(%rbx), %rdi
callq 0x3370
movq %rbx, %rdi
callq 0x3370
movq 0x31a15(%rip), %rbx     # 0x5e5a0
testq %rbx, %rbx
je 0x2cbb6
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x2cb9b
callq *%rax
movq 0x20(%rbx), %r14
movq %r14, 0x319fa(%rip)     # 0x5e5a0
movq %rbx, %rdi
callq 0x3370
movq %r14, %rbx
testq %r14, %r14
jne 0x2cb90
leaq 0x319bb(%rip), %rbx     # 0x5e578
movq %rbx, %rdi
callq 0x3840
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x37f0
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/hfile_net.c
// Function: hfile_plugin_init_net
int hfile_plugin_init_net(struct hFILE_plugin *self)
{
    static const struct hFILE_scheme_handler handler =
        { hopen_net, hfile_always_remote, "knetfile", 0 };

    self->name = "knetfile";
    hfile_add_scheme_handler("http", &handler);
    hfile_add_scheme_handler("ftp",  &handler);
    return 0;
}

// Assembly:
pushq %rbx
leaq 0x23b0a(%rip), %rax     # 0x5075c
movq %rax, 0x10(%rdi)
leaq 0x23b91(%rip), %rdi     # 0x507ee
leaq 0x31014(%rip), %rbx     # 0x5dc78
movq %rbx, %rsi
callq 0x2bf90
leaq 0x23b80(%rip), %rdi     # 0x507f3
movq %rbx, %rsi
callq 0x2bf90
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/sam.c
// Function: bam_plp_destroy
void bam_plp_destroy(bam_plp_t iter)
{
    lbnode_t *p, *pnext;
    if ( iter->overlaps ) kh_destroy(olap_hash, iter->overlaps);
    for (p = iter->head; p != NULL; p = pnext) {
        pnext = p->next;
        mp_free(iter->mp, p);
    }
    mp_destroy(iter->mp);
    if (iter->b) bam_destroy1(iter->b);
    free(iter->plp);
    free(iter);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x60(%rdi), %r14
testq %r14, %r14
je 0x33ce7
movq 0x18(%r14), %rdi
callq 0x3370
movq 0x10(%r14), %rdi
callq 0x3370
movq 0x20(%r14), %rdi
callq 0x3370
movq %r14, %rdi
callq 0x3370
movq 0x8(%rbx), %r14
testq %r14, %r14
je 0x33d55
movl $0x100, %ebp            # imm = 0x100
movq 0x50(%r14), %r15
movq (%rbx), %r12
decl (%r12)
movq $0x0, 0x50(%r14)
movl 0x8(%r12), %eax
cmpl %eax, 0x4(%r12)
jne 0x33d37
leal (%rax,%rax), %ecx
testl %eax, %eax
cmovel %ebp, %ecx
movl %ecx, 0x8(%r12)
movq 0x10(%r12), %rdi
movslq %ecx, %rsi
shlq $0x3, %rsi
callq 0x37b0
movq %rax, 0x10(%r12)
movq 0x10(%r12), %rax
movslq 0x4(%r12), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r12)
movq %r14, (%rax,%rcx,8)
movq %r15, %r14
testq %r15, %r15
jne 0x33cf5
movq (%rbx), %r14
cmpl $0x0, 0x4(%r14)
jle 0x33d8c
xorl %r15d, %r15d
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rax
movq 0x28(%rax), %rdi
callq 0x3370
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x3370
incq %r15
movslq 0x4(%r14), %rax
cmpq %rax, %r15
jl 0x33d62
movq 0x10(%r14), %rdi
callq 0x3370
movq %r14, %rdi
callq 0x3370
movq 0x48(%rbx), %r14
testq %r14, %r14
je 0x33db7
movq 0x28(%r14), %rdi
callq 0x3370
movq %r14, %rdi
callq 0x3370
movq 0x40(%rbx), %rdi
callq 0x3370
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3370
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/knetfile.c
// Function: knet_read
ssize_t knet_read(knetFile *fp, void *buf, size_t len)
{
	off_t l = 0;
	if (fp->fd == -1) return 0;
	if (fp->type == KNF_TYPE_FTP) {
		if (fp->is_ready == 0) {
			if (!fp->no_reconnect) kftp_reconnect(fp);
			kftp_connect_file(fp);
		}
	} else if (fp->type == KNF_TYPE_HTTP) {
		if (fp->is_ready == 0)
			khttp_connect_file(fp);
	}
	if (fp->type == KNF_TYPE_LOCAL) { // on Windows, the following block is necessary; not on UNIX
		size_t rest = len;
		ssize_t curr;
		while (rest) {
			do {
				curr = read(fp->fd, (void*)((char*)buf + l), rest);
			} while (curr < 0 && EINTR == errno);
			if (curr < 0) return -1;
			if (curr == 0) break;
			l += curr; rest -= curr;
		}
	} else l = my_netread(fp->fd, buf, len);
	fp->offset += l;
	return l;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
cmpl $-0x1, 0x4(%rdi)
je 0x4888b
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl (%rdi), %eax
cmpl $0x3, %eax
je 0x48890
cmpl $0x2, %eax
jne 0x4889e
cmpl $0x0, 0x40(%rbx)
jne 0x4889e
cmpl $0x0, 0x3c(%rbx)
jne 0x48881
movq %rbx, %rdi
callq 0x47f6f
movq %rbx, %rdi
callq 0x480e1
jmp 0x4889e
xorl %r12d, %r12d
jmp 0x488f8
cmpl $0x0, 0x40(%rbx)
jne 0x4889e
movq %rbx, %rdi
callq 0x48433
cmpl $0x1, (%rbx)
jne 0x488da
xorl %r12d, %r12d
testq %r14, %r14
je 0x488eb
leaq (%r15,%r12), %r13
movl 0x4(%rbx), %edi
movq %r13, %rsi
movq %r14, %rdx
callq 0x3220
testq %rax, %rax
jns 0x488ce
callq 0x35d0
cmpl $0x4, (%rax)
je 0x488af
jmp 0x488f1
je 0x488eb
addq %rax, %r12
subq %rax, %r14
jne 0x488ab
jmp 0x488eb
movl 0x4(%rbx), %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x48681
movq %rax, %r12
addq %r12, 0x8(%rbx)
jmp 0x488f8
movq $-0x1, %r12
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/knetfile.c
// Function: knet_seek
off_t knet_seek(knetFile *fp, off_t off, int whence)
{
	if (whence == SEEK_SET && off == fp->offset) return 0;
	if (fp->type == KNF_TYPE_LOCAL) {
		/* Be aware that lseek() returns the offset after seeking, while fseek() returns zero on success. */
		off_t offset = lseek(fp->fd, off, whence);
		if (offset == -1) return -1;
		fp->offset = offset;
		return fp->offset;
	} else if (fp->type == KNF_TYPE_FTP) {
		if (whence == SEEK_CUR) fp->offset += off;
		else if (whence == SEEK_SET) fp->offset = off;
		else if (whence == SEEK_END) fp->offset = fp->file_size + off;
		else return -1;
		fp->is_ready = 0;
		return fp->offset;
	} else if (fp->type == KNF_TYPE_HTTP) {
		if (whence == SEEK_END) { // FIXME: can we allow SEEK_END in future?
			fprintf(stderr, "[knet_seek] SEEK_END is not supported for HTTP. Offset is unchanged.\n");
			errno = ESPIPE;
			return -1;
		}
		if (whence == SEEK_CUR) fp->offset += off;
		else if (whence == SEEK_SET) fp->offset = off;
		else return -1;
		fp->is_ready = 0;
		return fp->offset;
	}
	errno = EINVAL;
	fprintf(stderr,"[knet_seek] %s\n", strerror(errno));
	return -1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
testl %edx, %edx
jne 0x48917
cmpq %rsi, 0x8(%rbx)
jne 0x48917
xorl %eax, %eax
jmp 0x48996
movl (%rbx), %eax
cmpl $0x3, %eax
je 0x4893c
cmpl $0x2, %eax
je 0x48953
cmpl $0x1, %eax
jne 0x48983
movl 0x4(%rbx), %edi
callq 0x3530
cmpq $-0x1, %rax
je 0x4898f
movq %rax, 0x8(%rbx)
jmp 0x48996
cmpl $0x1, %edx
je 0x48958
cmpl $0x2, %edx
je 0x4898a
movq $-0x1, %rax
testl %edx, %edx
jne 0x48996
jmp 0x48972
cmpl $0x1, %edx
jne 0x4895e
addq %rsi, 0x8(%rbx)
jmp 0x48976
testl %edx, %edx
je 0x48972
movq $-0x1, %rax
cmpl $0x2, %edx
jne 0x48996
addq 0x68(%rbx), %rsi
movq %rsi, 0x8(%rbx)
movl $0x0, 0x40(%rbx)
movq 0x8(%rbx), %rax
jmp 0x48996
callq 0x5589
jmp 0x4898f
callq 0x555c
movq $-0x1, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/cram/cram_codecs.c
// Function: cram_beta_decode_char
int cram_beta_decode_char(cram_slice *slice, cram_codec *c, cram_block *in, char *out, int *out_size) {
    int i, n;


    if (c->beta.nbits) {
        if (cram_not_enough_bits(in, c->beta.nbits))
            return -1;

	if (out)
	    for (i = 0, n = *out_size; i < n; i++)
		out[i] = get_bits_MSB(in, c->beta.nbits) - c->beta.offset;
	else
	    for (i = 0, n = *out_size; i < n; i++)
		get_bits_MSB(in, c->beta.nbits);
    } else {
	if (out)
	    for (i = 0, n = *out_size; i < n; i++)
		out[i] = -c->beta.offset;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rsi, %r14
movl 0x34(%rsi), %eax
testq %rax, %rax
je 0x49637
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x4965f
movq %rdx, %r12
movslq 0x14(%rdx), %rcx
subq 0x30(%rdx), %rcx
jbe 0x4965f
cmpq $0x10000000, %rcx       # imm = 0x10000000
ja 0x49608
movslq 0x38(%r12), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $-0x7, %rcx
cmpq %rax, %rcx
jb 0x4965f
movl (%r8), %r13d
xorl %ebx, %ebx
testq %r15, %r15
je 0x49670
testl %r13d, %r13d
jle 0x4965f
xorl %ebp, %ebp
movl 0x34(%r14), %esi
movq %r12, %rdi
callq 0x4934a
subl 0x30(%r14), %eax
movb %al, (%r15,%rbp)
incq %rbp
cmpq %rbp, %r13
jne 0x49619
jmp 0x4965f
xorl %ebx, %ebx
testq %r15, %r15
je 0x4965f
movslq (%r8), %rax
testq %rax, %rax
jle 0x4965f
xorl %ebx, %ebx
xorl %ecx, %ecx
movb 0x30(%r14), %dl
xorl %esi, %esi
subb %dl, %sil
movb %sil, (%r15,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x4964a
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r13d, %r13d
jle 0x4965f
movl 0x34(%r14), %esi
movq %r12, %rdi
callq 0x4934a
decl %r13d
jne 0x49675
jmp 0x4965f
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/cram/cram_codecs.c
// Function: cram_decoder_init
cram_codec *cram_decoder_init(enum cram_encoding codec,
			      char *data, int size,
			      enum cram_external_type option,
			      int version) {
    if (codec >= E_NULL && codec < E_NUM_CODECS && decode_init[codec]) {
	return decode_init[codec](data, size, option, version);
    } else {
	fprintf(stderr, "Unimplemented codec of type %s\n", cram_encoding2str(codec));
	return NULL;
    }
}

// Assembly:
cmpl $0x9, %edi
ja 0x4bc3b
movl $0x105, %eax            # imm = 0x105
btq %rdi, %rax
jb 0x4bc3b
movl %edi, %eax
leaq 0x12073(%rip), %r9      # 0x5dca0
movq %rsi, %rdi
movl %edx, %esi
movl %ecx, %edx
movl %r8d, %ecx
jmpq *(%r9,%rax,8)
pushq %rax
callq 0x56f7
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/cram/cram_codecs.c
// Function: cram_encoder_init
cram_codec *cram_encoder_init(enum cram_encoding codec,
			      cram_stats *st,
			      enum cram_external_type option,
			      void *dat,
			      int version) {
    if (st && !st->nvals)
	return NULL;

    if (encode_init[codec]) {
	cram_codec *r;
	if ((r = encode_init[codec](st, option, dat, version)))
	    r->out = NULL;
	return r;
    } else {
	fprintf(stderr, "Unimplemented codec of type %s\n", cram_encoding2str(codec));
	abort();
    }
}

// Assembly:
pushq %rax
testq %rsi, %rsi
je 0x4c008
cmpl $0x0, 0x100c(%rsi)
je 0x4c03a
movl $0x385, %eax            # imm = 0x385
btq %rdi, %rax
jb 0x4c03e
movl %edi, %eax
leaq 0x11cd4(%rip), %r9      # 0x5dcf0
movq %rsi, %rdi
movl %edx, %esi
movq %rcx, %rdx
movl %r8d, %ecx
callq *(%r9,%rax,8)
testq %rax, %rax
je 0x4c03c
movq $0x0, 0x8(%rax)
jmp 0x4c03c
xorl %eax, %eax
popq %rcx
retq
callq 0x572c
// File: /workspace/github_c_makefile_star2_O1/zhou-lab[P]tbmate/htslib/cram/cram_codecs.c
// Function: cram_byte_array_stop_decode_char
static int cram_byte_array_stop_decode_char(cram_slice *slice, cram_codec *c,
					    cram_block *in, char *out,
					    int *out_size) {
    cram_block *b = NULL;
    char *cp, ch;

    b = cram_get_block_by_id(slice, c->byte_array_stop.content_id);
    if (!b)
        return *out_size?-1:0;

    if (b->idx >= b->uncomp_size)
	return -1;

    cp = (char *)b->data + b->idx;
    if (out) {
	while ((ch = *cp) != (char)c->byte_array_stop.stop) {
	    if (cp - (char *)b->data >= b->uncomp_size)
		return -1;
	    *out++ = ch;
	    cp++;
	}
    } else {
	// Consume input, but produce no output
	while ((ch = *cp) != (char)c->byte_array_stop.stop) {
	    if (cp - (char *)b->data >= b->uncomp_size)
		return -1;
	    cp++;
	}
    }

    *out_size = cp - (char *)(b->data + b->idx);
    b->idx = cp - (char *)b->data + 1;

    return 0;
}

// Assembly:
pushq %rbx
movl 0x34(%rsi), %eax
cmpq $0x400, %rax            # imm = 0x400
setb %r9b
movq 0x18(%rdi), %rdx
testq %rdx, %rdx
setne %r10b
testb %r10b, %r9b
je 0x4c444
movq (%rdx,%rax,8), %rdx
jmp 0x4c484
movq (%rdi), %rdx
movslq 0x20(%rdx), %r9
testq %r9, %r9
jle 0x4c482
movq 0x10(%rdi), %rdi
xorl %r10d, %r10d
movq (%rdi,%r10,8), %r11
testq %r11, %r11
je 0x4c474
cmpl $0x4, 0x8(%r11)
jne 0x4c474
cmpl %eax, 0xc(%r11)
jne 0x4c474
xorl %ebx, %ebx
movq %r11, %rdx
jmp 0x4c476
movb $0x1, %bl
testb %bl, %bl
je 0x4c484
incq %r10
cmpq %r10, %r9
jne 0x4c457
xorl %edx, %edx
testq %rdx, %rdx
je 0x4c4e0
movslq 0x1c(%rdx), %r10
movslq 0x14(%rdx), %r11
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %r11d, %r10d
jge 0x4c521
movq 0x20(%rdx), %r9
leaq (%r9,%r10), %rdi
testq %rcx, %rcx
je 0x4c4e9
movb (%rdi), %r11b
cmpb 0x30(%rsi), %r11b
je 0x4c509
addq %r10, %r9
movq %r9, %r10
subq 0x20(%rdx), %r10
movslq 0x14(%rdx), %rbx
cmpq %rbx, %r10
jge 0x4c521
movb %r11b, (%rcx)
incq %rcx
movb 0x1(%rdi), %r11b
incq %rdi
incq %r9
cmpb 0x30(%rsi), %r11b
jne 0x4c4b8
jmp 0x4c509
xorl %eax, %eax
cmpl (%r8), %eax
sbbl %eax, %eax
jmp 0x4c521
movb 0x30(%rsi), %cl
cmpb %cl, (%rdi)
je 0x4c509
cmpq %r11, %r10
jge 0x4c521
leaq 0x1(%r10), %rsi
cmpb %cl, 0x1(%r9,%r10)
movq %rsi, %r10
jne 0x4c4f0
addq %rsi, %r9
movq %r9, %rdi
movl 0x20(%rdx), %eax
movl 0x1c(%rdx), %ecx
addl %eax, %ecx
movl %edi, %esi
subl %ecx, %esi
movl %esi, (%r8)
subl %eax, %edi
incl %edi
movl %edi, 0x1c(%rdx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/bspwm.c
// Function: sig_handler
void sig_handler(int sig)
{
	if (sig == SIGCHLD) {
		signal(sig, sig_handler);
		while (waitpid(-1, 0, WNOHANG) > 0)
			;
	} else if (sig == SIGINT || sig == SIGHUP || sig == SIGTERM) {
		running = false;
	}
}

// Assembly:
leal -0x1(%rdi), %eax
cmpl $0x2, %eax
jb 0x5a96
cmpl $0xf, %edi
je 0x5a96
cmpl $0x11, %edi
jne 0x5a9d
pushq %rax
leaq -0x1a(%rip), %rsi       # 0x5a58
movl $0x11, %edi
callq 0x4070
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %esi, %esi
movl $0x1, %edx
callq 0x4750
testl %eax, %eax
jg 0x5a7c
addq $0x8, %rsp
retq
movb $0x0, 0x23c33(%rip)     # 0x296d0
retq
// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/bspwm.c
// Function: cleanup
void cleanup(void)
{
	mon = NULL;

	while (mon_head != NULL) {
		remove_monitor(mon_head);
	}
	while (rule_head != NULL) {
		remove_rule(rule_head);
	}
	while (subscribe_head != NULL) {
		remove_subscriber(subscribe_head);
	}
	while (pending_rule_head != NULL) {
		remove_pending_rule(pending_rule_head);
	}

	empty_history();
}

// Assembly:
pushq %rax
movq $0x0, 0x23c66(%rip) # 0x29710
movq 0x23c57(%rip), %rdi     # 0x29708
testq %rdi, %rdi
je 0x5ac2
callq 0x73ad
jmp 0x5aaa
callq 0x1cde1
movq 0x23c6f(%rip), %rdi     # 0x29738
testq %rdi, %rdi
jne 0x5abd
jmp 0x5ad5
callq 0x1e7c7
movq 0x23c7c(%rip), %rdi     # 0x29758
testq %rdi, %rdi
jne 0x5ad0
jmp 0x5ae8
callq 0x1d030
movq 0x23be9(%rip), %rdi     # 0x296d8
testq %rdi, %rdi
jne 0x5ae3
popq %rax
jmp 0xd75c
// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/bspwm.c
// Function: init
void init(void)
{
	clients_count = 0;
	mon = mon_head = mon_tail = pri_mon = NULL;
	history_head = history_tail = history_needle = NULL;
	rule_head = rule_tail = NULL;
	stack_head = stack_tail = NULL;
	subscribe_head = subscribe_tail = NULL;
	pending_rule_head = pending_rule_tail = NULL;
	auto_raise = sticky_still = hide_sticky = record_history = true;
	randr_base = 0;
	exit_status = 0;
	restart = false;
}

// Assembly:
xorl %eax, %eax
movl %eax, 0x23bf2(%rip)     # 0x296f4
movq %rax, 0x23bef(%rip)     # 0x296f8
movq %rax, 0x23bf0(%rip)     # 0x29700
movq %rax, 0x23bf1(%rip)     # 0x29708
movq %rax, 0x23bf2(%rip)     # 0x29710
movq %rax, 0x23bf3(%rip)     # 0x29718
movq %rax, 0x23bf4(%rip)     # 0x29720
movq %rax, 0x23bf5(%rip)     # 0x29728
movq %rax, 0x23bf6(%rip)     # 0x29730
movq %rax, 0x23bf7(%rip)     # 0x29738
movq %rax, 0x23bf8(%rip)     # 0x29740
movq %rax, 0x23bf9(%rip)     # 0x29748
movq %rax, 0x23bfa(%rip)     # 0x29750
movq %rax, 0x23bfb(%rip)     # 0x29758
movq %rax, 0x23bfc(%rip)     # 0x29760
movq %rax, 0x23b6d(%rip)     # 0x296d8
movb $0x1, %cl
movb %cl, 0x23bf5(%rip)      # 0x29768
movb %cl, 0x23bf0(%rip)      # 0x29769
movb %cl, 0x23beb(%rip)      # 0x2976a
movb %cl, 0x23be6(%rip)      # 0x2976b
leaq 0x24284(%rip), %rcx     # 0x29e10
movb %al, (%rcx)
movl %eax, 0x23b5c(%rip)     # 0x296f0
movb %al, 0x23b46(%rip)      # 0x296e0
retq
// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/bspwm.c
// Function: register_events
void register_events(void)
{
	uint32_t values[] = {ROOT_EVENT_MASK};
	xcb_generic_error_t *e = xcb_request_check(dpy, xcb_change_window_attributes_checked(dpy, root, XCB_CW_EVENT_MASK, values));
	if (e != NULL) {
		free(e);
		xcb_ewmh_connection_wipe(ewmh);
		free(ewmh);
		xcb_disconnect(dpy);
		err("Another window manager is already running.\n");
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x4(%rsp), %rcx
movl $0x3a0004, (%rcx)       # imm = 0x3A0004
movq 0x23b17(%rip), %rbx     # 0x296c8
movl 0x23bc1(%rip), %esi     # 0x29778
movq %rbx, %rdi
movl $0x800, %edx            # imm = 0x800
callq 0x4640
movq %rbx, %rdi
movl %eax, %esi
callq 0x4900
testq %rax, %rax
je 0x5c19
movq %rax, %rdi
callq 0x4460
leaq 0x2424e(%rip), %rbx     # 0x29e30
movq (%rbx), %r14
movq 0x8(%r14), %rdi
callq 0x4460
movq 0x18(%r14), %rdi
callq 0x4460
movq (%rbx), %rdi
callq 0x4460
movq 0x23ac2(%rip), %rdi     # 0x296c8
callq 0x4980
leaq 0x195b6(%rip), %rdi     # 0x1f1c8
xorl %eax, %eax
callq 0x5c74
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/geometry.c
// Function: boundary_distance
uint32_t boundary_distance(xcb_rectangle_t r1, xcb_rectangle_t r2, direction_t dir)
{
	xcb_point_t r1_max = {r1.x + r1.width - 1, r1.y + r1.height - 1};
	xcb_point_t r2_max = {r2.x + r2.width - 1, r2.y + r2.height - 1};
	switch (dir) {
		case DIR_NORTH:
			return r2_max.y > r1.y ? r2_max.y - r1.y : r1.y - r2_max.y;
			break;
		case DIR_WEST:
			return r2_max.x > r1.x ? r2_max.x - r1.x : r1.x - r2_max.x;
			break;
		case DIR_SOUTH:
			return r2.y < r1_max.y ? r1_max.y - r2.y : r2.y - r1_max.y;
			break;
		case DIR_EAST:
			return r2.x < r1_max.x ? r1_max.x - r2.x : r2.x - r1_max.x;
			break;
		default:
			return UINT32_MAX;
	}
}

// Assembly:
cmpl $0x3, %edx
ja 0x6240
movl %edi, %eax
sarl $0x10, %eax
movl %esi, %ecx
sarl $0x10, %ecx
movl %edx, %edx
leaq 0x191bf(%rip), %r8      # 0x1f3a8
movslq (%r8,%rdx,4), %rdx
addq %r8, %rdx
jmpq *%rdx
shrq $0x30, %rsi
addl %esi, %ecx
decl %ecx
movswl %cx, %ecx
subl %eax, %ecx
jmp 0x6238
shrq $0x30, %rdi
addl %edi, %eax
decl %eax
cwtl
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
retq
movswl %si, %ecx
movq %rdi, %rax
shrq $0x20, %rax
addl %edi, %eax
decl %eax
cwtl
jmp 0x6236
movswl %di, %eax
movq %rsi, %rcx
shrq $0x20, %rcx
addl %esi, %ecx
decl %ecx
movswl %cx, %ecx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/geometry.c
// Function: rect_cmp
int rect_cmp(xcb_rectangle_t r1, xcb_rectangle_t r2)
{
	if (r1.y >= (r2.y + r2.height)) {
		return 1;
	} else if (r2.y >= (r1.y + r1.height)) {
		return -1;
	} else {
		if (r1.x >= (r2.x + r2.width)) {
			return 1;
		} else if (r2.x >= (r1.x + r1.width)) {
			return -1;
		} else {
			return area(r2) - area(r1);
		}
	}
}

// Assembly:
movq %rsi, %rcx
shrq $0x30, %rcx
movl %edi, %r8d
sarl $0x10, %r8d
movl %esi, %r9d
sarl $0x10, %r9d
leal (%r9,%rcx), %edx
movl $0x1, %eax
cmpl %r8d, %edx
jle 0x640b
movq %rdi, %rdx
shrq $0x30, %rdx
addl %edx, %r8d
cmpl %r9d, %r8d
jle 0x640c
movq %rsi, %r10
shrq $0x20, %r10
movswl %di, %r8d
movswl %si, %r9d
movzwl %r10w, %esi
leal (%rsi,%r9), %r10d
cmpl %r8d, %r10d
jle 0x640b
shrq $0x20, %rdi
movzwl %di, %edi
addl %edi, %r8d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %r9d, %r8d
jle 0x640b
imull %ecx, %esi
imull %edx, %edi
subl %edi, %esi
movl %esi, %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
nop
// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/settings.c
// Function: run_config
void run_config(int run_level)
{
	if (fork() == 0) {
		if (dpy != NULL) {
			close(xcb_get_file_descriptor(dpy));
		}
		setsid();
		char arg1[2];
		snprintf(arg1, 2, "%i", run_level);
		execl(config_path, config_path, arg1, (char *) NULL);
		err("Couldn't execute the configuration file.\n");
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
callq 0x49b0
testl %eax, %eax
jne 0x6a18
leaq 0x22d0a(%rip), %rax     # 0x296c8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x69d2
callq 0x4380
movl %eax, %edi
callq 0x4150
callq 0x4120
leaq 0x1a78d(%rip), %rdx     # 0x2116b
leaq 0x6(%rsp), %r14
movl $0x2, %esi
movq %r14, %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x4110
leaq 0x22bc5(%rip), %rdi     # 0x295c0
movq %rdi, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x4230
leaq 0x189f7(%rip), %rdi     # 0x1f408
xorl %eax, %eax
callq 0x5c74
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/monitor.c
// Function: make_monitor
monitor_t *make_monitor(const char *name, xcb_rectangle_t *rect, uint32_t id)
{
	monitor_t *m = calloc(1, sizeof(monitor_t));
	if (id == XCB_NONE) {
		m->id = xcb_generate_id(dpy);
	}
	m->randr_id = XCB_NONE;
	snprintf(m->name, sizeof(m->name), "%s", name == NULL ? DEFAULT_MON_NAME : name);
	m->padding = padding;
	m->border_width = border_width;
	m->window_gap = window_gap;
	m->root = XCB_NONE;
	m->prev = m->next = NULL;
	m->desk = m->desk_head = m->desk_tail = NULL;
	m->wired = true;
	m->sticky_count = 0;
	if (rect != NULL) {
		update_root(m, rect);
	} else {
		m->rectangle = (xcb_rectangle_t) {0, 0, screen_width, screen_height};
	}
	return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x80, %esi
callq 0x48b0
movq %rax, %rbx
testl %ebp, %ebp
jne 0x6b9f
leaq 0x22b34(%rip), %rax     # 0x296c8
movq (%rax), %rdi
callq 0x4920
movl %eax, 0x20(%rbx)
xorl %ebp, %ebp
movl %ebp, 0x24(%rbx)
testq %r15, %r15
leaq 0x188a2(%rip), %rcx     # 0x1f450
cmovneq %r15, %rcx
leaq 0x1848e(%rip), %rdx     # 0x1f047
movl $0x20, %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4110
leaq 0x231d1(%rip), %rax     # 0x29da0
movups (%rax), %xmm0
movups %xmm0, 0x30(%rbx)
leaq 0x231e7(%rip), %rax     # 0x29dc4
movl (%rax), %eax
movl %eax, 0x48(%rbx)
leaq 0x231d7(%rip), %rax     # 0x29dc0
movl (%rax), %eax
movl %eax, 0x44(%rbx)
movl %ebp, 0x28(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%rbx)
movups %xmm0, 0x58(%rbx)
movq $0x0, 0x78(%rbx)
movb $0x1, 0x2c(%rbx)
movl %ebp, 0x40(%rbx)
testq %r14, %r14
je 0x6c1d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6c4e
jmp 0x6c40
leaq 0x22b58(%rip), %rax     # 0x2977c
movzwl (%rax), %eax
leaq 0x22b52(%rip), %rcx     # 0x29780
movzwl (%rcx), %ecx
movl $0x0, 0x4c(%rbx)
movw %ax, 0x50(%rbx)
movw %cx, 0x52(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/monitor.c
// Function: reorder_monitor
void reorder_monitor(monitor_t *m)
{
	if (m == NULL) {
		return;
	}
	monitor_t *prev = m->prev;
	while (prev != NULL && rect_cmp(m->rectangle, prev->rectangle) < 0) {
		swap_monitors(m, prev);
		prev = m->prev;
	}
	monitor_t *next = m->next;
	while (next != NULL && rect_cmp(m->rectangle, next->rectangle) > 0) {
		swap_monitors(m, next);
		next = m->next;
	}
}

// Assembly:
testq %rdi, %rdi
je 0x7008
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x70(%rbx), %r14
testq %r14, %r14
je 0x6ff8
movq 0x4c(%rbx), %rdi
movq 0x4c(%r14), %rsi
callq 0x639f
testl %eax, %eax
jns 0x6ff8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7009
jmp 0x6fb5
movq 0x4c(%rbx), %rdi
movq 0x4c(%r14), %rsi
callq 0x639f
testl %eax, %eax
jle 0x7001
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7009
movq 0x78(%rbx), %r14
testq %r14, %r14
jne 0x6fdc
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/monitor.c
// Function: swap_monitors
bool swap_monitors(monitor_t *m1, monitor_t *m2)
{
	if (m1 == NULL || m2 == NULL || m1 == m2) {
		return false;
	}

	put_status(SBSC_MASK_MONITOR_SWAP, "monitor_swap 0x%08X 0x%08X\n", m1->id, m2->id);

	if (mon_head == m1) {
		mon_head = m2;
	} else if (mon_head == m2) {
		mon_head = m1;
	}
	if (mon_tail == m1) {
		mon_tail = m2;
	} else if (mon_tail == m2) {
		mon_tail = m1;
	}

	monitor_t *p1 = m1->prev;
	monitor_t *n1 = m1->next;
	monitor_t *p2 = m2->prev;
	monitor_t *n2 = m2->next;

	if (p1 != NULL && p1 != m2) {
		p1->next = m2;
	}
	if (n1 != NULL && n1 != m2) {
		n1->prev = m2;
	}
	if (p2 != NULL && p2 != m1) {
		p2->next = m1;
	}
	if (n2 != NULL && n2 != m1) {
		n2->prev = m1;
	}

	m1->prev = p2 == m1 ? m2 : p2;
	m1->next = n2 == m1 ? m2 : n2;
	m2->prev = p1 == m2 ? m1 : p1;
	m2->next = n1 == m2 ? m1 : n1;

	ewmh_update_wm_desktops();
	ewmh_update_desktop_names();
	ewmh_update_desktop_viewport();
	ewmh_update_current_desktop();

	put_status(SBSC_MASK_REPORT);
	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
setne %al
testq %rsi, %rsi
setne %cl
andb %al, %cl
cmpq %rsi, %rdi
setne %bl
andb %cl, %bl
cmpb $0x1, %bl
jne 0x713e
movq %rsi, %r14
movq %rdi, %r15
movl 0x20(%rdi), %edx
movl 0x20(%rsi), %ecx
leaq 0x18494(%rip), %rsi     # 0x1f4d4
movl $0x10, %edi
xorl %eax, %eax
callq 0x1eb0b
leaq 0x226b5(%rip), %rax     # 0x29708
movq (%rax), %rdx
movq %r14, %rcx
cmpq %r15, %rdx
je 0x7066
movq %r15, %rcx
cmpq %r14, %rdx
jne 0x7069
movq %rcx, (%rax)
leaq 0x22690(%rip), %rax     # 0x29700
movq (%rax), %rdx
movq %r14, %rcx
cmpq %r15, %rdx
je 0x7083
movq %r15, %rcx
cmpq %r14, %rdx
jne 0x7086
movq %rcx, (%rax)
movq 0x70(%r15), %rcx
movq 0x78(%r15), %rax
movq 0x70(%r14), %rdx
movq 0x78(%r14), %rsi
testq %rcx, %rcx
sete %dil
cmpq %r14, %rcx
sete %r8b
orb %dil, %r8b
jne 0x70ad
movq %r14, 0x78(%rcx)
testq %rax, %rax
sete %dil
cmpq %r14, %rax
sete %r8b
orb %dil, %r8b
jne 0x70c4
movq %r14, 0x70(%rax)
testq %rdx, %rdx
sete %dil
cmpq %r15, %rdx
sete %r8b
orb %dil, %r8b
jne 0x70db
movq %r15, 0x78(%rdx)
testq %rsi, %rsi
sete %dil
cmpq %r15, %rsi
sete %r8b
orb %dil, %r8b
jne 0x70f2
movq %r15, 0x70(%rsi)
cmpq %r15, %rdx
cmoveq %r14, %rdx
cmpq %r15, %rsi
cmoveq %r14, %rsi
cmpq %r14, %rcx
cmoveq %r15, %rcx
cmpq %r14, %rax
movq %rdx, 0x70(%r15)
movq %rsi, 0x78(%r15)
movq %rcx, 0x70(%r14)
cmoveq %r15, %rax
movq %rax, 0x78(%r14)
callq 0x1e003
callq 0x1e0b4
callq 0x1e17a
callq 0x1df11
movl $0x1, %edi
xorl %eax, %eax
callq 0x1eb0b
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/monitor.c
// Function: rename_monitor
void rename_monitor(monitor_t *m, const char *name)
{
	put_status(SBSC_MASK_MONITOR_RENAME, "monitor_rename 0x%08X %s %s\n", m->id, m->name, name);

	snprintf(m->name, sizeof(m->name), "%s", name);
	xcb_icccm_set_wm_name(dpy, m->root, XCB_ATOM_STRING, 8, strlen(m->name), m->name);

	put_status(SBSC_MASK_REPORT);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl 0x20(%rdi), %edx
leaq 0x18323(%rip), %rsi     # 0x1f47d
movl $0x4, %edi
movq %rbx, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x1eb0b
leaq 0x17ed4(%rip), %rdx     # 0x1f047
movl $0x20, %esi
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x4110
leaq 0x2253c(%rip), %rax     # 0x296c8
movq (%rax), %r14
movl 0x28(%rbx), %ebp
movq %rbx, %rdi
callq 0x4470
movq %r14, %rdi
movl %ebp, %esi
movl $0x1f, %edx
movl $0x8, %ecx
movl %eax, %r8d
movq %rbx, %r9
callq 0x4180
movl $0x1, %edi
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x1eb0b