LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_index.c
// Function: bam_index_load
bam_index_t *bam_index_load(const char *fn)
{
	bam_index_t *idx;
	idx = bam_index_load_local(fn);
	if (idx == 0 && (strstr(fn, "ftp://") == fn || strstr(fn, "http://") == fn)) {
		char *fnidx = calloc(strlen(fn) + 5, 1);
		strcat(strcpy(fnidx, fn), ".bai");
		fprintf(stderr, "[bam_index_load] attempting to download the remote index file.\n");
		download_from_remote(fnidx);
		idx = bam_index_load_local(fn);
	}
	if (idx == 0) fprintf(stderr, "[bam_index_load] fail to load BAM index.\n");
	return idx;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x15fc6
movq %rax, %r14
testq %rax, %rax
jne 0x16414
leaq 0x1057d(%rip), %rsi     # 0x26965
movl $0x6, %edx
movq %rbx, %rdi
callq 0x31c0
testl %eax, %eax
je 0x1642b
leaq 0x1056c(%rip), %rsi     # 0x2696c
movl $0x7, %edx
movq %rbx, %rdi
callq 0x31c0
testl %eax, %eax
je 0x1642b
xorl %r14d, %r14d
testq %r14, %r14
je 0x16424
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x4623
jmp 0x16419
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4481
movq (%r14), %r14
jmp 0x16414
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_index.c
// Function: bam_index_build2
int bam_index_build2(const char *fn, const char *_fnidx)
{
	char *fnidx;
	FILE *fpidx;
	bamFile fp;
	bam_index_t *idx;
	if ((fp = bam_open(fn, "r")) == 0) {
		fprintf(stderr, "[bam_index_build2] fail to open the BAM file.\n");
		return -1;
	}
	idx = bam_index_core(fp);
	bam_close(fp);
	if (_fnidx == 0) {
		fnidx = (char*)calloc(strlen(fn) + 5, 1);
		strcpy(fnidx, fn); strcat(fnidx, ".bai");
	} else fnidx = strdup(_fnidx);
	fpidx = fopen(fnidx, "w");
	if (fpidx == 0) {
		fprintf(stderr, "[bam_index_build2] fail to create the index file.\n");
		free(fnidx);
		return -1;
	}
	bam_index_save(idx, fpidx);
	bam_index_destroy(idx);
	fclose(fpidx);
	free(fnidx);
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq 0x11b74(%rip), %rsi     # 0x27fc7
callq 0xfa04
testq %rax, %rax
je 0x1650b
movq %rax, %r12
movq %rax, %rdi
callq 0x1569c
movq %rax, %rbx
movq %r12, %rdi
callq 0x1050e
testq %r14, %r14
je 0x16489
movq %r14, %rdi
callq 0x34b0
movq %rax, %r14
jmp 0x164c3
movq %r15, %rdi
callq 0x32d0
leaq 0x5(%rax), %rdi
movl $0x1, %esi
callq 0x3530
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x3510
movq %r14, %rdi
callq 0x32d0
movl $0x6961622e, (%r14,%rax) # imm = 0x6961622E
movb $0x0, 0x4(%r14,%rax)
leaq 0xdecb(%rip), %rsi      # 0x24395
movq %r14, %rdi
callq 0x35f0
testq %rax, %rax
je 0x16512
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
callq 0x15cac
movq %rbx, %rdi
callq 0x15bce
movq %r15, %rdi
callq 0x3560
movq %r14, %rdi
callq 0x32c0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x4668
jmp 0x1651a
movq %r14, %rdi
callq 0x463f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x164ff
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_index.c
// Function: bam_index
int bam_index(int argc, char *argv[])
{
	if (argc < 2) {
		fprintf(stderr, "Usage: samtools index <in.bam> [<out.index>]\n");
		return 1;
	}
	if (argc >= 3) bam_index_build2(argv[1], argv[2]);
	else bam_index_build(argv[1]);
	return 0;
}

// Assembly:
pushq %rbx
cmpl $0x1, %edi
jle 0x16553
movl %edi, %eax
movq 0x8(%rsi), %rdi
cmpl $0x2, %eax
jne 0x16544
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x1643e
jmp 0x1654f
movq 0x10(%rsi), %rsi
callq 0x1643e
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
callq 0x4684
movl $0x1, %ebx
jmp 0x1654f
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_pileup.c
// Function: bam_plbuf_reset
void bam_plbuf_reset(bam_plbuf_t *buf)
{
	lbnode_t *p, *q;
	buf->max_tid = buf->max_pos = -1;
	buf->tid = buf->pos = 0;
	buf->is_eof = 0;
	for (p = buf->head; p->next;) {
		q = p->next;
		mp_free(buf->mp, p);
		p = q;
	}
	buf->head = buf->tail;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq $-0x1, 0x38(%rdi)
movq $0x0, 0x30(%rdi)
movl $0x0, 0x44(%rdi)
movq 0x8(%rdi), %r14
movq 0x40(%r14), %rax
testq %rax, %rax
je 0x16fdb
movl $0x100, %ebp            # imm = 0x100
movq %rax, %r15
movq (%rbx), %r12
decl (%r12)
movq $0x0, 0x40(%r14)
movl 0x8(%r12), %eax
cmpl %eax, 0x4(%r12)
jne 0x16fb9
leal (%rax,%rax), %ecx
testl %eax, %eax
cmovel %ebp, %ecx
movl %ecx, 0x8(%r12)
movq 0x10(%r12), %rdi
movslq %ecx, %rsi
shlq $0x3, %rsi
callq 0x3610
movq %rax, 0x10(%r12)
movq 0x10(%r12), %rax
movslq 0x4(%r12), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r12)
movq %r14, (%rax,%rcx,8)
movq 0x40(%r15), %rax
movq %r15, %r14
testq %rax, %rax
jne 0x16f78
movq 0x10(%rbx), %rax
movq %rax, 0x8(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_pileup.c
// Function: bam_plbuf_init
bam_plbuf_t *bam_plbuf_init(bam_pileup_f func, void *data)
{
	bam_plbuf_t *buf;
	buf = (bam_plbuf_t*)calloc(1, sizeof(bam_plbuf_t));
	buf->func = func; buf->func_data = data;
	buf->mp = mp_init();
	buf->head = buf->tail = mp_alloc(buf->mp);
	buf->dummy = mp_alloc(buf->mp);
	buf->max_tid = buf->max_pos = -1;
	buf->flag_mask = BAM_DEF_MASK;
	return buf;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x58, %esi
callq 0x3530
movq %rax, %rbx
movq %r15, 0x20(%rax)
movq %r14, 0x28(%rax)
movl $0x1, %edi
movl $0x18, %esi
callq 0x3530
movq %rax, %r14
movq %rax, (%rbx)
movl (%rax), %r15d
leal 0x1(%r15), %eax
movl %eax, (%r14)
movslq 0x4(%r14), %rax
testq %rax, %rax
je 0x1705f
movq 0x10(%r14), %rcx
leaq -0x1(%rax), %rdx
movl %edx, 0x4(%r14)
movq -0x8(%rcx,%rax,8), %rax
jmp 0x1706e
movl $0x1, %edi
movl $0x48, %esi
callq 0x3530
movq %rax, 0x10(%rbx)
movq %rax, 0x8(%rbx)
addl $0x2, %r15d
movl %r15d, (%r14)
movslq 0x4(%r14), %rax
testq %rax, %rax
je 0x17099
movq 0x10(%r14), %rcx
leaq -0x1(%rax), %rdx
movl %edx, 0x4(%r14)
movq -0x8(%rcx,%rax,8), %rax
jmp 0x170a8
movl $0x1, %edi
movl $0x48, %esi
callq 0x3530
movq %rax, 0x18(%rbx)
movq $-0x1, 0x38(%rbx)
movl $0x704, 0x50(%rbx)      # imm = 0x704
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_pileup.c
// Function: bam_plbuf_destroy
void bam_plbuf_destroy(bam_plbuf_t *buf)
{
	mp_free(buf->mp, buf->dummy);
	mp_free(buf->mp, buf->head);
	if (buf->mp->cnt != 0)
		fprintf(stderr, "[bam_plbuf_destroy] memory leak: %d. Continue anyway.\n", buf->mp->cnt);
	mp_destroy(buf->mp);
	free(buf->pu);
	free(buf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
movq 0x18(%rdi), %r15
decl (%r14)
movq $0x0, 0x40(%r15)
movl 0x8(%r14), %eax
cmpl %eax, 0x4(%r14)
jne 0x1710d
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x100, %eax            # imm = 0x100
cmovnel %ecx, %eax
movl %eax, 0x8(%r14)
movq 0x10(%r14), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x3610
movq %rax, 0x10(%r14)
movq 0x10(%r14), %rax
movslq 0x4(%r14), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r14)
movq %r15, (%rax,%rcx,8)
movq (%rbx), %r14
movq 0x8(%rbx), %r15
decl (%r14)
movq $0x0, 0x40(%r15)
movl 0x8(%r14), %eax
cmpl %eax, 0x4(%r14)
jne 0x17161
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x100, %eax            # imm = 0x100
cmovnel %ecx, %eax
movl %eax, 0x8(%r14)
movq 0x10(%r14), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x3610
movq %rax, 0x10(%r14)
movq 0x10(%r14), %rax
movslq 0x4(%r14), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r14)
movq %r15, (%rax,%rcx,8)
movq (%rbx), %rax
movl (%rax), %edx
testl %edx, %edx
jne 0x171db
movq (%rbx), %r14
cmpl $0x0, 0x4(%r14)
jle 0x171b4
xorl %r15d, %r15d
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rax
movq 0x30(%rax), %rdi
callq 0x32c0
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x32c0
incq %r15
movslq 0x4(%r14), %rax
cmpq %rax, %r15
jl 0x1718a
movq 0x10(%r14), %rdi
callq 0x32c0
movq %r14, %rdi
callq 0x32c0
movq 0x48(%rbx), %rdi
callq 0x32c0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x32c0
movq 0x17e06(%rip), %rax     # 0x2efe8
movq (%rax), %rdi
leaq 0xfa38(%rip), %rsi      # 0x26c24
xorl %eax, %eax
callq 0x3630
jmp 0x1717d
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_pileup.c
// Function: bam_pileup_file
int bam_pileup_file(bamFile fp, int mask, bam_pileup_f func, void *func_data)
{
	bam_plbuf_t *buf;
	int ret;
	bam1_t *b;
	b = bam_init1();
	buf = bam_plbuf_init(func, func_data);
	bam_plbuf_set_mask(buf, mask);
	while ((ret = bam_read1(fp, b)) >= 0)
		bam_plbuf_push(b, buf);
	bam_plbuf_push(0, buf);
	bam_plbuf_destroy(buf);
	bam_destroy1(b);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
movl $0x1, %edi
movl $0x38, %esi
callq 0x3530
movq %rax, %rbx
movq %r12, %rdi
movq %r15, %rsi
callq 0x16fff
movq %rax, %r15
movl %ebp, %eax
orl $0x4, %eax
testl %ebp, %ebp
movl $0x704, %ecx            # imm = 0x704
cmovnsl %eax, %ecx
movl %ecx, 0x50(%r15)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1204b
testl %eax, %eax
js 0x177e4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x171f5
jmp 0x177c8
xorl %edi, %edi
movq %r15, %rsi
callq 0x171f5
movq %r15, %rdi
callq 0x170c4
testq %rbx, %rbx
je 0x1780c
movq 0x30(%rbx), %rdi
callq 0x32c0
movq %rbx, %rdi
callq 0x32c0
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_lpileup.c
// Function: bam_lplbuf_reset
void bam_lplbuf_reset(bam_lplbuf_t *buf)
{
	freenode_t *p, *q;
	bam_plbuf_reset(buf->plbuf);
	for (p = buf->head; p->next;) {
		q = p->next;
		mp_free(buf->mp, p);
		p = q;
	}
	buf->head = buf->tail;
	buf->max_level = 0;
	buf->n_cur = buf->n_pre = 0;
	buf->n_nodes = 0;
}

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x60, %esi
callq 0x3530
movq %rax, %rbx
movl $0x1, %edi
movl $0x18, %esi
callq 0x3530
incl (%rax)
movq %rax, 0x20(%rbx)
movslq 0x4(%rax), %rcx
testq %rcx, %rcx
je 0x1831a
movq 0x10(%rax), %rdx
leaq -0x1(%rcx), %rsi
movl %esi, 0x4(%rax)
movq -0x8(%rdx,%rcx,8), %rax
jmp 0x18329
movl $0x1, %edi
movl $0x10, %esi
callq 0x3530
movq %rax, 0x38(%rbx)
movq %rax, 0x30(%rbx)
movq %r15, 0x48(%rbx)
movq %r14, 0x50(%rbx)
leaq 0x15(%rip), %rdi        # 0x18355
movq %rbx, %rsi
callq 0x16fff
movq %rax, 0x58(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_lpileup.c
// Function: bam_lplbuf_destroy
void bam_lplbuf_destroy(bam_lplbuf_t *tv)
{
	freenode_t *p, *q;
	free(tv->cur_level); free(tv->pre_level);
	bam_plbuf_destroy(tv->plbuf);
	free(tv->aux);
	for (p = tv->head; p->next;) {
		q = p->next;
		mp_free(tv->mp, p); p = q;
	}
	mp_free(tv->mp, p);
	assert(tv->mp->cnt == 0);
	mp_destroy(tv->mp);
	free(tv);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x32c0
movq 0x18(%rbx), %rdi
callq 0x32c0
movq 0x58(%rbx), %rdi
callq 0x170c4
movq 0x28(%rbx), %rdi
callq 0x32c0
movq 0x30(%rbx), %r15
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x18869
movl $0xfffffff, %ebp        # imm = 0xFFFFFFF
movl $0x100, %r12d           # imm = 0x100
movq %rax, %r14
movq 0x20(%rbx), %r13
decl (%r13)
movq $0x0, 0x8(%r15)
movl (%r15), %eax
andl %ebp, %eax
orl $0x20000000, %eax       # imm = 0x20000000
movl %eax, (%r15)
movl 0x8(%r13), %eax
cmpl %eax, 0x4(%r13)
jne 0x18848
leal (%rax,%rax), %ecx
testl %eax, %eax
cmovel %r12d, %ecx
movl %ecx, 0x8(%r13)
movq 0x10(%r13), %rdi
movslq %ecx, %rsi
shlq $0x3, %rsi
callq 0x3610
movq %rax, 0x10(%r13)
movq 0x10(%r13), %rax
movslq 0x4(%r13), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r13)
movq %r15, (%rax,%rcx,8)
movq 0x8(%r14), %rax
movq %r14, %r15
testq %rax, %rax
jne 0x187fd
jmp 0x1886c
movq %r15, %r14
movq 0x20(%rbx), %r15
decl (%r15)
movq $0x0, 0x8(%r14)
movl $0xfffffff, %eax        # imm = 0xFFFFFFF
andl (%r14), %eax
orl $0x20000000, %eax       # imm = 0x20000000
movl %eax, (%r14)
movl 0x8(%r15), %eax
cmpl %eax, 0x4(%r15)
jne 0x188ba
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x100, %eax            # imm = 0x100
cmovnel %ecx, %eax
movl %eax, 0x8(%r15)
movq 0x10(%r15), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x3610
movq %rax, 0x10(%r15)
movq 0x10(%r15), %rax
movslq 0x4(%r15), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%r15)
movq %r14, (%rax,%rcx,8)
movq 0x20(%rbx), %r14
cmpl $0x0, (%r14)
jne 0x18921
cmpl $0x0, 0x4(%r14)
jle 0x188fa
xorl %r15d, %r15d
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x32c0
incq %r15
movslq 0x4(%r14), %rax
cmpq %rax, %r15
jl 0x188e1
movq 0x10(%r14), %rdi
callq 0x32c0
movq %r14, %rdi
callq 0x32c0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x32c0
leaq 0xe435(%rip), %rdi      # 0x26d5d
leaq 0xe43f(%rip), %rsi      # 0x26d6e
leaq 0xe446(%rip), %rcx      # 0x26d7c
movl $0xbe, %edx
callq 0x3140
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/glf.c
// Function: glf3_header_read
glf3_header_t *glf3_header_read(glfFile fp)
{
	glf3_header_t *h;
	char magic[4];
	h = glf3_header_init();
	bgzf_read(fp, magic, 4);
	if (strncmp(magic, "GLF\3", 4)) {
		fprintf(stderr, "[glf3_header_read] invalid magic.\n");
		glf3_header_destroy(h);
		return 0;
	}
	bgzf_read(fp, &h->l_text, 4);
	if (glf3_is_BE) h->l_text = bam_swap_endian_4(h->l_text);
	if (h->l_text) {
		h->text = (uint8_t*)calloc(h->l_text + 1, 1);
		bgzf_read(fp, h->text, h->l_text);
	}
	return h;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
movl $0x1, %edi
movl $0x10, %esi
callq 0x3530
movq %rax, %rbx
leaq 0xc(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x100b8
cmpl $0x3464c47, (%r15)      # imm = 0x3464C47
jne 0x19dd2
movq %r14, %rdi
movq %rbx, %rsi
movl $0x4, %edx
callq 0x100b8
movslq (%rbx), %r15
testq %r15, %r15
je 0x19dc5
movq %r15, %rdi
incq %rdi
movl $0x1, %esi
callq 0x3530
movq %rax, 0x8(%rbx)
movq %r14, %rdi
movq %rax, %rsi
movl %r15d, %edx
callq 0x100b8
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
callq 0x480d
xorl %ebx, %ebx
jmp 0x19dc5
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/glf.c
// Function: glf3_header_write
void glf3_header_write(glfFile fp, const glf3_header_t *h)
{
	int32_t x;
	bgzf_write(fp, "GLF\3", 4);
	x = glf3_is_BE? bam_swap_endian_4(h->l_text) : h->l_text;
	bgzf_write(fp, &x, 4);
	if (h->l_text) bgzf_write(fp, h->text, h->l_text);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xd320(%rip), %rsi      # 0x27125
movl $0x4, %edx
callq 0x10462
movl (%r14), %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
movl $0x4, %edx
callq 0x10462
movl (%r14), %edx
testl %edx, %edx
je 0x19e39
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x10462
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/glf.c
// Function: glf3_ref_read
char *glf3_ref_read(glfFile fp, int *len)
{
	int32_t n, x;
	char *str;
	*len = 0;
	if (bgzf_read(fp, &n, 4) != 4) return 0;
	if (glf3_is_BE) n = bam_swap_endian_4(n);
	if (n < 0) {
		fprintf(stderr, "[glf3_ref_read] invalid reference name length: %d.\n", n);
		return 0;
	}
	str = (char*)calloc(n + 1, 1); // not necesarily n+1 in fact
	x = bgzf_read(fp, str, n);
	x += bgzf_read(fp, len, 4);
	if (x != n + 4) {
		free(str); *len = -1; return 0; // truncated
	}
	if (glf3_is_BE) *len = bam_swap_endian_4(*len);
	return str;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movl $0x0, (%rsi)
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
callq 0x100b8
cmpl $0x4, %eax
jne 0x19ec5
movl 0xc(%rsp), %r12d
testl %r12d, %r12d
js 0x19ed8
movq %r12, %rdi
incq %rdi
movl $0x1, %esi
callq 0x3530
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
movl %r12d, %edx
callq 0x100b8
movl %eax, %ebp
movq %r15, %rdi
movq %rbx, %rsi
movl $0x4, %edx
callq 0x100b8
addl %ebp, %eax
movl 0xc(%rsp), %ecx
addl $0x4, %ecx
cmpl %ecx, %eax
je 0x19ec8
movq %r14, %rdi
callq 0x32c0
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
xorl %r14d, %r14d
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x15109(%rip), %rax     # 0x2efe8
movq (%rax), %rdi
leaq 0xd264(%rip), %rsi      # 0x2714d
xorl %r14d, %r14d
movl %r12d, %edx
xorl %eax, %eax
callq 0x3630
jmp 0x19ec8
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/glf.c
// Function: glf3_ref_write
void glf3_ref_write(glfFile fp, const char *str, int len)
{
	int32_t m, n = strlen(str) + 1;
	m = glf3_is_BE? bam_swap_endian_4(n) : n;
	bgzf_write(fp, &m, 4);
	bgzf_write(fp, str, n);
	if (glf3_is_BE) len = bam_swap_endian_4(len);
	bgzf_write(fp, &len, 4);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4(%rsp), %r15
movl %edx, (%r15)
movq %rsi, %rdi
callq 0x32d0
leal 0x1(%rax), %ebp
movq %rsp, %rsi
movl %ebp, (%rsi)
movq %r14, %rdi
movl $0x4, %edx
callq 0x10462
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x10462
movq %r14, %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x10462
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/glf.c
// Function: glf3_view1
void glf3_view1(const char *ref_name, const glf3_t *g3, int pos)
{
	int j;
	if (g3->rtype == GLF3_RTYPE_END) return;
	printf("%s\t%d\t%c\t%d\t%d\t%d", ref_name, pos + 1,
		   g3->rtype == GLF3_RTYPE_INDEL? '*' : "XACMGRSVTWYHKDBN"[g3->ref_base],
		   g3->depth, g3->rms_mapQ, g3->min_lk);
	if (g3->rtype == GLF3_RTYPE_SUB)
		for (j = 0; j != 10; ++j) printf("\t%d", g3->lk[j]);
	else {
		printf("\t%d\t%d\t%d\t%d\t%d\t%s\t%s\t", g3->lk[0], g3->lk[1], g3->lk[2], g3->indel_len[0], g3->indel_len[1],
			   g3->indel_len[0]? g3->indel_seq[0] : "*", g3->indel_len[1]? g3->indel_seq[1] : "*");
	}
	printf("\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movzbl (%rsi), %eax
cmpq $0x10, %rax
jae 0x19f69
popq %rbx
popq %r14
popq %r15
retq
movq %rdi, %rsi
incl %edx
movl %eax, %edi
andb $-0x10, %dil
movl $0x2a, %ecx
cmpb $0x20, %dil
je 0x19f8d
andl $0xf, %eax
leaq 0xd20a(%rip), %rcx      # 0x27193
movsbl (%rax,%rcx), %ecx
movl 0xc(%rbx), %r8d
movzbl %r8b, %r10d
shrl $0x8, %r8d
movzbl 0x1(%rbx), %r9d
subq $0x8, %rsp
leaq 0xd1d8(%rip), %rdi      # 0x27181
xorl %eax, %eax
pushq %r10
callq 0x3040
addq $0x10, %rsp
movb (%rbx), %al
andb $-0x10, %al
cmpb $0x10, %al
jne 0x19fe5
movl $0x2, %r15d
leaq 0xd1c4(%rip), %r14      # 0x2718f
movzbl (%rbx,%r15), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
incq %r15
cmpq $0xc, %r15
jne 0x19fcb
jmp 0x1a02e
movswl 0x14(%rbx), %r8d
movswl 0x16(%rbx), %r9d
leaq 0xc47b(%rip), %r11      # 0x26471
movq %r11, %r10
testl %r8d, %r8d
je 0x1a002
movq 0x20(%rbx), %r10
movzbl 0x2(%rbx), %esi
movzbl 0x3(%rbx), %edx
movzbl 0x4(%rbx), %ecx
testw %r9w, %r9w
je 0x1a018
movq 0x28(%rbx), %r11
leaq 0xd185(%rip), %rdi      # 0x271a4
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x3040
addq $0x10, %rsp
movl $0xa, %edi
popq %rbx
popq %r14
popq %r15
jmp 0x3170
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/glf.c
// Function: glf3_write1
int glf3_write1(glfFile fp, const glf3_t *g3)
{
	int r;
	uint8_t c;
	uint32_t y[2];
	c = g3->rtype<<4 | g3->ref_base;
	r = bgzf_write(fp, &c, 1);
	if (g3->rtype == GLF3_RTYPE_END) return r;
	y[0] = g3->offset;
	y[1] = g3->min_lk<<24 | g3->depth;
	if (glf3_is_BE) {
		y[0] = bam_swap_endian_4(y[0]);
		y[1] = bam_swap_endian_4(y[1]);
	}
	r += bgzf_write(fp, y, 8);
	r += bgzf_write(fp, &g3->rms_mapQ, 1);
	if (g3->rtype == GLF3_RTYPE_SUB) r += bgzf_write(fp, g3->lk, 10);
	else {
		int16_t x[2];
		r += bgzf_write(fp, g3->lk, 3);
		x[0] = glf3_is_BE? bam_swap_endian_2(g3->indel_len[0]) : g3->indel_len[0];
		x[1] = glf3_is_BE? bam_swap_endian_2(g3->indel_len[1]) : g3->indel_len[1];
		r += bgzf_write(fp, x, 4);
		if (g3->indel_len[0]) r += bgzf_write(fp, g3->indel_seq[0], abs(g3->indel_len[0]));
		if (g3->indel_len[1]) r += bgzf_write(fp, g3->indel_seq[1], abs(g3->indel_len[1]));
	}
	return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movb (%rsi), %al
leaq 0x3(%rsp), %rsi
movb %al, (%rsi)
movl $0x1, %edx
callq 0x10462
movl %eax, %ebp
cmpb $0x10, (%r14)
jb 0x1a15b
movl 0x10(%r14), %eax
leaq 0x8(%rsp), %rsi
movl %eax, (%rsi)
movl 0xc(%r14), %eax
roll $0x18, %eax
movl %eax, 0x4(%rsi)
movq %rbx, %rdi
movl $0x8, %edx
callq 0x10462
movl %eax, %r12d
addl %ebp, %r12d
leaq 0x1(%r14), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x10462
movl %eax, %r15d
addl %r12d, %r15d
movb (%r14), %al
andb $-0x10, %al
cmpb $0x10, %al
jne 0x1a0d4
addq $0x2, %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa, %edx
callq 0x10462
movl %eax, %ebp
addl %r15d, %ebp
jmp 0x1a15b
leaq 0x2(%r14), %rsi
movq %rbx, %rdi
movl $0x3, %edx
callq 0x10462
movl %eax, %r12d
movzwl 0x14(%r14), %eax
leaq 0x4(%rsp), %rsi
movw %ax, (%rsi)
movzwl 0x16(%r14), %eax
movw %ax, 0x2(%rsi)
movq %rbx, %rdi
movl $0x4, %edx
callq 0x10462
movl %eax, %ebp
addl %r12d, %ebp
addl %r15d, %ebp
movzwl 0x14(%r14), %eax
testw %ax, %ax
je 0x1a137
movq 0x20(%r14), %rsi
movl %eax, %ecx
negw %cx
cmovsw %ax, %cx
movzwl %cx, %edx
movq %rbx, %rdi
callq 0x10462
addl %eax, %ebp
movzwl 0x16(%r14), %eax
testw %ax, %ax
je 0x1a15b
movq 0x28(%r14), %rsi
movl %eax, %ecx
negw %cx
cmovsw %ax, %cx
movzwl %cx, %edx
movq %rbx, %rdi
callq 0x10462
addl %eax, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/glf.c
// Function: glf3_view
void glf3_view(glfFile fp)
{
	glf3_header_t *h;
	char *name;
	glf3_t *g3;
	int len;
	h = glf3_header_read(fp);
	g3 = glf3_init1();
	while ((name = glf3_ref_read(fp, &len)) != 0) {
		int pos = 0;
		while (glf3_read1(fp, g3) && g3->rtype != GLF3_RTYPE_END) {
			pos += g3->offset;
			glf3_view1(name, g3, pos);
		}
		free(name);
	}
	glf3_header_destroy(h);
	glf3_destroy1(g3);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
callq 0x19d4f
movq %rax, %r14
movl $0x1, %edi
movl $0x30, %esi
callq 0x3530
movq %rax, %rbx
leaq 0x4(%rsp), %rsi
movq %r15, %rdi
callq 0x19e41
testq %rax, %rax
je 0x1a3b5
movq %rax, %r13
leaq 0x4(%rsp), %r12
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1a16a
testl %eax, %eax
je 0x1a39a
xorl %ebp, %ebp
cmpb $0x10, (%rbx)
jb 0x1a39a
addl 0x10(%rbx), %ebp
movq %r13, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x19f52
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1a16a
testl %eax, %eax
jne 0x1a376
movq %r13, %rdi
callq 0x32c0
movq %r15, %rdi
movq %r12, %rsi
callq 0x19e41
movq %rax, %r13
testq %rax, %rax
jne 0x1a365
movq 0x8(%r14), %rdi
callq 0x32c0
movq %r14, %rdi
callq 0x32c0
movq 0x20(%rbx), %rdi
callq 0x32c0
movq 0x28(%rbx), %rdi
callq 0x32c0
movq %rbx, %rdi
callq 0x32c0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/glf.c
// Function: glf3_view_main
int glf3_view_main(int argc, char *argv[])
{
	glfFile fp;
	if (argc == 1) {
		fprintf(stderr, "Usage: glfview <in.glf>\n");
		return 1;
	}
	fp = (strcmp(argv[1], "-") == 0)? bgzf_fdopen(fileno(stdin), "r") : bgzf_open(argv[1], "r");
	if (fp == 0) {
		fprintf(stderr, "Fail to open file '%s'\n", argv[1]);
		return 1;
	}
	glf3_view(fp);
	bgzf_close(fp);
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x1, %edi
je 0x1a462
movq %rsi, %rbx
movq 0x8(%rsi), %r14
leaq 0xa9b0(%rip), %rsi      # 0x24db6
movq %r14, %rdi
callq 0x34e0
testl %eax, %eax
je 0x1a423
leaq 0xdbae(%rip), %rsi      # 0x27fc7
movq %r14, %rdi
callq 0xfa04
jmp 0x1a440
movq 0x14ba6(%rip), %rax     # 0x2efd0
movq (%rax), %rdi
callq 0x3030
leaq 0xdb8e(%rip), %rsi      # 0x27fc7
movl %eax, %edi
callq 0xfb6d
movq %rax, %r14
testq %rax, %rax
je 0x1a469
movq %r14, %rdi
callq 0x1a323
movq %r14, %rdi
callq 0x1050e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x485e
jmp 0x1a475
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x4840
movl $0x1, %eax
jmp 0x1a45a
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/faidx.c
// Function: fai_destroy
void fai_destroy(faidx_t *fai)
{
	int i;
	for (i = 0; i < fai->n; ++i) free(fai->name[i]);
	free(fai->name);
	kh_destroy(s, fai->hash);
	if (fai->rz) razf_close(fai->rz);
	free(fai);
}

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, 0x28(%rsp)
cmpl $0x0, 0x8(%rdi)
jle 0x1ac2f
movq %rdi, %rbx
xorl %r15d, %r15d
movq %rdi, 0x18(%rsp)
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rax,%r15,8), %r10
movq %rcx, 0x8(%rsp)
movl (%rcx), %r13d
movl $0x0, %eax
testl %r13d, %r13d
je 0x1abdd
movsbl (%r10), %ecx
testl %ecx, %ecx
movq %r15, 0x20(%rsp)
je 0x1ab2d
movb 0x1(%r10), %al
testb %al, %al
je 0x1ab2f
leaq 0x2(%r10), %rdx
movl %ecx, %esi
shll $0x5, %esi
subl %ecx, %esi
movsbl %al, %ecx
addl %esi, %ecx
movb (%rdx), %al
incq %rdx
testb %al, %al
jne 0x1ab16
jmp 0x1ab2f
xorl %ecx, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %r13d
movl %edx, %edi
leal -0x1(%r13), %esi
movl %ecx, %eax
xorl %edx, %edx
divl %esi
movl %edx, %r14d
incl %r14d
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
movl %edi, %r12d
movl %edi, 0x14(%rsp)
movq %rsi, 0x30(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %ebp
leal (%r12,%r12), %r15d
andl $0x1e, %r15d
movl %ebp, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x1abc3
testb $0x1, %al
jne 0x1aba8
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r10, %rsi
movq %r10, %rbx
callq 0x34e0
movq 0x30(%rsp), %rsi
movl 0x14(%rsp), %edi
movq %rbx, %r10
testl %eax, %eax
je 0x1abc3
addl %r14d, %r12d
cmpl %r13d, %r12d
movl %r13d, %eax
movl $0x0, %ecx
cmovbl %ecx, %eax
subl %eax, %r12d
cmpl %edi, %r12d
jne 0x1ab5d
jmp 0x1abd0
movl %r15d, %ecx
shrl %cl, %ebp
testb $0x3, %bpl
cmovel %r12d, %r13d
movl %r13d, %eax
movq 0x18(%rsp), %rbx
movq 0x20(%rsp), %r15
movq 0x8(%rsp), %rcx
movq 0x20(%rcx), %rdx
movl %eax, %eax
shlq $0x4, %rax
movq (%rdx,%rax), %rcx
movq 0x8(%rdx,%rax), %r8
movq %rcx, %r9
shrq $0x30, %r9
movq %rcx, %rax
shrq $0x20, %rax
movzwl %ax, %eax
movl %eax, (%rsp)
movq 0x28(%rsp), %rdi
leaq 0xc6c6(%rip), %rsi      # 0x272db
movq %r10, %rdx
xorl %eax, %eax
callq 0x3630
incq %r15
movslq 0x8(%rbx), %rax
cmpq %rax, %r15
jl 0x1aadb
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/faidx.c
// Function: fai_read
faidx_t *fai_read(FILE *fp)
{
	faidx_t *fai;
	char *buf, *p;
	int len, line_len, line_blen;
#ifdef _WIN32
	long offset;
#else
	long long offset;
#endif
	fai = (faidx_t*)calloc(1, sizeof(faidx_t));
	fai->hash = kh_init(s);
	buf = (char*)calloc(0x10000, 1);
	while (!feof(fp) && fgets(buf, 0x10000, fp)) {
		for (p = buf; *p && isgraph(*p); ++p);
		*p = 0; ++p;
#ifdef _WIN32
		sscanf(p, "%d%ld%d%d", &len, &offset, &line_blen, &line_len);
#else
		sscanf(p, "%d%lld%d%d", &len, &offset, &line_blen, &line_len);
#endif
		fai_insert_index(fai, buf, len, line_len, line_blen, offset);
	}
	free(buf);
	return fai;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x1, %edi
movl $0x20, %esi
callq 0x3530
movq %rax, %r14
movl $0x1, %edi
movl $0x28, %esi
callq 0x3530
movq %rax, 0x18(%r14)
movl $0x10000, %edi          # imm = 0x10000
movl $0x1, %esi
callq 0x3530
movq %rax, %r15
movq %rbx, %rdi
callq 0x3550
testl %eax, %eax
jne 0x1ad33
leaq 0x4(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %r15, %rdi
movl $0x10000, %esi          # imm = 0x10000
movq %rbx, %rdx
callq 0x3200
testq %rax, %rax
je 0x1ad33
movb (%r15), %bpl
movq %r15, %rdi
testb %bpl, %bpl
je 0x1ace2
callq 0x3310
movq (%rax), %rax
movq %r15, %rdi
movsbq %bpl, %rcx
cmpw $0x0, (%rax,%rcx,2)
jns 0x1ace2
movb 0x1(%rdi), %bpl
incq %rdi
testb %bpl, %bpl
jne 0x1accb
movb $0x0, (%rdi)
incq %rdi
leaq 0xc5fe(%rip), %rsi      # 0x272ed
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %r12, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x30f0
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movl 0x4(%rsp), %r8d
movq 0x10(%rsp), %r9
movq %r14, %rdi
movq %r15, %rsi
callq 0x1a7c3
movq %rbx, %rdi
callq 0x3550
testl %eax, %eax
je 0x1aca0
movq %r15, %rdi
callq 0x32c0
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/faidx.c
// Function: fai_build
int fai_build(const char *fn)
{
	char *str;
	RAZF *rz;
	FILE *fp;
	faidx_t *fai;
	str = (char*)calloc(strlen(fn) + 5, 1);
	sprintf(str, "%s.fai", fn);
	rz = razf_open(fn, "r");
	if (rz == 0) {
		fprintf(stderr, "[fai_build] fail to open the FASTA file %s\n",str);
		free(str);
		return -1;
	}
	fai = fai_build_core(rz);
	razf_close(rz);
	fp = fopen(str, "wb");
	if (fp == 0) {
		fprintf(stderr, "[fai_build] fail to write FASTA index %s\n",str);
		fai_destroy(fai); free(str);
		return -1;
	}
	fai_save(fai, fp);
	fclose(fp);
	free(str);
	fai_destroy(fai);
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
callq 0x32d0
leaq 0x5(%rax), %rdi
movl $0x1, %esi
callq 0x3530
movq %rax, %rbx
leaq 0xc586(%rip), %rsi      # 0x272f8
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3350
leaq 0xd241(%rip), %rsi      # 0x27fc7
movq %r14, %rdi
callq 0x22449
testq %rax, %rax
je 0x1adeb
movq %rax, %r15
movq %rax, %rdi
callq 0x1a47c
movq %rax, %r14
movq %r15, %rdi
callq 0x22e92
leaq 0xab55(%rip), %rsi      # 0x25905
movq %rbx, %rdi
callq 0x35f0
testq %rax, %rax
je 0x1adf5
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x1aab3
movq %r15, %rdi
callq 0x3560
movq %rbx, %rdi
callq 0x32c0
movq %r14, %rdi
callq 0x1aa39
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
callq 0x49ab
jmp 0x1ae00
movq %rbx, %rdi
movq %r14, %rsi
callq 0x496f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1ade5
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/faidx.c
// Function: download_and_open
FILE *download_and_open(const char *fn)
{
    const int buf_size = 1 * 1024 * 1024;
    uint8_t *buf;
    FILE *fp;
    knetFile *fp_remote;
    const char *url = fn;
    const char *p;
    int l = strlen(fn);
    for (p = fn + l - 1; p >= fn; --p)
        if (*p == '/') break;
    fn = p + 1;

    // First try to open a local copy
    fp = fopen(fn, "r");
    if (fp)
        return fp;

    // If failed, download from remote and open
    fp_remote = knet_open(url, "rb");
    if (fp_remote == 0) {
        fprintf(stderr, "[download_from_remote] fail to open remote file %s\n",url);
        return NULL;
    }
    if ((fp = fopen(fn, "wb")) == 0) {
        fprintf(stderr, "[download_from_remote] fail to create file in the working directory %s\n",fn);
        knet_close(fp_remote);
        return NULL;
    }
    buf = (uint8_t*)calloc(buf_size, 1);
    while ((l = knet_read(fp_remote, buf, buf_size)) != 0)
        fwrite(buf, 1, l, fp);
    free(buf);
    fclose(fp);
    knet_close(fp_remote);

    return fopen(fn, "r");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
callq 0x32d0
cltq
addq %r15, %rax
decq %rax
movq %rax, %rbx
cmpq %r15, %rax
jb 0x1ae30
leaq -0x1(%rbx), %rax
cmpb $0x2f, (%rbx)
jne 0x1ae1f
incq %rbx
leaq 0xd18d(%rip), %rsi      # 0x27fc7
movq %rbx, %rdi
callq 0x35f0
movq %rax, %r12
testq %rax, %rax
je 0x1ae59
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x9d2f(%rip), %rsi      # 0x24b8f
movq %r15, %rdi
callq 0x1c348
testq %rax, %rax
je 0x1af07
movq %rax, %r14
leaq 0xaa8a(%rip), %rsi      # 0x25905
movq %rbx, %rdi
callq 0x35f0
testq %rax, %rax
je 0x1af2a
movq %rax, %r15
movl $0x100000, %edi         # imm = 0x100000
movl $0x1, %esi
callq 0x3530
movq %rax, %r12
movl $0x100000, %edx         # imm = 0x100000
movq %r14, %rdi
movq %rax, %rsi
callq 0x1c4bd
testl %eax, %eax
je 0x1aed5
movslq %eax, %rdx
movl $0x1, %esi
movq %r12, %rdi
movq %r15, %rcx
callq 0x3600
movl $0x100000, %edx         # imm = 0x100000
movq %r14, %rdi
movq %r12, %rsi
jmp 0x1aeac
movq %r12, %rdi
callq 0x32c0
movq %r15, %rdi
callq 0x3560
movq %r14, %rdi
callq 0x1c43b
leaq 0xd0d3(%rip), %rsi      # 0x27fc7
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x35f0
movq 0x140da(%rip), %rax     # 0x2efe8
movq (%rax), %rdi
leaq 0xc43d(%rip), %rsi      # 0x27355
xorl %r12d, %r12d
movq %r15, %rdx
xorl %eax, %eax
callq 0x3630
jmp 0x1ae4a
movq 0x140b7(%rip), %rax     # 0x2efe8
movq (%rax), %rdi
leaq 0xc44e(%rip), %rsi      # 0x27389
xorl %r12d, %r12d
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3630
movq %r14, %rdi
callq 0x1c43b
jmp 0x1ae4a
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/faidx.c
// Function: fai_load
faidx_t *fai_load(const char *fn)
{
	char *str;
	FILE *fp;
	faidx_t *fai;
	str = (char*)calloc(strlen(fn) + 5, 1);
	sprintf(str, "%s.fai", fn);

#ifdef _USE_KNETFILE
    if (strstr(fn, "ftp://") == fn || strstr(fn, "http://") == fn)
    {
        fp = download_and_open(str);
        if ( !fp )
        {
            fprintf(stderr, "[fai_load] failed to open remote FASTA index %s\n", str);
            free(str);
            return 0;
        }
    }
    else
#endif
        fp = fopen(str, "rb");
	if (fp == 0) {
		fprintf(stderr, "[fai_load] build FASTA index.\n");
		fai_build(fn);
		fp = fopen(str, "rb");
		if (fp == 0) {
			fprintf(stderr, "[fai_load] fail to open FASTA index.\n");
			free(str);
			return 0;
		}
	}

	fai = fai_read(fp);
	fclose(fp);

	fai->rz = razf_open(fn, "rb");
	free(str);
	if (fai->rz == 0) {
		fprintf(stderr, "[fai_load] fail to open FASTA file.\n");
		return 0;
	}
	return fai;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x32d0
leaq 0x5(%rax), %rdi
movl $0x1, %esi
callq 0x3530
movq %rax, %r14
leaq 0xc37b(%rip), %rsi      # 0x272f8
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3350
leaq 0xb9d4(%rip), %rsi      # 0x26965
movl $0x6, %edx
movq %rbx, %rdi
callq 0x31c0
testl %eax, %eax
je 0x1afce
leaq 0xb9c3(%rip), %rsi      # 0x2696c
movl $0x7, %edx
movq %rbx, %rdi
callq 0x31c0
testl %eax, %eax
je 0x1afce
leaq 0x9bce(%rip), %rsi      # 0x24b8f
movq %r14, %rdi
callq 0x35f0
movq %rax, %r12
jmp 0x1afde
movq %r14, %rdi
callq 0x1ae07
movq %rax, %r12
testq %rax, %rax
je 0x1b046
testq %r12, %r12
je 0x1b027
movq %r12, %rdi
callq 0x1ac3e
movq %rax, %r15
movq %r12, %rdi
callq 0x3560
leaq 0x9b92(%rip), %rsi      # 0x24b8f
movq %rbx, %rdi
callq 0x22449
movq %rax, %rbx
movq %rax, (%r15)
movq %r14, %rdi
callq 0x32c0
testq %rbx, %rbx
je 0x1b03f
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rsp, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x49d3
testb $0x1, %al
je 0x1b04e
movq (%rsp), %r12
jmp 0x1afe3
callq 0x4a50
jmp 0x1b04e
movq %r14, %rdi
callq 0x4a6c
xorl %r15d, %r15d
jmp 0x1b018
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/faidx.c
// Function: faidx_main
int faidx_main(int argc, char *argv[])
{
	if (argc == 1) {
		fprintf(stderr, "Usage: faidx <in.fasta> [<reg> [...]]\n");
		return 1;
	} else {
		if (argc == 2) fai_build(argv[1]);
		else {
			int i, j, k, l;
			char *s;
			faidx_t *fai;
			fai = fai_load(argv[1]);
			if (fai == 0) return 1;
			for (i = 2; i != argc; ++i) {
				printf(">%s\n", argv[i]);
				s = fai_fetch(fai, argv[i], &l);
				for (j = 0; j < l; j += 60) {
					for (k = 0; k < 60 && k < l - j; ++k)
						putchar(s[j + k]);
					putchar('\n');
				}
				free(s);
			}
			fai_destroy(fai);
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
cmpl $0x2, %edi
je 0x1b4ba
movl %edi, %ebp
cmpl $0x1, %edi
je 0x1b4c7
movq 0x8(%rbx), %rdi
callq 0x1af55
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x1b4cc
cmpl $0x2, %ebp
je 0x1b4a6
movl %ebp, %eax
movq %rax, 0x18(%rsp)
movl $0x2, %r15d
movq %rbx, 0x20(%rsp)
movq (%rbx,%r15,8), %rsi
leaq 0xc075(%rip), %rdi      # 0x27493
xorl %eax, %eax
callq 0x3040
movq (%rbx,%r15,8), %rsi
movq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x1b053
movq %rax, 0x10(%rsp)
movslq 0x4(%rsp), %rbx
testq %rbx, %rbx
jle 0x1b489
movq 0x10(%rsp), %r13
xorl %r14d, %r14d
movq %rbx, %r12
subq %r14, %r12
jle 0x1b472
xorl %ebp, %ebp
movsbl (%r13,%rbp), %edi
callq 0x3170
cmpq $0x3a, %rbp
ja 0x1b472
incq %rbp
cmpq %r12, %rbp
jl 0x1b459
movl $0xa, %edi
callq 0x3170
addq $0x3c, %r14
addq $0x3c, %r13
cmpq %rbx, %r14
jb 0x1b44f
movq 0x10(%rsp), %rdi
callq 0x32c0
incq %r15
cmpq 0x18(%rsp), %r15
movq 0x20(%rsp), %rbx
jne 0x1b413
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x1aa39
testq %rbx, %rbx
jne 0x1b4c3
jmp 0x1b4cc
movq 0x8(%rbx), %rdi
callq 0x1ad4d
xorl %eax, %eax
jmp 0x1b4d1
callq 0x4a94
movl $0x1, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/knetfile.c
// Function: kftp_connect
int kftp_connect(knetFile *ftp)
{
	ftp->ctrl_fd = socket_connect(ftp->host, ftp->port);
	if (ftp->ctrl_fd == -1) return -1;
	kftp_get_response(ftp);
	kftp_send_cmd(ftp, "USER anonymous\r\n", 1);
	kftp_send_cmd(ftp, "PASS kftp@\r\n", 1);
	kftp_send_cmd(ftp, "TYPE I\r\n", 1);
	return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
movq 0x18(%rbx), %rsi
callq 0x1ba08
movl %eax, 0x20(%rbx)
cmpl $-0x1, %eax
je 0x1ba01
movq %rbx, %rdi
callq 0x1baf8
leaq 0xbb58(%rip), %rsi      # 0x27520
movq %rbx, %rdi
movl $0x1, %edx
callq 0x1bc20
leaq 0xbb55(%rip), %rsi      # 0x27531
movq %rbx, %rdi
movl $0x1, %edx
callq 0x1bc20
leaq 0xbb4e(%rip), %rsi      # 0x2753e
movq %rbx, %rdi
movl $0x1, %edx
callq 0x1bc20
xorl %eax, %eax
jmp 0x1ba06
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/knetfile.c
// Function: socket_connect
static int socket_connect(const char *host, const char *port)
{
#define __err_connect(func) do { perror(func); freeaddrinfo(res); return -1; } while (0)

	int on = 1, fd;
	struct linger lng = { 0, 0 };
	struct addrinfo hints, *res;
	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;
	/* In Unix/Mac, getaddrinfo() is the most convenient way to get
	 * server information. */
	if (getaddrinfo(host, port, &hints, &res) != 0) __err_connect("getaddrinfo");
	if ((fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1) __err_connect("socket");
	/* The following two setsockopt() are used by ftplib
	 * (http://nbpfaus.net/~pfau/ftplib/). I am not sure if they
	 * necessary. */
	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) __err_connect("setsockopt");
	if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &lng, sizeof(lng)) == -1) __err_connect("setsockopt");
	if (connect(fd, res->ai_addr, res->ai_addrlen) != 0) __err_connect("connect");
	freeaddrinfo(res);
	return fd;
}

// Assembly:
pushq %rbx
subq $0x50, %rsp
movl $0x1, %eax
movl %eax, 0x14(%rsp)
movq $0x0, 0x18(%rsp)
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, 0x20(%rdx)
movl %eax, 0x8(%rdx)
leaq 0x8(%rsp), %rcx
callq 0x3160
testl %eax, %eax
jne 0x1bacc
movq 0x8(%rsp), %rax
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x3450
cmpl $-0x1, %eax
je 0x1bad5
movl %eax, %ebx
leaq 0x14(%rsp), %rcx
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x31f0
cmpl $-0x1, %eax
je 0x1bac3
leaq 0x18(%rsp), %rcx
movl %ebx, %edi
movl $0x1, %esi
movl $0xd, %edx
movl $0x8, %r8d
callq 0x31f0
cmpl $-0x1, %eax
je 0x1bac3
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
movl %ebx, %edi
callq 0x3420
testl %eax, %eax
je 0x1bae6
leaq 0xbbe9(%rip), %rdi      # 0x276aa
jmp 0x1badc
leaq 0xbbd5(%rip), %rdi      # 0x2769f
jmp 0x1badc
leaq 0xbbb9(%rip), %rdi      # 0x2768c
jmp 0x1badc
leaq 0xbbbc(%rip), %rdi      # 0x27698
callq 0x3620
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rdi
callq 0x32b0
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/knetfile.c
// Function: kftp_get_response
static int kftp_get_response(knetFile *ftp)
{
#ifndef _WIN32
	unsigned char c;
#else
	char c;
#endif
	int n = 0;
	char *p;
	if (socket_wait(ftp->ctrl_fd, 1) <= 0) return 0;
	while (netread(ftp->ctrl_fd, &c, 1)) { // FIXME: this is *VERY BAD* for unbuffered I/O
		//fputc(c, stderr);
		if (n >= ftp->max_response) {
			ftp->max_response = ftp->max_response? ftp->max_response<<1 : 256;
			ftp->response = realloc(ftp->response, ftp->max_response);
		}
		ftp->response[n++] = c;
		if (c == '\n') {
			if (n >= 4 && isdigit(ftp->response[0]) && isdigit(ftp->response[1]) && isdigit(ftp->response[2])
				&& ftp->response[3] != '-') break;
			n = 0;
			continue;
		}
	}
	if (n < 2) return -1;
	ftp->response[n-2] = 0;
	return strtol(ftp->response, &p, 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x20(%rdi), %edi
movl $0x1, %esi
callq 0x1c5f8
testl %eax, %eax
jle 0x1bbe3
movl 0x20(%rbx), %edi
leaq 0xf(%rsp), %rsi
movl $0x1, %edx
callq 0x31b0
testq %rax, %rax
je 0x1bbe7
xorl %r13d, %r13d
leaq 0xf(%rsp), %r14
movl $0x100, %ebp            # imm = 0x100
movl 0x38(%rbx), %eax
cmpl %eax, %r13d
jl 0x1bb69
leal (%rax,%rax), %ecx
testl %eax, %eax
cmovel %ebp, %ecx
movl %ecx, 0x38(%rbx)
movq 0x48(%rbx), %rdi
movslq %ecx, %rsi
callq 0x3610
movq %rax, 0x48(%rbx)
movb 0xf(%rsp), %al
movq 0x48(%rbx), %rcx
leal 0x1(%r13), %r12d
movslq %r13d, %rdx
movb %al, (%rcx,%rdx)
cmpb $0xa, %al
jne 0x1bbbf
xorl %r15d, %r15d
cmpl $0x3, %r13d
jl 0x1bbc2
callq 0x3310
movq (%rax), %rcx
movq 0x48(%rbx), %rax
movsbq (%rax), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x1bbc2
movsbq 0x1(%rax), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x1bbc2
movsbq 0x2(%rax), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x1bbc2
cmpb $0x2d, 0x3(%rax)
je 0x1bbc2
jmp 0x1bbea
movl %r12d, %r15d
movl 0x20(%rbx), %edi
movl $0x1, %edx
movq %r14, %rsi
callq 0x31b0
movl %r15d, %r13d
movl %r15d, %r12d
testq %rax, %rax
jne 0x1bb46
jmp 0x1bbea
xorl %eax, %eax
jmp 0x1bc11
xorl %r12d, %r12d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x2, %r12d
jl 0x1bc11
movq 0x48(%rbx), %rax
movl %r12d, %ecx
movb $0x0, -0x2(%rax,%rcx)
movq 0x48(%rbx), %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x3400
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/knetfile.c
// Function: kftp_reconnect
int kftp_reconnect(knetFile *ftp)
{
	if (ftp->ctrl_fd != -1) {
		netclose(ftp->ctrl_fd);
		ftp->ctrl_fd = -1;
	}
	netclose(ftp->fd);
	ftp->fd = -1;
	return kftp_connect(ftp);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x20(%rdi), %edi
cmpl $-0x1, %edi
je 0x1bc90
callq 0x3090
movl $0xffffffff, 0x20(%rbx) # imm = 0xFFFFFFFF
movl 0x4(%rbx), %edi
callq 0x3090
movl $0xffffffff, 0x4(%rbx)  # imm = 0xFFFFFFFF
movq %rbx, %rdi
popq %rbx
jmp 0x1b9a0