LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/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 0x180a7(%rip), %rdx     # 0x248c3
callq 0x31a0
testl %eax, %eax
js 0xc862
xorl %r12d, %r12d
leaq 0x18094(%rip), %r15     # 0x248c3
xorl %ebx, %ebx
cmpl $0x53, %eax
je 0xc83d
cmpl $0x73, %eax
je 0xc842
jmp 0xc848
movl $0x1, %ebx
movl $0x1, %r12d
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x31a0
testl %eax, %eax
jns 0xc831
testl %r12d, %r12d
sete %r12b
jmp 0xc867
movb $0x1, %r12b
xorl %ebx, %ebx
movq 0x2174a(%rip), %r13     # 0x2dfb8
movslq (%r13), %rax
leal 0x2(%rax), %ecx
cmpl %ebp, %ecx
jg 0xc8e9
movq (%r14,%rax,8), %rdi
leaq 0x17363(%rip), %rsi     # 0x23be7
xorl %edx, %edx
callq 0x14d06
movq %rax, %r15
movslq (%r13), %rax
movq 0x8(%r14,%rax,8), %rdi
movq 0x10(%r15), %rdx
leaq 0x180bb(%rip), %rsi     # 0x2495d
callq 0x14d06
testq %rax, %rax
je 0xc8f0
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
testb %r12b, %r12b
je 0xc8c1
callq 0xb180
jmp 0xc8c8
movl %ebx, %edx
callq 0xc8fc
movq %r15, %rdi
callq 0x150dc
movq %r14, %rdi
callq 0x150dc
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3a7a
jmp 0xc8f5
callq 0x3a5e
movl $0x1, %eax
jmp 0xc8da
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/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 0xd440
cmpq $0x100001, 0x18(%r14)   # imm = 0x100001
jb 0xd4a8
jmp 0xd440
cmpl $0x0, 0x4(%r13)
movq 0x8(%r13), %rsi
js 0xd3d4
testb $0x10, 0xc(%rsi)
je 0xd3bc
cmpl %ebp, (%r13)
jg 0xd44d
movq %r15, %rdi
callq 0x15157
movq 0x8(%r13), %rax
movl $0x0, 0x24(%rax)
movq (%r14), %r13
jmp 0xd3db
movl $0x0, 0x24(%rsi)
movq 0x10(%r13), %rax
testq %rax, %rax
je 0xd440
decq 0x18(%r14)
movq %rax, (%r14)
movq 0x10(%r14), %r12
decq (%r12)
movq 0x8(%r12), %rcx
cmpq 0x10(%r12), %rcx
jne 0xd42e
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x10, %eax
cmoveq %rax, %rsi
movq %rsi, 0x10(%r12)
movq 0x18(%r12), %rdi
shlq $0x3, %rsi
callq 0x3610
movq %rax, 0x18(%r12)
movq 0x8(%r12), %rcx
jmp 0xd433
movq 0x18(%r12), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r12)
movq %r13, (%rax,%rcx,8)
movq (%r14), %r13
cmpq 0x8(%r14), %r13
jne 0xd3a1
movl (%rbx), %eax
testl %eax, %eax
je 0xd4a8
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rcx
movl %r15d, %edx
shrl $0x4, %edx
movl (%rcx,%rdx,4), %edx
movl %r14d, %ecx
andb $0x1e, %cl
shrl %cl, %edx
testb $0x3, %dl
jne 0xd49c
movq 0x20(%rbx), %rax
movl %r15d, %r12d
shlq $0x5, %r12
movq 0x10(%rax,%r12), %rdi
movl %ebp, %esi
callq 0xda76
movq 0x20(%rbx), %rax
movq 0x18(%rax,%r12), %rdi
movl %ebp, %esi
callq 0xda76
movl (%rbx), %eax
incl %r15d
addl $0x2, %r14d
cmpl %eax, %r15d
jne 0xd459
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/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:
movl (%rdi), %r8d
testl %r8d, %r8d
je 0xdacf
pushq %r14
pushq %rbx
movq 0x10(%rdi), %rax
xorl %edx, %edx
xorl %r9d, %r9d
movl %r9d, %r10d
shrl $0x4, %r10d
movl (%rax,%r10,4), %r11d
movl %edx, %ecx
andl $0x1e, %ecx
movl %r11d, %ebx
shrl %cl, %ebx
testb $0x3, %bl
jne 0xdac1
movq 0x20(%rdi), %rbx
movl %r9d, %r14d
movq (%rbx,%r14,8), %rbx
cmpl %esi, (%rbx)
jg 0xdac1
btsl %ecx, %r11d
movl %r11d, (%rax,%r10,4)
decl 0x4(%rdi)
movl (%rdi), %r8d
incl %r9d
addl $0x2, %edx
cmpl %r8d, %r9d
jne 0xda8a
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_mate.c
// Function: bam_mating
int bam_mating(int argc, char *argv[])
{
	bamFile in, out;
	if (argc < 3) {
		fprintf(stderr, "samtools fixmate <in.nameSrt.bam> <out.nameSrt.bam>\n");
		return 1;
	}
	in = (strcmp(argv[1], "-") == 0)? bam_dopen(fileno(stdin), "r") : bam_open(argv[1], "r");
    out = (strcmp(argv[2], "-") == 0)? bam_dopen(fileno(stdout), "w") : bam_open(argv[2], "w");
	bam_mating_core(in, out);
	bam_close(in); bam_close(out);
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jle 0xde66
movq %rsi, %r14
movq 0x8(%rsi), %rdi
cmpb $0x2d, (%rdi)
jne 0xddd6
cmpb $0x0, 0x1(%rdi)
je 0xde28
leaq 0x192ea(%rip), %rsi     # 0x270c7
callq 0x10048
movq %rax, %rbx
movq 0x10(%r14), %rdi
cmpb $0x2d, (%rdi)
jne 0xddf4
cmpb $0x0, 0x1(%rdi)
je 0xde47
leaq 0x155b2(%rip), %rsi     # 0x233ad
callq 0x10048
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0xdad0
movq %rbx, %rdi
callq 0x10d25
movq %r14, %rdi
callq 0x10d25
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x201a1(%rip), %rax     # 0x2dfd0
movq (%rax), %rdi
callq 0x3030
leaq 0x19289(%rip), %rsi     # 0x270c7
movl %eax, %edi
callq 0x101a3
jmp 0xdde2
movq 0x201aa(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
callq 0x3030
leaq 0x15550(%rip), %rsi     # 0x233ad
movl %eax, %edi
callq 0x101a3
jmp 0xde00
callq 0x3bcf
movl $0x1, %eax
jmp 0xde20
nop
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/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 %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %r15
movl $0x1, %edi
movl $0x60, %esi
callq 0x3530
movq %rax, %rbx
movl $0x1, %edi
movl $0x38, %esi
callq 0x3530
movq %rax, %r14
movq %r15, 0x50(%rsp)
movq %r15, %rdi
movq %rax, %rsi
callq 0x126b5
testl %eax, %eax
js 0xe046
movq $0x0, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
xorl %r15d, %r15d
movq $0x0, 0x20(%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
xorl %r13d, %r13d
xorl %r12d, %r12d
movq 0x8(%r14), %rax
btq $0x20, %rax
jae 0xdfe9
incq %r13
movq %r13, 0x10(%rbx)
btq $0x21, %rax
jae 0xdf49
movq 0x28(%rsp), %rdx
incq %rdx
movq %rdx, 0x28(%rsp)
movq %rdx, 0x20(%rbx)
btq $0x26, %rax
jae 0xdf61
movq 0x30(%rsp), %rdx
incq %rdx
movq %rdx, 0x30(%rsp)
movq %rdx, 0x30(%rbx)
btq $0x27, %rax
jae 0xdf79
movq 0x38(%rsp), %rdx
incq %rdx
movq %rdx, 0x38(%rsp)
movq %rdx, 0x38(%rbx)
movq %rax, %rcx
shrq $0x20, %rcx
andl $0xc, %ecx
je 0xdf9d
cmpl $0x8, %ecx
jne 0xdfe9
movq 0x20(%rsp), %rdx
incq %rdx
movq %rdx, 0x20(%rsp)
movq %rdx, 0x28(%rbx)
jmp 0xdfe9
movq 0x18(%rsp), %rdx
incq %rdx
movq %rdx, 0x18(%rsp)
movq %rdx, 0x18(%rbx)
movl 0x14(%r14), %ecx
cmpl (%r14), %ecx
je 0xdfe9
movq 0x10(%rsp), %rdx
incq %rdx
movq %rdx, 0x10(%rsp)
movq %rdx, 0x50(%rbx)
movl %eax, %ecx
andl $0xff0000, %ecx         # imm = 0xFF0000
cmpl $0x40001, %ecx          # imm = 0x40001
jb 0xdfe9
movq 0x8(%rsp), %rdx
incq %rdx
movq %rdx, 0x8(%rsp)
movq %rdx, 0x58(%rbx)
btq $0x22, %rax
jb 0xdff7
incq %r15
movq %r15, 0x8(%rbx)
btq $0x29, %rax
jae 0xe00f
movq 0x40(%rsp), %rdx
incq %rdx
movq %rdx, 0x40(%rsp)
movq %rdx, 0x40(%rbx)
btq $0x2a, %rax
jae 0xe027
movq 0x48(%rsp), %rcx
incq %rcx
movq %rcx, 0x48(%rsp)
movq %rcx, 0x48(%rbx)
movq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0x126b5
incq %r12
testl %eax, %eax
jns 0xdf1b
movl %eax, %ebp
movq %r12, (%rbx)
jmp 0xe04d
movl %eax, %ebp
testq %r14, %r14
je 0xe05e
movq 0x30(%r14), %rdi
callq 0x32c0
movq %r14, %rdi
callq 0x32c0
cmpl $-0x1, %ebp
jne 0xe075
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3beb
jmp 0xe063
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/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;
	else i++;
	return cs[i];
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r15
leaq 0x16a2d(%rip), %rsi     # 0x24cc6
callq 0x1175c
testq %rax, %rax
je 0xe2bb
movq %rax, %rdi
callq 0x12251
movq %rax, %r14
testb $0x10, 0xc(%r15)
jne 0xe2bf
incl %ebx
movl %ebx, %eax
jmp 0xe2cb
xorl %eax, %eax
jmp 0xe2d1
movq %r14, %rdi
callq 0x32d0
notl %ebx
addl %ebx, %eax
cltq
movb (%r14,%rax), %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/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;
	return cq[i];
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r15
leaq 0x169e1(%rip), %rsi     # 0x24cc9
callq 0x1175c
testq %rax, %rax
je 0xe31b
movq %rax, %rdi
callq 0x12251
movq %rax, %r14
testb $0x10, 0xc(%r15)
je 0xe312
movq %r14, %rdi
callq 0x32d0
notl %ebx
addl %ebx, %eax
movl %eax, %ebx
movslq %ebx, %rax
movb (%r14,%rax), %al
jmp 0xe31d
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/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 0x3280
movq (%rax), %rax
movslq %ebx, %rcx
movl (%rax,%rcx,4), %eax
cmpl $0x46, %eax
jg 0xe347
cmpl $0x41, %eax
je 0xe359
cmpl $0x43, %eax
jne 0xe355
movb $0x1, %al
jmp 0xe35f
cmpl $0x47, %eax
je 0xe35d
cmpl $0x54, %eax
jne 0xe355
movb $0x3, %al
jmp 0xe35f
movb $0x4, %al
jmp 0xe35f
xorl %eax, %eax
jmp 0xe35f
movb $0x2, %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/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 0xe323
movl %eax, %ebx
movl %ebp, %edi
callq 0xe323
cmpb $0x4, %bl
sete %cl
cmpb $0x4, %al
sete %dl
orb %cl, %dl
movb $0x34, %cl
jne 0xe394
xorb %bl, %al
movzbl %al, %eax
leaq 0x1693b(%rip), %rcx     # 0x24ccc
movb (%rax,%rcx), %cl
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bgzf.c
// Function: bgzf_open
BGZF*
bgzf_open(const char* __restrict path, const char* __restrict mode)
{
    BGZF* fp = NULL;
    if (strchr(mode, 'r') || strchr(mode, 'R')) { /* The reading mode is preferred. */
#ifdef _USE_KNETFILE
		knetFile *file = knet_open(path, mode);
		if (file == 0) return 0;
		fp = bgzf_read_init();
		fp->file_descriptor = -1;
		fp->open_mode = 'r';
		fp->x.fpr = file;
#else
		int fd, oflag = O_RDONLY;
#ifdef _WIN32
		oflag |= O_BINARY;
#endif
		fd = open(path, oflag);
		if (fd == -1) return 0;
        fp = open_read(fd);
#endif
    } else if (strchr(mode, 'w') || strchr(mode, 'W')) {
		int fd, oflag = O_WRONLY | O_CREAT | O_TRUNC;
#ifdef _WIN32
		oflag |= O_BINARY;
#endif
		fd = open(path, oflag, 0666);
		if (fd == -1) return 0;
        fp = open_write(fd, strchr(mode, 'u')? 1 : 0);
    }
    if (fp != NULL) fp->owned_file = 1;
    return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x72, %esi
callq 0x3440
testq %rax, %rax
jne 0x10079
movq %rbx, %rdi
movl $0x52, %esi
callq 0x3440
testq %rax, %rax
je 0x100ad
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1c952
testq %rax, %rax
je 0x10114
movq %rax, %rbx
callq 0x10f65
movq %rax, %r15
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movb $0x72, 0x4(%rax)
movq %rbx, 0x8(%rax)
movb $0x1, 0x5(%r15)
jmp 0x10117
movq %rbx, %rdi
movl $0x77, %esi
callq 0x3440
testq %rax, %rax
jne 0x100d1
movq %rbx, %rdi
movl $0x57, %esi
callq 0x3440
testq %rax, %rax
je 0x10114
xorl %r15d, %r15d
movq %r14, %rdi
movl $0x241, %esi            # imm = 0x241
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x33b0
cmpl $-0x1, %eax
je 0x10117
movl %eax, %ebp
movq %rbx, %rdi
movl $0x75, %esi
callq 0x3440
xorl %esi, %esi
testq %rax, %rax
setne %sil
movl %ebp, %edi
callq 0x10125
movq %rax, %r15
testq %rax, %rax
jne 0x100a6
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bgzf.c
// Function: open_write
static
BGZF*
open_write(int fd, bool is_uncompressed)
{
    FILE* file = fdopen(fd, "w");
    BGZF* fp;
	if (file == 0) return 0;
	fp = malloc(sizeof(BGZF));
    fp->file_descriptor = fd;
    fp->open_mode = 'w';
    fp->owned_file = 0; fp->is_uncompressed = is_uncompressed;
#ifdef _USE_KNETFILE
    fp->x.fpw = file;
#else
    fp->file = file;
#endif
    fp->uncompressed_block_size = DEFAULT_BLOCK_SIZE;
    fp->uncompressed_block = NULL;
    fp->compressed_block_size = MAX_BLOCK_SIZE;
    fp->compressed_block = malloc(MAX_BLOCK_SIZE);
    fp->block_address = 0;
    fp->block_offset = 0;
    fp->block_length = 0;
    fp->error = NULL;
    return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movl %edi, %r14d
leaq 0x13275(%rip), %rsi     # 0x233ad
callq 0x3360
testq %rax, %rax
je 0x10193
movq %rax, %r15
movl $0x50, %edi
callq 0x31d0
movq %rax, %rbx
movl %r14d, (%rax)
movw $0x77, 0x4(%rax)
movb %bpl, 0x6(%rax)
movq %r15, 0x8(%rax)
movabsq $0x1000000010000, %rax  # imm = 0x1000000010000
movq %rax, 0x10(%rbx)
xorl %r14d, %r14d
movq %r14, 0x18(%rbx)
movl $0x10000, %edi          # imm = 0x10000
callq 0x31d0
movq %rax, 0x20(%rbx)
movq %r14, 0x40(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rbx)
jmp 0x10195
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bgzf.c
// Function: bgzf_fdopen
BGZF*
bgzf_fdopen(int fd, const char * __restrict mode)
{
	if (fd == -1) return 0;
    if (mode[0] == 'r' || mode[0] == 'R') {
        return open_read(fd);
    } else if (mode[0] == 'w' || mode[0] == 'W') {
        return open_write(fd, strstr(mode, "u")? 1 : 0);
    } else {
        return NULL;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $-0x1, %edi
je 0x101f5
movl %edi, %ebx
movzbl (%rsi), %ecx
xorl %eax, %eax
cmpl $0x71, %ecx
jg 0x101c4
cmpl $0x52, %ecx
je 0x101ce
cmpl $0x57, %ecx
je 0x101ff
jmp 0x101f7
cmpl $0x77, %ecx
je 0x101ff
cmpl $0x72, %ecx
jne 0x101f7
leaq 0x16ef2(%rip), %rsi     # 0x270c7
movl %ebx, %edi
callq 0x1ca9e
testq %rax, %rax
je 0x101f5
movq %rax, %r14
callq 0x10f65
movl %ebx, (%rax)
movb $0x72, 0x4(%rax)
movq %r14, 0x8(%rax)
jmp 0x101f7
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rsi, %rdi
movl $0x75, %esi
callq 0x3440
xorl %esi, %esi
testq %rax, %rax
setne %sil
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x10125
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bgzf.c
// Function: bgzf_read
int
bgzf_read(BGZF* fp, void* data, int length)
{
    if (length <= 0) {
        return 0;
    }
    if (fp->open_mode != 'r') {
        report_error(fp, "file not open for reading");
        return -1;
    }

    int bytes_read = 0;
    bgzf_byte_t* output = data;
    while (bytes_read < length) {
        int available = fp->block_length - fp->block_offset;
        if (available <= 0) {
            if (bgzf_read_block(fp) != 0) {
                return -1;
            }
            available = fp->block_length - fp->block_offset;
            if (available <= 0) {
                break;
            }
        }
        int copy_length = bgzf_min(length-bytes_read, available);
        bgzf_byte_t* buffer = fp->uncompressed_block;
        memcpy(output, buffer + fp->block_offset, copy_length);
        fp->block_offset += copy_length;
        output += copy_length;
        bytes_read += copy_length;
    }
    if (fp->block_offset == fp->block_length) {
#ifdef _USE_KNETFILE
        fp->block_address = knet_tell(fp->x.fpr);
#else
        fp->block_address = ftello(fp->file);
#endif
        fp->block_offset = 0;
        fp->block_length = 0;
    }
    return bytes_read;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %edx, %edx
jle 0x109fd
movq %rdi, %r14
cmpb $0x72, 0x4(%rdi)
jne 0x10a01
movl %edx, %ebp
movq %rsi, %r15
movl 0x34(%r14), %eax
xorl %ebx, %ebx
movl 0x30(%r14), %ecx
subl %eax, %ecx
jg 0x109ae
movq %r14, %rdi
callq 0x10223
testl %eax, %eax
jne 0x10a0c
movl 0x30(%r14), %ecx
movl 0x34(%r14), %eax
subl %eax, %ecx
jle 0x109e1
movl %ebp, %edx
subl %ebx, %edx
cmpl %ecx, %edx
cmovgel %ecx, %edx
movslq %eax, %rsi
addq 0x18(%r14), %rsi
movslq %edx, %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x3680
movl 0x34(%r14), %eax
addl %r12d, %eax
movl %eax, 0x34(%r14)
addq %r12, %r15
addl %r12d, %ebx
cmpl %ebp, %ebx
jl 0x1098e
cmpl 0x30(%r14), %eax
jne 0x10a11
movq 0x8(%r14), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%r14)
movq $0x0, 0x30(%r14)
jmp 0x10a11
xorl %ebx, %ebx
jmp 0x10a11
leaq 0x14739(%rip), %rax     # 0x25141
movq %rax, 0x40(%r14)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bgzf.c
// Function: bgzf_flush
int bgzf_flush(BGZF* fp)
{
    while (fp->block_offset > 0) {
        int count, block_length;
		block_length = deflate_block(fp, fp->block_offset);
        if (block_length < 0) return -1;
#ifdef _USE_KNETFILE
        count = fwrite(fp->compressed_block, 1, block_length, fp->x.fpw);
#else
        count = fwrite(fp->compressed_block, 1, block_length, fp->file);
#endif
        if (count != block_length) {
            report_error(fp, "write failed");
            return -1;
        }
        fp->block_address += block_length;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0x34(%rdi), %esi
testl %esi, %esi
jle 0x10a69
movq %rdi, %rbx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x10a85
testl %eax, %eax
js 0x10a78
movl %eax, %r14d
movq 0x8(%rbx), %rcx
movq 0x20(%rbx), %rdi
movl %eax, %r15d
movl $0x1, %esi
movq %r15, %rdx
callq 0x3600
cmpl %eax, %r14d
jne 0x10a6d
addq %r15, 0x28(%rbx)
movl 0x34(%rbx), %esi
testl %esi, %esi
jg 0x10a32
xorl %ebp, %ebp
jmp 0x10a78
leaq 0x146e7(%rip), %rax     # 0x2515b
movq %rax, 0x40(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bgzf.c
// Function: bgzf_write
int bgzf_write(BGZF* fp, const void* data, int length)
{
    if (fp->open_mode != 'w') {
        report_error(fp, "file not open for writing");
        return -1;
    }

    if (fp->uncompressed_block == NULL)
        fp->uncompressed_block = malloc(fp->uncompressed_block_size);

    const bgzf_byte_t* input = data;
    int block_length = fp->uncompressed_block_size;
    int bytes_written = 0;
    while (bytes_written < length) {
        int copy_length = bgzf_min(block_length - fp->block_offset, length - bytes_written);
        bgzf_byte_t* buffer = fp->uncompressed_block;
        memcpy(buffer + fp->block_offset, input, copy_length);
        fp->block_offset += copy_length;
        input += copy_length;
        bytes_written += copy_length;
        if (fp->block_offset == block_length) {
            if (bgzf_flush(fp) != 0) {
                break;
            }
        }
    }
    return bytes_written;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x77, 0x4(%rdi)
jne 0x10d02
movl %edx, %ebp
movq %rsi, %r14
movq 0x18(%rbx), %rdi
movslq 0x10(%rbx), %r15
testq %rdi, %rdi
jne 0x10cac
movq %r15, %rdi
callq 0x31d0
movq %rax, %rdi
movq %rax, 0x18(%rbx)
xorl %r12d, %r12d
testl %ebp, %ebp
jle 0x10d13
movslq 0x34(%rbx), %rax
movl %r15d, %ecx
subl %eax, %ecx
movl %ebp, %edx
subl %r12d, %edx
cmpl %edx, %ecx
cmovll %ecx, %edx
addq %rax, %rdi
movslq %edx, %r13
movq %r14, %rsi
movq %r13, %rdx
callq 0x3680
movl 0x34(%rbx), %eax
addl %r13d, %eax
movl %eax, 0x34(%rbx)
addl %r13d, %r12d
cmpl %r15d, %eax
jne 0x10cf4
movq %rbx, %rdi
callq 0x10a1c
testl %eax, %eax
jne 0x10d13
cmpl %ebp, %r12d
jge 0x10d13
addq %r13, %r14
movq 0x18(%rbx), %rdi
jmp 0x10cb3
leaq 0x1445f(%rip), %rax     # 0x25168
movq %rax, 0x40(%rbx)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bgzf.c
// Function: bgzf_check_EOF
int bgzf_check_EOF(BGZF *fp)
{
	static uint8_t magic[28] = "\037\213\010\4\0\0\0\0\0\377\6\0\102\103\2\0\033\0\3\0\0\0\0\0\0\0\0\0";
	uint8_t buf[28];
	off_t offset;
#ifdef _USE_KNETFILE
	offset = knet_tell(fp->x.fpr);
	if (knet_seek(fp->x.fpr, -28, SEEK_END) != 0) return -1;
	knet_read(fp->x.fpr, buf, 28);
	knet_seek(fp->x.fpr, offset, SEEK_SET);
#else
	offset = ftello(fp->file);
	if (fseeko(fp->file, -28, SEEK_END) != 0) return -1;
	fread(buf, 1, 28, fp->file);
	fseeko(fp->file, offset, SEEK_SET);
#endif
	return (memcmp(magic, buf, 28) == 0)? 1 : 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
movq 0x8(%rdi), %rdi
movq 0x8(%rdi), %rbx
movq $-0x1c, %rsi
movl $0x2, %edx
callq 0x1cb7b
movq %rax, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rcx, %rcx
jne 0x10eec
movq 0x8(%r14), %rdi
movq %rsp, %r15
movl $0x1c, %edx
movq %r15, %rsi
callq 0x1cabb
movq 0x8(%r14), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x1cb7b
movdqa 0x1dcee(%rip), %xmm0    # 0x2ebb0
movdqu 0x1dcf2(%rip), %xmm1    # 0x2ebbc
movdqu 0xc(%r15), %xmm2
pcmpeqb %xmm1, %xmm2
pcmpeqb (%r15), %xmm0
pand %xmm2, %xmm0
pmovmskb %xmm0, %ecx
xorl %eax, %eax
cmpl $0xffff, %ecx           # imm = 0xFFFF
sete %al
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/kstring.c
// Function: ksBM_search
int *ksBM_search(const uint8_t *str, int n, const uint8_t *pat, int m, int *_prep, int *n_matches)
{
	int i, j, *prep, *bmGs, *bmBc;
	int *matches = 0, mm = 0, nm = 0;
	prep = _prep? _prep : ksBM_prep(pat, m);
	bmGs = prep; bmBc = prep + m;
	j = 0;
	while (j <= n - m) {
		for (i = m - 1; i >= 0 && pat[i] == str[i+j]; --i);
		if (i < 0) {
			if (nm == mm) {
				mm = mm? mm<<1 : 1;
				matches = realloc(matches, mm * sizeof(int));
			}
			matches[nm++] = j;
			j += bmGs[0];
		} else {
			int max = bmBc[str[i+j]] - m + 1 + i;
			if (max < bmGs[i]) max = bmGs[i];
			j += max;
		}
	}
	*n_matches = nm;
	if (_prep == 0) free(prep);
	return matches;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x10(%rsp)
movq %rdx, %r13
movl %esi, %r10d
movq %rdi, %r12
movq %r8, %r9
movq %r8, 0x18(%rsp)
testq %r8, %r8
movq %rcx, 0x8(%rsp)
jne 0x11587
movq %r13, %rdi
movl %ecx, %esi
movl %r10d, %ebx
callq 0x112a4
movl %ebx, %r10d
movq 0x8(%rsp), %rcx
movq %rax, %r9
subl %ecx, %r10d
js 0x11670
movslq %ecx, %r11
leaq (%r9,%r11,4), %r15
leaq -0x1(%r12), %rax
movq %rax, 0x30(%rsp)
xorl %r14d, %r14d
movl $0x0, 0x4(%rsp)
xorl %ebx, %ebx
xorl %ebp, %ebp
movq %r15, 0x20(%rsp)
movslq %ebp, %rdx
addq 0x30(%rsp), %rdx
movl $0x1, %eax
movq %r11, %rsi
testq %rsi, %rsi
jle 0x115ff
leaq -0x1(%rsi), %r8
movb -0x1(%r13,%rsi), %dil
decl %eax
cmpb (%rdx,%rsi), %dil
movq %r8, %rsi
je 0x115c5
leal (%rcx,%rbp), %edx
addl %eax, %edx
decl %edx
movslq %edx, %rdx
movzbl (%r12,%rdx), %edx
addl (%r15,%rdx,4), %eax
movl %r8d, %edx
movl (%r9,%rdx,4), %edx
cmpl %edx, %eax
cmovlel %edx, %eax
jmp 0x11663
cmpl 0x4(%rsp), %r14d
jne 0x11657
leal (%r14,%r14), %ecx
testl %r14d, %r14d
movl $0x1, %eax
cmovel %eax, %ecx
movl %ecx, 0x4(%rsp)
movslq %ecx, %rsi
shlq $0x2, %rsi
movq %rbx, %rdi
movq %r9, %rbx
movq %r12, %r15
movl %r10d, %r12d
movq %r14, 0x28(%rsp)
movq %r11, %r14
callq 0x3610
movq %r14, %r11
movq 0x28(%rsp), %r14
movl %r12d, %r10d
movq %r15, %r12
movq 0x20(%rsp), %r15
movq 0x8(%rsp), %rcx
movq %rbx, %r9
movq %rax, %rbx
movslq %r14d, %rax
incl %r14d
movl %ebp, (%rbx,%rax,4)
movl (%r9), %eax
addl %eax, %ebp
cmpl %r10d, %ebp
jle 0x115b5
jmp 0x11675
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x10(%rsp), %rax
movl %r14d, (%rax)
cmpq $0x0, 0x18(%rsp)
jne 0x1168d
movq %r9, %rdi
callq 0x32c0
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_aux.c
// Function: bam_aux_append
void bam_aux_append(bam1_t *b, const char tag[2], char type, int len, uint8_t *data)
{
	int ori_len = b->data_len;
	b->data_len += 3 + len;
	b->l_aux += 3 + len;
	if (b->m_data < b->data_len) {
		b->m_data = b->data_len;
		kroundup32(b->m_data);
		b->data = (uint8_t*)realloc(b->data, b->m_data);
	}
	b->data[ori_len] = tag[0]; b->data[ori_len + 1] = tag[1];
	b->data[ori_len + 2] = type;
	memcpy(b->data + ori_len + 3, data, len);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movl %ecx, %r14d
movq %rdi, %r15
movslq 0x24(%rdi), %r13
leal 0x3(%r14), %ecx
leal (%r14,%r13), %eax
addl $0x3, %eax
movl %eax, 0x24(%rdi)
addl %ecx, 0x20(%rdi)
movl %edx, %ebp
movq %rsi, %r12
cmpl %eax, 0x28(%rdi)
jge 0x1170f
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(%r15)
movq 0x30(%r15), %rdi
movslq %ecx, %rsi
callq 0x3610
movq %rax, 0x30(%r15)
jmp 0x11713
movq 0x30(%r15), %rax
movb (%r12), %cl
movb %cl, (%rax,%r13)
movb 0x1(%r12), %al
movq 0x30(%r15), %rcx
movb %al, 0x1(%rcx,%r13)
movq 0x30(%r15), %rax
movb %bpl, 0x2(%rax,%r13)
movq 0x30(%r15), %rax
leaq (%rax,%r13), %rdi
addq $0x3, %rdi
movslq %r14d, %rdx
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3680
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_aux.c
// Function: bam_aux_get
uint8_t *bam_aux_get(const bam1_t *b, const char tag[2])
{
	uint8_t *s;
	int y = tag[0]<<8 | tag[1];
	s = bam1_aux(b);
	while (s < b->data + b->data_len) {
		int x = (int)s[0]<<8 | s[1];
		s += 2;
		if (x == y) return s;
		__skip_tag(s);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x8(%rdi), %rax
movq 0x30(%rdi), %rcx
movq %rax, %rdx
shrq $0x30, %rdx
leaq (%rcx,%rdx,4), %rdx
shrl $0x18, %eax
movslq 0x10(%rdi), %r8
addq %r8, %rax
addq %rdx, %rax
leal 0x1(%r8), %edx
shrl $0x1f, %edx
addl %r8d, %edx
incl %edx
sarl %edx
movslq %edx, %r15
addq %rax, %r15
movslq 0x24(%rdi), %r14
addq %rcx, %r14
cmpq %r14, %r15
jae 0x11836
movsbl (%rsi), %eax
shll $0x8, %eax
movsbl 0x1(%rsi), %ebp
orl %eax, %ebp
leaq 0x13b75(%rip), %r12     # 0x25330
movzwl (%r15), %eax
rolw $0x8, %ax
movzwl %ax, %eax
leaq 0x2(%r15), %rbx
cmpl %ebp, %eax
je 0x11838
callq 0x3280
movq (%rax), %rax
movzbl (%rbx), %ecx
movl (%rax,%rcx,4), %ecx
movl %ecx, %eax
andl $-0x3, %eax
cmpl $0x41, %eax
jne 0x117ec
addq $0x4, %r15
jmp 0x11831
leaq 0x3(%r15), %rax
leal -0x44(%rcx), %edx
cmpl $0x5, %edx
ja 0x11807
movslq (%r12,%rdx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
addq $0x7, %r15
jmp 0x11831
cmpl $0x53, %ecx
je 0x11828
movq %rax, %r15
cmpl $0x5a, %ecx
jne 0x11831
leaq 0x1(%rax), %r15
cmpb $0x0, (%rax)
movq %r15, %rax
jne 0x11814
jmp 0x11831
addq $0xb, %r15
jmp 0x11831
addq $0x5, %r15
jmp 0x11831
movq %rax, %r15
cmpq %r14, %r15
jb 0x117bb
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_aux.c
// Function: bam_aux_del
int bam_aux_del(bam1_t *b, uint8_t *s)
{
	uint8_t *p, *aux;
	aux = bam1_aux(b);
	p = s - 2;
	__skip_tag(s);
	memmove(p, s, b->l_aux - (s - aux));
	b->data_len -= s - p;
	b->l_aux -= s - p;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %r12
movq 0x30(%rdi), %rbp
movslq 0x10(%rdi), %r13
callq 0x3280
movq (%rax), %rax
movzbl (%r14), %ecx
movl (%rax,%rcx,4), %ecx
movl %ecx, %eax
andl $-0x3, %eax
cmpl $0x41, %eax
jne 0x11880
leaq 0x2(%r14), %r15
jmp 0x118cc
leaq 0x1(%r14), %rax
leal -0x44(%rcx), %edx
cmpl $0x5, %edx
ja 0x118a2
leaq 0x13ab5(%rip), %rcx     # 0x25348
movslq (%rcx,%rdx,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
leaq 0x5(%r14), %r15
jmp 0x118cc
cmpl $0x53, %ecx
je 0x118c3
movq %rax, %r15
cmpl $0x5a, %ecx
jne 0x118cc
leaq 0x1(%rax), %r15
cmpb $0x0, (%rax)
movq %r15, %rax
jne 0x118af
jmp 0x118cc
leaq 0x9(%r14), %r15
jmp 0x118cc
leaq 0x3(%r14), %r15
jmp 0x118cc
movq %rax, %r15
addq $-0x2, %r14
movq %r12, %rax
shrq $0x30, %rax
leaq (,%rax,4), %rax
addq %rbp, %rax
shrl $0x18, %r12d
addq %rax, %r12
addq %r13, %r12
leal 0x1(%r13), %eax
shrl $0x1f, %eax
addl %r13d, %eax
incl %eax
sarl %eax
movslq %eax, %rdx
addq %r12, %rdx
movslq 0x20(%rbx), %rax
subq %r15, %rdx
addq %rax, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3430
subl %r15d, %r14d
movq 0x20(%rbx), %xmm0
movd %r14d, %xmm1
pshufd $0x50, %xmm1, %xmm1     # xmm1 = xmm1[0,0,1,1]
paddd %xmm0, %xmm1
movq %xmm1, 0x20(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_aux.c
// Function: bam_get_tid
int32_t bam_get_tid(const bam_header_t *header, const char *seq_name)
{
	khint_t k;
	khash_t(s) *h = (khash_t(s)*)header->hash;
	k = kh_get(s, h, seq_name);
	return k == kh_end(h)? -1 : kh_value(h, k);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x20(%rdi), %rax
movq %rax, (%rsp)
movl (%rax), %r10d
testl %r10d, %r10d
je 0x11e76
movq %rsi, %rbx
movsbl (%rsi), %edi
xorl %r8d, %r8d
movl $0x0, %ecx
testl %edi, %edi
je 0x11e80
movb 0x1(%rbx), %al
testb %al, %al
je 0x11e7e
leaq 0x2(%rbx), %rdx
movl %edi, %ecx
movl %ecx, %edi
shll $0x5, %edi
subl %ecx, %edi
movsbl %al, %ecx
addl %edi, %ecx
movb (%rdx), %al
incq %rdx
testb %al, %al
jne 0x11e5f
jmp 0x11e80
xorl %r12d, %r12d
jmp 0x11f20
movl %edi, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %r10d
movl %edx, %r14d
leal -0x1(%r10), %edi
movl %ecx, %eax
xorl %edx, %edx
divl %edi
movl %edx, %r13d
incl %r13d
movq (%rsp), %rax
movq 0x10(%rax), %rdi
movl %r14d, %r12d
movq %r10, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %ebp
leal (%r12,%r12), %r15d
andl $0x1e, %r15d
movl %ebp, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x11f13
testb $0x1, %al
jne 0x11ef7
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdi
movq %rbx, %rsi
callq 0x34e0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r10
xorl %r8d, %r8d
testl %eax, %eax
je 0x11f13
addl %r13d, %r12d
cmpl %r10d, %r12d
movl %r10d, %eax
cmovbl %r8d, %eax
subl %eax, %r12d
cmpl %r14d, %r12d
jne 0x11eaf
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x11f38
movl %r15d, %ecx
shrl %cl, %ebp
testb $0x3, %bpl
cmovnel %r10d, %r12d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %r10d, %r12d
je 0x11f38
movq (%rsp), %rax
movq 0x20(%rax), %rax
movl %r12d, %ecx
movl (%rax,%rcx,4), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_aux.c
// Function: bam_aux2i
int32_t bam_aux2i(const uint8_t *s)
{
	int type;
	if (s == 0) return 0;
	type = *s++;
	if (type == 'c') return (int32_t)*(int8_t*)s;
	else if (type == 'C') return (int32_t)*(uint8_t*)s;
	else if (type == 's') return (int32_t)*(int16_t*)s;
	else if (type == 'S') return (int32_t)*(uint16_t*)s;
	else if (type == 'i' || type == 'I') return *(int32_t*)s;
	else return 0;
}

// Assembly:
xorl %eax, %eax
testq %rdi, %rdi
je 0x12228
movb (%rdi), %cl
leal -0x43(%rcx), %edx
rolb $0x4, %dl
cmpb $0x3, %dl
ja 0x1221d
movzbl %dl, %eax
leaq 0x13160(%rip), %rcx     # 0x25360
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl 0x1(%rdi), %eax
retq
movsbl 0x1(%rdi), %eax
retq
movswl 0x1(%rdi), %eax
retq
movzwl 0x1(%rdi), %eax
retq
andb $-0x21, %cl
cmpb $0x49, %cl
jne 0x12228
movl 0x1(%rdi), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam.c
// Function: bam_calend
uint32_t bam_calend(const bam1_core_t *c, const uint32_t *cigar)
{
	uint32_t k, end;
	end = c->pos;
	for (k = 0; k < c->n_cigar; ++k) {
		int op = cigar[k] & BAM_CIGAR_MASK;
		if (op == BAM_CMATCH || op == BAM_CDEL || op == BAM_CREF_SKIP)
			end += cigar[k] >> BAM_CIGAR_SHIFT;
	}
	return end;
}

// Assembly:
movl 0x4(%rdi), %eax
movq 0x8(%rdi), %rcx
shrq $0x30, %rcx
je 0x122a9
xorl %edx, %edx
movl (%rsi,%rdx,4), %edi
movl %edi, %r8d
andl $0xf, %r8d
movl %edi, %r9d
shrl $0x4, %r9d
cmpl $0x3, %r8d
movl $0x0, %r8d
cmovel %r9d, %r8d
testb $0xd, %dil
cmovel %r9d, %r8d
addl %r8d, %eax
incq %rdx
cmpq %rdx, %rcx
jne 0x12277
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam.c
// Function: bam_cigar2qlen
int32_t bam_cigar2qlen(const bam1_core_t *c, const uint32_t *cigar)
{
	uint32_t k;
	int32_t l = 0;
	for (k = 0; k < c->n_cigar; ++k) {
		int op = cigar[k] & BAM_CIGAR_MASK;
		if (op == BAM_CMATCH || op == BAM_CINS || op == BAM_CSOFT_CLIP)
			l += cigar[k] >> BAM_CIGAR_SHIFT;
	}
	return l;
}

// Assembly:
movq 0x8(%rdi), %rcx
xorl %eax, %eax
shrq $0x30, %rcx
je 0x122e5
xorl %edx, %edx
movl $0x13, %edi
xorl %eax, %eax
movl (%rsi,%rdx,4), %r8d
movl %r8d, %r9d
andl $0xf, %r9d
cmpl $0x4, %r9d
ja 0x122dd
btl %r9d, %edi
jae 0x122dd
shrl $0x4, %r8d
addl %r8d, %eax
incq %rdx
cmpq %rdx, %rcx
jne 0x122bf
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam.c
// Function: bam_header_destroy
void bam_header_destroy(bam_header_t *header)
{
	int32_t i;
	extern void bam_destroy_header_hash(bam_header_t *header);
	if (header == 0) return;
	if (header->target_name) {
		for (i = 0; i < header->n_targets; ++i)
			free(header->target_name[i]);
		free(header->target_name);
		free(header->target_len);
	}
	free(header->text);
	if (header->dict) sam_header_free(header->dict);
	if (header->rg2lib) sam_tbl_destroy(header->rg2lib);
	bam_destroy_header_hash(header);
	free(header);
}

// Assembly:
testq %rdi, %rdi
je 0x12382
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x12346
cmpl $0x0, (%rbx)
jle 0x12338
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x32c0
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x1231c
movq 0x8(%rbx), %rdi
callq 0x32c0
movq 0x10(%rbx), %rdi
callq 0x32c0
movq 0x38(%rbx), %rdi
callq 0x32c0
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x1235d
callq 0x1f4b4
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x1236b
callq 0x20552
movq %rbx, %rdi
callq 0x11df2
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x32c0
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam.c
// Function: bam_header_write
int bam_header_write(bamFile fp, const bam_header_t *header)
{
	char buf[4];
	int32_t i, name_len, x;
	// write "BAM1"
	strncpy(buf, "BAM\001", 4);
	bam_write(fp, buf, 4);
	// write plain text and the number of reference sequences
	if (bam_is_be) {
		x = bam_swap_endian_4(header->l_text);
		bam_write(fp, &x, 4);
		if (header->l_text) bam_write(fp, header->text, header->l_text);
		x = bam_swap_endian_4(header->n_targets);
		bam_write(fp, &x, 4);
	} else {
		bam_write(fp, &header->l_text, 4);
		if (header->l_text) bam_write(fp, header->text, header->l_text);
		bam_write(fp, &header->n_targets, 4);
	}
	// write sequence names and lengths
	for (i = 0; i != header->n_targets; ++i) {
		char *p = header->target_name[i];
		name_len = strlen(p) + 1;
		if (bam_is_be) {
			x = bam_swap_endian_4(name_len);
			bam_write(fp, &x, 4);
		} else bam_write(fp, &name_len, 4);
		bam_write(fp, p, name_len);
		if (bam_is_be) {
			x = bam_swap_endian_4(header->target_len[i]);
			bam_write(fp, &x, 4);
		} else bam_write(fp, &header->target_len[i], 4);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x14(%rsp), %rsi
movl $0x14d4142, (%rsi)      # imm = 0x14D4142
movl $0x4, %edx
callq 0x10c77
leaq 0x30(%rbx), %r12
cmpl $0x0, 0x1cd8f(%rip)     # 0x2f320
je 0x125cf
movl (%r12), %eax
bswapl %eax
leaq 0xc(%rsp), %r15
movl %eax, (%r15)
movq %r14, %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x10c77
movl (%r12), %edx
testl %edx, %edx
je 0x125c5
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x10c77
movl (%rbx), %eax
bswapl %eax
movl %eax, 0xc(%rsp)
jmp 0x125f9
movq %r14, %rdi
movq %r12, %rsi
movl $0x4, %edx
callq 0x10c77
movl (%r12), %edx
movq %rbx, %r15
testl %edx, %edx
je 0x125f9
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x10c77
movq %rbx, %r15
movq %r14, %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x10c77
cmpl $0x0, (%rbx)
je 0x126a4
xorl %r13d, %r13d
leaq 0xc(%rsp), %r15
xorl %ebp, %ebp
movq 0x8(%rbx), %rax
movq (%rax,%r13,2), %r12
movq %r12, %rdi
callq 0x32d0
incl %eax
movl %eax, 0x10(%rsp)
cmpl $0x0, 0x1cce7(%rip)     # 0x2f320
leaq 0x10(%rsp), %rsi
je 0x12649
bswapl %eax
movl %eax, 0xc(%rsp)
movq %r15, %rsi
movq %r14, %rdi
movl $0x4, %edx
callq 0x10c77
movl 0x10(%rsp), %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x10c77
movq 0x10(%rbx), %rsi
addq %r13, %rsi
cmpl $0x0, 0x1ccad(%rip)     # 0x2f320
je 0x12685
movl (%rsi), %eax
bswapl %eax
movl %eax, 0xc(%rsp)
movq %r14, %rdi
movq %r15, %rsi
jmp 0x12688
movq %r14, %rdi
movl $0x4, %edx
callq 0x10c77
incq %rbp
movl (%rbx), %eax
addq $0x4, %r13
cmpq %rax, %rbp
jne 0x1261c
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam.c
// Function: swap_endian_data
static void swap_endian_data(const bam1_core_t *c, int data_len, uint8_t *data)
{
	uint8_t *s;
	uint32_t i, *cigar = (uint32_t*)(data + c->l_qname);
	s = data + c->n_cigar*4 + c->l_qname + c->l_qseq + (c->l_qseq + 1)/2;
	for (i = 0; i < c->n_cigar; ++i) bam_swap_endian_4p(&cigar[i]);
	while (s < data + data_len) {
		uint8_t type;
		s += 2; // skip key
		type = toupper(*s); ++s; // skip type
		if (type == 'C' || type == 'A') ++s;
		else if (type == 'S') { bam_swap_endian_2p(s); s += 2; }
		else if (type == 'I' || type == 'F') { bam_swap_endian_4p(s); s += 4; }
		else if (type == 'D') { bam_swap_endian_8p(s); s += 8; }
		else if (type == 'Z' || type == 'H') { while (*s) ++s; ++s; }
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq 0x8(%rdi), %rcx
movl %ecx, %eax
shrl $0x18, %eax
addq %rdx, %rax
shrq $0x30, %rcx
leaq (%rax,%rcx,4), %rdx
movslq 0x10(%rdi), %r8
addq %r8, %rdx
leal 0x1(%r8), %r9d
shrl $0x1f, %r9d
addl %r9d, %r8d
incl %r8d
sarl %r8d
movslq %r8d, %r14
addq %rdx, %r14
testq %rcx, %rcx
je 0x128b6
xorl %ecx, %ecx
movl (%rax,%rcx,4), %edx
bswapl %edx
movl %edx, (%rax,%rcx,4)
incq %rcx
movzwl 0xe(%rdi), %edx
cmpq %rdx, %rcx
jb 0x128a2
movslq %esi, %rax
addq %rax, %rbx
cmpq %rbx, %r14
jae 0x1295c
callq 0x3280
movq (%rax), %rax
leaq 0x12b40(%rip), %rcx     # 0x25414
movzbl 0x2(%r14), %edx
movl (%rax,%rdx,4), %esi
movl %esi, %edx
andl $0xfd, %edx
cmpl $0x41, %edx
jne 0x128ef
addq $0x4, %r14
jmp 0x12953
leaq 0x3(%r14), %rdx
movzbl %sil, %esi
leal -0x44(%rsi), %edi
cmpl $0x5, %edi
ja 0x12918
movslq (%rcx,%rdi,4), %rsi
addq %rcx, %rsi
jmpq *%rsi
movl 0x3(%r14), %edx
bswapl %edx
movl %edx, 0x3(%r14)
addq $0x7, %r14
jmp 0x12953
cmpl $0x53, %esi
je 0x12944
movq %rdx, %r14
cmpl $0x5a, %esi
jne 0x12953
leaq 0x1(%rdx), %r14
cmpb $0x0, (%rdx)
movq %r14, %rdx
jne 0x12925
jmp 0x12953
movq 0x3(%r14), %rdx
bswapq %rdx
movq %rdx, 0x3(%r14)
addq $0xb, %r14
jmp 0x12953
rolw $0x8, 0x3(%r14)
addq $0x5, %r14
jmp 0x12953
movq %rdx, %r14
cmpq %rbx, %r14
jb 0x128d4
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam.c
// Function: bam_write1_core
inline int bam_write1_core(bamFile fp, const bam1_core_t *c, int data_len, uint8_t *data)
{
	uint32_t x[8], block_len = data_len + BAM_CORE_SIZE, y;
	int i;
	assert(BAM_CORE_SIZE == 32);
	x[0] = c->tid;
	x[1] = c->pos;
	x[2] = (uint32_t)c->bin<<16 | c->qual<<8 | c->l_qname;
	x[3] = (uint32_t)c->flag<<16 | c->n_cigar;
	x[4] = c->l_qseq;
	x[5] = c->mtid;
	x[6] = c->mpos;
	x[7] = c->isize;
	if (bam_is_be) {
		for (i = 0; i < 8; ++i) bam_swap_endian_4p(x + i);
		y = block_len;
		bam_write(fp, bam_swap_endian_4p(&y), 4);
		swap_endian_data(c, data_len, data);
	} else bam_write(fp, &block_len, 4);
	bam_write(fp, x, BAM_CORE_SIZE);
	bam_write(fp, data, data_len);
	if (bam_is_be) swap_endian_data(c, data_len, data);
	return 4 + block_len;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
leal 0x20(%r14), %eax
movl %eax, 0x8(%rsp)
movq (%rsi), %rcx
movq %rcx, 0x10(%rsp)
movq 0x8(%rsi), %rcx
movl %ecx, %edx
shll $0x10, %edx
movl %ecx, %esi
shrl $0x8, %esi
andl $0xff00, %esi           # imm = 0xFF00
orl %edx, %esi
movl %ecx, %edx
shrl $0x18, %edx
orl %esi, %edx
movl %edx, 0x18(%rsp)
movq %rcx, %rdx
shrq $0x10, %rdx
andl $0xffff0000, %edx       # imm = 0xFFFF0000
shrq $0x30, %rcx
orl %edx, %ecx
movl %ecx, 0x1c(%rsp)
movdqu 0x10(%r15), %xmm0
movdqa %xmm0, 0x20(%rsp)
cmpl $0x0, 0x1c94a(%rip)     # 0x2f320
je 0x12a3e
xorl %ecx, %ecx
pxor %xmm0, %xmm0
movdqa 0x10(%rsp,%rcx,4), %xmm1
movdqa %xmm1, %xmm2
punpckhbw %xmm0, %xmm2    # xmm2 = xmm2[8],xmm0[8],xmm2[9],xmm0[9],xmm2[10],xmm0[10],xmm2[11],xmm0[11],xmm2[12],xmm0[12],xmm2[13],xmm0[13],xmm2[14],xmm0[14],xmm2[15],xmm0[15]
pshuflw $0x1b, %xmm2, %xmm2     # xmm2 = xmm2[3,2,1,0,4,5,6,7]
pshufhw $0x1b, %xmm2, %xmm2     # xmm2 = xmm2[0,1,2,3,7,6,5,4]
punpcklbw %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
pshuflw $0x1b, %xmm1, %xmm1     # xmm1 = xmm1[3,2,1,0,4,5,6,7]
pshufhw $0x1b, %xmm1, %xmm1     # xmm1 = xmm1[0,1,2,3,7,6,5,4]
packuswb %xmm2, %xmm1
movdqa %xmm1, 0x10(%rsp,%rcx,4)
addq $0x4, %rcx
cmpq $0x8, %rcx
jne 0x129de
bswapl %eax
leaq 0xc(%rsp), %rsi
movl %eax, (%rsi)
movq %r12, %rdi
movl $0x4, %edx
callq 0x10c77
movq %r15, %rdi
movl %r14d, %esi
movq %rbx, %rdx
callq 0x12862
jmp 0x12a50
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
movl $0x4, %edx
callq 0x10c77
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
movl $0x20, %edx
callq 0x10c77
movq %r12, %rdi
movq %rbx, %rsi
movl %r14d, %edx
callq 0x10c77
cmpl $0x0, 0x1c8a9(%rip)     # 0x2f320
je 0x12a87
movq %r15, %rdi
movl %r14d, %esi
movq %rbx, %rdx
callq 0x12862
movl 0x8(%rsp), %eax
addl $0x4, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam.c
// Function: bam_get_library
const char *bam_get_library(bam_header_t *h, const bam1_t *b)
{
	const uint8_t *rg;
	if (h->dict == 0) h->dict = sam_header_parse2(h->text);
	if (h->rg2lib == 0) h->rg2lib = sam_header2tbl(h->dict, "RG", "ID", "LB");
	rg = bam_aux_get(b, "RG");
	return (rg == 0)? 0 : sam_tbl_get(h->rg2lib, (const char*)(rg + 1));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rax
testq %rax, %rax
jne 0x13504
movq 0x38(%rbx), %rdi
callq 0x1f7ab
movq %rax, 0x18(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0x1352c
leaq 0x10a1f(%rip), %rsi     # 0x23f31
leaq 0x1200b(%rip), %rdx     # 0x25524
leaq 0x12007(%rip), %rcx     # 0x25527
movq %rax, %rdi
callq 0x1fc72
movq %rax, 0x28(%rbx)
leaq 0x109fe(%rip), %rsi     # 0x23f31
movq %r14, %rdi
callq 0x1175c
testq %rax, %rax
je 0x13556
movq 0x28(%rbx), %rdi
incq %rax
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x20429
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq