LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_index.c
// Function: bam_index_build2
int bam_index_build2(const char *fn, const char *_fnidx)
{
	char *fnidx;
	FILE *fpidx;
	bamFile fp;
	bam_index_t *idx;
	if ((fp = bam_open(fn, "r")) == 0) {
		fprintf(stderr, "[bam_index_build2] fail to open the BAM file.\n");
		return -1;
	}
	idx = bam_index_core(fp);
	bam_close(fp);
	if(idx == 0) {
		fprintf(stderr, "[bam_index_build2] fail to index the BAM file.\n");
		return -1;
	}
	if (_fnidx == 0) {
		fnidx = (char*)calloc(strlen(fn) + 5, 1);
		strcpy(fnidx, fn); strcat(fnidx, ".bai");
	} else fnidx = strdup(_fnidx);
	fpidx = fopen(fnidx, "wb");
	if (fpidx == 0) {
		fprintf(stderr, "[bam_index_build2] fail to create the index file.\n");
		free(fnidx);
        bam_index_destroy(idx);
		return -1;
	}
	bam_index_save(idx, fpidx);
	bam_index_destroy(idx);
	fclose(fpidx);
	free(fnidx);
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq 0xb400(%rip), %rsi      # 0x1b806
callq 0x17198
testq %rax, %rax
je 0x104c7
movq %rax, %r12
movq %rax, %rdi
callq 0xf131
movq %rax, %rbx
movq %r12, %rdi
callq 0x17e8e
testq %rbx, %rbx
je 0x104ce
testq %r14, %r14
je 0x10445
movq %r14, %rdi
callq 0x3590
movq %rax, %r14
jmp 0x1047f
movq %r15, %rdi
callq 0x31e0
leaq 0x5(%rax), %rdi
movl $0x1, %esi
callq 0x32e0
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x30d0
movq %r14, %rdi
callq 0x31e0
movl $0x6961622e, (%r14,%rax) # imm = 0x6961622E
movb $0x0, 0x4(%r14,%rax)
leaq 0xaeee(%rip), %rsi      # 0x1b374
movq %r14, %rdi
callq 0x3340
testq %rax, %rax
je 0x104d5
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
callq 0xfbe3
movq %rbx, %rdi
callq 0xfb05
movq %r15, %rdi
callq 0x31c0
movq %r14, %rdi
callq 0x3060
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x3ea8
jmp 0x104e0
callq 0x3e8c
jmp 0x104e0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3e4f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x104bb
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_index.c
// Function: bam_index
int bam_index(int argc, char *argv[])
{
	if (argc < 2) {
		fprintf(stderr, "Usage: samtools index <in.bam> [out.index]\n");
		return 1;
	}
	if (argc >= 3) bam_index_build2(argv[1], argv[2]);
	else bam_index_build(argv[1]);
	return 0;
}

// Assembly:
pushq %rbx
cmpl $0x1, %edi
jle 0x10519
movl %edi, %eax
movq 0x8(%rsi), %rdi
cmpl $0x2, %eax
jne 0x1050a
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x103f1
jmp 0x10515
movq 0x10(%rsi), %rsi
callq 0x103f1
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
callq 0x3ec4
movl $0x1, %ebx
jmp 0x10515
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_index.c
// Function: get_chunk_coordinates
pair64_t *get_chunk_coordinates(const bam_index_t *idx, int tid, int beg, int end, int *cnt_off)
{ // for pysam compatibility
	bam_iter_t iter;
	pair64_t *off;
	iter = bam_iter_query(idx, tid, beg, end);
	off = iter->off; *cnt_off = iter->n_off;
	free(iter);
	return off;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %r8, %rbx
callq 0x106d3
movq 0x28(%rax), %r14
movl 0x10(%rax), %ecx
movl %ecx, (%rbx)
movq %rax, %rdi
callq 0x3060
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_index.c
// Function: bam_fetch
int bam_fetch(bamFile fp, const bam_index_t *idx, int tid, int beg, int end, void *data, bam_fetch_f func)
{
	int ret;
	bam_iter_t iter;
	bam1_t *b;
	b = bam_init1();
	iter = bam_iter_query(idx, tid, beg, end);
	while ((ret = bam_iter_read(fp, iter, b)) >= 0) func(b, data);
	bam_iter_destroy(iter);
	bam_destroy1(b);
	return (ret == -1)? 0 : ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movl %r8d, 0x4(%rsp)
movl %ecx, %r12d
movl %edx, %r13d
movq %rsi, %rbp
movq %rdi, %r15
movl $0x1, %edi
movl $0x38, %esi
callq 0x32e0
movq %rax, %rbx
movq %rbp, %rdi
movl %r13d, %esi
movl %r12d, %edx
movl 0x4(%rsp), %ecx
callq 0x106d3
movq %rax, %r12
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x10c19
testl %eax, %eax
js 0x10e65
movq 0x40(%rsp), %r13
movq %rbx, %rdi
movq %r14, %rsi
callq *%r13
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x10c19
testl %eax, %eax
jns 0x10e4a
movl %eax, %ebp
movq %r12, %rdi
callq 0x10bfd
testq %rbx, %rbx
je 0x10e85
movq 0x30(%rbx), %rdi
callq 0x3060
movq %rbx, %rdi
callq 0x3060
xorl %eax, %eax
cmpl $-0x1, %ebp
cmovnel %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_pileup.c
// Function: bam_plp_init
bam_plp_t bam_plp_init(bam_plp_auto_f func, void *data)
{
	bam_plp_t iter;
	iter = calloc(1, sizeof(struct __bam_plp_t));
	iter->mp = mp_init();
	iter->head = iter->tail = mp_alloc(iter->mp);
	iter->dummy = mp_alloc(iter->mp);
	iter->max_tid = iter->max_pos = -1;
	iter->flag_mask = BAM_DEF_MASK;
	iter->maxcnt = 8000;
	if (func) {
		iter->func = func;
		iter->data = data;
		iter->b = bam_init1();
	}
	return iter;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x68, %esi
callq 0x32e0
movq %rax, %rbx
movl $0x1, %edi
movl $0x18, %esi
callq 0x32e0
movq %rax, %r12
movq %rax, (%rbx)
movl (%rax), %r13d
leal 0x1(%r13), %eax
movl %eax, (%r12)
movslq 0x4(%r12), %rax
testq %rax, %rax
je 0x112ac
movq 0x10(%r12), %rcx
leaq -0x1(%rax), %rdx
movl %edx, 0x4(%r12)
movq -0x8(%rcx,%rax,8), %rax
jmp 0x112bb
movl $0x1, %edi
movl $0x58, %esi
callq 0x32e0
movq %rax, 0x10(%rbx)
movq %rax, 0x8(%rbx)
addl $0x2, %r13d
movl %r13d, (%r12)
movslq 0x4(%r12), %rax
testq %rax, %rax
je 0x112ea
movq 0x10(%r12), %rcx
leaq -0x1(%rax), %rdx
movl %edx, 0x4(%r12)
movq -0x8(%rcx,%rax,8), %rax
jmp 0x112f9
movl $0x1, %edi
movl $0x58, %esi
callq 0x32e0
movq %rax, 0x18(%rbx)
movq $-0x1, 0x28(%rbx)
movl $0x704, 0x34(%rbx)      # imm = 0x704
movl $0x1f40, 0x40(%rbx)     # imm = 0x1F40
testq %r15, %r15
je 0x11333
movq %r15, 0x58(%rbx)
movq %r14, 0x60(%rbx)
movl $0x1, %edi
movl $0x38, %esi
callq 0x32e0
movq %rax, 0x50(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_pileup.c
// Function: bam_plp_destroy
void bam_plp_destroy(bam_plp_t iter)
{
	mp_free(iter->mp, iter->dummy);
	mp_free(iter->mp, iter->head);
	if (iter->mp->cnt != 0)
		fprintf(stderr, "[bam_plp_destroy] memory leak: %d. Continue anyway.\n", iter->mp->cnt);
	mp_destroy(iter->mp);
	if (iter->b) bam_destroy1(iter->b);
	free(iter->plp);
	free(iter);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
movq 0x18(%rdi), %r15
decl (%r14)
movq $0x0, 0x50(%r15)
movl 0x8(%r14), %eax
cmpl %eax, 0x4(%r14)
jne 0x11389
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x100, %eax            # imm = 0x100
cmovnel %ecx, %eax
movl %eax, 0x8(%r14)
movq 0x10(%r14), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x3430
movq %rax, 0x10(%r14)
movq 0x10(%r14), %rax
movslq 0x4(%r14), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r14)
movq %r15, (%rax,%rcx,8)
movq (%rbx), %r14
movq 0x8(%rbx), %r15
decl (%r14)
movq $0x0, 0x50(%r15)
movl 0x8(%r14), %eax
cmpl %eax, 0x4(%r14)
jne 0x113dd
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x100, %eax            # imm = 0x100
cmovnel %ecx, %eax
movl %eax, 0x8(%r14)
movq 0x10(%r14), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x3430
movq %rax, 0x10(%r14)
movq 0x10(%r14), %rax
movslq 0x4(%r14), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r14)
movq %r15, (%rax,%rcx,8)
movq (%rbx), %rax
movl (%rax), %edx
testl %edx, %edx
jne 0x11472
movq (%rbx), %r14
cmpl $0x0, 0x4(%r14)
jle 0x11430
xorl %r15d, %r15d
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rax
movq 0x30(%rax), %rdi
callq 0x3060
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x3060
incq %r15
movslq 0x4(%r14), %rax
cmpq %rax, %r15
jl 0x11406
movq 0x10(%r14), %rdi
callq 0x3060
movq %r14, %rdi
callq 0x3060
movq 0x50(%rbx), %rax
testq %rax, %rax
je 0x1145c
movq 0x30(%rax), %rdi
callq 0x3060
movq 0x50(%rbx), %rdi
callq 0x3060
movq 0x48(%rbx), %rdi
callq 0x3060
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3060
movq 0x10b7f(%rip), %rax     # 0x21ff8
movq (%rax), %rdi
leaq 0xa15d(%rip), %rsi      # 0x1b5e0
xorl %eax, %eax
callq 0x3320
jmp 0x113f9
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_pileup.c
// Function: bam_plp_auto
const bam_pileup1_t *bam_plp_auto(bam_plp_t iter, int *_tid, int *_pos, int *_n_plp)
{
	const bam_pileup1_t *plp;
	if (iter->func == 0 || iter->error) { *_n_plp = -1; return 0; }
	if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp;
	else { // no pileup line can be obtained; read alignments
		*_n_plp = 0;
		if (iter->is_eof) return 0;
		while (iter->func(iter->data, iter->b) >= 0) {
			if (bam_plp_push(iter, iter->b) < 0) {
				*_n_plp = -1;
				return 0;
			}
			if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp;
			// otherwise no pileup line can be returned; read the next alignment.
		}
		bam_plp_push(iter, 0);
		if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp;
		return 0;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
cmpq $0x0, 0x58(%rdi)
je 0x11c99
movq %rdi, %r12
cmpl $0x0, 0x3c(%rdi)
je 0x11cad
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rdx, %r14
movq %rsi, %r15
movq %r12, %rdi
movq %rbx, %rcx
callq 0x1148f
testq %rax, %rax
jne 0x11ca1
movl $0x0, (%rbx)
cmpl $0x0, 0x30(%r12)
jne 0x11c9f
jmp 0x11cfa
movq 0x50(%r12), %rsi
movq %r12, %rdi
callq 0x11aa8
testl %eax, %eax
js 0x11c99
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x1148f
testq %rax, %rax
jne 0x11ca1
movq 0x50(%r12), %rsi
movq 0x60(%r12), %rdi
callq *0x58(%r12)
testl %eax, %eax
jns 0x11cd3
cmpl $0x0, 0x3c(%r12)
jne 0x11d1e
movl $0x1, 0x30(%r12)
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1148f
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_pileup.c
// Function: bam_plp_reset
void bam_plp_reset(bam_plp_t iter)
{
	lbnode_t *p, *q;
	iter->max_tid = iter->max_pos = -1;
	iter->tid = iter->pos = 0;
	iter->is_eof = 0;
	for (p = iter->head; p->next;) {
		q = p->next;
		mp_free(iter->mp, p);
		p = q;
	}
	iter->head = iter->tail;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x2c(%rdi)
movl $0xffffffff, 0x28(%rdi) # imm = 0xFFFFFFFF
movq $0x0, 0x20(%rdi)
movq 0x8(%rdi), %r14
movq 0x50(%r14), %rax
testq %rax, %rax
je 0x11dd2
movl $0x100, %ebp            # imm = 0x100
movq %rax, %r15
movq (%rbx), %r12
decl (%r12)
movq $0x0, 0x50(%r14)
movl 0x8(%r12), %eax
cmpl %eax, 0x4(%r12)
jne 0x11db0
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 0x3430
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 0x50(%r15), %rax
movq %r15, %r14
testq %rax, %rax
jne 0x11d6f
movq 0x10(%rbx), %rax
movq %rax, 0x8(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_pileup.c
// Function: bam_pileup_file
int bam_pileup_file(bamFile fp, int mask, bam_pileup_f func, void *func_data)
{
	bam_plbuf_t *buf;
	int ret;
	bam1_t *b;
	b = bam_init1();
	buf = bam_plbuf_init(func, func_data);
	bam_plbuf_set_mask(buf, mask);
	while ((ret = bam_read1(fp, b)) >= 0)
		bam_plbuf_push(b, buf);
	bam_plbuf_push(0, buf);
	bam_plbuf_destroy(buf);
	bam_destroy1(b);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, (%rsp)
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, %r14
movl $0x1, %edi
movl $0x38, %esi
callq 0x32e0
movq %rax, %rbx
movl $0x1, %edi
movl $0x18, %esi
callq 0x32e0
movq %rax, %r15
xorl %edi, %edi
xorl %esi, %esi
callq 0x1124c
movq %rax, %r12
movq %rax, (%r15)
movq %r13, 0x8(%r15)
movq (%rsp), %rax
movq %rax, 0x10(%r15)
movl %ebp, %eax
orl $0x4, %eax
testl %ebp, %ebp
movl $0x704, %ecx            # imm = 0x704
cmovnsl %eax, %ecx
movl %ecx, 0x34(%r12)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9b44
testl %eax, %eax
js 0x11e80
movq %rbx, %rdi
movq %r15, %rsi
callq 0x11f11
jmp 0x11e64
xorl %edi, %edi
movq %r15, %rsi
callq 0x11f11
movq %r12, %rdi
callq 0x11340
movq %r15, %rdi
callq 0x3060
testq %rbx, %rbx
je 0x11eb0
movq 0x30(%rbx), %rdi
callq 0x3060
movq %rbx, %rdi
callq 0x3060
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_pileup.c
// Function: bam_plbuf_init
bam_plbuf_t *bam_plbuf_init(bam_pileup_f func, void *data)
{
	bam_plbuf_t *buf;
	buf = calloc(1, sizeof(bam_plbuf_t));
	buf->iter = bam_plp_init(0, 0);
	buf->func = func;
	buf->data = data;
	return buf;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl $0x1, %edi
movl $0x18, %esi
callq 0x32e0
movq %rax, %r15
xorl %edi, %edi
xorl %esi, %esi
callq 0x1124c
movq %rax, (%r15)
movq %r14, 0x8(%r15)
movq %rbx, 0x10(%r15)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_pileup.c
// Function: bam_plbuf_push
int bam_plbuf_push(const bam1_t *b, bam_plbuf_t *buf)
{
	int ret, n_plp, tid, pos;
	const bam_pileup1_t *plp;
	ret = bam_plp_push(buf->iter, b);
	if (ret < 0) return ret;
	while ((plp = bam_plp_next(buf->iter, &tid, &pos, &n_plp)) != 0)
		buf->func(tid, pos, n_plp, plp, buf->data);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %rsi
movq (%rbx), %rdi
callq 0x11aa8
testl %eax, %eax
js 0x11f8a
movq (%rbx), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0x1148f
xorl %ebp, %ebp
testq %rax, %rax
je 0x11f8f
leaq 0x8(%rsp), %r14
leaq 0x4(%rsp), %r15
leaq 0xc(%rsp), %r12
movl 0x8(%rsp), %edi
movl 0x4(%rsp), %esi
movl 0xc(%rsp), %edx
movq 0x10(%rbx), %r8
movq %rax, %rcx
callq *0x8(%rbx)
movq (%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x1148f
testq %rax, %rax
jne 0x11f5c
jmp 0x11f8f
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_pileup.c
// Function: bam_mplp_init
bam_mplp_t bam_mplp_init(int n, bam_plp_auto_f func, void **data)
{
	int i;
	bam_mplp_t iter;
	iter = calloc(1, sizeof(struct __bam_mplp_t));
	iter->pos = calloc(n, 8);
	iter->n_plp = calloc(n, sizeof(int));
	iter->plp = calloc(n, sizeof(void*));
	iter->iter = calloc(n, sizeof(void*));
	iter->n = n;
	iter->min = (uint64_t)-1;
	for (i = 0; i < n; ++i) {
		iter->iter[i] = bam_plp_init(func, data[i]);
		iter->pos[i] = iter->min;
	}
	return iter;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movl $0x1, %edi
movl $0x30, %esi
callq 0x32e0
movq %rax, %r15
movl %ebp, 0xc(%rsp)
movslq %ebp, %r13
movl $0x8, %esi
movq %r13, %rdi
callq 0x32e0
movq %rax, %r12
movq %rax, 0x10(%r15)
movl $0x4, %esi
movq %r13, %rdi
callq 0x32e0
movq %rax, 0x20(%r15)
movl $0x8, %esi
movq %r13, %rdi
callq 0x32e0
movq %rax, 0x28(%r15)
movl $0x8, %esi
movq %r13, %rdi
callq 0x32e0
movq %rax, 0x18(%r15)
movl %r13d, (%r15)
movq %r15, 0x10(%rsp)
movq $-0x1, 0x8(%r15)
testl %r13d, %r13d
jle 0x12072
movq %rax, %rbp
movl 0xc(%rsp), %r13d
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rsi
movq %r14, %rdi
callq 0x1124c
movq %rax, (%rbp,%r15,8)
movq $-0x1, (%r12,%r15,8)
incq %r15
cmpq %r15, %r13
jne 0x12051
movq 0x10(%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_pileup.c
// Function: bam_mplp_destroy
void bam_mplp_destroy(bam_mplp_t iter)
{
	int i;
	for (i = 0; i < iter->n; ++i) bam_plp_destroy(iter->iter[i]);
	free(iter->iter); free(iter->pos); free(iter->n_plp); free(iter->plp);
	free(iter);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, (%rdi)
jle 0x120cb
xorl %r14d, %r14d
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x11340
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x120b3
movq 0x18(%rbx), %rdi
callq 0x3060
movq 0x10(%rbx), %rdi
callq 0x3060
movq 0x20(%rbx), %rdi
callq 0x3060
movq 0x28(%rbx), %rdi
callq 0x3060
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3060
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_pileup.c
// Function: bam_mplp_auto
int bam_mplp_auto(bam_mplp_t iter, int *_tid, int *_pos, int *n_plp, const bam_pileup1_t **plp)
{
	int i, ret = 0;
	uint64_t new_min = (uint64_t)-1;
	for (i = 0; i < iter->n; ++i) {
		if (iter->pos[i] == iter->min) {
			int tid, pos;
			iter->plp[i] = bam_plp_auto(iter->iter[i], &tid, &pos, &iter->n_plp[i]);
			iter->pos[i] = (uint64_t)tid<<32 | pos;
		}
		if (iter->plp[i] && iter->pos[i] < new_min) new_min = iter->pos[i];
	}
	iter->min = new_min;
	if (new_min == (uint64_t)-1) return 0;
	*_tid = new_min>>32; *_pos = (uint32_t)new_min;
	for (i = 0; i < iter->n; ++i) {
		if (iter->pos[i] == iter->min) { // FIXME: valgrind reports "uninitialised value(s) at this line"
			n_plp[i] = iter->n_plp[i], plp[i] = iter->plp[i];
			++ret;
		} else n_plp[i] = 0, plp[i] = 0;
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %r15
cmpl $0x0, (%rdi)
jle 0x121a8
movq $-0x1, %r13
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0x10(%r15), %rax
movq (%rax,%rbp,2), %rax
cmpq 0x8(%r15), %rax
jne 0x1217d
movq 0x18(%r15), %rax
movq (%rax,%rbp,2), %rdi
movq 0x20(%r15), %rcx
addq %rbp, %rcx
leaq 0x4(%rsp), %rsi
movq %rsp, %rdx
callq 0x11c7e
movq 0x28(%r15), %rcx
movq %rax, (%rcx,%rbp,2)
movl 0x4(%rsp), %eax
shlq $0x20, %rax
movslq (%rsp), %rcx
orq %rax, %rcx
movq 0x10(%r15), %rax
movq %rcx, (%rax,%rbp,2)
movq 0x28(%r15), %rax
cmpq $0x0, (%rax,%rbp,2)
je 0x12197
movq 0x10(%r15), %rax
movq (%rax,%rbp,2), %rax
cmpq %r13, %rax
cmovbq %rax, %r13
incq %r12
movslq (%r15), %rax
addq $0x4, %rbp
cmpq %rax, %r12
jl 0x12134
jmp 0x121af
movq $-0x1, %r13
movq %r13, 0x8(%r15)
xorl %eax, %eax
cmpq $-0x1, %r13
je 0x1221b
movq %r13, %rcx
shrq $0x20, %rcx
movq 0x8(%rsp), %rdx
movl %ecx, (%rdx)
movq 0x10(%rsp), %rcx
movl %r13d, (%rcx)
cmpl $0x0, (%r15)
jle 0x1221b
xorl %ecx, %ecx
xorl %eax, %eax
movq 0x10(%r15), %rdx
cmpq %r13, (%rdx,%rcx,8)
jne 0x12200
movq 0x20(%r15), %rdx
movl (%rdx,%rcx,4), %edx
movl %edx, (%r14,%rcx,4)
movq 0x28(%r15), %rdx
movq (%rdx,%rcx,8), %rdx
movq %rdx, (%rbx,%rcx,8)
incl %eax
jmp 0x12210
movl $0x0, (%r14,%rcx,4)
movq $0x0, (%rbx,%rcx,8)
incq %rcx
movslq (%r15), %rdx
cmpq %rdx, %rcx
jl 0x121db
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/razf.c
// Function: razf_buffered_write
static void _razf_buffered_write(RAZF *rz, const void *data, int size){
	int i, n;
	while(1){
		if(rz->buf_len == RZ_BUFFER_SIZE){
			_razf_write(rz, rz->inbuf, rz->buf_len);
			rz->buf_len = 0;
		}
		if(size + rz->buf_len < RZ_BUFFER_SIZE){
			for(i=0;i<size;i++) ((char*)rz->inbuf + rz->buf_len)[i] = ((char*)data)[i];
			rz->buf_len += size;
			return;
		} else {
			n = RZ_BUFFER_SIZE - rz->buf_len;
			for(i=0;i<n;i++) ((char*)rz->inbuf + rz->buf_len)[i] = ((char*)data)[i];
			size -= n;
			data += n;
			rz->buf_len += n;
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
cmpl $0x1000, 0x84(%r14) # imm = 0x1000
jne 0x12483
movq 0x60(%r14), %rsi
movq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
callq 0x13300
movl $0x0, 0x84(%r14)
movl 0x84(%r14), %ecx
leal (%rcx,%rbx), %eax
cmpl $0xfff, %eax            # imm = 0xFFF
jle 0x124df
movl $0x1000, %eax           # imm = 0x1000
subl %ecx, %eax
cmpl $0xfff, %ecx            # imm = 0xFFF
jg 0x124cb
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
xorl %edx, %edx
movslq 0x84(%r14), %rsi
addq 0x60(%r14), %rsi
movb (%r15,%rdx), %dil
movb %dil, (%rdx,%rsi)
incq %rdx
cmpq %rdx, %rcx
jne 0x124b0
subl %eax, %ebx
movslq %eax, %rcx
addq %rcx, %r15
addl %eax, 0x84(%r14)
jmp 0x1245a
testl %ebx, %ebx
jle 0x12502
movl %ebx, %eax
xorl %ecx, %ecx
movslq 0x84(%r14), %rdx
addq 0x60(%r14), %rdx
movb (%r15,%rcx), %sil
movb %sil, (%rcx,%rdx)
incq %rcx
cmpq %rcx, %rax
jne 0x124e7
addl %ebx, 0x84(%r14)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/razf.c
// Function: razf_open_w
static RAZF* razf_open_w(int fd){
	RAZF *rz;
#ifdef _WIN32
	setmode(fd, O_BINARY);
#endif
	rz = calloc(1, sizeof(RAZF));
	rz->mode = 'w';
#ifdef _USE_KNETFILE
    rz->x.fpw = fd;
#else
	rz->filedes = fd;
#endif
	rz->stream = calloc(sizeof(z_stream), 1);
	rz->inbuf  = malloc(RZ_BUFFER_SIZE);
	rz->outbuf = malloc(RZ_BUFFER_SIZE);
	rz->index = calloc(sizeof(ZBlockIndex), 1);
	deflateInit2(rz->stream, RZ_COMPRESS_LEVEL, Z_DEFLATED, WINDOW_BITS + 16, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
	rz->stream->avail_out = RZ_BUFFER_SIZE;
	rz->stream->next_out  = rz->outbuf;
	rz->header = calloc(sizeof(gz_header), 1);
	rz->header->os    = 0x03; //Unix
	rz->header->text  = 0;
	rz->header->time  = 0;
	rz->header->extra = malloc(7);
	strncpy((char*)rz->header->extra, "RAZF", 4);
	rz->header->extra[4] = 1; // obsolete field
	// block size = RZ_BLOCK_SIZE, Big-Endian
	rz->header->extra[5] = RZ_BLOCK_SIZE >> 8;
	rz->header->extra[6] = RZ_BLOCK_SIZE & 0xFF;
	rz->header->extra_len = 7;
	rz->header->name = rz->header->comment  = 0;
	rz->header->hcrc = 0;
	deflateSetHeader(rz->stream, rz->header);
	rz->block_pos = rz->block_off = 0;
	return rz;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edi, %ebp
movl $0x1, %edi
movl $0x98, %esi
callq 0x32e0
movq %rax, %rbx
movb $0x77, (%rax)
movl %ebp, 0x8(%rax)
movl $0x70, %edi
movl $0x1, %esi
callq 0x32e0
movq %rax, %r14
movq %rax, 0x10(%rbx)
movl $0x1000, %edi           # imm = 0x1000
callq 0x33e0
movq %rax, 0x60(%rbx)
movl $0x1000, %edi           # imm = 0x1000
callq 0x33e0
movq %rax, %r15
movq %rax, 0x68(%rbx)
movl $0x18, %edi
movl $0x1, %esi
callq 0x32e0
movq %rax, 0x18(%rbx)
leaq 0x91b8(%rip), %rax      # 0x1b77f
xorl %r12d, %r12d
movq %r14, %rdi
movl $0x6, %esi
movl $0x8, %edx
movl $0x1f, %ecx
movl $0x8, %r8d
xorl %r9d, %r9d
pushq $0x70
pushq %rax
callq 0x3290
addq $0x10, %rsp
movl $0x1000, 0x20(%r14)     # imm = 0x1000
movq %r15, 0x18(%r14)
movl $0x50, %edi
movl $0x1, %esi
callq 0x32e0
movq %rax, %r15
movq %rax, 0x78(%rbx)
movl $0x3, 0x14(%rax)
movl %r12d, (%rax)
movq %r12, 0x8(%rax)
movl $0x7, %edi
callq 0x33e0
movq %rax, 0x18(%r15)
movl $0x465a4152, (%rax)     # imm = 0x465A4152
movw $0x8001, 0x4(%rax)      # imm = 0x8001
movb $0x0, 0x6(%rax)
movl $0x7, 0x20(%r15)
movq %r12, 0x38(%r15)
movq %r12, 0x28(%r15)
movl %r12d, 0x44(%r15)
movq %r14, %rdi
movq %r15, %rsi
callq 0x34a0
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/razf.c
// Function: razf_get_data_size
int razf_get_data_size(RAZF *rz, int64_t *u_size, int64_t *c_size){
	int64_t n;
	if(rz->mode != 'r' && rz->mode != 'R') return 0;
	switch(rz->file_type){
		case FILE_TYPE_PLAIN:
			if(rz->end == 0x7fffffffffffffffLL){
#ifdef _USE_KNETFILE
				if(knet_seek(rz->x.fpr, 0, SEEK_CUR) == -1) return 0;
                n = knet_tell(rz->x.fpr);
				knet_seek(rz->x.fpr, 0, SEEK_END);
                rz->end = knet_tell(rz->x.fpr);
				knet_seek(rz->x.fpr, n, SEEK_SET);
#else
				if((n = lseek(rz->filedes, 0, SEEK_CUR)) == -1) return 0;
				rz->end = lseek(rz->filedes, 0, SEEK_END);
				lseek(rz->filedes, n, SEEK_SET);
#endif                
			}
			*u_size = *c_size = rz->end;
			return 1;
		case FILE_TYPE_GZ:
			return 0;
		case FILE_TYPE_RZ:
			if(rz->src_end == rz->end) return 0;
			*u_size = rz->src_end;
			*c_size = rz->end;
			return 1;
		default:
			return 0;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movzbl (%rdi), %eax
xorl %r12d, %r12d
orl $0x20, %eax
cmpl $0x72, %eax
jne 0x12b44
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl 0x4(%rdi), %eax
cmpl $0x1, %eax
je 0x12b2a
cmpl $0x2, %eax
jne 0x12b44
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rax, 0x30(%r15)
jne 0x12b1e
movq 0x8(%r15), %rdi
xorl %r12d, %r12d
xorl %esi, %esi
movl $0x1, %edx
callq 0x158e6
cmpq $-0x1, %rax
je 0x12b44
movq 0x8(%r15), %rdi
movq 0x8(%rdi), %r12
xorl %esi, %esi
movl $0x2, %edx
callq 0x158e6
movq 0x8(%r15), %rdi
movq 0x8(%rdi), %rax
movq %rax, 0x30(%r15)
movq %r12, %rsi
xorl %edx, %edx
callq 0x158e6
movq 0x30(%r15), %rax
movq %rax, (%rbx)
movq %rax, (%r14)
jmp 0x12b3e
movq 0x38(%r15), %rax
cmpq 0x30(%r15), %rax
je 0x12b44
movq %rax, (%r14)
movq 0x30(%r15), %rax
movq %rax, (%rbx)
movl $0x1, %r12d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/razf.c
// Function: razf_read
int razf_read(RAZF *rz, void *data, int size){
	int ori_size, i;
	ori_size = size;
	while(size > 0){
		if(rz->buf_len){
			if(size < rz->buf_len){
				for(i=0;i<size;i++) ((char*)data)[i] = ((char*)rz->outbuf + rz->buf_off)[i];
				rz->buf_off += size;
				rz->buf_len -= size;
				data += size;
				rz->block_off += size;
				size = 0;
				break;
			} else {
				for(i=0;i<rz->buf_len;i++) ((char*)data)[i] = ((char*)rz->outbuf + rz->buf_off)[i];
				data += rz->buf_len;
				size -= rz->buf_len;
				rz->block_off += rz->buf_len;
				rz->buf_off = 0;
				rz->buf_len = 0;
				if(rz->buf_flush){
					rz->block_pos = rz->next_block_pos;
					rz->block_off = 0;
					rz->buf_flush = 0;
				}
			}
		} else if(rz->buf_flush){
			rz->block_pos = rz->next_block_pos;
			rz->block_off = 0;
			rz->buf_flush = 0;
		}
		if(rz->buf_flush) continue;
		rz->buf_len = _razf_read(rz, rz->outbuf, RZ_BUFFER_SIZE);
		if(rz->z_eof && rz->buf_len == 0) break;
	}
	rz->out += ori_size - size;
	return ori_size - size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
movl %edx, %ebp
testl %edx, %edx
jle 0x12c55
movq %rsi, %r15
movl %ebx, %ebp
movl 0x84(%r14), %eax
testl %eax, %eax
je 0x12bc6
cmpl %eax, %ebp
jl 0x12c1f
movl 0x84(%r14), %ecx
testl %ecx, %ecx
jle 0x12baf
xorl %eax, %eax
movslq 0x80(%r14), %rcx
addq 0x68(%r14), %rcx
movb (%rax,%rcx), %cl
movb %cl, (%r15,%rax)
incq %rax
movslq 0x84(%r14), %rcx
cmpq %rcx, %rax
jl 0x12b8e
movslq %ecx, %rax
addq %rax, %r15
addq %rax, 0x50(%r14)
subl %eax, %ebp
movq $0x0, 0x80(%r14)
cmpl $0x0, 0x40(%r14)
je 0x12be5
movq 0x58(%r14), %rax
movq %rax, 0x48(%r14)
movq $0x0, 0x50(%r14)
movl $0x0, 0x40(%r14)
cmpl $0x0, 0x40(%r14)
jne 0x12c15
movq 0x68(%r14), %rsi
movq %r14, %rdi
callq 0x12c69
movl %eax, 0x84(%r14)
cmpl $0x0, 0x8c(%r14)
sete %cl
testl %eax, %eax
setne %al
orb %cl, %al
cmpb $0x1, %al
jne 0x12c55
testl %ebp, %ebp
jg 0x12b6e
jmp 0x12c55
movl %ebp, %eax
testl %ebp, %ebp
jle 0x12c41
xorl %ecx, %ecx
movslq 0x80(%r14), %rdx
addq 0x68(%r14), %rdx
movb (%rcx,%rdx), %dl
movb %dl, (%r15,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x12c27
addl %ebp, 0x80(%r14)
subl %ebp, 0x84(%r14)
addq %rax, 0x50(%r14)
xorl %ebp, %ebp
subl %ebp, %ebx
movslq %ebx, %rax
addq %rax, 0x28(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/razf.c
// Function: razf_skip
int razf_skip(RAZF* rz, int size){
	int ori_size;
	ori_size = size;
	while(size > 0){
		if(rz->buf_len){
			if(size < rz->buf_len){
				rz->buf_off += size;
				rz->buf_len -= size;
				rz->block_off += size;
				size = 0;
				break;
			} else {
				size -= rz->buf_len;
				rz->buf_off = 0;
				rz->buf_len = 0;
				rz->block_off += rz->buf_len;
				if(rz->buf_flush){
					rz->block_pos = rz->next_block_pos;
					rz->block_off = 0;
					rz->buf_flush = 0;
				}
			}
		} else if(rz->buf_flush){
			rz->block_pos = rz->next_block_pos;
			rz->block_off = 0;
			rz->buf_flush = 0;
		}
		if(rz->buf_flush) continue;
		rz->buf_len = _razf_read(rz, rz->outbuf, RZ_BUFFER_SIZE);
		if(rz->z_eof || rz->z_err) break;
	}
	rz->out += ori_size - size;
	return ori_size - size;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, %r14d
testl %esi, %esi
jle 0x12e78
movl %ebp, %r14d
movl 0x84(%rbx), %ecx
testl %ecx, %ecx
je 0x12e53
movl %r14d, %eax
subl %ecx, %eax
jl 0x12e5e
movq $0x0, 0x80(%rbx)
cmpl $0x0, 0x40(%rbx)
movl %eax, %r14d
je 0x12e22
movq 0x58(%rbx), %rcx
movq %rcx, 0x48(%rbx)
movq $0x0, 0x50(%rbx)
movl $0x0, 0x40(%rbx)
movl %eax, %r14d
cmpl $0x0, 0x40(%rbx)
jne 0x12e4c
movq 0x68(%rbx), %rsi
movq %rbx, %rdi
callq 0x12c69
movl %eax, 0x84(%rbx)
cmpl $0x0, 0x8c(%rbx)
jne 0x12e78
cmpl $0x0, 0x88(%rbx)
jne 0x12e78
testl %r14d, %r14d
jg 0x12de3
jmp 0x12e78
cmpl $0x0, 0x40(%rbx)
movl %r14d, %eax
jne 0x12e08
jmp 0x12e22
addl %r14d, 0x80(%rbx)
subl %r14d, %ecx
movl %ecx, 0x84(%rbx)
movl %r14d, %eax
addq %rax, 0x50(%rbx)
xorl %r14d, %r14d
subl %r14d, %ebp
movslq %ebp, %rax
addq %rax, 0x28(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/razf.c
// Function: razf_jump
int64_t razf_jump(RAZF *rz, int64_t block_start, int block_offset){
	int64_t pos;
	rz->z_eof = 0;
	if(rz->file_type == FILE_TYPE_PLAIN){
		rz->buf_off = rz->buf_len = 0;
		pos = block_start + block_offset;
#ifdef _USE_KNETFILE
		knet_seek(rz->x.fpr, pos, SEEK_SET);
        pos = knet_tell(rz->x.fpr);
#else
		pos = lseek(rz->filedes, pos, SEEK_SET);
#endif
		rz->out = rz->in = pos;
		return pos;
	}
	if(block_start == rz->block_pos && block_offset >= rz->block_off) {
		block_offset -= rz->block_off;
		goto SKIP; // Needn't reset inflate
	}
	if(block_start  == 0) block_start = rz->header_size; // Automaticly revist wrong block_start
	_razf_reset_read(rz, block_start, 0);
	SKIP:
	if(block_offset) razf_skip(rz, block_offset);
	return rz->block_off;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rdi, %rbx
movl $0x0, 0x8c(%rdi)
cmpl $0x2, 0x4(%rdi)
jne 0x12ed0
movq $0x0, 0x80(%rbx)
movslq %ebp, %rax
addq %rsi, %rax
movq 0x8(%rbx), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x158e6
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%rbx)
movq %rax, 0x28(%rbx)
jmp 0x12f0b
cmpq %rsi, 0x48(%rbx)
jne 0x12ee2
movslq %ebp, %rcx
movq 0x50(%rbx), %rax
cmpq %rcx, %rax
jle 0x12ef7
testq %rsi, %rsi
jne 0x12eeb
movslq 0x70(%rbx), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x12f12
jmp 0x12ef9
subl %eax, %ebp
testl %ebp, %ebp
je 0x12f07
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12dcc
movq 0x50(%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/razf.c
// Function: razf_reset_read
static void _razf_reset_read(RAZF *rz, int64_t in, int64_t out){
#ifdef _USE_KNETFILE
	knet_seek(rz->x.fpr, in, SEEK_SET);
#else
	lseek(rz->filedes, in, SEEK_SET);
#endif
	rz->in  = in;
	rz->out = out;
	rz->block_pos = in;
	rz->next_block_pos = in;
	rz->block_off = 0;
	rz->buf_flush = 0;
	rz->z_eof = rz->z_err = 0;
	inflateReset(rz->stream);
	rz->stream->avail_in = 0;
	rz->buf_off = rz->buf_len = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdi), %rdi
xorl %r12d, %r12d
xorl %edx, %edx
callq 0x158e6
movq %r14, 0x20(%r15)
movq %rbx, 0x28(%r15)
movq %r14, 0x48(%r15)
movq %r14, 0x58(%r15)
movq %r12, 0x50(%r15)
movl %r12d, 0x40(%r15)
movq %r12, 0x88(%r15)
movq 0x10(%r15), %rdi
callq 0x3500
movq 0x10(%r15), %rax
movl %r12d, 0x8(%rax)
movq %r12, 0x80(%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/razf.c
// Function: razf_seek
int64_t razf_seek(RAZF* rz, int64_t pos, int where){
	int64_t idx;
	int64_t seek_pos, new_out;
	rz->z_eof = 0;
	if (where == SEEK_CUR) pos += rz->out;
	else if (where == SEEK_END) pos += rz->src_end;
	if(rz->file_type == FILE_TYPE_PLAIN){
#ifdef _USE_KNETFILE
		knet_seek(rz->x.fpr, pos, SEEK_SET);
        seek_pos = knet_tell(rz->x.fpr);
#else
		seek_pos = lseek(rz->filedes, pos, SEEK_SET);
#endif
		rz->buf_off = rz->buf_len = 0;
		rz->out = rz->in = seek_pos;
		return seek_pos;
	} else if(rz->file_type == FILE_TYPE_GZ){
		if(pos >= rz->out) goto SKIP;
		return rz->out;
	}
	if(pos == rz->out) return pos;
	if(pos > rz->src_end) return rz->out;
	if(!rz->seekable || !rz->load_index){
		if(pos >= rz->out) goto SKIP;
	}
	idx = pos / RZ_BLOCK_SIZE - 1;
	seek_pos = (idx < 0)? rz->header_size:(rz->index->cell_offsets[idx] + rz->index->bin_offsets[idx / RZ_BIN_SIZE]);
	new_out  = (idx + 1) * RZ_BLOCK_SIZE;
	if(pos > rz->out && new_out <= rz->out) goto SKIP;
	_razf_reset_read(rz, seek_pos, new_out);
	SKIP:
	razf_skip(rz, (int)(pos - rz->out));
	return rz->out;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl $0x0, 0x8c(%rdi)
cmpl $0x1, %edx
je 0x12f99
cmpl $0x2, %edx
jne 0x12fa2
movl $0x38, %eax
jmp 0x12f9e
movl $0x28, %eax
addq (%rbx,%rax), %r14
movl 0x4(%rbx), %eax
cmpl $0x3, %eax
je 0x12fda
cmpl $0x2, %eax
jne 0x12ff8
movq 0x8(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x158e6
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rax
movq $0x0, 0x80(%rbx)
movq %rax, 0x20(%rbx)
movq %rax, 0x28(%rbx)
jmp 0x1300c
movq 0x28(%rbx), %rax
cmpq %rax, %r14
jl 0x1300c
subl 0x28(%rbx), %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x12dcc
movq 0x28(%rbx), %rax
jmp 0x1300c
movq 0x28(%rbx), %rax
cmpq %rax, %r14
jne 0x13006
movq %r14, %rax
jmp 0x1300c
cmpq 0x38(%rbx), %r14
jle 0x13014
addq $0x8, %rsp
popq %rbx
popq %r14
retq
cmpl $0x0, 0x90(%rbx)
je 0x13026
cmpl $0x0, 0x94(%rbx)
jne 0x1302b
cmpq %rax, %r14
jge 0x12fe3
movl $0x7fff, %ecx           # imm = 0x7FFF
leaq (%r14,%rcx), %rdx
testq %r14, %r14
cmovnsq %r14, %rdx
sarq $0xf, %rdx
cmpq %rcx, %r14
jg 0x1304a
movslq 0x70(%rbx), %rsi
jmp 0x13065
leaq -0x1(%rdx), %rcx
movq 0x18(%rbx), %rsi
movq (%rsi), %rdi
movq 0x8(%rsi), %r8
movl -0x4(%rdi,%rdx,4), %esi
shrq $0x11, %rcx
addq (%r8,%rcx,8), %rsi
shlq $0xf, %rdx
cmpq %rax, %r14
setle %cl
cmpq %rax, %rdx
setg %al
orb %cl, %al
cmpb $0x1, %al
jne 0x12fe3
movq %rbx, %rdi
callq 0x12f12
jmp 0x12fe3
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/razf.c
// Function: razf_write
static void _razf_write(RAZF* rz, const void *data, int size){
	int tout;
	rz->stream->avail_in = size;
	rz->stream->next_in  = (void*)data;
	while(1){
		tout = rz->stream->avail_out;
		deflate(rz->stream, Z_NO_FLUSH);
		rz->out += tout - rz->stream->avail_out;
		if(rz->stream->avail_out) break;
#ifdef _USE_KNETFILE
		write(rz->x.fpw, rz->outbuf, RZ_BUFFER_SIZE - rz->stream->avail_out);
#else
		write(rz->filedes, rz->outbuf, RZ_BUFFER_SIZE - rz->stream->avail_out);
#endif
		rz->stream->avail_out = RZ_BUFFER_SIZE;
		rz->stream->next_out  = rz->outbuf;
		if(rz->stream->avail_in == 0) break;
	};
	rz->in += size - rz->stream->avail_in;
	rz->block_off += size - rz->stream->avail_in;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rdi, %r14
movq 0x10(%rdi), %rax
movl %edx, 0x8(%rax)
movq %rsi, (%rax)
movq 0x10(%r14), %rdi
movl 0x20(%rdi), %r15d
xorl %esi, %esi
callq 0x3250
movq 0x10(%r14), %rax
movl 0x20(%rax), %eax
subl %eax, %r15d
addq %r15, 0x28(%r14)
testl %eax, %eax
jne 0x13360
movl 0x8(%r14), %edi
movq 0x68(%r14), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x3190
movq 0x10(%r14), %rax
movl $0x1000, 0x20(%rax)     # imm = 0x1000
movq 0x68(%r14), %rcx
movq %rcx, 0x18(%rax)
cmpl $0x0, 0x8(%rax)
jne 0x13314
movq 0x10(%r14), %rax
subl 0x8(%rax), %ebx
addq %rbx, 0x20(%r14)
addq %rbx, 0x50(%r14)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/razf.c
// Function: load_zindex
static void load_zindex(RAZF *rz, int fd){
#endif
	int32_t i, v32;
	int is_be;
	if(!rz->load_index) return;
	if(rz->index == NULL) rz->index = malloc(sizeof(ZBlockIndex));
	is_be = is_big_endian();
#ifdef _USE_KNETFILE
	knet_read(fp, &rz->index->size, sizeof(int));
#else
	read(fd, &rz->index->size, sizeof(int));
#endif
	if(!is_be) rz->index->size = byte_swap_4((uint32_t)rz->index->size);
	rz->index->cap = rz->index->size;
	v32 = rz->index->size / RZ_BIN_SIZE + 1;
	rz->index->bin_offsets  = malloc(sizeof(int64_t) * v32);
#ifdef _USE_KNETFILE
	knet_read(fp, rz->index->bin_offsets, sizeof(int64_t) * v32);
#else
	read(fd, rz->index->bin_offsets, sizeof(int64_t) * v32);
#endif
	rz->index->cell_offsets = malloc(sizeof(int) * rz->index->size);
#ifdef _USE_KNETFILE
	knet_read(fp, rz->index->cell_offsets, sizeof(int) * rz->index->size);
#else
	read(fd, rz->index->cell_offsets, sizeof(int) * rz->index->size);
#endif
	if(!is_be){
		for(i=0;i<v32;i++) rz->index->bin_offsets[i] = byte_swap_8((uint64_t)rz->index->bin_offsets[i]);
		for(i=0;i<rz->index->size;i++) rz->index->cell_offsets[i] = byte_swap_4((uint32_t)rz->index->cell_offsets[i]);
	}
}

// Assembly:
cmpl $0x0, 0x94(%rdi)
je 0x13475
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x18(%rdi)
jne 0x133a8
movl $0x18, %edi
callq 0x33e0
movq %rax, 0x18(%rbx)
movq 0x18(%rbx), %rsi
addq $0x10, %rsi
movl $0x4, %edx
movq %r14, %rdi
callq 0x1582a
movq 0x18(%rbx), %rbp
movl 0x10(%rbp), %r12d
bswapl %r12d
movl %r12d, 0x10(%rbp)
movl %r12d, 0x14(%rbp)
sarl $0x11, %r12d
movslq %r12d, %r13
leaq 0x8(,%r13,8), %r15
movq %r15, %rdi
callq 0x33e0
movq %rax, 0x8(%rbp)
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x1582a
movq 0x18(%rbx), %rbp
movslq 0x10(%rbp), %r15
shlq $0x2, %r15
movq %r15, %rdi
callq 0x33e0
movq %rax, (%rbp)
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x1582a
testl %r13d, %r13d
js 0x13444
movq 0x18(%rbx), %rax
movq 0x8(%rax), %rax
incl %r12d
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdx
bswapq %rdx
movq %rdx, (%rax,%rcx,8)
incq %rcx
cmpq %rcx, %r12
jne 0x13431
movq 0x18(%rbx), %rax
cmpl $0x0, 0x10(%rax)
jle 0x13467
movq (%rax), %rcx
xorl %edx, %edx
movl (%rcx,%rdx,4), %esi
bswapl %esi
movl %esi, (%rcx,%rdx,4)
incq %rdx
movslq 0x10(%rax), %rsi
cmpq %rsi, %rdx
jl 0x13453
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/faidx.c
// Function: fai_destroy
void fai_destroy(faidx_t *fai)
{
	int i;
	for (i = 0; i < fai->n; ++i) free(fai->name[i]);
	free(fai->name);
	kh_destroy(s, fai->hash);
	if (fai->rz) razf_close(fai->rz);
	free(fai);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x8(%rdi)
jle 0x13a45
xorl %r14d, %r14d
movq 0x10(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3060
incq %r14
movslq 0x8(%rbx), %rax
cmpq %rax, %r14
jl 0x13a2c
movq 0x10(%rbx), %rdi
callq 0x3060
movq 0x18(%rbx), %r14
testq %r14, %r14
je 0x13a7a
movq 0x18(%r14), %rdi
callq 0x3060
movq 0x10(%r14), %rdi
callq 0x3060
movq 0x20(%r14), %rdi
callq 0x3060
movq %r14, %rdi
callq 0x3060
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x13a87
callq 0x130ba
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3060
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/faidx.c
// Function: fai_save
void fai_save(const faidx_t *fai, FILE *fp)
{
	khint_t k;
	int i;
	for (i = 0; i < fai->n; ++i) {
		faidx1_t x;
		k = kh_get(s, fai->hash, fai->name[i]);
		x = kh_value(fai->hash, k);
#ifdef _WIN32
		fprintf(fp, "%s\t%d\t%ld\t%d\t%d\n", fai->name[i], (int)x.len, (long)x.offset, (int)x.line_blen, (int)x.line_len);
#else
		fprintf(fp, "%s\t%d\t%lld\t%d\t%d\n", fai->name[i], (int)x.len, (long long)x.offset, (int)x.line_blen, (int)x.line_len);
#endif
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, 0x28(%rsp)
cmpl $0x0, 0x8(%rdi)
jle 0x13c09
movq %rdi, %rbx
xorl %r15d, %r15d
movq %rdi, 0x18(%rsp)
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rax,%r15,8), %r10
movq %rcx, 0x8(%rsp)
movl (%rcx), %r13d
movl $0x0, %eax
testl %r13d, %r13d
je 0x13bc0
movsbl (%r10), %ecx
testl %ecx, %ecx
movq %r15, 0x20(%rsp)
je 0x13b10
movb 0x1(%r10), %al
testb %al, %al
je 0x13b12
leaq 0x2(%r10), %rdx
movl %ecx, %esi
shll $0x5, %esi
subl %ecx, %esi
movsbl %al, %ecx
addl %esi, %ecx
movb (%rdx), %al
incq %rdx
testb %al, %al
jne 0x13af9
jmp 0x13b12
xorl %ecx, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %r13d
movl %edx, %edi
leal -0x1(%r13), %esi
movl %ecx, %eax
xorl %edx, %edx
divl %esi
movl %edx, %r14d
incl %r14d
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
movl %edi, %r12d
movl %edi, 0x14(%rsp)
movq %rsi, 0x30(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %ebp
leal (%r12,%r12), %r15d
andl $0x1e, %r15d
movl %ebp, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x13ba6
testb $0x1, %al
jne 0x13b8b
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r10, %rsi
movq %r10, %rbx
callq 0x3300
movq 0x30(%rsp), %rsi
movl 0x14(%rsp), %edi
movq %rbx, %r10
testl %eax, %eax
je 0x13ba6
addl %r14d, %r12d
cmpl %r13d, %r12d
movl %r13d, %eax
movl $0x0, %ecx
cmovbl %ecx, %eax
subl %eax, %r12d
cmpl %edi, %r12d
jne 0x13b40
jmp 0x13bb3
movl %r15d, %ecx
shrl %cl, %ebp
testb $0x3, %bpl
cmovel %r12d, %r13d
movl %r13d, %eax
movq 0x18(%rsp), %rbx
movq 0x20(%rsp), %r15
movq 0x8(%rsp), %rcx
movq 0x20(%rcx), %rdx
movl %eax, %eax
leaq (%rax,%rax,2), %rax
movl (%rdx,%rax,8), %esi
movl 0x4(%rdx,%rax,8), %r9d
movl 0x8(%rdx,%rax,8), %ecx
movq 0x10(%rdx,%rax,8), %r8
movl %esi, (%rsp)
movq 0x28(%rsp), %rdi
leaq 0x7cff(%rip), %rsi      # 0x1b8ee
movq %r10, %rdx
xorl %eax, %eax
callq 0x3320
incq %r15
movslq 0x8(%rbx), %rax
cmpq %rax, %r15
jl 0x13abe
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/faidx.c
// Function: fai_read
faidx_t *fai_read(FILE *fp)
{
	faidx_t *fai;
	char *buf, *p;
	int len, line_len, line_blen;
#ifdef _WIN32
	long offset;
#else
	long long offset;
#endif
	fai = (faidx_t*)calloc(1, sizeof(faidx_t));
	fai->hash = kh_init(s);
	buf = (char*)calloc(0x10000, 1);
	while (!feof(fp) && fgets(buf, 0x10000, fp)) {
		for (p = buf; *p && isgraph(*p); ++p);
		*p = 0; ++p;
#ifdef _WIN32
		sscanf(p, "%d%ld%d%d", &len, &offset, &line_blen, &line_len);
#else
		sscanf(p, "%d%lld%d%d", &len, &offset, &line_blen, &line_len);
#endif
		fai_insert_index(fai, buf, len, line_len, line_blen, offset);
	}
	free(buf);
	return fai;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x1, %edi
movl $0x20, %esi
callq 0x32e0
movq %rax, %r14
movl $0x1, %edi
movl $0x28, %esi
callq 0x32e0
movq %rax, 0x18(%r14)
movl $0x10000, %edi          # imm = 0x10000
movl $0x1, %esi
callq 0x32e0
movq %rax, %r15
movq %rbx, %rdi
callq 0x3330
testl %eax, %eax
jne 0x13d0d
leaq 0x4(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %r15, %rdi
movl $0x10000, %esi          # imm = 0x10000
movq %rbx, %rdx
callq 0x32d0
testq %rax, %rax
je 0x13d0d
movb (%r15), %bpl
movq %r15, %rdi
testb %bpl, %bpl
je 0x13cbc
callq 0x35f0
movq (%rax), %rax
movq %r15, %rdi
movsbq %bpl, %rcx
cmpw $0x0, (%rax,%rcx,2)
jns 0x13cbc
movb 0x1(%rdi), %bpl
incq %rdi
testb %bpl, %bpl
jne 0x13ca5
movb $0x0, (%rdi)
incq %rdi
leaq 0x7c37(%rip), %rsi      # 0x1b900
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %r12, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x3410
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movl 0x4(%rsp), %r8d
movq 0x10(%rsp), %r9
movq %r14, %rdi
movq %r15, %rsi
callq 0x137ad
movq %rbx, %rdi
callq 0x3330
testl %eax, %eax
je 0x13c7a
movq %r15, %rdi
callq 0x3060
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/faidx.c
// Function: fai_build
int fai_build(const char *fn)
{
	char *str;
	RAZF *rz;
	FILE *fp;
	faidx_t *fai;
	str = (char*)calloc(strlen(fn) + 5, 1);
	sprintf(str, "%s.fai", fn);
	rz = razf_open(fn, "r");
	if (rz == 0) {
		fprintf(stderr, "[fai_build] fail to open the FASTA file %s\n",fn);
		free(str);
		return -1;
	}
	fai = fai_build_core(rz);
	razf_close(rz);
	fp = fopen(str, "wb");
	if (fp == 0) {
		fprintf(stderr, "[fai_build] fail to write FASTA index %s\n",str);
		fai_destroy(fai); free(str);
		return -1;
	}
	fai_save(fai, fp);
	fclose(fp);
	free(str);
	fai_destroy(fai);
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
callq 0x31e0
leaq 0x5(%rax), %rdi
movl $0x1, %esi
callq 0x32e0
movq %rax, %rbx
leaq 0x7bbf(%rip), %rsi      # 0x1b90b
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3510
leaq 0x7aa6(%rip), %rsi      # 0x1b806
movq %r14, %rdi
callq 0x12671
testq %rax, %rax
je 0x13dc5
movq %rax, %r15
movq %rax, %rdi
callq 0x13478
movq %rax, %r14
movq %r15, %rdi
callq 0x130ba
leaq 0x75ea(%rip), %rsi      # 0x1b374
movq %rbx, %rdi
callq 0x3340
testq %rax, %rax
je 0x13dea
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x13a96
movq %r15, %rdi
callq 0x31c0
movq %rbx, %rdi
callq 0x3060
movq %r14, %rdi
callq 0x13a1c
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq 0xe22c(%rip), %rax      # 0x21ff8
movq (%rax), %rdi
leaq 0x7b3c(%rip), %rsi      # 0x1b912
movq %r14, %rdx
xorl %eax, %eax
callq 0x3320
movq %rbx, %rdi
callq 0x3060
jmp 0x13df5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x40b0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x13dbf