LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_color.c
// Function: bam_aux_getCSi
char bam_aux_getCSi(bam1_t *b, int i)
{
	uint8_t *c = bam_aux_get(b, "CS");
	char *cs = NULL;

	// return the base if the tag was not found
	if(0 == c) return 0;

	cs = bam_aux2Z(c);
	// adjust for strandedness and leading adaptor
	if(bam1_strand(b)) {
	    i = strlen(cs) - 1 - i;
	    // adjust for leading hard clip
	    uint32_t cigar = bam1_cigar(b)[0];
	    if((cigar & BAM_CIGAR_MASK) == BAM_CHARD_CLIP) {
		i -= cigar >> BAM_CIGAR_SHIFT;
	    }
	} else { i++; }
	return cs[i];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
leaq 0x32a3c(%rip), %rsi     # 0x4152b
callq 0x22374
testq %rax, %rax
je 0xeb15
movq %rax, %rdi
callq 0x23423
movq %rax, %rbx
movq 0x8(%r14), %r15
btq $0x24, %r15
jb 0xeb19
incl %ebp
movl %ebp, %eax
jmp 0xeb43
xorl %eax, %eax
jmp 0xeb48
movq %rbx, %rdi
callq 0x3360
notl %ebp
addl %ebp, %eax
movq 0x30(%r14), %rcx
shrl $0x18, %r15d
movl (%rcx,%r15), %ecx
movl %ecx, %edx
andl $0xf, %edx
shrl $0x4, %ecx
xorl %esi, %esi
cmpl $0x5, %edx
cmovel %ecx, %esi
subl %esi, %eax
cltq
movb (%rbx,%rax), %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_color.c
// Function: bam_aux_getCQi
char bam_aux_getCQi(bam1_t *b, int i)
{
	uint8_t *c = bam_aux_get(b, "CQ");
	char *cq = NULL;
	
	// return the base if the tag was not found
	if(0 == c) return 0;

	cq = bam_aux2Z(c);
	// adjust for strandedness
	if(bam1_strand(b)) {
	    i = strlen(cq) - 1 - i;
	    // adjust for leading hard clip
	    uint32_t cigar = bam1_cigar(b)[0];
	    if((cigar & BAM_CIGAR_MASK) == BAM_CHARD_CLIP) {
		i -= (cigar >> BAM_CIGAR_SHIFT);
	    }
	}
	return cq[i];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
leaq 0x329c8(%rip), %rsi     # 0x4152e
callq 0x22374
testq %rax, %rax
je 0xebba
movq %rax, %rdi
callq 0x23423
movq %rax, %rbx
movq 0x8(%r14), %r15
btq $0x24, %r15
jae 0xebb2
movq %rbx, %rdi
callq 0x3360
notl %ebp
addl %ebp, %eax
movq 0x30(%r14), %rcx
shrl $0x18, %r15d
movl (%rcx,%r15), %ecx
movl %ecx, %edx
andl $0xf, %edx
shrl $0x4, %ecx
xorl %esi, %esi
cmpl $0x5, %edx
cmovel %ecx, %esi
subl %esi, %eax
movl %eax, %ebp
movslq %ebp, %rax
movb (%rbx,%rax), %al
jmp 0xebbc
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_color.c
// Function: bam_aux_nt2int
char bam_aux_nt2int(char a)
{
	switch(toupper(a)) {
		case 'A':
			return 0;
			break;
		case 'C':
			return 1;
			break;
		case 'G':
			return 2;
			break;
		case 'T':
			return 3;
			break;
		default:
			return 4;
			break;
	}
}

// Assembly:
pushq %rbx
movl %edi, %ebx
callq 0x3300
movq (%rax), %rax
movslq %ebx, %rcx
movl (%rax,%rcx,4), %eax
cmpl $0x46, %eax
jg 0xebeb
cmpl $0x41, %eax
je 0xebfd
cmpl $0x43, %eax
jne 0xebf9
movb $0x1, %al
jmp 0xec03
cmpl $0x47, %eax
je 0xec01
cmpl $0x54, %eax
jne 0xebf9
movb $0x3, %al
jmp 0xec03
movb $0x4, %al
jmp 0xec03
xorl %eax, %eax
jmp 0xec03
movb $0x2, %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_color.c
// Function: bam_aux_ntnt2cs
char bam_aux_ntnt2cs(char a, char b)
{
	a = bam_aux_nt2int(a);
	b = bam_aux_nt2int(b);
	if(4 == a || 4 == b) return '4';
	return "0123"[(int)(a ^ b)];
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
callq 0xebc7
movl %eax, %ebx
movl %ebp, %edi
callq 0xebc7
cmpb $0x4, %bl
sete %cl
cmpb $0x4, %al
sete %dl
orb %cl, %dl
movb $0x34, %cl
jne 0xec38
xorb %bl, %al
movzbl %al, %eax
leaq 0x328fc(%rip), %rcx     # 0x41531
movb (%rax,%rcx), %cl
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam2bcf.c
// Function: bcf_call_init
bcf_callaux_t *bcf_call_init(double theta, int min_baseQ)
{
	bcf_callaux_t *bca;
	if (theta <= 0.) theta = CALL_DEFTHETA;
	bca = calloc(1, sizeof(bcf_callaux_t));
	bca->capQ = 60;
	bca->openQ = 40; bca->extQ = 20; bca->tandemQ = 100;
	bca->min_baseQ = min_baseQ;
	bca->e = errmod_init(1. - theta);
	bca->min_frac = 0.002;
	bca->min_support = 1;
    bca->per_sample_flt = 0;
    bca->npos = 100;
    bca->ref_pos = calloc(bca->npos, sizeof(int));
    bca->alt_pos = calloc(bca->npos, sizeof(int));
 	return bca;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x28, %rsp
movl %edi, %ebp
movapd %xmm0, (%rsp)
movsd 0x30cc7(%rip), %xmm1    # 0x419f8
subsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
movl $0x1, %edi
movl $0x90, %esi
callq 0x3610
movq %rax, %rbx
movl $0x3c, (%rax)
movl %ebp, 0x4(%rax)
xorpd %xmm0, %xmm0
movapd (%rsp), %xmm1
cmpnlesd %xmm0, %xmm1
movapd 0x10(%rsp), %xmm2
andpd %xmm1, %xmm2
movsd 0x30c8a(%rip), %xmm0    # 0x41a00
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
callq 0x16057
movq %rax, 0x80(%rbx)
movabsq $0x3f60624dd2f1a9fc, %rax # imm = 0x3F60624DD2F1A9FC
movq %rax, 0x20(%rbx)
movaps 0x2e5aa(%rip), %xmm0    # 0x3f350
movups %xmm0, 0x8(%rbx)
movl $0x64, 0x48(%rbx)
movl $0x64, %edi
movl $0x4, %esi
callq 0x3610
movq %rax, 0x38(%rbx)
movl $0x64, %edi
movl $0x4, %esi
callq 0x3610
movq %rax, 0x40(%rbx)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam2bcf.c
// Function: bcf_call_destroy
void bcf_call_destroy(bcf_callaux_t *bca)
{
	if (bca == 0) return;
	errmod_destroy(bca->e);
    if (bca->npos) { free(bca->ref_pos); free(bca->alt_pos); bca->npos = 0; }
	free(bca->bases); free(bca->inscns); free(bca);
}

// Assembly:
testq %rdi, %rdi
je 0x10e30
pushq %rbx
movq %rdi, %rbx
movq 0x80(%rdi), %rdi
callq 0x1637d
cmpl $0x0, 0x48(%rbx)
je 0x10e15
movq 0x38(%rbx), %rdi
callq 0x3350
movq 0x40(%rbx), %rdi
callq 0x3350
movl $0x0, 0x48(%rbx)
movq 0x78(%rbx), %rdi
callq 0x3350
movq 0x70(%rbx), %rdi
callq 0x3350
movq %rbx, %rdi
popq %rbx
jmp 0x3350
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam2bcf.c
// Function: calc_vdb
void calc_vdb(bcf_callaux_t *bca, bcf_call_t *call)
{
    int i, dp = 0;
    float mean_pos = 0, mean_diff = 0;
    for (i=0; i<bca->npos; i++)
    {
        if ( !bca->alt_pos[i] ) continue;
        dp += bca->alt_pos[i];
        int j = i<bca->npos/2 ? i : bca->npos - i;
        mean_pos += bca->alt_pos[i]*j;
    }
    if ( dp<2 )
    {
        call->vdb = -1;
        return;
    }
    mean_pos /= dp;
    for (i=0; i<bca->npos; i++)
    {
        if ( !bca->alt_pos[i] ) continue;
        int j = i<bca->npos/2 ? i : bca->npos - i;
        mean_diff += bca->alt_pos[i] * fabs(j - mean_pos);
    }
    mean_diff /= dp;
    call->vdb = mean_diff_to_prob(mean_diff, dp, bca->npos);
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
movl 0x48(%rdi), %esi
movss 0x303b9(%rip), %xmm0    # 0x41ab0
testl %esi, %esi
jle 0x117c5
movq %rdi, %rax
movq 0x40(%rdi), %rcx
movl %esi, %edx
shrl %edx
xorps %xmm1, %xmm1
xorl %r8d, %r8d
movl %esi, %r9d
xorl %edi, %edi
movl (%rcx,%r8,4), %r10d
testl %r10d, %r10d
je 0x1173b
addl %r10d, %edi
cmpq %rdx, %r8
movl %r9d, %r11d
cmovbl %r8d, %r11d
imull %r10d, %r11d
xorps %xmm2, %xmm2
cvtsi2ss %r11d, %xmm2
addss %xmm2, %xmm1
incq %r8
decl %r9d
cmpq %r8, %rsi
jne 0x11715
cmpl $0x2, %edi
jl 0x117c5
xorps %xmm2, %xmm2
cvtsi2ss %edi, %xmm2
testl %esi, %esi
jle 0x117b9
divss %xmm2, %xmm1
movq 0x40(%rax), %rax
movl %esi, %ecx
shrl %ecx
xorps %xmm0, %xmm0
xorl %edx, %edx
movaps 0x30332(%rip), %xmm3    # 0x41aa0
movq %rsi, %r8
movl (%rax,%rdx,4), %r9d
testl %r9d, %r9d
je 0x117af
cmpq %rcx, %rdx
movl %r8d, %r10d
cmovbl %edx, %r10d
xorps %xmm4, %xmm4
cvtsi2sd %r9d, %xmm4
xorps %xmm5, %xmm5
cvtsi2ss %r10d, %xmm5
subss %xmm1, %xmm5
andps %xmm3, %xmm5
cvtss2sd %xmm5, %xmm5
mulsd %xmm4, %xmm5
cvtss2sd %xmm0, %xmm0
addsd %xmm5, %xmm0
cvtsd2ss %xmm0, %xmm0
incq %rdx
decq %r8
jne 0x11771
jmp 0x117bc
xorps %xmm0, %xmm0
divss %xmm2, %xmm0
callq 0x1154f
movss %xmm0, 0x90(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam2bcf_indel.c
// Function: bcf_call_del_rghash
void bcf_call_del_rghash(void *_hash)
{
	khint_t k;
	khash_t(rg) *hash = (khash_t(rg)*)_hash;
	if (hash == 0) return;
	for (k = kh_begin(hash); k < kh_end(hash); ++k)
		if (kh_exist(hash, k))
			free((char*)kh_key(hash, k));
	kh_destroy(rg, hash);
}

// Assembly:
testq %rdi, %rdi
je 0x13bda
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %eax
testl %eax, %eax
je 0x13bb2
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rcx
movq %r15, %rdx
shrq $0x4, %rdx
movl (%rcx,%rdx,4), %edx
movl %r14d, %ecx
andb $0x1e, %cl
shrl %cl, %edx
testb $0x3, %dl
jne 0x13ba4
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x3350
movl (%rbx), %eax
incq %r15
movl %eax, %ecx
addl $0x2, %r14d
cmpq %rcx, %r15
jb 0x13b7a
movq 0x18(%rbx), %rdi
callq 0x3350
movq 0x10(%rbx), %rdi
callq 0x3350
movq 0x20(%rbx), %rdi
callq 0x3350
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3350
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam2bcf_indel.c
// Function: tpos2qpos
static int tpos2qpos(const bam1_core_t *c, const uint32_t *cigar, int32_t tpos, int is_left, int32_t *_tpos)
{
	int k, x = c->pos, y = 0, last_y = 0;
	*_tpos = c->pos;
	for (k = 0; k < c->n_cigar; ++k) {
		int op = cigar[k] & BAM_CIGAR_MASK;
		int l = cigar[k] >> BAM_CIGAR_SHIFT;
		if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) {
			if (c->pos > tpos) return y;
			if (x + l > tpos) {
				*_tpos = tpos;
				return y + (tpos - x);
			}
			x += l; y += l;
			last_y = y;
		} else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) y += l;
		else if (op == BAM_CDEL || op == BAM_CREF_SKIP) {
			if (x + l > tpos) {
				*_tpos = is_left? x : x + l;
				return y;
			}
			x += l;
		}
	}
	*_tpos = x;
	return last_y;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl 0x4(%rdi), %r9d
movl %r9d, (%r8)
movq 0x8(%rdi), %rdi
xorl %ebx, %ebx
shrq $0x30, %rdi
jne 0x15844
movl %r9d, %r10d
movl %r10d, (%r8)
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r11d, %r11d
xorl %ebx, %ebx
xorl %eax, %eax
movl %r9d, %r10d
movl (%rsi,%r11,4), %ebp
movl %ebp, %r15d
andl $0xf, %r15d
movl %ebp, %r14d
shrl $0x4, %r14d
cmpl $0x7, %r15d
setne %r12b
testb $0x7, %bpl
setne %r13b
testb %r12b, %r13b
jne 0x15890
cmpl %edx, %r9d
jg 0x15839
leal (%r14,%r10), %ebx
cmpl %edx, %ebx
jg 0x158c1
addl %eax, %r14d
movl %ebx, %r10d
movl %r14d, %eax
movl %r14d, %ebx
jmp 0x158a2
cmpl $0x4, %r15d
je 0x1589c
cmpl $0x1, %r15d
jne 0x158ac
addl %eax, %r14d
movl %r14d, %eax
incq %r11
cmpq %r11, %rdi
jne 0x1584e
jmp 0x15834
andl $0xe, %ebp
cmpl $0x2, %ebp
jne 0x158a2
addl %r10d, %r14d
cmpl %edx, %r14d
jg 0x158ce
movl %r14d, %r10d
jmp 0x158a2
movl %edx, (%r8)
subl %r10d, %edx
addl %edx, %eax
jmp 0x15839
testl %ecx, %ecx
cmovel %r14d, %r10d
movl %r10d, (%r8)
jmp 0x15839
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/sample.c
// Function: kh_put_sm
bam_sample_t *bam_smpl_init(void)
{
	bam_sample_t *s;
	s = calloc(1, sizeof(bam_sample_t));
	s->rg2smid = kh_init(sm);
	s->sm2id = kh_init(sm);
	return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rsi, %rbp
movq %rdi, %r13
movl 0x8(%rdi), %eax
cmpl 0xc(%rdi), %eax
jb 0x172b3
movl (%r13), %eax
movl 0x4(%r13), %ecx
addl %ecx, %ecx
xorl %esi, %esi
cmpl %eax, %ecx
sbbl %esi, %esi
orl $0x1, %esi
addl %eax, %esi
movq %r13, %rdi
callq 0x17473
movl (%r13), %r14d
movsbl (%rbp), %esi
testl %esi, %esi
je 0x172e1
movb 0x1(%rbp), %al
testb %al, %al
je 0x172e3
leaq 0x2(%rbp), %rcx
movl %esi, %edx
shll $0x5, %edx
subl %esi, %edx
movsbl %al, %esi
addl %edx, %esi
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x172ca
jmp 0x172e3
xorl %esi, %esi
xorl %r10d, %r10d
movl %esi, %eax
xorl %edx, %edx
divl %r14d
movl %edx, %r15d
movq 0x10(%r13), %rdi
movl %edx, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %eax
leal (%r15,%r15), %ecx
shrl %cl, %eax
testb $0x2, %al
je 0x1730e
movl %r15d, %r12d
jmp 0x173e7
movq %rbp, (%rsp)
movq %r13, 0x8(%rsp)
movq %rbx, 0x18(%rsp)
leal -0x1(%r14), %ecx
movl %esi, %eax
xorl %edx, %edx
divl %ecx
incl %edx
movl %r15d, %r13d
movl %r14d, %r12d
movq %rdi, 0x20(%rsp)
movl %edx, 0x14(%rsp)
movl %r13d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %ebp
leal (,%r13,2), %ebx
andl $0x1e, %ebx
movl %ebp, %eax
movl %ebx, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x173b8
testb $0x1, %al
jne 0x17382
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rdi
movq (%rsp), %rsi
callq 0x35a0
movl 0x14(%rsp), %edx
xorl %r10d, %r10d
movq 0x20(%rsp), %rdi
testl %eax, %eax
je 0x173b8
btl %ebx, %ebp
cmovbl %r13d, %r12d
addl %edx, %r13d
cmpl %r14d, %r13d
movl %r14d, %eax
cmovbl %r10d, %eax
subl %eax, %r13d
cmpl %r15d, %r13d
jne 0x17337
movb $0x1, %al
movl %r14d, %ecx
cmpl %r14d, %r12d
movq 0x18(%rsp), %rbx
movq 0x8(%rsp), %r13
movq (%rsp), %rbp
je 0x173d7
jmp 0x173e7
movl %ebx, %ecx
shrl %cl, %ebp
testb $0x2, %bpl
sete %al
movl %r12d, %ecx
movl %r13d, %r15d
movq 0x18(%rsp), %rbx
movq 0x8(%rsp), %r13
movq (%rsp), %rbp
cmpl %r14d, %ecx
cmovel %r15d, %ecx
testb %al, %al
cmovnel %r15d, %ecx
movl %ecx, %r12d
movl %r12d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %edx
leal (%r12,%r12), %ecx
andl $0x1e, %ecx
shrl %cl, %edx
testb $0x2, %dl
jne 0x1742b
xorl %esi, %esi
testb $0x1, %dl
je 0x1745f
movq 0x18(%r13), %rdx
movl %r12d, %esi
movq %rbp, (%rdx,%rsi,8)
movl $0x3, %edx
shll %cl, %edx
notl %edx
movq 0x10(%r13), %rcx
andl %edx, (%rcx,%rax,4)
incl 0x4(%r13)
movl $0x2, %esi
jmp 0x1745f
movq 0x18(%r13), %rdx
movl $0x3, %esi
shll %cl, %esi
movl %r12d, %ecx
movq %rbp, (%rdx,%rcx,8)
notl %esi
movq 0x10(%r13), %rcx
andl %esi, (%rcx,%rax,4)
movq 0x4(%r13), %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, 0x4(%r13)
movl $0x1, %esi
movl %esi, (%rbx)
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/sample.c
// Function: bam_smpl_destroy
void bam_smpl_destroy(bam_sample_t *sm)
{
	int i;
	khint_t k;
	khash_t(sm) *rg2smid = (khash_t(sm)*)sm->rg2smid;
	if (sm == 0) return;
	for (i = 0; i < sm->n; ++i) free(sm->smpl[i]);
	free(sm->smpl);
	for (k = kh_begin(rg2smid); k != kh_end(rg2smid); ++k)
		if (kh_exist(rg2smid, k)) free((char*)kh_key(rg2smid, k));
	kh_destroy(sm, sm->rg2smid);
	kh_destroy(sm, sm->sm2id);
	free(sm);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %r14
cmpl $0x0, (%rdi)
jle 0x16754
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x3350
incq %r15
movslq (%rbx), %rax
cmpq %rax, %r15
jl 0x1673c
movq 0x8(%rbx), %rdi
callq 0x3350
movl (%r14), %eax
testl %eax, %eax
je 0x167a0
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x10(%r14), %rcx
movl %r15d, %edx
shrl $0x4, %edx
movl (%rcx,%rdx,4), %edx
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %edx
testb $0x3, %dl
jne 0x16795
movq 0x18(%r14), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x3350
movl (%r14), %eax
incl %r15d
addl $0x2, %ebp
cmpl %eax, %r15d
jne 0x16769
movq 0x10(%rbx), %r14
testq %r14, %r14
je 0x167cc
movq 0x18(%r14), %rdi
callq 0x3350
movq 0x10(%r14), %rdi
callq 0x3350
movq 0x20(%r14), %rdi
callq 0x3350
movq %r14, %rdi
callq 0x3350
movq 0x18(%rbx), %r14
testq %r14, %r14
je 0x167f8
movq 0x18(%r14), %rdi
callq 0x3350
movq 0x10(%r14), %rdi
callq 0x3350
movq 0x20(%r14), %rdi
callq 0x3350
movq %r14, %rdi
callq 0x3350
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3350
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/cut_target.c
// Function: read_aln
static int read_aln(void *data, bam1_t *b)
{
	extern int bam_prob_realn_core(bam1_t *b, const char *ref, int flag);
	ct_t *g = (ct_t*)data;
	int ret, len;
	ret = bam_read1(g->fp, b);
	if (ret >= 0 && g->fai && b->core.tid >= 0 && (b->core.flag&4) == 0) {
		if (b->core.tid != g->tid) { // then load the sequence
			free(g->ref);
			g->ref = fai_fetch(g->fai, g->h->target_name[b->core.tid], &len);
			g->tid = b->core.tid;
		}
		bam_prob_realn_core(b, g->ref, 1<<1|1);
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rdi
callq 0x2393b
movl %eax, %ebp
testl %eax, %eax
js 0x17c99
cmpq $0x0, 0x30(%r14)
je 0x17c99
movl (%rbx), %eax
testl %eax, %eax
js 0x17c99
testb $0x4, 0xc(%rbx)
jne 0x17c99
movq 0x28(%r14), %rsi
cmpl 0x4(%r14), %eax
je 0x17c8c
movq %rsi, %rdi
callq 0x3350
movq 0x20(%r14), %rax
movq 0x30(%r14), %rdi
movq 0x8(%rax), %rax
movslq (%rbx), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xc(%rsp), %rdx
callq 0x2fb9f
movq %rax, %rsi
movq %rax, 0x28(%r14)
movl (%rbx), %eax
movl %eax, 0x4(%r14)
movq %rbx, %rdi
movl $0x3, %edx
callq 0x2e0ec
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/phase.c
// Function: readaln
static int readaln(void *data, bam1_t *b)
{
	phaseg_t *g = (phaseg_t*)data;
	int ret;
	ret = bam_read1(g->fp, b);
	if (ret < 0) return ret;
	if (!(b->core.flag & (BAM_FUNMAP|BAM_FSECONDARY|BAM_FQCFAIL|BAM_FDUP)) && g->pre) {
		if (g->n == g->m) {
			g->m = g->m? g->m<<1 : 16;
			g->b = realloc(g->b, g->m * sizeof(void*));
		}
		g->b[g->n++] = bam_dup1(b);
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x2393b
movl %eax, %ebp
testl %eax, %eax
js 0x19ec4
movzwl 0xc(%r14), %eax
testl $0x704, %eax            # imm = 0x704
jne 0x19ec4
cmpq $0x0, 0x20(%rbx)
je 0x19ec4
movl 0x40(%rbx), %r15d
cmpl 0x44(%rbx), %r15d
jne 0x19e4b
leal (%r15,%r15), %eax
testl %r15d, %r15d
movl $0x10, %ecx
cmovnel %eax, %ecx
movl %ecx, 0x44(%rbx)
movq 0x48(%rbx), %rdi
movslq %ecx, %rsi
shlq $0x3, %rsi
callq 0x3720
movq %rax, (%rsp)
movq %rax, 0x48(%rbx)
movl 0x40(%rbx), %r15d
jmp 0x19e53
movq 0x48(%rbx), %rax
movq %rax, (%rsp)
movl $0x1, %edi
movl $0x38, %esi
callq 0x3610
movq %rax, %r12
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm0, (%rax)
movups %xmm1, 0x10(%rax)
movq 0x30(%r14), %rax
movq %rax, 0x30(%r12)
movslq 0x24(%r12), %r13
movl %r13d, 0x28(%r12)
movl $0x1, %esi
movq %r13, %rdi
callq 0x3610
movq %rax, 0x30(%r12)
movq 0x30(%r14), %rsi
movq %rax, %rdi
movq %r13, %rdx
callq 0x37d0
leal 0x1(%r15), %eax
movl %eax, 0x40(%rbx)
movslq %r15d, %rax
movq (%rsp), %rcx
movq %r12, (%rcx,%rax,8)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/phase.c
// Function: update_vpos
static void update_vpos(int vpos, nseq_t *hash)
{
	khint_t k;
	for (k = 0; k < kh_end(hash); ++k) {
		if (kh_exist(hash, k)) {
			frag_t *f = &kh_val(hash, k);
			if (f->vpos < vpos) kh_del(64, hash, k); // TODO: if frag_t::seq is allocated dynamically, free it
			else f->vpos -= vpos;
		}
	}
}

// Assembly:
movl (%rsi), %r9d
testl %r9d, %r9d
je 0x1ac3a
pushq %rbp
pushq %r14
pushq %rbx
movq 0x10(%rsi), %rax
movl $0x80, %edx
xorl %r8d, %r8d
xorl %r10d, %r10d
movq %r10, %r11
shrq $0x4, %r11
movl (%rax,%r11,4), %ebx
movl %r8d, %ecx
andl $0x1e, %ecx
movl %ebx, %ebp
shrl %cl, %ebp
testb $0x3, %bpl
jne 0x1ac20
movq 0x20(%rsi), %r14
movl (%r14,%rdx,2), %ebp
subl %edi, %ebp
jge 0x1ac1c
btsl %ecx, %ebx
movl %ebx, (%rax,%r11,4)
decl 0x4(%rsi)
movl (%rsi), %r9d
jmp 0x1ac20
movl %ebp, (%r14,%rdx,2)
incq %r10
movl %r9d, %ecx
addq $0x8a, %rdx
addl $0x2, %r8d
cmpq %rcx, %r10
jb 0x1abe6
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam2depth.c
// Function: read_bam
static int read_bam(void *data, bam1_t *b) // read level filters better go here to avoid pileup
{
	aux_t *aux = (aux_t*)data; // data in fact is a pointer to an auxiliary structure
	int ret = aux->iter? bam_iter_read(aux->fp, aux->iter, b) : bam_read1(aux->fp, b);
	if (!(b->core.flag&BAM_FUNMAP)) {
		if ((int)b->core.qual < aux->min_mapQ) b->core.flag |= BAM_FUNMAP;
		else if (aux->min_len && bam_cigar2qlen(&b->core, bam1_cigar(b)) < aux->min_len) b->core.flag |= BAM_FUNMAP;
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
movq 0x8(%r14), %rsi
testq %rsi, %rsi
je 0x1baa8
movq %rbx, %rdx
callq 0x2acb6
jmp 0x1bab0
movq %rbx, %rsi
callq 0x2393b
movl %eax, %ebp
movq 0x8(%rbx), %rsi
btq $0x22, %rsi
jb 0x1bafc
movl %esi, %eax
shrl $0x10, %eax
movzbl %al, %eax
cmpl 0x10(%r14), %eax
jl 0x1baeb
cmpl $0x0, 0x14(%r14)
je 0x1bafc
shrl $0x18, %esi
addq 0x30(%rbx), %rsi
movq %rbx, %rdi
callq 0x23521
cmpl 0x14(%r14), %eax
jge 0x1bafc
movq 0x8(%rbx), %rsi
movabsq $0x400000000, %rax      # imm = 0x400000000
orq %rsi, %rax
movq %rax, 0x8(%rbx)
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/padding.c
// Function: load_unpadded_ref
int load_unpadded_ref(faidx_t *fai, char *ref_name, int ref_len, kstring_t *seq)
{
	char base;
	char *fai_ref = 0;
	int fai_ref_len = 0, k;

	fai_ref = fai_fetch(fai, ref_name, &fai_ref_len);
	if (fai_ref_len != ref_len) {
		fprintf(stderr, "[depad] ERROR: FASTA sequence %s length %i, expected %i\n", ref_name, fai_ref_len, ref_len);
		free(fai_ref);
		return -1;
	}
	ks_resize(seq, ref_len);
	seq->l = 0;
	for (k = 0; k < ref_len; ++k) {
		base = fai_ref[k];
		if (base == '-' || base == '*') {
			// Map gaps to null to match unpad_seq function
			seq->s[seq->l++] = 0;
		} else {
			int i = bam_nt16_table[(int)base];
			if (i == 0 || i==16) { // Equals maps to 0, anything unexpected to 16
				fprintf(stderr, "[depad] ERROR: Invalid character %c (ASCII %i) in FASTA sequence %s\n", base, (int)base, ref_name);
				free(fai_ref);
				return -1;
			}
			seq->s[seq->l++] = i;
		}
	}
	assert(ref_len == seq->l);
	free(fai_ref);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r15
movl %edx, %ebp
movq %rsi, %r14
leaq 0xc(%rsp), %r12
movl $0x0, (%r12)
movq %r12, %rdx
callq 0x2fb9f
movq %rax, %rbx
movl (%r12), %ecx
cmpl %ebp, %ecx
jne 0x1bc00
movslq %ebp, %r12
cmpq %r12, 0x8(%r15)
jae 0x1bb8f
leaq -0x1(%r12), %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%r15)
movq 0x10(%r15), %rdi
callq 0x3720
movq %rax, 0x10(%r15)
movq $0x0, (%r15)
testl %ebp, %ebp
jle 0x1bbe2
movl %ebp, %eax
xorl %edx, %edx
leaq 0x3523b(%rip), %rsi     # 0x50de0
movzbl (%rbx,%rdx), %ecx
xorl %edi, %edi
cmpl $0x2a, %ecx
je 0x1bbc3
cmpl $0x2d, %ecx
je 0x1bbc3
movsbq %cl, %rcx
movb (%rsi,%rcx), %dil
testb $-0x11, %dil
je 0x1bc2d
movq (%r15), %rcx
movq 0x10(%r15), %r8
leaq 0x1(%rcx), %r9
movq %r9, (%r15)
movb %dil, (%r8,%rcx)
incq %rdx
cmpq %rdx, %rax
jne 0x1bba5
movq (%r15), %rax
jmp 0x1bbe4
xorl %eax, %eax
cmpq %r12, %rax
jne 0x1bc4c
movq %rbx, %rdi
callq 0x3350
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x343e1(%rip), %rax     # 0x4ffe8
movq (%rax), %rdi
leaq 0x26933(%rip), %rsi     # 0x42544
movq %r14, %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3750
movq %rbx, %rdi
callq 0x3350
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1bbf3
movq 0x343b4(%rip), %rax     # 0x4ffe8
movq (%rax), %rdi
leaq 0x2693f(%rip), %rsi     # 0x4257d
movl %ecx, %edx
movq %r14, %r8
xorl %eax, %eax
callq 0x3750
jmp 0x1bc1e
leaq 0x2696f(%rip), %rdi     # 0x425c2
leaq 0x2697a(%rip), %rsi     # 0x425d4
leaq 0x2697d(%rip), %rcx     # 0x425de
movl $0x67, %edx
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/padding.c
// Function: get_unpadded_len
int get_unpadded_len(faidx_t *fai, char *ref_name, int padded_len)
{
	char base;
	char *fai_ref = 0;
	int fai_ref_len = 0, k;
	int bases=0, gaps=0;

	fai_ref = fai_fetch(fai, ref_name, &fai_ref_len);
	if (fai_ref_len != padded_len) {
		fprintf(stderr, "[depad] ERROR: FASTA sequence '%s' length %i, expected %i\n", ref_name, fai_ref_len, padded_len);
		free(fai_ref);
		return -1;
	}
	for (k = 0; k < padded_len; ++k) {
		//fprintf(stderr, "[depad] checking base %i of %i or %i\n", k+1, ref_len, strlen(fai_ref));
		base = fai_ref[k];
		if (base == '-' || base == '*') {
			gaps += 1;
		} else {
			int i = bam_nt16_table[(int)base];
			if (i == 0 || i==16) { // Equals maps to 0, anything unexpected to 16
				fprintf(stderr, "[depad] ERROR: Invalid character %c (ASCII %i) in FASTA sequence '%s'\n", base, (int)base, ref_name);
				free(fai_ref);
				return -1;
			}
			bases += 1;
		}
	}
	free(fai_ref);
	assert (padded_len == bases + gaps);
	return bases;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movq %rsi, %r14
leaq 0xc(%rsp), %r15
movl $0x0, (%r15)
movq %r15, %rdx
callq 0x2fb9f
movq %rax, %rbx
movl (%r15), %ecx
cmpl %ebp, %ecx
jne 0x1bcff
testl %ebp, %ebp
jle 0x1bcd9
movl %ebp, %eax
xorl %edx, %edx
leaq 0x35137(%rip), %rsi     # 0x50de0
xorl %r12d, %r12d
xorl %r15d, %r15d
movzbl (%rbx,%rdx), %ecx
cmpl $0x2d, %ecx
je 0x1bcbd
cmpl $0x2a, %ecx
jne 0x1bcc2
incl %r12d
jmp 0x1bccf
movsbq %cl, %rcx
testb $-0x11, (%rsi,%rcx)
je 0x1bd2d
incl %r15d
incq %rdx
cmpq %rdx, %rax
jne 0x1bcaf
jmp 0x1bcdf
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x3350
addl %r15d, %r12d
cmpl %ebp, %r12d
jne 0x1bd4c
movl %r15d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x342e2(%rip), %rax     # 0x4ffe8
movq (%rax), %rdi
leaq 0x26909(%rip), %rsi     # 0x42619
movq %r14, %rdx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3750
movq %rbx, %rdi
callq 0x3350
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x1bcef
movq 0x342b4(%rip), %rax     # 0x4ffe8
movq (%rax), %rdi
leaq 0x26916(%rip), %rsi     # 0x42654
movl %ecx, %edx
movq %r14, %r8
xorl %eax, %eax
callq 0x3750
jmp 0x1bd1d
leaq 0x26948(%rip), %rdi     # 0x4269b
leaq 0x2687a(%rip), %rsi     # 0x425d4
leaq 0x26955(%rip), %rcx     # 0x426b6
movl $0x89, %edx
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/padding.c
// Function: replace_cigar
static void replace_cigar(bam1_t *b, int n, uint32_t *cigar)
{
	if (n != b->core.n_cigar) {
		int o = b->core.l_qname + b->core.n_cigar * 4;
		if (b->data_len + (n - b->core.n_cigar) * 4 > b->m_data) {
			b->m_data = b->data_len + (n - b->core.n_cigar) * 4;
			kroundup32(b->m_data);
			b->data = (uint8_t*)realloc(b->data, b->m_data);
		}
		memmove(b->data + b->core.l_qname + n * 4, b->data + o, b->data_len - o);
		memcpy(b->data + b->core.l_qname, cigar, n * 4);
		b->data_len += (n - b->core.n_cigar) * 4;
		b->core.n_cigar = n;
	} else memcpy(b->data + b->core.l_qname, cigar, n * 4);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
movq 0x8(%rdi), %rdi
movq %rdi, %rcx
shrq $0x30, %rcx
movl %esi, %eax
subl %ecx, %eax
jne 0x1c9bf
shrl $0x18, %edi
addq 0x30(%r14), %rdi
shll $0x2, %ebx
movq %r15, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x37d0
movl %edi, %edx
shrl $0x18, %edx
leal (%rdx,%rcx,4), %ebp
movl 0x24(%r14), %ecx
leal (%rcx,%rax,4), %eax
cmpl 0x28(%r14), %eax
jle 0x1ca18
decl %eax
movl %eax, %ecx
sarl %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x8, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x10, %ecx
orl %eax, %ecx
incl %ecx
movl %ecx, 0x28(%r14)
movq 0x30(%r14), %rdi
movslq %ecx, %rsi
callq 0x3720
movq %rax, 0x30(%r14)
movq 0x8(%r14), %rdi
movl 0x24(%r14), %ecx
jmp 0x1ca1c
movq 0x30(%r14), %rax
shrl $0x18, %edi
leal (,%rbx,4), %edx
movslq %edx, %r12
addq %rax, %rdi
addq %r12, %rdi
movl %ebp, %esi
addq %rax, %rsi
subl %ebp, %ecx
movslq %ecx, %rdx
callq 0x34e0
movzbl 0xb(%r14), %edi
addq 0x30(%r14), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x37d0
movzwl 0xe(%r14), %eax
movl %ebx, %ecx
subl %eax, %ecx
shll $0x2, %ecx
addl %ecx, 0x24(%r14)
movw %bx, 0xe(%r14)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_tview_curses.c
// Function: curses_destroy
static void curses_destroy(tview_t* base)
	{
	curses_tview_t* tv=(curses_tview_t*)base;

	
	delwin(tv->wgoto); delwin(tv->whelp);
	endwin();

	base_tv_destroy(base);
	
	free(tv);
	}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0xc8(%rdi), %rdi
callq 0x3430
movq 0xd0(%rbx), %rdi
callq 0x3430
callq 0x3590
movq %rbx, %rdi
callq 0x6ec5
movq %rbx, %rdi
popq %rbx
jmp 0x3350
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_tview_html.c
// Function: html_tv_init
tview_t* html_tv_init(const char *fn, const char *fn_fa, const char *samples)
	{
	char* colstr=getenv("COLUMNS");
	html_tview_t *tv = (html_tview_t*)calloc(1, sizeof(html_tview_t));
	tview_t* base=(tview_t*)tv;
	if(tv==0)
		{
		fprintf(stderr,"Calloc failed\n");
		return 0;
		}
	tv->row_count=0;
	tv->screen=NULL;
	tv->out=stdout;
	tv->attributes=0;
	base_tv_init(base,fn,fn_fa,samples);
	/* initialize callbacks */
#define SET_CALLBACK(fun) base->my_##fun=html_##fun;
	SET_CALLBACK(destroy);
	SET_CALLBACK(mvprintw);
	SET_CALLBACK(mvaddch);
	SET_CALLBACK(attron);
	SET_CALLBACK(attroff);
	SET_CALLBACK(clear);
	SET_CALLBACK(colorpair);
	SET_CALLBACK(drawaln);
	SET_CALLBACK(loop);
	SET_CALLBACK(underline);
#undef SET_CALLBACK

	
	if(colstr!=0)
		{
		base->mcol=atoi(colstr);
		if(base->mcol<10) base->mcol=80;
		}
	base->mrow=99999;
	
/*
	init_pair(tv,1, "blue", "white");
	init_pair(tv,2, "green", "white");
	init_pair(tv,3, "yellow", "white");
	init_pair(tv,4, "white", "white");
	init_pair(tv,5, "green", "white");
	init_pair(tv,6, "cyan", "white");
	init_pair(tv,7, "yellow", "white");
	init_pair(tv,8, "red", "white");
	init_pair(tv,9, "blue", "white");
	*/
	return base;
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
leaq 0x23a8a(%rip), %rdi     # 0x43403
callq 0x3540
movq %rax, %r14
movl $0x1, %edi
movl $0xe8, %esi
callq 0x3610
movq %rax, %rbx
testq %rax, %rax
je 0x1fa75
movq 0x30655(%rip), %rax     # 0x4fff8
movq (%rax), %rax
movq %rax, 0xd8(%rbx)
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x5e4c
leaq 0xb7(%rip), %rax        # 0x1fa7c
movq %rax, 0x78(%rbx)
leaq 0x10d(%rip), %rax       # 0x1fadd
movq %rax, 0x80(%rbx)
leaq 0x1f8(%rip), %rax       # 0x1fbd6
movq %rax, 0x88(%rbx)
leaq 0x2ba(%rip), %rax       # 0x1fca6
movq %rax, 0x90(%rbx)
leaq 0x2b3(%rip), %rax       # 0x1fcad
movq %rax, 0x98(%rbx)
leaq 0x2ae(%rip), %rax       # 0x1fcb6
movq %rax, 0xa0(%rbx)
leaq 0x30b(%rip), %rax       # 0x1fd21
movq %rax, 0xa8(%rbx)
leaq 0x307(%rip), %rax       # 0x1fd2b
movq %rax, 0xb0(%rbx)
leaq 0x72d(%rip), %rax       # 0x2015f
movq %rax, 0xb8(%rbx)
leaq 0x722(%rip), %rax       # 0x20162
movq %rax, 0xc0(%rbx)
testq %r14, %r14
je 0x1fa62
movq %r14, %rdi
callq 0x34c0
cmpl $0xa, %eax
movl $0x50, %ecx
cmovgel %eax, %ecx
movl %ecx, 0x4(%rbx)
movl $0x1869f, (%rbx)        # imm = 0x1869F
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x47ac
jmp 0x1fa68
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_tview_html.c
// Function: html_destroy
static void html_destroy(tview_t* base)
	{
	int i;
	html_tview_t* tv=(html_tview_t*)base;
	if(tv->screen!=NULL)
		{
		for(i=0;i< tv->row_count;++i) free(tv->screen[i]);
		free(tv->screen);
		}
	base_tv_destroy(base);
	free(tv);
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xd0(%rdi), %rdi
testq %rdi, %rdi
je 0x1fac6
cmpl $0x0, 0xc8(%rbx)
jle 0x1fac1
xorl %r14d, %r14d
movq 0xd0(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3350
incq %r14
movslq 0xc8(%rbx), %rax
cmpq %rax, %r14
jl 0x1fa9b
movq 0xd0(%rbx), %rdi
callq 0x3350
movq %rbx, %rdi
callq 0x6ec5
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3350
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_tview_html.c
// Function: html_mvprintw
static void html_mvprintw(struct AbstractTview* tv,int y ,int x,const char* fmt,...)
	{
	int i,nchars=0;
	unsigned int size=tv->mcol+2;
	char* str=malloc(size);
	if(str==0) exit(EXIT_FAILURE);
	va_list argptr;
  	va_start(argptr, fmt);
	nchars=vsnprintf(str,size, fmt, argptr);
	va_end(argptr);
	
	for(i=0;i< nchars;++i)
		{
		tv->my_mvaddch(tv,y,x+i,str[i]);
		}
	free(str);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rcx, %r12
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r14
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x1fb3d
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movl 0x4(%rdi), %r13d
addl $0x2, %r13d
movq %r13, %rdi
callq 0x3240
testq %rax, %rax
je 0x1fbcc
movq %rax, %r15
leaq 0x20(%rsp), %rax
movq %rsp, %rcx
movq %rax, 0x10(%rcx)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000020, %rax     # imm = 0x3000000020
movq %rax, (%rcx)
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x3520
testl %eax, %eax
jle 0x1fbb2
movl %eax, %r12d
movl %ebp, %r13d
xorl %ebp, %ebp
movsbl (%r15,%rbp), %ecx
leal (%r13,%rbp), %edx
movq %r14, %rdi
movl %ebx, %esi
callq *0x88(%r14)
incq %rbp
cmpq %rbp, %r12
jne 0x1fb94
movq %r15, %rdi
callq 0x3350
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x31a0
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_tview_html.c
// Function: html_mvaddch
static void html_mvaddch(struct AbstractTview* tv,int y,int x,int ch)
	{
	tixel_t* row=NULL;
	html_tview_t* ptr=FROM_TV(tv);
	if( x >= tv->mcol ) return; //out of screen
	while(ptr->row_count<=y)
		{
		int x;
		row=(tixel_t*)calloc(tv->mcol,sizeof(tixel_t));
		if(row==0)  exit(EXIT_FAILURE);
		for(x=0;x<tv->mcol;++x) {row[x].ch=' ';row[x].attributes=0;}
		ptr->screen=(tixel_t**)realloc(ptr->screen,sizeof(tixel_t*)*(ptr->row_count+1));
		ptr->screen[ptr->row_count++]=row;
		}
	row=ptr->screen[y];
	row[x].ch=ch;
	row[x].attributes=ptr->attributes;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl %edx, 0x4(%rdi)
jle 0x1fc8d
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %r14
movl 0xc8(%rdi), %ebx
cmpl %esi, %ebx
jle 0x1fc05
movq 0xd0(%r14), %rax
jmp 0x1fc75
movl %ecx, 0x4(%rsp)
movslq 0x4(%r14), %r13
movl $0x8, %esi
movq %r13, %rdi
callq 0x3610
testq %rax, %rax
je 0x1fc9c
movq %rax, %r12
testl %r13d, %r13d
jle 0x1fc39
xorl %eax, %eax
movq $0x20, (%r12,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x1fc29
movq 0xd0(%r14), %rdi
movslq %ebx, %rax
leaq 0x8(,%rax,8), %rsi
callq 0x3720
movq %rax, 0xd0(%r14)
movslq 0xc8(%r14), %rcx
leal 0x1(%rcx), %ebx
movl %ebx, 0xc8(%r14)
movq %r12, (%rax,%rcx,8)
cmpl %r15d, %ecx
jl 0x1fc09
movl 0x4(%rsp), %ecx
movslq %r15d, %rdx
movq (%rax,%rdx,8), %rax
movslq %ebp, %rsi
movl %ecx, (%rax,%rsi,8)
movl 0xe0(%r14), %edx
movl %edx, 0x4(%rax,%rsi,8)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x31a0
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_tview_html.c
// Function: html_clear
static void html_clear(struct AbstractTview* tv)
    {
    html_tview_t* ptr=FROM_TV(tv);
    if(ptr->screen!=NULL)
	{
	int i;
	for(i=0;i< ptr->row_count;++i) free(ptr->screen[i]);
	free(ptr->screen);
	ptr->screen=NULL;
	}
    ptr->row_count=0;
    ptr->attributes=0;
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xd0(%rdi), %rdi
testq %rdi, %rdi
je 0x1fd0b
cmpl $0x0, 0xc8(%rbx)
jle 0x1fcfb
xorl %r14d, %r14d
movq 0xd0(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3350
incq %r14
movslq 0xc8(%rbx), %rax
cmpq %rax, %r14
jl 0x1fcd5
movq 0xd0(%rbx), %rdi
callq 0x3350
movq $0x0, 0xd0(%rbx)
xorl %eax, %eax
movl %eax, 0xc8(%rbx)
movl %eax, 0xe0(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_lpileup.c
// Function: bam_lplbuf_reset
void bam_lplbuf_reset(bam_lplbuf_t *buf)
{
	freenode_t *p, *q;
	bam_plbuf_reset(buf->plbuf);
	for (p = buf->head; p->next;) {
		q = p->next;
		mp_free(buf->mp, p);
		p = q;
	}
	buf->head = buf->tail;
	buf->max_level = 0;
	buf->n_cur = buf->n_pre = 0;
	buf->n_nodes = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x58(%rdi), %rdi
callq 0x2c051
movq 0x30(%rbx), %r14
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x2cdf0
movl $0xfffffff, %ebp        # imm = 0xFFFFFFF
movl $0x100, %r15d           # imm = 0x100
movq %rax, %r12
movq 0x20(%rbx), %r13
decl (%r13)
movq $0x0, 0x8(%r14)
movl (%r14), %eax
andl %ebp, %eax
orl $0x20000000, %eax       # imm = 0x20000000
movl %eax, (%r14)
movl 0x4(%r13), %ecx
cmpl 0x8(%r13), %ecx
jne 0x2cdd1
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
cmovel %r15d, %eax
movl %eax, 0x8(%r13)
movq 0x10(%r13), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x3720
movq %rax, 0x10(%r13)
movl 0x4(%r13), %ecx
jmp 0x2cdd5
movq 0x10(%r13), %rax
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r13)
movslq %ecx, %rcx
movq %r14, (%rax,%rcx,8)
movq 0x8(%r12), %rax
movq %r12, %r14
testq %rax, %rax
jne 0x2cd80
movq 0x38(%rbx), %rax
movq %rax, 0x30(%rbx)
xorl %eax, %eax
movl %eax, 0xc(%rbx)
movq $0x0, 0x4(%rbx)
movl %eax, 0x40(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_lpileup.c
// Function: bam_lplbuf_init
bam_lplbuf_t *bam_lplbuf_init(bam_pileup_f func, void *data)
{
	bam_lplbuf_t *tv;
	tv = (bam_lplbuf_t*)calloc(1, sizeof(bam_lplbuf_t));
	tv->mp = mp_init();
	tv->head = tv->tail = mp_alloc(tv->mp);
	tv->func = func;
	tv->user_data = data;
	tv->plbuf = bam_plbuf_init(tview_func, tv);
	return (bam_lplbuf_t*)tv;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl $0x1, %edi
movl $0x60, %esi
callq 0x3610
movq %rax, %r15
movl $0x1, %edi
movl $0x18, %esi
callq 0x3610
movq %rax, 0x20(%r15)
movl $0x1, (%rax)
movl $0x1, %edi
movl $0x10, %esi
callq 0x3610
movq %rax, 0x38(%r15)
movq %rax, 0x30(%r15)
movq %r14, 0x48(%r15)
movq %rbx, 0x50(%r15)
leaq 0x15(%rip), %rdi        # 0x2ce88
movq %r15, %rsi
callq 0x2bf5f
movq %rax, 0x58(%r15)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_lpileup.c
// Function: bam_lplbuf_destroy
void bam_lplbuf_destroy(bam_lplbuf_t *tv)
{
	freenode_t *p, *q;
	free(tv->cur_level); free(tv->pre_level);
	bam_plbuf_destroy(tv->plbuf);
	free(tv->aux);
	for (p = tv->head; p->next;) {
		q = p->next;
		mp_free(tv->mp, p); p = q;
	}
	mp_free(tv->mp, p);
	assert(tv->mp->cnt == 0);
	mp_destroy(tv->mp);
	free(tv);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x3350
movq 0x18(%rbx), %rdi
callq 0x3350
movq 0x58(%rbx), %rdi
callq 0x2c03c
movq 0x28(%rbx), %rdi
callq 0x3350
movq 0x30(%rbx), %r15
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x2d39c
movl $0xfffffff, %ebp        # imm = 0xFFFFFFF
movl $0x100, %r12d           # imm = 0x100
movq %rax, %r14
movq 0x20(%rbx), %r13
decl (%r13)
movq $0x0, 0x8(%r15)
movl (%r15), %eax
andl %ebp, %eax
orl $0x20000000, %eax       # imm = 0x20000000
movl %eax, (%r15)
movl 0x4(%r13), %ecx
cmpl 0x8(%r13), %ecx
jne 0x2d37c
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
cmovel %r12d, %eax
movl %eax, 0x8(%r13)
movq 0x10(%r13), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x3720
movq %rax, 0x10(%r13)
movl 0x4(%r13), %ecx
jmp 0x2d380
movq 0x10(%r13), %rax
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r13)
movslq %ecx, %rcx
movq %r15, (%rax,%rcx,8)
movq 0x8(%r14), %rax
movq %r14, %r15
testq %rax, %rax
jne 0x2d32b
jmp 0x2d39f
movq %r15, %r14
movq 0x20(%rbx), %r15
decl (%r15)
movq $0x0, 0x8(%r14)
movl $0xfffffff, %eax        # imm = 0xFFFFFFF
andl (%r14), %eax
orl $0x20000000, %eax       # imm = 0x20000000
movl %eax, (%r14)
movl 0x4(%r15), %ecx
cmpl 0x8(%r15), %ecx
jne 0x2d3f3
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x100, %ecx            # imm = 0x100
cmovnel %eax, %ecx
movl %ecx, 0x8(%r15)
movq 0x10(%r15), %rdi
movslq %ecx, %rsi
shlq $0x3, %rsi
callq 0x3720
movq %rax, 0x10(%r15)
movl 0x4(%r15), %ecx
jmp 0x2d3f7
movq 0x10(%r15), %rax
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r15)
movslq %ecx, %rcx
movq %r14, (%rax,%rcx,8)
movq 0x20(%rbx), %r14
cmpl $0x0, (%r14)
jne 0x2d459
cmpl $0x0, 0x4(%r14)
jle 0x2d432
xorl %r15d, %r15d
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x3350
incq %r15
movslq 0x4(%r14), %rax
cmpq %rax, %r15
jl 0x2d419
movq 0x10(%r14), %rdi
callq 0x3350
movq %r14, %rdi
callq 0x3350
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3350
leaq 0x17226(%rip), %rdi     # 0x44686
leaq 0x17230(%rip), %rsi     # 0x44697
leaq 0x17237(%rip), %rcx     # 0x446a5
movl $0xbe, %edx
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_sort.c
// Function: change_SO
static int change_SO(bam_header_t *h, const char *so)
{
	char *p, *q, *beg = 0, *end = 0, *newtext;
	if (h->l_text > 3) {
		if (strncmp(h->text, "@HD", 3) == 0) {
			if ((p = strchr(h->text, '\n')) == 0) return -1;
			*p = '\0';
			if ((q = strstr(h->text, "\tSO:")) != 0) {
				*p = '\n'; // change back
				if (strncmp(q + 4, so, p - q - 4) != 0) {
					beg = q;
					for (q += 4; *q != '\n' && *q != '\t'; ++q);
					end = q;
				} else return 0; // no need to change
			} else beg = end = p, *p = '\n';
		}
	}
	if (beg == 0) { // no @HD
		h->l_text += strlen(so) + 15;
		newtext = malloc(h->l_text + 1);
		sprintf(newtext, "@HD\tVN:1.3\tSO:%s\n", so);
		strcat(newtext, h->text);
	} else { // has @HD but different or no SO
		h->l_text = (beg - h->text) + (4 + strlen(so)) + (h->text + h->l_text - end);
		newtext = malloc(h->l_text + 1);
		strncpy(newtext, h->text, beg - h->text);
		sprintf(newtext + (beg - h->text), "\tSO:%s", so);
		strcat(newtext, end);
	}
	free(h->text);
	h->text = newtext;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x30(%rdi), %r15d
cmpl $0x4, %r15d
jb 0x3630f
movq 0x38(%rbx), %rdi
cmpb $0x40, (%rdi)
jne 0x3630f
cmpb $0x48, 0x1(%rdi)
jne 0x3630f
cmpb $0x44, 0x2(%rdi)
jne 0x3630f
movl $0xa, %esi
callq 0x34f0
testq %rax, %rax
je 0x3635f
movq %rax, %r15
movb $0x0, (%rax)
movq 0x38(%rbx), %rdi
leaq 0xf52e(%rip), %rsi      # 0x457f2
callq 0x3460
movb $0xa, (%r15)
testq %rax, %rax
je 0x3636e
movq %rax, %r12
leaq 0x4(%rax), %rdi
subq %rax, %r15
addq $-0x4, %r15
movq %r14, %rsi
movq %r15, %rdx
callq 0x3230
testl %eax, %eax
je 0x3635f
movq %r12, %r13
addq $0x3, %r13
movq %r13, %r15
movb 0x1(%r15), %al
incq %r15
addb $-0x9, %al
incq %r13
cmpb $0x2, %al
jae 0x362fd
jmp 0x36374
movq %r14, %rdi
callq 0x3360
leal (%rax,%r15), %ecx
addl $0xf, %ecx
movl %ecx, 0x30(%rbx)
leal (%rax,%r15), %edi
addl $0x10, %edi
callq 0x3240
movq %rax, %r13
leaq 0xf4c0(%rip), %rsi      # 0x457f7
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3400
movq 0x38(%rbx), %r14
movq %r13, %rdi
movq %r14, %rsi
callq 0x3480
movq %r14, %rdi
callq 0x3350
movq %r13, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %r13
movq %r15, %r12
movq 0x38(%rbx), %rbp
subq %rbp, %r12
movq %r14, %rdi
callq 0x3360
addl %r12d, %eax
movl 0x30(%rbx), %ecx
addl %ebp, %ecx
subl %r13d, %ecx
leal (%rcx,%rax), %edx
addl $0x4, %edx
movl %edx, 0x30(%rbx)
leal (%rcx,%rax), %edi
addl $0x5, %edi
callq 0x3240
movq %rax, %r13
movq %rax, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x3670
addq %r13, %r12
leaq 0xf44c(%rip), %rsi      # 0x45809
movq %r12, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3400
movq %r13, %rdi
movq %r15, %rsi
callq 0x3480
movq 0x38(%rbx), %r14
jmp 0x36353
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_sort.c
// Function: sort_blocks
static int sort_blocks(int n_files, size_t k, bam1_p *buf, const char *prefix, const bam_header_t *h, int n_threads)
{
	int i;
	size_t rest;
	bam1_p *b;
	pthread_t *tid;
	pthread_attr_t attr;
	worker_t *w;

	if (n_threads < 1) n_threads = 1;
	if (k < n_threads * 64) n_threads = 1; // use a single thread if we only sort a small batch of records
	pthread_attr_init(&attr);
	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
	w = calloc(n_threads, sizeof(worker_t));
	tid = calloc(n_threads, sizeof(pthread_t));
	b = buf; rest = k;
	for (i = 0; i < n_threads; ++i) {
		w[i].buf_len = rest / (n_threads - i);
		w[i].buf = b;
		w[i].prefix = prefix;
		w[i].h = h;
		w[i].index = n_files + i;
		b += w[i].buf_len; rest -= w[i].buf_len;
		pthread_create(&tid[i], &attr, worker, &w[i]);
	}
	for (i = 0; i < n_threads; ++i) pthread_join(tid[i], 0);
	free(tid); free(w);
	return n_files + n_threads;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %r9d, %ebx
movq %r8, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq %rdx, %r12
movq %rsi, %r13
movl %edi, %r15d
cmpl $0x2, %r9d
movl $0x1, %eax
cmovll %eax, %ebx
movl %ebx, %ecx
shll $0x6, %ecx
cmpq %rsi, %rcx
cmoval %eax, %ebx
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x3680
movq %r14, %rdi
xorl %esi, %esi
callq 0x3810
movl $0x28, %esi
movq %rbx, %rdi
callq 0x3610
movq %rax, %r14
movl $0x8, %esi
movq %rbx, %rdi
callq 0x3610
movq %rax, %rbp
movq %r14, 0x10(%rsp)
movq %rax, 0x8(%rsp)
movq %rbx, 0x18(%rsp)
movl %r15d, 0x4(%rsp)
movq %r13, %rax
xorl %edx, %edx
divq %rbx
movq %rax, (%r14)
movq %r12, 0x10(%r14)
movq 0x20(%rsp), %rcx
movq %rcx, 0x8(%r14)
movq 0x28(%rsp), %rcx
movq %rcx, 0x18(%r14)
movl %r15d, 0x20(%r14)
leaq (%r12,%rax,8), %r12
subq %rax, %r13
movq %rbp, %rdi
leaq 0x30(%rsp), %rsi
leaq 0x4a5(%rip), %rdx       # 0x36944
movq %r14, %rcx
callq 0x3310
incl %r15d
addq $0x8, %rbp
addq $0x28, %r14
decq %rbx
jne 0x36464
xorl %ebx, %ebx
movq 0x18(%rsp), %r14
movq 0x8(%rsp), %r15
movq (%r15,%rbx,8), %rdi
xorl %esi, %esi
callq 0x3040
incq %rbx
cmpq %rbx, %r14
jne 0x364c3
movq %r15, %rdi
callq 0x3350
movq 0x10(%rsp), %rdi
callq 0x3350
addl 0x4(%rsp), %r14d
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_sort.c
// Function: write_buffer
static void write_buffer(const char *fn, const char *mode, size_t l, bam1_p *buf, const bam_header_t *h, int n_threads)
{
	size_t i;
	bamFile fp;
	fp = strcmp(fn, "-")? bam_open(fn, mode) : bam_dopen(fileno(stdout), mode);
	if (fp == 0) return;
	bam_header_write(fp, h);
	if (n_threads > 1) bgzf_mt(fp, n_threads, 256);
	for (i = 0; i < l; ++i)
		bam_write1_core(fp, &buf[i]->core, buf[i]->data_len, buf[i]->data);
	bam_close(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r9d, %ebp
movq %r8, %r12
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
cmpb $0x2d, (%rdi)
jne 0x36521
cmpb $0x0, 0x1(%rdi)
je 0x3658c
movq %r15, %rsi
callq 0x20308
movq %rax, %r15
testq %rax, %rax
je 0x36583
movq %r15, %rdi
movq %r12, %rsi
callq 0x237d0
cmpl $0x2, %ebp
jl 0x36550
movq %r15, %rdi
movl %ebp, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x20d7d
testq %r14, %r14
je 0x36573
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rsi
movl 0x24(%rsi), %edx
movq 0x30(%rsi), %rcx
movq %r15, %rdi
callq 0x24229
incq %r12
cmpq %r12, %r14
jne 0x36558
movq %r15, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x21311
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x19a65(%rip), %rax     # 0x4fff8
movq (%rax), %rdi
callq 0x3030
movl %eax, %edi
movq %r15, %rsi
callq 0x20487
jmp 0x36529