LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/garbeam[P]st/st.c
// Function: base64dec
char *
base64dec(const char *src)
{
	size_t in_len = strlen(src);
	char *result, *dst;

	if (in_len % 4)
		in_len += 4 - (in_len % 4);
	result = dst = xmalloc(in_len / 4 * 3 + 1);
	while (*src) {
		int a = base64_digits[(unsigned char) base64dec_getc(&src)];
		int b = base64_digits[(unsigned char) base64dec_getc(&src)];
		int c = base64_digits[(unsigned char) base64dec_getc(&src)];
		int d = base64_digits[(unsigned char) base64dec_getc(&src)];

		*dst++ = (a << 2) | ((b & 0x30) >> 4);
		if (c == -1)
			break;
		*dst++ = ((b & 0x0f) << 4) | ((c & 0x3c) >> 2);
		if (d == -1)
			break;
		*dst++ = ((c & 0x03) << 6) | d;
	}
	*dst = '\0';
	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x10(%rsp), %rbx
movq %rdi, (%rbx)
callq 0x5340
addq $0x3, %rax
shrq $0x2, %rax
leaq (%rax,%rax,2), %rdi
incq %rdi
callq 0x5dec
leaq 0x52ef(%rip), %r12      # 0xe470
movq %rax, 0x8(%rsp)
movq %rax, %r15
movq 0x10(%rsp), %rax
cmpb $0x0, (%rax)
je 0x9229
movq %rbx, %rdi
callq 0x9241
movzbl %al, %eax
movb (%rax,%r12), %r14b
movq %rbx, %rdi
callq 0x9241
movzbl %al, %eax
movb (%rax,%r12), %r13b
movq %rbx, %rdi
callq 0x9241
movzbl %al, %eax
movb (%rax,%r12), %bpl
movq %rbx, %rdi
callq 0x9241
movzbl %al, %eax
movb (%rax,%r12), %al
shlb $0x2, %r14b
movl %r13d, %ecx
shrb $0x4, %cl
andb $0x3, %cl
orb %r14b, %cl
movb %cl, (%r15)
cmpb $-0x1, %bpl
je 0x9216
shlb $0x4, %r13b
movl %ebp, %ecx
shrb $0x2, %cl
andb $0xf, %cl
orb %r13b, %cl
movb %cl, 0x1(%r15)
cmpb $-0x1, %al
je 0x921b
shlb $0x6, %bpl
orb %bpl, %al
movb %al, 0x2(%r15)
addq $0x3, %r15
movb $0x1, %al
jmp 0x9221
incq %r15
jmp 0x921f
addq $0x2, %r15
xorl %eax, %eax
testb %al, %al
jne 0x9189
movb $0x0, (%r15)
movq 0x8(%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/garbeam[P]st/st.c
// Function: selscroll
void
selscroll(int orig, int n)
{
	if (sel.ob.x == -1)
		return;

	if (BETWEEN(sel.ob.y, orig, term.bot) || BETWEEN(sel.oe.y, orig, term.bot)) {
		if ((sel.ob.y += n) > term.bot || (sel.oe.y += n) < term.top) {
			selclear();
			return;
		}
		if (sel.type == SEL_RECTANGULAR) {
			if (sel.ob.y < term.top)
				sel.ob.y = term.top;
			if (sel.oe.y > term.bot)
				sel.oe.y = term.bot;
		} else {
			if (sel.ob.y < term.top) {
				sel.ob.y = term.top;
				sel.ob.x = 0;
			}
			if (sel.oe.y > term.bot) {
				sel.oe.y = term.bot;
				sel.oe.x = term.col;
			}
		}
		selnormalize();
	}
}

// Assembly:
cmpl $-0x1, 0xbd15(%rip)     # 0x156fc
je 0x9a1f
movl 0xbd11(%rip), %ecx      # 0x15700
cmpl %edi, %ecx
setl %dl
movl 0xbd5e(%rip), %eax      # 0x15758
cmpl %eax, %ecx
setg %r8b
orb %dl, %r8b
cmpb $0x1, %r8b
jne 0x9a20
movl 0xbcf9(%rip), %edx      # 0x15708
cmpl %edi, %edx
setl %dil
cmpl %eax, %edx
setg %dl
orb %dil, %dl
je 0x9a20
retq
addl %esi, %ecx
movl %ecx, 0xbcd8(%rip)      # 0x15700
cmpl %eax, %ecx
jg 0x9a42
addl 0xbcd6(%rip), %esi      # 0x15708
movl %esi, 0xbcd0(%rip)      # 0x15708
movl 0xbd16(%rip), %edx      # 0x15754
cmpl %edx, %esi
jge 0x9a67
movl $0x0, 0xbc94(%rip)      # 0x156e0
movl $0xffffffff, 0xbca6(%rip) # imm = 0xFFFFFFFF
movl 0xbc94(%rip), %edi      # 0x156f0
movl 0xbc96(%rip), %esi      # 0x156f8
jmp 0x616b
cmpl $0x2, 0xbc76(%rip)      # 0x156e4
jne 0x9a8d
cmpl %edx, %ecx
jge 0x9a7a
movl %edx, 0xbc86(%rip)      # 0x15700
cmpl %eax, %esi
jle 0x606f
movl %eax, 0xbc80(%rip)      # 0x15708
jmp 0x606f
cmpl %edx, %ecx
jge 0x9aa1
movl %edx, 0xbc69(%rip)      # 0x15700
movl $0x0, 0xbc5b(%rip)      # 0x156fc
cmpl %eax, %esi
jle 0x606f
movl %eax, 0xbc59(%rip)      # 0x15708
movl 0xbc5f(%rip), %eax      # 0x15714
movl %eax, 0xbc49(%rip)      # 0x15704
jmp 0x606f
// File: /workspace/github_c_makefile_star2_O1/garbeam[P]st/x.c
// Function: xximspot
void
xximspot(int x, int y)
{
	XPoint spot = { borderpx + x * win.cw, borderpx + (y + 1) * win.ch };
	XVaNestedList attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);

	XSetICValues(xw.xic, XNPreeditAttributes, attr, NULL);
	XFree(attr);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
imull 0xcfc8(%rip), %edi      # 0x17eb4
addl $0x2, %edi
leaq 0xc(%rsp), %rdx
movw %di, (%rdx)
incl %esi
imull 0xcfb0(%rip), %esi      # 0x17eb0
addl $0x2, %esi
movw %si, 0x2(%rdx)
leaq 0x3c8e(%rip), %rsi      # 0xeb9c
xorl %edi, %edi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x56b0
movq %rax, %rbx
movq 0xcedd(%rip), %rdi      # 0x17e00
leaq 0x3c7f(%rip), %rsi      # 0xeba9
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x5240
movq %rbx, %rdi
callq 0x5090
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/garbeam[P]st/x.c
// Function: ximopen
void
ximopen(Display *dpy)
{
	XIMCallback destroy = { .client_data = NULL, .callback = ximdestroy };

	if ((xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL)) == NULL) {
		XSetLocaleModifiers("@im=local");
		if ((xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL)) == NULL) {
			XSetLocaleModifiers("@im=");
			if ((xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL)) == NULL)
				die("XOpenIM failed. Could not open input device.\n");
		}
	}
	if (XSetIMValues(xw.xim, XNDestroyCallback, &destroy, NULL) != NULL)
		die("XSetIMValues failed. Could not set input method value.\n");
	xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
				XNClientWindow, xw.win, XNFocusWindow, xw.win, NULL);
	if (xw.xic == NULL)
		die("XCreateIC failed. Could not obtain input method.\n");
}

// Assembly:
subq $0x18, %rsp
movups 0x71de(%rip), %xmm0     # 0x13230
movaps %xmm0, (%rsp)
movq 0xbd53(%rip), %rdi      # 0x17db0
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x5680
movq %rax, 0xbd89(%rip)      # 0x17df8
testq %rax, %rax
jne 0xc0d6
leaq 0x2e3f(%rip), %rdi      # 0xeeba
callq 0x5740
movq 0xbd29(%rip), %rdi      # 0x17db0
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x5680
movq %rax, 0xbd5f(%rip)      # 0x17df8
testq %rax, %rax
jne 0xc0d6
leaq 0x2e1f(%rip), %rdi      # 0xeec4
callq 0x5740
movq 0xbcff(%rip), %rdi      # 0x17db0
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x5680
movq %rax, 0xbd35(%rip)      # 0x17df8
testq %rax, %rax
jne 0xc0d6
leaq 0x2dfa(%rip), %rdi      # 0xeec9
xorl %eax, %eax
callq 0x5e16
movq 0xbd1b(%rip), %rdi      # 0x17df8
leaq 0x2e13(%rip), %rsi      # 0xeef7
movq %rsp, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x5590
testq %rax, %rax
je 0xc103
leaq 0x2e0b(%rip), %rdi      # 0xef07
xorl %eax, %eax
callq 0x5e16
movq 0xbcee(%rip), %rdi      # 0x17df8
movq 0xbcaf(%rip), %r8       # 0x17dc0
leaq 0x2e27(%rip), %rsi      # 0xef3f
leaq 0x2e2b(%rip), %rcx      # 0xef4a
leaq 0x2e31(%rip), %r9       # 0xef57
movl $0x408, %edx            # imm = 0x408
xorl %eax, %eax
pushq $0x0
pushq %r8
callq 0x5030
addq $0x10, %rsp
movq %rax, 0xbcbf(%rip)      # 0x17e00
testq %rax, %rax
jne 0xc154
leaq 0x2e16(%rip), %rdi      # 0xef63
xorl %eax, %eax
callq 0x5e16
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/garbeam[P]st/x.c
// Function: bpress
void
bpress(XEvent *e)
{
	struct timespec now;
	MouseShortcut *ms;
	int snap;

	if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
		mousereport(e);
		return;
	}

	for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
		if (e->xbutton.button == ms->b
				&& match(ms->mask, e->xbutton.state)) {
			ttywrite(ms->s, strlen(ms->s), 1);
			return;
		}
	}

	if (e->xbutton.button == Button1) {
		/*
		 * If the user clicks below predefined timeouts specific
		 * snapping behaviour is exposed.
		 */
		clock_gettime(CLOCK_MONOTONIC, &now);
		if (TIMEDIFF(now, xsel.tclick2) <= tripleclicktimeout) {
			snap = SNAP_LINE;
		} else if (TIMEDIFF(now, xsel.tclick1) <= doubleclicktimeout) {
			snap = SNAP_WORD;
		} else {
			snap = 0;
		}
		xsel.tclick2 = xsel.tclick1;
		xsel.tclick1 = now;

		selstart(evcol(e), evrow(e), snap);
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movzwl 0xb6de(%rip), %eax      # 0x17eb8
testl $0xc018, %eax           # imm = 0xC018
je 0xc7f6
testb $0x1, 0x50(%rbx)
jne 0xc7f6
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0xd079
movl 0x54(%rbx), %ecx
xorl %eax, %eax
leaq 0x857e(%rip), %rdx      # 0x14d80
movl $0xffffdfef, %esi       # imm = 0xFFFFDFEF
cmpl (%rax,%rdx), %ecx
jne 0xc829
movl 0x4(%rax,%rdx), %edi
cmpl $-0x1, %edi
je 0xc950
movl 0x50(%rbx), %r8d
andl %esi, %r8d
cmpl %edi, %r8d
je 0xc950
addq $0x10, %rax
cmpq $0x10, %rax
je 0xc807
cmpl $0x1, 0x54(%rbx)
jne 0xc948
leaq 0x8(%rsp), %r14
movl $0x1, %edi
movq %r14, %rsi
callq 0x5130
movq (%r14), %rdx
movq 0x8(%r14), %rax
movq %rdx, %rcx
subq 0xb6d0(%rip), %rcx      # 0x17f30
imulq $0x3e8, %rcx, %rcx      # imm = 0x3E8
cvtsi2sd %rcx, %xmm0
movq %rax, %rcx
subq 0xb6c2(%rip), %rcx      # 0x17f38
cvtsi2sd %rcx, %xmm1
divsd 0x2255(%rip), %xmm1     # 0xead8
addsd %xmm0, %xmm1
movl $0x2, %ecx
movsd 0x227c(%rip), %xmm0     # 0xeb10
ucomisd %xmm1, %xmm0
jae 0xc8dc
subq 0xb67f(%rip), %rdx      # 0x17f20
imulq $0x3e8, %rdx, %rcx      # imm = 0x3E8
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
subq 0xb671(%rip), %rax      # 0x17f28
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd 0x2211(%rip), %xmm1     # 0xead8
addsd %xmm0, %xmm1
movsd 0x2245(%rip), %xmm0     # 0xeb18
xorl %ecx, %ecx
ucomisd %xmm1, %xmm0
setae %cl
movups 0xb63d(%rip), %xmm0     # 0x17f20
movups %xmm0, 0xb646(%rip)     # 0x17f30
movups 0x8(%rsp), %xmm0
movups %xmm0, 0xb62a(%rip)     # 0x17f20
movl 0x40(%rbx), %edx
xorl %esi, %esi
movl $0x0, %eax
cmpl $0x2, %edx
jl 0xc915
addl $-0x2, %edx
movl 0xb592(%rip), %eax      # 0x17ea0
decl %eax
cmpl %eax, %edx
cmovll %edx, %eax
cltd
idivl 0xb598(%rip)            # 0x17eb4
movl %eax, %edi
movl 0x44(%rbx), %eax
cmpl $0x2, %eax
jl 0xc936
addl $-0x2, %eax
movl 0xb575(%rip), %esi      # 0x17ea4
decl %esi
cmpl %esi, %eax
cmovll %eax, %esi
movl %esi, %eax
cltd
idivl 0xb571(%rip)            # 0x17eb0
movl %eax, %esi
movl %ecx, %edx
callq 0x5f98
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq 0x8(%rax,%rdx), %rbx
movq %rbx, %rdi
callq 0x5340
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x6b48
// File: /workspace/github_c_makefile_star2_O1/garbeam[P]st/x.c
// Function: brelease
void
brelease(XEvent *e)
{
	if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
		mousereport(e);
		return;
	}

	if (e->xbutton.button == Button2)
		selpaste(NULL);
	else if (e->xbutton.button == Button1)
		mousesel(e, 1);
}

// Assembly:
movzwl 0xb53d(%rip), %eax      # 0x17eb8
testl $0xc018, %eax           # imm = 0xC018
je 0xc98c
testb $0x1, 0x50(%rdi)
je 0xd079
movl 0x54(%rdi), %eax
cmpl $0x1, %eax
je 0xc9c0
cmpl $0x2, %eax
jne 0xc9ca
movq 0xb410(%rip), %rdi      # 0x17db0
movq 0xb561(%rip), %rdx      # 0x17f08
movq 0xb412(%rip), %r8       # 0x17dc0
movl $0x1, %esi
movl $0x1, %ecx
xorl %r9d, %r9d
jmp 0x51a0
movl $0x1, %esi
jmp 0xd215
retq
// File: /workspace/github_c_makefile_star2_O1/garbeam[P]st/x.c
// Function: focus
void
focus(XEvent *ev)
{
	XFocusChangeEvent *e = &ev->xfocus;

	if (e->mode == NotifyGrab)
		return;

	if (ev->type == FocusIn) {
		XSetICFocus(xw.xic);
		win.mode |= MODE_FOCUSED;
		xseturgency(0);
		if (IS_SET(MODE_FOCUS))
			ttywrite("\033[I", 3, 0);
	} else {
		XUnsetICFocus(xw.xic);
		win.mode &= ~MODE_FOCUSED;
		if (IS_SET(MODE_FOCUS))
			ttywrite("\033[O", 3, 0);
	}
}

// Assembly:
pushq %rax
cmpl $0x1, 0x28(%rdi)
jne 0xc9f4
popq %rax
retq
cmpl $0x9, (%rdi)
movq 0xb402(%rip), %rdi      # 0x17e00
jne 0xca25
callq 0x5610
orb $0x2, 0xb4ac(%rip)      # 0x17eb8
xorl %edi, %edi
callq 0xafd2
testb $0x20, 0xb49f(%rip)     # 0x17eb9
je 0xc9f2
leaq 0x2931(%rip), %rdi      # 0xf354
jmp 0xca48
callq 0x5390
movl 0xb488(%rip), %eax      # 0x17eb8
movl %eax, %ecx
andl $-0x3, %ecx
movl %ecx, 0xb47d(%rip)      # 0x17eb8
btl $0xd, %eax
jae 0xc9f2
leaq 0x2910(%rip), %rdi      # 0xf358
movl $0x3, %esi
xorl %edx, %edx
popq %rax
jmp 0x6b48
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/padding.c
// Function: usage
static int usage(int is_long_help)
{
	fprintf(stderr, "\n");
	fprintf(stderr, "Usage:   samtools depad <in.bam>\n\n");
	fprintf(stderr, "Options: -s       output is SAM (default is BAM)\n");
	fprintf(stderr, "         -S       input is SAM (default is BAM)\n");
	fprintf(stderr, "         -u       uncompressed BAM output (can't use with -s)\n");
	fprintf(stderr, "         -1       fast compression BAM output (can't use with -s)\n");
	fprintf(stderr, "         -T FILE  reference sequence file [null]\n");
	fprintf(stderr, "         -o FILE  output file name [stdout]\n");
	fprintf(stderr, "         -?       longer help\n");
	fprintf(stderr, "\n");
	if (is_long_help)
		fprintf(stderr, "Notes:\n\
\n\
  1. Requires embedded reference sequences (before the reads for that reference),\n\
     with the future aim to also support a FASTA padded reference sequence file.\n\
\n\
  2. The input padded alignment read's CIGAR strings must not use P or I operators.\n\
\n");
        return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edi, %ebx
movq 0x4abbf(%rip), %r12     # 0x4efe8
movq (%r12), %rsi
pushq $0xa
popq %rbp
movl %ebp, %edi
callq 0x3320
movq (%r12), %rcx
leaq 0x3d7bb(%rip), %rdi     # 0x41bfd
pushq $0x22
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
callq 0x3700
movq (%r12), %rcx
leaq 0x3d7c4(%rip), %rdi     # 0x41c20
pushq $0x31
popq %r15
movq %r15, %rsi
movq %r14, %rdx
callq 0x3700
movq (%r12), %rcx
leaq 0x3d7dc(%rip), %rdi     # 0x41c52
pushq $0x30
popq %rsi
movq %r14, %rdx
callq 0x3700
movq (%r12), %rcx
leaq 0x3d7f7(%rip), %rdi     # 0x41c83
pushq $0x3e
popq %rsi
movq %r14, %rdx
callq 0x3700
movq (%r12), %rcx
leaq 0x3d820(%rip), %rdi     # 0x41cc2
pushq $0x42
popq %rsi
movq %r14, %rdx
callq 0x3700
movq (%r12), %rcx
leaq 0x3d84d(%rip), %rdi     # 0x41d05
movq %r15, %rsi
movq %r14, %rdx
callq 0x3700
movq (%r12), %rcx
leaq 0x3b333(%rip), %rdi     # 0x3f801
pushq $0x2c
popq %rsi
movq %r14, %rdx
callq 0x3700
movq (%r12), %rcx
leaq 0x3b4e6(%rip), %rdi     # 0x3f9ca
pushq $0x1e
popq %rsi
movq %r14, %rdx
callq 0x3700
movq (%r12), %rsi
movl %ebp, %edi
callq 0x3320
testl %ebx, %ebx
jne 0x4507
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq (%r12), %rcx
leaq 0x3d825(%rip), %rdi     # 0x41d37
pushq $0x1
popq %rdx
movl $0x101, %esi            # imm = 0x101
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3700
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_tview.c
// Function: base_tv_destroy
void base_tv_destroy(tview_t* tv)
	{
	bam_lplbuf_destroy(tv->lplbuf);
	bcf_call_destroy(tv->bca);
	bam_index_destroy(tv->idx);
	if (tv->fai) fai_destroy(tv->fai);
	free(tv->ref);
	bam_header_destroy(tv->header);
	bam_close(tv->fp);
	}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x2c910
movq 0x38(%rbx), %rdi
callq 0x10a59
movq 0x8(%rbx), %rdi
callq 0x291f9
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x6ad5
callq 0x2e970
movq 0x68(%rbx), %rdi
callq 0x3350
movq 0x18(%rbx), %rdi
callq 0x22e78
movq 0x20(%rbx), %rdi
popq %rbx
jmp 0x20aae
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_tview.c
// Function: tv_fetch_func
int tv_fetch_func(const bam1_t *b, void *data)
{
	tview_t *tv = (tview_t*)data;
    if ( tv->rg_hash )
    {
        const uint8_t *rg = bam_aux_get(b, "RG");
        if ( !rg ) return 0; 
        khiter_t k = kh_get(kh_rg, tv->rg_hash, (const char*)(rg + 1));
        if ( k == kh_end(tv->rg_hash) ) return 0;
    }
	if (tv->no_skip) {
		uint32_t *cigar = bam1_cigar(b); // this is cheating...
		int i;
		for (i = 0; i <b->core.n_cigar; ++i) {
			if ((cigar[i]&0xf) == BAM_CREF_SKIP)
				cigar[i] = cigar[i]>>4<<4 | BAM_CDEL;
		}
	}
	bam_lplbuf_push(b, tv->lplbuf);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r12
movq %rdi, %rbx
cmpq $0x0, 0x70(%rsi)
je 0x6c28
leaq 0x3a232(%rip), %rsi     # 0x40d49
movq %rbx, %rdi
callq 0x21c82
testq %rax, %rax
je 0x6c72
movq 0x70(%r12), %rcx
movq %rcx, 0x18(%rsp)
movl (%rcx), %r14d
testl %r14d, %r14d
je 0x6b75
leaq 0x1(%rax), %rcx
movq %rcx, 0x20(%rsp)
movsbl (%rcx), %esi
xorl %edi, %edi
movl $0x0, %ecx
testl %esi, %esi
je 0x6b7f
movb 0x2(%rax), %dl
testb %dl, %dl
je 0x6b7d
addq $0x3, %rax
movl %esi, %ecx
movl %ecx, %esi
shll $0x5, %esi
subl %ecx, %esi
movsbl %dl, %ecx
addl %esi, %ecx
movb (%rax), %dl
incq %rax
testb %dl, %dl
jne 0x6b5e
jmp 0x6b7f
xorl %r15d, %r15d
jmp 0x6c23
movl %esi, %ecx
movq %r12, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movl %ecx, %eax
xorl %edx, %edx
divl %r14d
movl %edx, %ebx
leal -0x1(%r14), %esi
movl %ecx, %eax
xorl %edx, %edx
divl %esi
incl %edx
movq 0x18(%rsp), %rax
movq 0x10(%rax), %r12
movl %ebx, %r15d
movl %edx, 0x4(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%r12,%rax,4), %ebp
leal (%r15,%r15), %r13d
andl $0x1e, %r13d
movl %ebp, %eax
movl %r13d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x6c0c
testb $0x1, %al
jne 0x6bf3
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x20(%rsp), %rsi
callq 0x35a0
movl 0x4(%rsp), %edx
xorl %edi, %edi
testl %eax, %eax
je 0x6c0c
addl %edx, %r15d
cmpl %r14d, %r15d
movl %r14d, %eax
cmovbl %edi, %eax
subl %eax, %r15d
cmpl %ebx, %r15d
jne 0x6bae
movl %r14d, %r15d
jmp 0x6c19
movl %r13d, %ecx
shrl %cl, %ebp
testb $0x3, %bpl
cmovnel %r14d, %r15d
movq 0x10(%rsp), %rbx
movq 0x8(%rsp), %r12
cmpl %r14d, %r15d
je 0x6c72
cmpl $0x0, 0x60(%r12)
je 0x6c65
movq 0x8(%rbx), %rax
movq %rax, %rcx
shrq $0x30, %rcx
je 0x6c65
shrl $0x18, %eax
addq 0x30(%rbx), %rax
xorl %ecx, %ecx
movl (%rax,%rcx,4), %edx
movl %edx, %esi
andl $0xf, %esi
cmpl $0x3, %esi
jne 0x6c59
andl $-0xe, %edx
movl %edx, (%rax,%rcx,4)
incq %rcx
movzwl 0xe(%rbx), %edx
cmpq %rdx, %rcx
jb 0x6c46
movq 0x10(%r12), %rsi
movq %rbx, %rdi
callq 0x2ca9d
xorl %eax, %eax
addq $0x28, %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_tview.c
// Function: error
static void error(const char *format, ...)
{
    if ( !format )
    {
        fprintf(stderr, "\n");
        fprintf(stderr, "Usage: bamtk tview [options] <aln.bam> [ref.fasta]\n");
        fprintf(stderr, "Options:\n");
        fprintf(stderr, "   -d display      output as (H)tml or (C)urses or (T)ext \n");
        fprintf(stderr, "   -p chr:pos      go directly to this position\n");
        fprintf(stderr, "   -s STR          display only reads from this sample or group\n");
        fprintf(stderr, "\n\n");
    }
    else
    {
        va_list ap;
        va_start(ap, format);
        vfprintf(stderr, format, ap);
        va_end(ap);
    }
    exit(-1);
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x70b3
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)
testq %rdi, %rdi
jne 0x7168
movq 0x47f25(%rip), %rbx     # 0x4efe8
movq (%rbx), %rsi
movl $0xa, %edi
callq 0x3320
movq (%rbx), %rcx
leaq 0x37162(%rip), %rdi     # 0x3e23c
movl $0x33, %esi
movl $0x1, %edx
callq 0x3700
movq (%rbx), %rcx
leaq 0x3717d(%rip), %rdi     # 0x3e270
movl $0x9, %esi
movl $0x1, %edx
callq 0x3700
movq (%rbx), %rcx
leaq 0x3716e(%rip), %rdi     # 0x3e27a
movl $0x3b, %esi
movl $0x1, %edx
callq 0x3700
movq (%rbx), %rcx
leaq 0x37191(%rip), %rdi     # 0x3e2b6
movl $0x30, %esi
movl $0x1, %edx
callq 0x3700
movq (%rbx), %rcx
leaq 0x371a9(%rip), %rdi     # 0x3e2e7
movl $0x40, %esi
movl $0x1, %edx
callq 0x3700
movq (%rbx), %rcx
leaq 0x38f62(%rip), %rdi     # 0x400b9
movl $0x2, %esi
movl $0x1, %edx
callq 0x3700
jmp 0x71a2
movq %rdi, %r10
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq 0x47e51(%rip), %rax     # 0x4efe8
movq (%rax), %rdi
movq %r10, %rsi
callq 0x32d0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x31a0
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/sam_view.c
// Function: main_import
int main_import(int argc, char *argv[])
{
	int argc2, ret;
	char **argv2;
	if (argc != 4) {
		fprintf(stderr, "Usage: bamtk import <in.ref_list> <in.sam> <out.bam>\n");
		return 1;
	}
	argc2 = 6;
	argv2 = calloc(6, sizeof(char*));
	argv2[0] = "import", argv2[1] = "-o", argv2[2] = argv[3], argv2[3] = "-bt", argv2[4] = argv[1], argv2[5] = argv[2];
	ret = main_samview(argc2, argv2);
	free(argv2);
	return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x4, %edi
jne 0xaa51
movq %rsi, %rbx
movl $0x6, %edi
movl $0x8, %esi
callq 0x3610
movq %rax, %r14
leaq 0x34a77(%rip), %rax     # 0x3f476
movq %rax, (%r14)
leaq 0x34a74(%rip), %rax     # 0x3f47d
movq %rax, 0x8(%r14)
movq 0x18(%rbx), %rax
movq %rax, 0x10(%r14)
leaq 0x34a64(%rip), %rax     # 0x3f480
movq %rax, 0x18(%r14)
movq 0x8(%rbx), %rax
movq %rax, 0x20(%r14)
movq 0x10(%rbx), %rax
movq %rax, 0x28(%r14)
movl $0x6, %edi
movq %r14, %rsi
callq 0x98d8
movl %eax, %ebx
movq %r14, %rdi
callq 0x3350
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x3d8f
movl $0x1, %eax
jmp 0xaa49
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_rmdup.c
// Function: clear_best
static void clear_best(khash_t(lib) *aux, int max)
{
	khint_t k;
	for (k = kh_begin(aux); k != kh_end(aux); ++k) {
		if (kh_exist(aux, k)) {
			lib_aux_t *q = &kh_val(aux, k);
			if (kh_size(q->best_hash) >= max)
				kh_clear(pos, q->best_hash);
		}
	}
}

// Assembly:
cmpl $0x0, (%rdi)
je 0xbd20
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x10(%r14), %rax
movl %r15d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
je 0xbcce
incl %r15d
addl $0x2, %ebp
cmpl (%r14), %r15d
jne 0xbca9
jmp 0xbd18
movq 0x20(%r14), %rax
movl %r15d, %ecx
leaq (%rcx,%rcx,2), %rcx
movq 0x10(%rax,%rcx,8), %r12
testq %r12, %r12
je 0xbcc1
cmpl %ebx, 0x4(%r12)
jb 0xbcc1
movq 0x10(%r12), %rdi
testq %rdi, %rdi
je 0xbcc1
movl (%r12), %eax
shrl $0x4, %eax
leaq 0x4(,%rax,4), %rdx
movl $0xaa, %esi
callq 0x3080
movq $0x0, 0x4(%r12)
jmp 0xbcc1
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_rmdup.c
// Function: clear_del_set
static void clear_del_set(khash_t(name) *del_set)
{
	khint_t k;
	for (k = kh_begin(del_set); k < kh_end(del_set); ++k)
		if (kh_exist(del_set, k))
			free((char*)kh_key(del_set, k));
	kh_clear(name, del_set);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %eax
testl %eax, %eax
je 0xbd69
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movl %r15d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %r14d, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0xbd5b
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x3350
incq %r15
movl (%rbx), %eax
addl $0x2, %r14d
cmpq %rax, %r15
jb 0xbd35
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0xbd8e
shrl $0x4, %eax
leal 0x4(,%rax,4), %edx
movl $0xaa, %esi
callq 0x3080
movq $0x0, 0x4(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_rmdup.c
// Function: bam_rmdup
int bam_rmdup(int argc, char *argv[])
{
	int c, is_se = 0, force_se = 0;
	samfile_t *in, *out;
	while ((c = getopt(argc, argv, "sS")) >= 0) {
		switch (c) {
		case 's': is_se = 1; break;
		case 'S': force_se = is_se = 1; break;
		}
	}
	if (optind + 2 > argc) {
		fprintf(stderr, "\n");
		fprintf(stderr, "Usage:  samtools rmdup [-sS] <input.srt.bam> <output.bam>\n\n");
		fprintf(stderr, "Option: -s    rmdup for SE reads\n");
		fprintf(stderr, "        -S    treat PE reads as SE in rmdup (force -s)\n\n");
		return 1;
	}
	in = samopen(argv[optind], "rb", 0);
	out = samopen(argv[optind+1], "wb", in->header);
	if (in == 0 || out == 0) {
		fprintf(stderr, "[bam_rmdup] fail to read/write input files\n");
		return 1;
	}
	if (is_se) bam_rmdupse_core(in, out, force_se);
	else bam_rmdup_core(in, out);
	samclose(in); samclose(out);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebp
leaq 0x33d97(%rip), %rdx     # 0x40022
callq 0x3210
testl %eax, %eax
js 0xc2d1
xorl %r12d, %r12d
leaq 0x33d84(%rip), %r15     # 0x40022
xorl %ebx, %ebx
cmpl $0x53, %eax
je 0xc2ac
cmpl $0x73, %eax
je 0xc2b1
jmp 0xc2b7
movl $0x1, %ebx
movl $0x1, %r12d
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3210
testl %eax, %eax
jns 0xc2a0
testl %r12d, %r12d
sete %r12b
jmp 0xc2d6
movb $0x1, %r12b
xorl %ebx, %ebx
movq 0x42cdb(%rip), %r13     # 0x4efb8
movslq (%r13), %rax
leal 0x2(%rax), %ecx
cmpl %ebp, %ecx
jg 0xc35d
movq (%r14,%rax,8), %rdi
leaq 0x33dc9(%rip), %rsi     # 0x400bc
xorl %edx, %edx
callq 0x278cd
movq %rax, %r15
movslq (%r13), %rax
movq 0x8(%r14,%rax,8), %rdi
movq 0x10(%r15), %rdx
leaq 0x33dae(%rip), %rsi     # 0x400bf
callq 0x278cd
testq %r15, %r15
je 0xc364
movq %rax, %r14
testq %rax, %rax
je 0xc364
movq %r15, %rdi
movq %r14, %rsi
testb %r12b, %r12b
je 0xc335
callq 0xb0ec
jmp 0xc33c
movl %ebx, %edx
callq 0xc85c
movq %r15, %rdi
callq 0x27d21
movq %r14, %rdi
callq 0x27d21
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3e2a
jmp 0xc369
callq 0x3e0e
movl $0x1, %eax
jmp 0xc34e
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_rmdupse.c
// Function: dump_alignment
static void dump_alignment(samfile_t *out, queue_t *queue, int32_t pos, khash_t(lib) *h)
{
	if (queue->size > QUEUE_CLEAR_SIZE || pos == MAX_POS) {
		khint_t k;
		while (1) {
			elem_t *q;
			if (queue->head == queue->tail) break;
			q = &kl_val(queue->head);
			if (q->discarded) {
				q->b->data_len = 0;
				kl_shift(q, queue, 0);
				continue;
			}
			if ((q->b->core.flag&BAM_FREVERSE) && q->endpos > pos) break;
			samwrite(out, q->b);
			q->b->data_len = 0;
			kl_shift(q, queue, 0);
		}
		for (k = kh_begin(h); k != kh_end(h); ++k) {
			if (kh_exist(h, k)) {
				clear_besthash(kh_val(h, k).left, pos);
				clear_besthash(kh_val(h, k).rght, pos);
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
cmpl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
je 0xcf2d
cmpq $0x100001, 0x18(%r14)   # imm = 0x100001
jb 0xcf91
jmp 0xcf2d
cmpl $0x0, 0x4(%r12)
movq 0x8(%r12), %rsi
js 0xceca
testb $0x10, 0xc(%rsi)
je 0xceb1
cmpl %ebp, (%r12)
jg 0xcf3a
movq %r15, %rdi
callq 0x27d9c
movq 0x8(%r12), %rax
movl $0x0, 0x24(%rax)
movq (%r14), %r12
jmp 0xced1
movl $0x0, 0x24(%rsi)
movq 0x10(%r12), %rax
testq %rax, %rax
je 0xcf2d
decq 0x18(%r14)
movq %rax, (%r14)
movq 0x10(%r14), %r13
decq (%r13)
movq 0x10(%r13), %rax
cmpq %rax, 0x8(%r13)
jne 0xcf19
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x10, %eax
cmoveq %rax, %rsi
movq %rsi, 0x10(%r13)
movq 0x18(%r13), %rdi
shlq $0x3, %rsi
callq 0x3720
movq %rax, 0x18(%r13)
movq 0x8(%r13), %rax
movq 0x18(%r13), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%r13)
movq %r12, (%rcx,%rax,8)
movq (%r14), %r12
cmpq 0x8(%r14), %r12
jne 0xce94
cmpl $0x0, (%rbx)
je 0xcf91
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movl %r15d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %r14d, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0xcf85
movq 0x20(%rbx), %rax
movl %r15d, %r12d
shlq $0x5, %r12
movq 0x10(%rax,%r12), %rdi
movl %ebp, %esi
callq 0xd3d1
movq 0x20(%rbx), %rax
movq 0x18(%rax,%r12), %rdi
movl %ebp, %esi
callq 0xd3d1
incl %r15d
addl $0x2, %r14d
cmpl (%rbx), %r15d
jne 0xcf45
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_rmdupse.c
// Function: push_queue
static inline elem_t *push_queue(queue_t *queue, const bam1_t *b, int endpos, int score)
{
	elem_t *p = kl_pushp(q, queue);
	p->discarded = 0;
	p->endpos = endpos; p->score = score;
	if (p->b == 0) p->b = bam_init1();
	bam_copy1(p->b, b);
	return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movq %rdi, %r15
movq 0x10(%rdi), %rax
incq (%rax)
movl %edx, %r12d
movq %rsi, %rbx
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0xcfd6
movq 0x18(%rax), %rdx
leaq -0x1(%rcx), %rsi
movq %rsi, 0x8(%rax)
movq -0x8(%rdx,%rcx,8), %rax
jmp 0xcfe5
movl $0x1, %edi
movl $0x18, %esi
callq 0x3610
movq 0x8(%r15), %r14
movq $0x0, 0x10(%rax)
movq %rax, 0x10(%r14)
movq %rax, 0x8(%r15)
incq 0x18(%r15)
movl %r12d, (%r14)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl %ebp, 0x4(%r14)
cmpq $0x0, 0x8(%r14)
jne 0xd024
movl $0x1, %edi
movl $0x38, %esi
callq 0x3610
movq %rax, 0x8(%r14)
movq 0x8(%r14), %r12
movq 0x30(%r12), %r15
movl 0x28(%r12), %ebp
movl 0x24(%rbx), %eax
cmpl %eax, %ebp
jge 0xd06d
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, %ebp
sarl $0x10, %ebp
orl %eax, %ebp
incl %ebp
movslq %ebp, %rsi
movq %r15, %rdi
callq 0x3720
movq %rax, %r15
movq 0x30(%rbx), %rsi
movslq 0x24(%rbx), %rdx
movq %r15, %rdi
callq 0x37d0
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm2, 0x20(%r12)
movq 0x30(%rbx), %rax
movq %rax, 0x30(%r12)
movups %xmm0, (%r12)
movups %xmm1, 0x10(%r12)
movl %ebp, 0x28(%r12)
movq %r15, 0x30(%r12)
movq %r14, %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/bam_rmdupse.c
// Function: clear_besthash
static void clear_besthash(besthash_t *h, int32_t pos)
{
	khint_t k;
	for (k = kh_begin(h); k != kh_end(h); ++k)
		if (kh_exist(h, k) && kh_val(h, k)->endpos <= pos)
			kh_del(best, h, k);
}

// Assembly:
cmpl $0x0, (%rdi)
je 0xd423
pushq %rbx
movq 0x10(%rdi), %rax
xorl %edx, %edx
xorl %r8d, %r8d
movl %r8d, %r9d
shrl $0x4, %r9d
movl (%rax,%r9,4), %r10d
movl %edx, %ecx
andl $0x1e, %ecx
movl %r10d, %r11d
shrl %cl, %r11d
testb $0x3, %r11b
jne 0xd417
movq 0x20(%rdi), %r11
movl %r8d, %ebx
movq (%r11,%rbx,8), %r11
cmpl %esi, (%r11)
jg 0xd417
btsl %ecx, %r10d
movl %r10d, (%rax,%r9,4)
decl 0x4(%rdi)
incl %r8d
addl $0x2, %edx
cmpl (%rdi), %r8d
jne 0xd3e0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_mate.c
// Function: usage
void usage()
{
    fprintf(stderr,"Usage: samtools fixmate <in.nameSrt.bam> <out.nameSrt.bam>\n");
    fprintf(stderr,"Options:\n");
    fprintf(stderr,"       -r    remove unmapped reads and secondary alignments\n");
    exit(1);
}

// Assembly:
pushq %rbx
movq 0x40d5c(%rip), %rbx     # 0x4efe8
movq (%rbx), %rcx
leaq 0x31fa8(%rip), %rdi     # 0x4023e
movl $0x3b, %esi
movl $0x1, %edx
callq 0x3700
movq (%rbx), %rcx
leaq 0x2ffc1(%rip), %rdi     # 0x3e270
movl $0x9, %esi
movl $0x1, %edx
callq 0x3700
movq (%rbx), %rcx
leaq 0x31fb2(%rip), %rdi     # 0x4027a
movl $0x3c, %esi
movl $0x1, %edx
callq 0x3700
movl $0x1, %edi
callq 0x31a0
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_mate.c
// Function: bam_mating
int bam_mating(int argc, char *argv[])
{
	bamFile in, out;
    int c, remove_reads=0;
    while ((c = getopt(argc, argv, "r")) >= 0) {
        switch (c) {
            case 'r': remove_reads=1; break;
        }
    }
    if (optind+1 >= argc) usage();
	in = (strcmp(argv[optind], "-") == 0)? bam_dopen(fileno(stdin), "r") : bam_open(argv[optind], "r");
    out = (strcmp(argv[optind+1], "-") == 0)? bam_dopen(fileno(stdout), "w") : bam_open(argv[optind+1], "w");
	bam_mating_core(in, out, remove_reads);
	bam_close(in); bam_close(out);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movl %edi, %ebp
leaq 0x3697a(%rip), %rdx     # 0x44c6f
callq 0x3210
xorl %ebx, %ebx
testl %eax, %eax
js 0xe325
movl $0x1, %r12d
leaq 0x36962(%rip), %r15     # 0x44c6f
cmpl $0x72, %eax
cmovel %r12d, %ebx
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3210
testl %eax, %eax
jns 0xe30d
movq 0x40c8c(%rip), %r12     # 0x4efb8
movl (%r12), %eax
incl %eax
cmpl %ebp, %eax
jge 0xe3fb
movslq (%r12), %rax
movq (%r14,%rax,8), %r15
leaq 0x30b0f(%rip), %rsi     # 0x3ee58
movq %r15, %rdi
callq 0x35a0
testl %eax, %eax
je 0xe366
leaq 0x36913(%rip), %rsi     # 0x44c6f
movq %r15, %rdi
callq 0x1fdb8
jmp 0xe383
movq 0x40c63(%rip), %rax     # 0x4efd0
movq (%rax), %rdi
callq 0x3030
leaq 0x368f3(%rip), %rsi     # 0x44c6f
movl %eax, %edi
callq 0x1ff6b
movq %rax, %r15
movslq (%r12), %rax
movq 0x8(%r14,%rax,8), %r14
leaq 0x30ac2(%rip), %rsi     # 0x3ee58
movq %r14, %rdi
callq 0x35a0
testl %eax, %eax
je 0xe3b3
leaq 0x2fe91(%rip), %rsi     # 0x3e23a
movq %r14, %rdi
callq 0x1fdb8
jmp 0xe3d0
movq 0x40c3e(%rip), %rax     # 0x4eff8
movq (%rax), %rdi
callq 0x3030
leaq 0x2fe71(%rip), %rsi     # 0x3e23a
movl %eax, %edi
callq 0x1ff6b
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
movl %ebx, %edx
callq 0xdf06
movq %r15, %rdi
callq 0x20aae
movq %r14, %rdi
callq 0x20aae
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0xe284
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_stat.c
// Function: bam_flagstat_core
bam_flagstat_t *bam_flagstat_core(bamFile fp)
{
	bam_flagstat_t *s;
	bam1_t *b;
	bam1_core_t *c;
	int ret;
	s = (bam_flagstat_t*)calloc(1, sizeof(bam_flagstat_t));
	b = bam_init1();
	c = &b->core;
	while ((ret = bam_read1(fp, b)) >= 0)
		flagstat_loop(s, c);
	bam_destroy1(b);
	if (ret != -1)
		fprintf(stderr, "[bam_flagstat_core] Truncated file? Continue anyway.\n");
	return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r15
movl $0x1, %edi
movl $0xb0, %esi
callq 0x3610
movq %rax, %rbx
movl $0x1, %edi
movl $0x38, %esi
callq 0x3610
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0x23238
testl %eax, %eax
js 0xe4f4
movq 0x8(%r14), %rcx
movq %rcx, %rax
shrq $0x29, %rax
andl $0x1, %eax
movl %eax, %edx
incq (%rbx,%rdx,8)
btq $0x20, %rcx
jae 0xe4ce
incq 0x20(%rbx,%rax,8)
btq $0x21, %rcx
jae 0xe46d
incq 0x40(%rbx,%rax,8)
btq $0x26, %rcx
jae 0xe479
incq 0x60(%rbx,%rax,8)
btq $0x27, %rcx
jae 0xe485
incq 0x70(%rbx,%rax,8)
movq %rcx, %rdx
shrq $0x20, %rdx
movl %edx, %esi
andl $0xc, %esi
cmpl $0x8, %esi
jne 0xe49b
incq 0x50(%rbx,%rax,8)
testb $0xc, %dl
jne 0xe4ce
incq 0x30(%rbx,%rax,8)
movl 0x14(%r14), %edx
cmpl (%r14), %edx
je 0xe4ce
incq 0x90(%rbx,%rax,8)
movl %ecx, %edx
andl $0xff0000, %edx         # imm = 0xFF0000
cmpl $0x40001, %edx          # imm = 0x40001
jb 0xe4ce
incq 0xa0(%rbx,%rax,8)
btq $0x22, %rcx
jb 0xe4da
incq 0x10(%rbx,%rax,8)
btq $0x2a, %rcx
jae 0xe4e9
incq 0x80(%rbx,%rax,8)
movq %r15, %rdi
movq %r14, %rsi
jmp 0xe434
movl %eax, %ebp
testq %r14, %r14
je 0xe50c
movq 0x30(%r14), %rdi
callq 0x3350
movq %r14, %rdi
callq 0x3350
cmpl $-0x1, %ebp
jne 0xe51f
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x3f7f
jmp 0xe511
// File: /workspace/github_c_makefile_star2_O1/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 0x31d14(%rip), %rsi     # 0x404eb
callq 0x21c82
testq %rax, %rax
je 0xe7fd
movq %rax, %rdi
callq 0x22aae
movq %rax, %rbx
movq 0x8(%r14), %r15
btq $0x24, %r15
jb 0xe801
incl %ebp
movl %ebp, %eax
jmp 0xe82b
xorl %eax, %eax
jmp 0xe830
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_O1/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 0x31ca0(%rip), %rsi     # 0x404ee
callq 0x21c82
testq %rax, %rax
je 0xe8a2
movq %rax, %rdi
callq 0x22aae
movq %rax, %rbx
movq 0x8(%r14), %r15
btq $0x24, %r15
jae 0xe89a
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 0xe8a4
xorl %eax, %eax
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/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 0xe8d3
cmpl $0x41, %eax
je 0xe8e5
cmpl $0x43, %eax
jne 0xe8e1
movb $0x1, %al
jmp 0xe8eb
cmpl $0x47, %eax
je 0xe8e9
cmpl $0x54, %eax
jne 0xe8e1
movb $0x3, %al
jmp 0xe8eb
movb $0x4, %al
jmp 0xe8eb
xorl %eax, %eax
jmp 0xe8eb
movb $0x2, %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xe8af
movl %eax, %ebx
movl %ebp, %edi
callq 0xe8af
cmpb $0x4, %bl
sete %cl
cmpb $0x4, %al
sete %dl
orb %cl, %dl
movb $0x34, %cl
jne 0xe920
xorb %bl, %al
movzbl %al, %eax
leaq 0x31bd4(%rip), %rcx     # 0x404f1
movb (%rax,%rcx), %cl
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
subq $0x20, %rsp
movl %edi, %ebp
movapd %xmm0, (%rsp)
movsd 0x30029(%rip), %xmm1    # 0x409b8
subsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
movl $0x1, %edi
movl $0x90, %esi
callq 0x3610
movq %rax, %rbx
movl $0x3c, (%rax)
movabsq $0x1400000028, %rax     # imm = 0x1400000028
movq %rax, 0x8(%rbx)
movl $0x64, %r14d
movl %r14d, 0x10(%rbx)
movl %ebp, 0x4(%rbx)
xorpd %xmm0, %xmm0
movapd (%rsp), %xmm1
cmpnlesd %xmm0, %xmm1
movapd 0x10(%rsp), %xmm2
andpd %xmm1, %xmm2
movsd 0x2ffd4(%rip), %xmm0    # 0x409c0
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
callq 0x15d95
movq %rax, 0x80(%rbx)
movabsq $0x3f60624dd2f1a9fc, %rax # imm = 0x3F60624DD2F1A9FC
movq %rax, 0x20(%rbx)
movl $0x1, 0x14(%rbx)
movl $0x0, 0x30(%rbx)
movl %r14d, 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 $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x10aa8
pushq %rbx
movq %rdi, %rbx
movq 0x80(%rdi), %rdi
callq 0x160b2
cmpl $0x0, 0x48(%rbx)
je 0x10a8d
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_O1/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
movq %rdi, %rax
movl 0x48(%rdi), %esi
testl %esi, %esi
jle 0x1139a
movq 0x40(%rax), %rcx
movl %esi, %edx
shrl %edx
xorps %xmm1, %xmm1
xorl %r8d, %r8d
movq %rsi, %r9
xorl %edi, %edi
movl (%rcx,%r8,4), %r10d
testl %r10d, %r10d
je 0x11390
addl %r10d, %edi
cmpq %rdx, %r8
movl %r8d, %r11d
cmovael %r9d, %r11d
imull %r10d, %r11d
xorps %xmm0, %xmm0
cvtsi2ss %r11d, %xmm0
addss %xmm0, %xmm1
incq %r8
decq %r9
jne 0x1136a
jmp 0x1139f
xorl %edi, %edi
xorps %xmm1, %xmm1
cmpl $0x2, %edi
jge 0x113ae
movss 0x2f694(%rip), %xmm0    # 0x40a40
jmp 0x11425
cvtsi2ss %edi, %xmm2
testl %esi, %esi
jle 0x11419
divss %xmm2, %xmm1
movq 0x40(%rax), %rax
movl %esi, %ecx
shrl %ecx
xorps %xmm0, %xmm0
xorl %edx, %edx
movaps 0x2f692(%rip), %xmm3    # 0x40a60
movq %rsi, %r8
movl (%rax,%rdx,4), %r9d
testl %r9d, %r9d
je 0x1140f
cmpq %rcx, %rdx
movl %edx, %r10d
cmovael %r8d, %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 0x113d1
jmp 0x1141c
xorps %xmm0, %xmm0
divss %xmm2, %xmm0
callq 0x111b0
movss %xmm0, 0x90(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x1367d
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, (%rdi)
je 0x13655
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movl %r15d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %r14d, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x13647
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x3350
incq %r15
movl (%rbx), %eax
addl $0x2, %r14d
cmpq %rax, %r15
jb 0x13621
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_O1/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)
xorl %r10d, %r10d
cmpw $0x0, 0xe(%rdi)
je 0x15400
xorl %r11d, %r11d
xorl %r10d, %r10d
xorl %ebx, %ebx
movl (%rsi,%r11,4), %r15d
movl %r15d, %ebp
andl $0xf, %ebp
movl %r15d, %r14d
shrl $0x4, %r14d
cmpl $0x7, %ebp
setne %r12b
testb $0x7, %r15b
setne %r13b
testb %r12b, %r13b
jne 0x1538a
cmpl %edx, 0x4(%rdi)
jle 0x1539f
xorl %ebp, %ebp
movl %ebx, %eax
jmp 0x153ea
cmpl $0x4, %ebp
je 0x15394
cmpl $0x1, %ebp
jne 0x153b6
addl %ebx, %r14d
movb $0x1, %bpl
movl %r14d, %ebx
jmp 0x153ea
leal (%r14,%r9), %r15d
cmpl %edx, %r15d
jle 0x153d6
movl %edx, (%r8)
movl %edx, %eax
subl %r9d, %eax
addl %ebx, %eax
xorl %ebp, %ebp
jmp 0x153ea
andl $0xe, %r15d
movb $0x1, %bpl
cmpl $0x2, %r15d
jne 0x153ea
addl %r9d, %r14d
cmpl %edx, %r14d
jle 0x153e7
testl %ecx, %ecx
cmovnel %r9d, %r14d
movl %r14d, (%r8)
jmp 0x15384
addl %ebx, %r14d
movb $0x1, %bpl
movl %r15d, %r9d
movl %r14d, %ebx
movl %r14d, %r10d
jmp 0x153ea
movl %r14d, %r9d
testb %bpl, %bpl
je 0x15406
incq %r11
movzwl 0xe(%rdi), %r14d
cmpq %r14, %r11
jb 0x1535a
movl %r9d, (%r8)
movl %r10d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq