LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/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 0xfbbf
movl %edi, %ebx
movzbl (%rsi), %ecx
xorl %eax, %eax
cmpl $0x71, %ecx
jg 0xfb8e
cmpl $0x52, %ecx
je 0xfb98
cmpl $0x57, %ecx
je 0xfbc9
jmp 0xfbc1
cmpl $0x77, %ecx
je 0xfbc9
cmpl $0x72, %ecx
jne 0xfbc1
leaq 0x18428(%rip), %rsi     # 0x27fc7
movl %ebx, %edi
callq 0x1c4a0
testq %rax, %rax
je 0xfbbf
movq %rax, %r14
callq 0x10749
movl %ebx, (%rax)
movb $0x72, 0x4(%rax)
movq %r14, 0x8(%rax)
jmp 0xfbc1
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 0xfaef
// File: /workspace/github_cpp_makefile_star2_O1/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 0x10139
movq %rdi, %r14
cmpb $0x72, 0x4(%rdi)
jne 0x1013d
movl %edx, %ebp
movq %rsi, %r15
xorl %ebx, %ebx
movl %ebp, %r12d
subl %ebx, %r12d
jle 0x1014f
movl 0x30(%r14), %eax
subl 0x34(%r14), %eax
jle 0x10111
cmpl %eax, %r12d
cmovll %r12d, %eax
movslq 0x34(%r14), %rsi
addq 0x18(%r14), %rsi
movslq %eax, %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x3680
addl %r12d, 0x34(%r14)
addq %r12, %r15
addl %r12d, %ebx
xorl %ecx, %ecx
jmp 0x10122
movq %r14, %rdi
callq 0xfbed
movl $0x1, %ecx
testl %eax, %eax
je 0x10128
testl %ecx, %ecx
je 0x100d4
jmp 0x1014a
movl 0x30(%r14), %eax
subl 0x34(%r14), %eax
jg 0x100e6
movl $0x3, %ecx
jmp 0x10122
xorl %ebx, %ebx
jmp 0x10174
leaq 0x15fad(%rip), %rax     # 0x260f1
movq %rax, 0x40(%r14)
jmp 0x1016f
cmpl $0x3, %ecx
jne 0x1016f
movl 0x34(%r14), %eax
cmpl 0x30(%r14), %eax
jne 0x10174
movq 0x8(%r14), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%r14)
movq $0x0, 0x30(%r14)
jmp 0x10174
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_O1/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 0x101cc
movq %rdi, %rbx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x101e8
testl %eax, %eax
js 0x101db
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 0x101d0
addq %r15, 0x28(%rbx)
movl 0x34(%rbx), %esi
testl %esi, %esi
jg 0x10195
xorl %ebp, %ebp
jmp 0x101db
leaq 0x15f34(%rip), %rax     # 0x2610b
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_O1/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 0x104e6
movl %edx, %ebp
movq %rsi, %r14
cmpq $0x0, 0x18(%rbx)
jne 0x1048f
movslq 0x10(%rbx), %rdi
callq 0x31d0
movq %rax, 0x18(%rbx)
testl %ebp, %ebp
jle 0x104f9
movl 0x10(%rbx), %r13d
xorl %r15d, %r15d
movslq 0x34(%rbx), %rdi
movl %r13d, %eax
subl %edi, %eax
movl %ebp, %ecx
subl %r15d, %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
addq 0x18(%rbx), %rdi
movslq %ecx, %r12
movq %r14, %rsi
movq %r12, %rdx
callq 0x3680
movl 0x34(%rbx), %eax
addl %r12d, %eax
movl %eax, 0x34(%rbx)
addq %r12, %r14
addl %r12d, %r15d
cmpl %r13d, %eax
jne 0x104df
movq %rbx, %rdi
callq 0x1017f
testl %eax, %eax
jne 0x104fc
cmpl %ebp, %r15d
jl 0x1049a
jmp 0x104fc
leaq 0x15c2b(%rip), %rax     # 0x26118
movq %rax, 0x40(%rbx)
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x104fc
xorl %r15d, %r15d
movl %r15d, %eax
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/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 0x1c579
movq %rax, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rcx, %rcx
jne 0x106d0
movq 0x8(%r14), %rdi
movq %rsp, %r15
movl $0x1c, %edx
movq %r15, %rsi
callq 0x1c4bd
movq 0x8(%r14), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x1c579
movdqa 0x1f50a(%rip), %xmm0    # 0x2fbb0
movdqu 0x1f50e(%rip), %xmm1    # 0x2fbbc
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_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bgzf.c
// Function: bgzf_read_init
static BGZF *bgzf_read_init()
{
	BGZF *fp;
	fp = calloc(1, sizeof(BGZF));
    fp->uncompressed_block_size = MAX_BLOCK_SIZE;
    fp->uncompressed_block = malloc(MAX_BLOCK_SIZE);
    fp->compressed_block_size = MAX_BLOCK_SIZE;
    fp->compressed_block = malloc(MAX_BLOCK_SIZE);
	fp->cache_size = 0;
	fp->cache = kh_init(cache);
	return fp;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl $0x1, %edi
movl $0x50, %esi
callq 0x3530
movq %rax, %rbx
movl $0x10000, %ebp          # imm = 0x10000
movl %ebp, 0x10(%rax)
movl $0x10000, %edi          # imm = 0x10000
callq 0x31d0
movq %rax, 0x18(%rbx)
movl %ebp, 0x14(%rbx)
movl $0x10000, %edi          # imm = 0x10000
callq 0x31d0
movq %rax, 0x20(%rbx)
movl $0x0, 0x38(%rbx)
movl $0x1, %edi
movl $0x28, %esi
callq 0x3530
movq %rax, 0x48(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/kstring.c
// Function: ksprintf
int ksprintf(kstring_t *s, const char *fmt, ...)
{
	va_list ap;
	int l;
	va_start(ap, fmt);
	l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap); // This line does not work with glibc 2.0. See `man snprintf'.
	va_end(ap);
	if (l + 1 > s->m - s->l) {
		s->m = s->l + l + 2;
		kroundup32(s->m);
		s->s = (char*)realloc(s->s, s->m);
		va_start(ap, fmt);
		l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap);
	}
	va_end(ap);
	s->l += l;
	return l;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x20(%rsp), %r15
movq %rdx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
testb %al, %al
je 0x10aaa
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rcx
movq %r15, 0x10(%rcx)
leaq 0x100(%rsp), %r12
movq %r12, 0x8(%rcx)
movabsq $0x3000000010, %r13     # imm = 0x3000000010
movq %r13, (%rcx)
movq (%rdi), %rax
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rdi
addq %rax, %rdi
subq %rax, %rsi
movq %r14, %rdx
callq 0x3460
leal 0x1(%rax), %ecx
movslq %ecx, %rdx
movq (%rbx), %rcx
movq 0x8(%rbx), %rsi
subq %rcx, %rsi
cmpq %rdx, %rsi
jae 0x10b6c
cltq
addq %rcx, %rax
incq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x3610
movq %rax, 0x10(%rbx)
movq %rsp, %rcx
movq %r13, (%rcx)
movq %r12, 0x8(%rcx)
movq %r15, 0x10(%rcx)
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdi
addq %rax, %rdi
subq %rax, %rsi
movq %r14, %rdx
callq 0x3460
cltq
addq %rax, (%rbx)
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 $0x48, %rsp
movq %r9, 0x20(%rsp)
movl %ecx, %r14d
movq %rdx, %r12
movl %esi, %ebx
movq %rdi, %r13
movq %r8, %r9
movq %r8, 0x28(%rsp)
testq %r8, %r8
jne 0x10f01
movq %r12, %rdi
movl %r14d, %esi
callq 0x10d28
movq %rax, %r9
subl %r14d, %ebx
js 0x11016
movslq %r14d, %r8
leaq (%r9,%r8,4), %r10
movl %r14d, %r11d
sarl $0x1f, %r11d
andl %r14d, %r11d
leal -0x1(%r11), %eax
movl %eax, 0x1c(%rsp)
leaq -0x1(%r13), %rax
movq %rax, 0x40(%rsp)
movq $0x0, 0x8(%rsp)
xorl %eax, %eax
xorl %ebp, %ebp
xorl %r15d, %r15d
movq %r13, 0x38(%rsp)
movl %ebx, 0x18(%rsp)
movl %r14d, 0x14(%rsp)
movq %r10, 0x30(%rsp)
movslq %r15d, %rcx
addq 0x40(%rsp), %rcx
movq %r8, %rsi
testq %rsi, %rsi
jle 0x10f76
leaq -0x1(%rsi), %rdx
movb -0x1(%r12,%rsi), %dil
cmpb (%rcx,%rsi), %dil
movq %rdx, %rsi
je 0x10f5a
leal 0x1(%rdx), %ecx
jmp 0x10f7d
movl %r11d, %ecx
movl 0x1c(%rsp), %edx
testl %ecx, %ecx
jle 0x10fa2
leal (%rdx,%r15), %esi
movslq %esi, %rsi
movzbl (%r13,%rsi), %esi
subl %r14d, %ecx
addl (%r10,%rsi,4), %ecx
movl %edx, %edx
movl (%r9,%rdx,4), %edx
cmpl %edx, %ecx
cmovlel %edx, %ecx
jmp 0x11008
cmpl %eax, 0x8(%rsp)
jne 0x10ff1
leal (%rax,%rax), %r13d
testl %eax, %eax
movl $0x1, %eax
cmovel %eax, %r13d
movslq %r13d, %rsi
shlq $0x2, %rsi
movq %rbp, %rdi
movq %r9, %r14
movq %r8, %rbp
movq %r11, %rbx
callq 0x3610
movq %rbx, %r11
movq 0x30(%rsp), %r10
movq %rbp, %r8
movq %r14, %r9
movl 0x14(%rsp), %r14d
movl 0x18(%rsp), %ebx
movq %rax, %rbp
movl %r13d, %eax
movq 0x38(%rsp), %r13
movq 0x8(%rsp), %rdx
movslq %edx, %rcx
incl %edx
movq %rdx, 0x8(%rsp)
movl %r15d, (%rbp,%rcx,4)
movl (%r9), %ecx
addl %ecx, %r15d
cmpl %ebx, %r15d
jle 0x10f4f
jmp 0x11021
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rsp), %rcx
movl %ecx, (%rax)
cmpq $0x0, 0x28(%rsp)
jne 0x1103d
movq %r9, %rdi
callq 0x32c0
movq %rbp, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
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_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 %r13
pushq %r12
pushq %rbx
pushq %rax
movsbl (%rsi), %eax
shll $0x8, %eax
movsbl 0x1(%rsi), %ebp
orl %eax, %ebp
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), %rsi
addq %rsi, %rax
addq %rdx, %rax
leal 0x1(%rsi), %edx
shrl $0x1f, %edx
addl %esi, %edx
incl %edx
sarl %edx
movslq %edx, %r15
addq %rax, %r15
movslq 0x24(%rdi), %r14
addq %rcx, %r14
cmpq %r14, %r15
jae 0x111f1
movzwl (%r15), %eax
rolw $0x8, %ax
movzwl %ax, %r12d
leaq 0x2(%r15), %r13
cmpl %ebp, %r12d
jne 0x1117d
movq %r13, %rbx
jmp 0x111e3
callq 0x3280
movq (%rax), %rax
movzbl (%r13), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, %ecx
andl $-0x3, %ecx
cmpl $0x41, %ecx
jne 0x1119d
addq $0x4, %r15
jmp 0x111e0
leaq 0x3(%r15), %r13
leal -0x44(%rax), %ecx
cmpl $0x5, %ecx
ja 0x111bf
leaq 0x150f0(%rip), %rdx     # 0x262a0
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
addq $0x7, %r15
jmp 0x111e0
cmpl $0x53, %eax
je 0x111dc
cmpl $0x5a, %eax
jne 0x111e3
cmpb $0x0, (%r13)
leaq 0x1(%r13), %r13
jne 0x111c9
jmp 0x111e3
addq $0xb, %r15
jmp 0x111e0
addq $0x5, %r15
movq %r15, %r13
movq %r13, %r15
cmpl %ebp, %r12d
jne 0x1115a
jmp 0x111f3
xorl %ebx, %ebx
movq %rbx, %rax
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_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 0x11241
leaq 0x2(%r14), %r15
jmp 0x1128d
leaq 0x1(%r14), %rax
leal -0x44(%rcx), %edx
cmpl $0x5, %edx
ja 0x11263
leaq 0x15064(%rip), %rcx     # 0x262b8
movslq (%rcx,%rdx,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
leaq 0x5(%r14), %r15
jmp 0x1128d
cmpl $0x53, %ecx
je 0x11284
movq %rax, %r15
cmpl $0x5a, %ecx
jne 0x1128d
leaq 0x1(%rax), %r15
cmpb $0x0, (%rax)
movq %r15, %rax
jne 0x11270
jmp 0x1128d
leaq 0x9(%r14), %r15
jmp 0x1128d
leaq 0x3(%r14), %r15
jmp 0x1128d
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 %r14d, %r15d
subl %r15d, 0x24(%rbx)
subl %r15d, 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_O1/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 0x11595
movq %rsi, %rbx
movsbl (%rsi), %edi
xorl %r8d, %r8d
movl $0x0, %ecx
testl %edi, %edi
je 0x1159f
movb 0x1(%rbx), %al
testb %al, %al
je 0x1159d
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 0x1157e
jmp 0x1159f
xorl %r13d, %r13d
jmp 0x11641
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, %r12d
incl %r12d
movq (%rsp), %rax
movq 0x10(%rax), %rdi
movl %r14d, %r13d
movq %r10, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movl %r13d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %ebp
leal (,%r13,2), %r15d
andl $0x1e, %r15d
movl %ebp, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x11634
testb $0x1, %al
jne 0x1161a
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl %r13d, %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 0x11634
addl %r12d, %r13d
cmpl %r10d, %r13d
movl %r10d, %eax
cmovbl %r8d, %eax
subl %eax, %r13d
cmpl %r14d, %r13d
jne 0x115ce
movl %r10d, %r13d
jmp 0x11641
movl %r15d, %ecx
shrl %cl, %ebp
testb $0x3, %bpl
cmovnel %r10d, %r13d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %r10d, %r13d
je 0x11659
movq (%rsp), %rax
movq 0x20(%rax), %rax
movl %r13d, %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_O1/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 0x11974
movb (%rdi), %cl
leal -0x43(%rcx), %edx
rolb $0x4, %dl
cmpb $0x3, %dl
ja 0x11969
movzbl %dl, %eax
leaq 0x14984(%rip), %rcx     # 0x262d0
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 0x11974
movl 0x1(%rdi), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x11c49
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 0x11c17
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x11c85
xorl %edx, %edx
movl $0x13, %edi
xorl %eax, %eax
movl (%rsi,%rdx,4), %r8d
movl %r8d, %r9d
andl $0xf, %r9d
cmpl $0x4, %r9d
ja 0x11c7d
btl %r9d, %edi
jae 0x11c7d
shrl $0x4, %r8d
addl %r8d, %eax
incq %rdx
cmpq %rdx, %rcx
jne 0x11c5f
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x11d20
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
je 0x11ce4
cmpl $0x0, (%rbx)
jle 0x11cd2
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x32c0
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x11cba
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 0x11cfb
callq 0x1f998
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x11d09
callq 0x20767
movq %rbx, %rdi
callq 0x11511
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x32c0
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x10462
leaq 0x30(%rbx), %r15
cmpl $0x0, 0x1e3f8(%rip)     # 0x30320
je 0x11f66
movl (%r15), %eax
bswapl %eax
leaq 0xc(%rsp), %rsi
movl %eax, (%rsi)
movq %r14, %rdi
movl $0x4, %edx
callq 0x10462
movl (%r15), %edx
testl %edx, %edx
je 0x11f56
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x10462
movl (%rbx), %eax
bswapl %eax
leaq 0xc(%rsp), %rsi
movl %eax, (%rsi)
movq %r14, %rdi
jmp 0x11f8f
movq %r14, %rdi
movq %r15, %rsi
movl $0x4, %edx
callq 0x10462
movl (%r15), %edx
testl %edx, %edx
je 0x11f89
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x10462
movq %r14, %rdi
movq %rbx, %rsi
movl $0x4, %edx
callq 0x10462
cmpl $0x0, (%rbx)
je 0x1203a
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, 0x1e357(%rip)     # 0x30320
leaq 0x10(%rsp), %rsi
je 0x11fd9
bswapl %eax
movl %eax, 0xc(%rsp)
movq %r15, %rsi
movq %r14, %rdi
movl $0x4, %edx
callq 0x10462
movl 0x10(%rsp), %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x10462
cmpl $0x0, 0x1e324(%rip)     # 0x30320
je 0x12014
movq 0x10(%rbx), %rax
movl (%rax,%r13), %eax
bswapl %eax
movl %eax, 0xc(%rsp)
movq %r14, %rdi
movq %r15, %rsi
jmp 0x1201e
movq 0x10(%rbx), %rsi
addq %r13, %rsi
movq %r14, %rdi
movl $0x4, %edx
callq 0x10462
incq %rbp
movl (%rbx), %eax
addq $0x4, %r13
cmpq %rax, %rbp
jne 0x11fac
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_O1/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 0x1224c
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 0x12238
movslq %esi, %rax
addq %rax, %rbx
cmpq %rbx, %r14
jae 0x122f2
callq 0x3280
movq (%rax), %rax
leaq 0x1411a(%rip), %rcx     # 0x26384
movzbl 0x2(%r14), %edx
movl (%rax,%rdx,4), %esi
movl %esi, %edx
andl $0xfd, %edx
cmpl $0x41, %edx
jne 0x12285
addq $0x4, %r14
jmp 0x122e9
leaq 0x3(%r14), %rdx
movzbl %sil, %esi
leal -0x44(%rsi), %edi
cmpl $0x5, %edi
ja 0x122ae
movslq (%rcx,%rdi,4), %rsi
addq %rcx, %rsi
jmpq *%rsi
movl 0x3(%r14), %edx
bswapl %edx
movl %edx, 0x3(%r14)
addq $0x7, %r14
jmp 0x122e9
cmpl $0x53, %esi
je 0x122da
movq %rdx, %r14
cmpl $0x5a, %esi
jne 0x122e9
leaq 0x1(%rdx), %r14
cmpb $0x0, (%rdx)
movq %r14, %rdx
jne 0x122bb
jmp 0x122e9
movq 0x3(%r14), %rdx
bswapq %rdx
movq %rdx, 0x3(%r14)
addq $0xb, %r14
jmp 0x122e9
rolw $0x8, 0x3(%r14)
addq $0x5, %r14
jmp 0x122e9
movq %rdx, %r14
cmpq %rbx, %r14
jb 0x1226a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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, 0xc(%rsp)
movl (%rsi), %ecx
movl %ecx, 0x10(%rsp)
movl 0x4(%rsi), %ecx
movl %ecx, 0x14(%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)
movl 0x10(%r15), %ecx
movl %ecx, 0x20(%rsp)
movl 0x14(%r15), %ecx
movl %ecx, 0x24(%rsp)
movl 0x18(%r15), %ecx
movl %ecx, 0x28(%rsp)
movl 0x1c(%r15), %ecx
movl %ecx, 0x2c(%rsp)
cmpl $0x0, 0x1df9b(%rip)     # 0x30320
je 0x123c2
xorl %ecx, %ecx
movl 0x10(%rsp,%rcx,4), %edx
bswapl %edx
movl %edx, 0x10(%rsp,%rcx,4)
incq %rcx
cmpq $0x8, %rcx
jne 0x12389
bswapl %eax
leaq 0x34(%rsp), %rsi
movl %eax, (%rsi)
movq %r12, %rdi
movl $0x4, %edx
callq 0x10462
movq %r15, %rdi
movl %r14d, %esi
movq %rbx, %rdx
callq 0x121f8
jmp 0x123d4
leaq 0xc(%rsp), %rsi
movq %r12, %rdi
movl $0x4, %edx
callq 0x10462
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
movl $0x20, %edx
callq 0x10462
movq %r12, %rdi
movq %rbx, %rsi
movl %r14d, %edx
callq 0x10462
cmpl $0x0, 0x1df25(%rip)     # 0x30320
je 0x1240b
movq %r15, %rdi
movl %r14d, %esi
movq %rbx, %rdx
callq 0x121f8
movl 0xc(%rsp), %eax
addl $0x4, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
cmpq $0x0, 0x18(%rdi)
jne 0x12e55
movq 0x38(%rbx), %rdi
callq 0x1fc77
movq %rax, 0x18(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0x12e7e
movq 0x18(%rbx), %rdi
leaq 0x12072(%rip), %rsi     # 0x24ed9
leaq 0x13626(%rip), %rdx     # 0x26494
leaq 0x13622(%rip), %rcx     # 0x26497
callq 0x2017d
movq %rax, 0x28(%rbx)
leaq 0x12054(%rip), %rsi     # 0x24ed9
movq %r14, %rdi
callq 0x1110a
testq %rax, %rax
je 0x12ea8
movq 0x28(%rbx), %rdi
incq %rax
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x20639
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_import.c
// Function: _bam_get_lines
char **__bam_get_lines(const char *fn, int *_n) // for bam_plcmd.c only
{
	char **list = 0, *s;
	int n = 0, dret, m = 0;
	gzFile fp = (strcmp(fn, "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(fn, "r");
	kstream_t *ks;
	kstring_t *str;
	str = (kstring_t*)calloc(1, sizeof(kstring_t));
	ks = ks_init(fp);
	while (ks_getuntil(ks, '\n', str, &dret) > 0) {
		if (n == m) {
			m = m? m << 1 : 16;
			list = (char**)realloc(list, m * sizeof(char*));
		}
		if (str->s[str->l-1] == '\r')
			str->s[--str->l] = '\0';
		s = list[n++] = (char*)calloc(str->l + 1, 1);
		strcpy(s, str->s);
	}
	ks_destroy(ks);
	gzclose(fp);
	free(str->s); free(str);
	*_n = n;
	return list;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, 0x18(%rsp)
movq %rdi, %r14
leaq 0x11ee5(%rip), %rsi     # 0x24db6
callq 0x34e0
testl %eax, %eax
je 0x12eeb
leaq 0x150e6(%rip), %rsi     # 0x27fc7
movq %r14, %rdi
callq 0x3380
jmp 0x12f08
movq 0x1c0de(%rip), %rax     # 0x2efd0
movq (%rax), %rdi
callq 0x3030
leaq 0x150c6(%rip), %rsi     # 0x27fc7
movl %eax, %edi
callq 0x3330
movq %rax, %r14
movl $0x1, %edi
movl $0x18, %esi
callq 0x3530
movq %rax, %r15
movl $0x1, %edi
movl $0x20, %esi
callq 0x3530
movq %rax, %r12
movq %r14, 0x18(%rax)
movl $0x2000, %edi           # imm = 0x2000
callq 0x31d0
movq %rax, (%r12)
leaq 0xc(%rsp), %rcx
movq %r12, %rdi
movl $0xa, %esi
movq %r15, %rdx
callq 0x13054
testl %eax, %eax
jle 0x1300c
movq %r14, 0x10(%rsp)
xorl %ebx, %ebx
leaq 0xc(%rsp), %rbp
xorl %r13d, %r13d
xorl %r14d, %r14d
movq %r12, 0x20(%rsp)
movl %r14d, %eax
cmpq %rax, %rbx
jne 0x12fac
movq %rbp, %r12
leal (%r14,%r14), %ebp
testl %r14d, %r14d
movl $0x10, %eax
cmovel %eax, %ebp
movslq %ebp, %rsi
shlq $0x3, %rsi
movq %r13, %rdi
callq 0x3610
movq %rax, %r13
movl %ebp, %r14d
movq %r12, %rbp
movq 0x20(%rsp), %r12
movq (%r15), %rax
movq 0x10(%r15), %rcx
cmpb $0xd, -0x1(%rcx,%rax)
jne 0x12fc6
leaq -0x1(%rax), %rdx
movq %rdx, (%r15)
movb $0x0, -0x1(%rcx,%rax)
movq (%r15), %rdi
incq %rdi
movl $0x1, %esi
callq 0x3530
movq %rax, (%r13,%rbx,8)
incq %rbx
movq 0x10(%r15), %rsi
movq %rax, %rdi
callq 0x3510
movq %r12, %rdi
movl $0xa, %esi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x13054
testl %eax, %eax
jg 0x12f75
movq 0x10(%rsp), %r14
jmp 0x13011
xorl %ebx, %ebx
xorl %r13d, %r13d
movq (%r12), %rdi
callq 0x32c0
movq %r12, %rdi
callq 0x32c0
movq %r14, %rdi
callq 0x3150
movq 0x10(%r15), %rdi
callq 0x32c0
movq %r15, %rdi
callq 0x32c0
movq 0x18(%rsp), %rax
movl %ebx, (%rax)
movq %r13, %rax
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/bam_import.c
// Function: sam_header_read2
bam_header_t *sam_header_read2(const char *fn)
{
	bam_header_t *header;
	int c, dret, ret;
	gzFile fp;
	kstream_t *ks;
	kstring_t *str;
	kh_ref_t *hash;
	khiter_t k;
	if (fn == 0) return 0;
	fp = (strcmp(fn, "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(fn, "r");
	if (fp == 0) return 0;
	hash = kh_init(ref);
	ks = ks_init(fp);
	str = (kstring_t*)calloc(1, sizeof(kstring_t));
	while (ks_getuntil(ks, 0, str, &dret) > 0) {
		char *s = strdup(str->s);
		int len, i;
		i = kh_size(hash);
		ks_getuntil(ks, 0, str, &dret);
		len = atoi(str->s);
		k = kh_put(ref, hash, s, &ret);
		kh_value(hash, k) = (uint64_t)len<<32 | i;
		if (dret != '\n')
			while ((c = ks_getc(ks)) != '\n' && c != -1);
	}
	ks_destroy(ks);
	gzclose(fp);
	free(str->s); free(str);
	fprintf(stderr, "[sam_header_read2] %d sequences loaded.\n", kh_size(hash));
	header = hash2header(hash);
	kh_destroy(ref, hash);
	return header;
}

// Assembly:
testq %rdi, %rdi
je 0x132a1
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x11b2f(%rip), %rsi     # 0x24db6
callq 0x34e0
testl %eax, %eax
je 0x132a4
leaq 0x14d30(%rip), %rsi     # 0x27fc7
movq %rbx, %rdi
callq 0x3380
jmp 0x132c1
xorl %eax, %eax
retq
movq 0x1bd25(%rip), %rax     # 0x2efd0
movq (%rax), %rdi
callq 0x3030
leaq 0x14d0d(%rip), %rsi     # 0x27fc7
movl %eax, %edi
callq 0x3330
testq %rax, %rax
jne 0x132ce
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x4(%rsp), %rsi
leaq 0x8(%rsp), %rbx
movq %rax, %rdi
movq %rbx, %rdx
callq 0x3e44
movq (%rbx), %rax
jmp 0x132c8
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_import.c
// Function: sam_header_parse
int sam_header_parse(bam_header_t *h)
{
	char **tmp;
	int i;
	free(h->target_len); free(h->target_name);
	h->n_targets = 0; h->target_len = 0; h->target_name = 0;
	if (h->l_text < 3) return 0;
	if (h->dict == 0) h->dict = sam_header_parse2(h->text);
	tmp = sam_header2list(h->dict, "SQ", "SN", &h->n_targets);
	if (h->n_targets == 0) return 0;
	h->target_name = calloc(h->n_targets, sizeof(void*));
	for (i = 0; i < h->n_targets; ++i)
		h->target_name[i] = strdup(tmp[i]);
	free(tmp);
	tmp = sam_header2list(h->dict, "SQ", "LN", &h->n_targets);
	h->target_len = calloc(h->n_targets, 4);
	for (i = 0; i < h->n_targets; ++i)
		h->target_len[i] = atoi(tmp[i]);
	free(tmp);
	return h->n_targets;
}

// 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 0x8(%rbx), %rdi
callq 0x32c0
movl $0x0, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
xorl %ebp, %ebp
cmpl $0x3, 0x30(%rbx)
jl 0x13406
cmpq $0x0, 0x18(%rbx)
jne 0x13335
movq 0x38(%rbx), %rdi
callq 0x1fc77
movq %rax, 0x18(%rbx)
movq 0x18(%rbx), %rdi
leaq 0x1326a(%rip), %rsi     # 0x265aa
leaq 0x13266(%rip), %rdx     # 0x265ad
movq %rbx, %rcx
callq 0x2055f
movslq (%rbx), %r15
testq %r15, %r15
je 0x13406
movq %rax, %r14
leaq 0x8(%rbx), %r12
movl $0x8, %esi
movq %r15, %rdi
callq 0x3530
movq %rax, (%r12)
testl %r15d, %r15d
jle 0x13394
xorl %r13d, %r13d
movq (%r14,%r13,8), %rdi
callq 0x34b0
movq (%r12), %rcx
movq %rax, (%rcx,%r13,8)
incq %r13
cmpq %r13, %r15
jne 0x1337b
movq %r14, %rdi
callq 0x32c0
movq 0x18(%rbx), %rdi
leaq 0x13203(%rip), %rsi     # 0x265aa
leaq 0x13202(%rip), %rdx     # 0x265b0
movq %rbx, %rcx
callq 0x2055f
movq %rax, %r14
movslq (%rbx), %r12
movl $0x4, %esi
movq %r12, %rdi
callq 0x3530
movq %rax, 0x10(%rbx)
testq %r12, %r12
jle 0x133fc
movq %rax, %r15
movl (%rbx), %eax
cmpl $0x2, %eax
movl $0x1, %r12d
cmovgel %eax, %r12d
xorl %r13d, %r13d
movq (%r14,%r13,8), %rdi
callq 0x3410
movl %eax, (%r15,%r13,4)
incq %r13
cmpq %r13, %r12
jne 0x133e7
movq %r14, %rdi
callq 0x32c0
movl (%rbx), %ebp
movl %ebp, %eax
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_import.c
// Function: alloc_data
static inline uint8_t *alloc_data(bam1_t *b, int size)
{
	if (b->m_data < size) {
		b->m_data = size;
		kroundup32(b->m_data);
		b->data = (uint8_t*)realloc(b->data, b->m_data);
	}
	return b->data;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl %esi, 0x28(%rdi)
jge 0x14418
decl %esi
movl %esi, %eax
sarl %eax
orl %esi, %eax
movl %eax, %ecx
sarl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x10, %eax
orl %ecx, %eax
incl %eax
movl %eax, 0x28(%rbx)
movq 0x30(%rbx), %rdi
movslq %eax, %rsi
callq 0x3610
movq %rax, 0x30(%rbx)
movq 0x30(%rbx), %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_import.c
// Function: sam_open
tamFile sam_open(const char *fn)
{
	tamFile fp;
	gzFile gzfp = (strcmp(fn, "-") == 0)? gzdopen(fileno(stdin), "rb") : gzopen(fn, "rb");
	if (gzfp == 0) return 0;
	fp = (tamFile)calloc(1, sizeof(struct __tamFile_t));
	fp->str = (kstring_t*)calloc(1, sizeof(kstring_t));
	fp->fp = gzfp;
	fp->ks = ks_init(fp->fp);
	return fp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x10965(%rip), %rsi     # 0x24db6
callq 0x34e0
testl %eax, %eax
je 0x1446b
leaq 0x1072e(%rip), %rsi     # 0x24b8f
movq %rbx, %rdi
callq 0x3380
jmp 0x14488
movq 0x1ab5e(%rip), %rax     # 0x2efd0
movq (%rax), %rdi
callq 0x3030
leaq 0x1070e(%rip), %rsi     # 0x24b8f
movl %eax, %edi
callq 0x3330
movq %rax, %rbx
testq %rax, %rax
je 0x144e1
movl $0x1, %edi
movl $0x28, %esi
callq 0x3530
movq %rax, %r14
movl $0x1, %edi
movl $0x18, %esi
callq 0x3530
movq %rax, 0x10(%r14)
movq %rbx, (%r14)
movl $0x1, %edi
movl $0x20, %esi
callq 0x3530
movq %rax, %r15
movq %rbx, 0x18(%rax)
movl $0x2000, %edi           # imm = 0x2000
callq 0x31d0
movq %rax, (%r15)
movq %r15, 0x8(%r14)
jmp 0x144e4
xorl %r14d, %r14d
movq %r14, %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_import.c
// Function: sam_close
void sam_close(tamFile fp)
{
	if (fp) {
		ks_destroy(fp->ks);
		gzclose(fp->fp);
		free(fp->str->s); free(fp->str);
		free(fp);
	}
}

// Assembly:
testq %rdi, %rdi
je 0x1453f
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0x14512
movq (%r14), %rdi
callq 0x32c0
movq %r14, %rdi
callq 0x32c0
movq (%rbx), %rdi
callq 0x3150
movq 0x10(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x32c0
movq 0x10(%rbx), %rdi
callq 0x32c0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x32c0
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/sam.c
// Function: bam_header_dup
bam_header_t *bam_header_dup(const bam_header_t *h0)
{
	bam_header_t *h;
	int i;
	h = bam_header_init();
	*h = *h0;
	h->hash = h->dict = h->rg2lib = 0;
	h->text = (char*)calloc(h->l_text + 1, 1);
	memcpy(h->text, h0->text, h->l_text);
	h->target_len = (uint32_t*)calloc(h->n_targets, 4);
	h->target_name = (char**)calloc(h->n_targets, sizeof(void*));
	for (i = 0; i < h->n_targets; ++i) {
		h->target_len[i] = h0->target_len[i];
		h->target_name[i] = strdup(h0->target_name[i]);
	}
	return h;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %eax, %eax
callq 0x11c86
movq %rax, %r14
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups 0x30(%rbx), %xmm3
movups %xmm1, 0x10(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm3, 0x30(%rax)
movups %xmm0, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movq $0x0, 0x28(%rax)
movslq 0x30(%rax), %r15
leaq 0x1(%r15), %rdi
movl $0x1, %esi
callq 0x3530
movq %rax, 0x38(%r14)
movq 0x38(%rbx), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x3680
movslq (%r14), %r15
movl $0x4, %esi
movq %r15, %rdi
callq 0x3530
movq %rax, 0x10(%r14)
movl $0x8, %esi
movq %r15, %rdi
callq 0x3530
movq %rax, 0x8(%r14)
cmpl $0x0, (%r14)
jle 0x14856
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movl (%rax,%r15,4), %eax
movq 0x10(%r14), %rcx
movl %eax, (%rcx,%r15,4)
movq 0x8(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x34b0
movq 0x8(%r14), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
movslq (%r14), %rax
cmpq %rax, %r15
jl 0x14826
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/sam.c
// Function: samclose
void samclose(samfile_t *fp)
{
	if (fp == 0) return;
	if (fp->header) bam_header_destroy(fp->header);
	if (fp->type & TYPE_BAM) bam_close(fp->x.bam);
	else if (fp->type & TYPE_READ) sam_close(fp->x.tamr);
	else fclose(fp->x.tamw);
	free(fp);
}

// Assembly:
testq %rdi, %rdi
je 0x14c44
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x14c2f
callq 0x11c9f
movl (%rbx), %eax
testb $0x1, %al
jne 0x14c45
movq 0x8(%rbx), %rdi
testb $0x2, %al
jne 0x14c50
callq 0x3560
jmp 0x14c55
retq
movq 0x8(%rbx), %rdi
callq 0x1050e
jmp 0x14c55
callq 0x144ed
movq %rbx, %rdi
popq %rbx
jmp 0x32c0
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/sam.c
// Function: samwrite
int samwrite(samfile_t *fp, const bam1_t *b)
{
	if (fp == 0 || (fp->type & TYPE_READ)) return -1; // not open for writing
	if (fp->type & TYPE_BAM) return bam_write1(fp->x.bam, b);
	else {
		char *s = bam_format1_core(fp->header, b, fp->type>>2&3);
		int l = strlen(s);
		fputs(s, fp->x.tamw); fputc('\n', fp->x.tamw);
		free(s);
		return l + 1;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x14cf4
movq %rdi, %rbx
movl (%rdi), %edx
testb $0x2, %dl
jne 0x14cf4
testb $0x1, %dl
jne 0x14cfd
movq 0x10(%rbx), %rdi
shrl $0x2, %edx
andl $0x3, %edx
callq 0x1242a
movq %rax, %r15
movq %rax, %rdi
callq 0x32d0
movq %rax, %r14
movq 0x8(%rbx), %rsi
movq %r15, %rdi
callq 0x33f0
movq 0x8(%rbx), %rsi
movl $0xa, %edi
callq 0x3290
movq %r15, %rdi
callq 0x32c0
incl %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
movq 0x8(%rbx), %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1241e
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/sam.c
// Function: sampileup
int sampileup(samfile_t *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 = samread(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
movq %rax, %rdi
movl %ebp, %esi
callq 0x16fec
movq %r14, %rdi
movq %rbx, %rsi
callq 0x14c5e
testl %eax, %eax
js 0x14d64
movq %rbx, %rdi
movq %r15, %rsi
callq 0x171f5
jmp 0x14d48
xorl %edi, %edi
movq %r15, %rsi
callq 0x171f5
movq %r15, %rdi
callq 0x170c4
testq %rbx, %rbx
je 0x14d8c
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
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/sam.c
// Function: samfaipath
char *samfaipath(const char *fn_ref)
{
	char *fn_list = 0;
	if (fn_ref == 0) return 0;
	fn_list = calloc(strlen(fn_ref) + 5, 1);
	strcat(strcpy(fn_list, fn_ref), ".fai");
	if (access(fn_list, R_OK) == -1) { // fn_list is unreadable
		if (access(fn_ref, R_OK) == -1) {
			fprintf(stderr, "[samfaipath] fail to read file %s.\n", fn_ref);
		} else {
			fprintf(stderr, "[samfaipath] build FASTA index...\n");
			if (fai_build(fn_ref) == -1) {
				fprintf(stderr, "[samfaipath] fail to build FASTA index.\n");
				free(fn_list); fn_list = 0;
			}
		}
	}
	return fn_list;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
je 0x14e1e
movq %rdi, %r14
callq 0x32d0
leaq 0x5(%rax), %rdi
movl $0x1, %esi
callq 0x3530
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x3510
movq %rbx, %rdi
callq 0x32d0
movl $0x6961662e, (%rbx,%rax) # imm = 0x6961662E
movb $0x0, 0x4(%rbx,%rax)
movq %rbx, %rdi
movl $0x4, %esi
callq 0x35e0
cmpl $-0x1, %eax
jne 0x14e20
movq %r14, %rdi
movl $0x4, %esi
callq 0x35e0
movq 0x1a1e5(%rip), %rcx     # 0x2efe8
movq (%rcx), %rdi
cmpl $-0x1, %eax
jne 0x14e2d
leaq 0x11a2d(%rip), %rsi     # 0x2683f
movq %r14, %rdx
xorl %eax, %eax
callq 0x3630
jmp 0x14e20
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x8(%rsp), %r15
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x43cf
movq (%r15), %rbx
jmp 0x14e20
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_index.c
// Function: bam_index_destroy
void bam_index_destroy(bam_index_t *idx)
{
	khint_t k;
	int i;
	if (idx == 0) return;
	for (i = 0; i < idx->n; ++i) {
		khash_t(i) *index = idx->index[i];
		bam_lidx_t *index2 = idx->index2 + i;
		for (k = kh_begin(index); k != kh_end(index); ++k) {
			if (kh_exist(index, k))
				free(kh_value(index, k).list);
		}
		kh_destroy(i, index);
		free(index2->offset);
	}
	free(idx->index); free(idx->index2);
	free(idx);
}

// Assembly:
testq %rdi, %rdi
je 0x15cab
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, (%rdi)
jle 0x15c83
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %r12
movq (%rax,%r15,8), %r14
cmpl $0x0, (%r14)
je 0x15c40
xorl %ebp, %ebp
xorl %r13d, %r13d
movq 0x10(%r14), %rax
movl %r13d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x15c35
movq 0x20(%r14), %rax
movl %r13d, %ecx
shlq $0x4, %rcx
movq 0x8(%rax,%rcx), %rdi
callq 0x32c0
incl %r13d
addl $0x2, %ebp
cmpl (%r14), %r13d
jne 0x15c08
movq 0x18(%r14), %rdi
callq 0x32c0
movq 0x10(%r14), %rdi
callq 0x32c0
movq 0x20(%r14), %rdi
callq 0x32c0
movq %r14, %rdi
callq 0x32c0
movq %r15, %rax
shlq $0x4, %rax
movq 0x8(%r12,%rax), %rdi
callq 0x32c0
incq %r15
movslq (%rbx), %rax
cmpq %rax, %r15
jl 0x15bf1
movq 0x8(%rbx), %rdi
callq 0x32c0
movq 0x10(%rbx), %rdi
callq 0x32c0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x32c0
retq