LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/misc/bamcheck.c
// Function: destroy_regions
void destroy_regions(stats_t *stats)
{
    int i;
    for (i=0; i<stats->nregions; i++)
    {
        if ( !stats->regions[i].mpos ) continue;
        free(stats->regions[i].pos);
    }
    if ( stats->regions ) free(stats->regions);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x1a4(%rdi)
jle 0x75e8
movl $0x10, %r14d
xorl %r15d, %r15d
movq 0x1b0(%rbx), %rax
cmpl $0x0, -0xc(%rax,%r14)
je 0x75d5
movq (%rax,%r14), %rdi
callq 0x3060
incq %r15
movslq 0x1a4(%rbx), %rax
addq $0x18, %r14
cmpq %rax, %r15
jl 0x75bd
movq 0x1b0(%rbx), %rdi
testq %rdi, %rdi
je 0x75fe
popq %rbx
popq %r14
popq %r15
jmp 0x3060
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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, %rbx
addq %rax, %rbx
movslq 0x24(%rdi), %r14
addq %rcx, %r14
leaq 0x1238b(%rip), %r12     # 0x1a970
cmpq %r14, %rbx
jae 0x86f8
movzwl (%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %r15d
cmpl %ebp, %r15d
jne 0x860d
addq $0x2, %rbx
movq %rbx, %rax
movq %rbx, %r13
jmp 0x86ad
callq 0x3030
movq (%rax), %rax
movzbl 0x2(%rbx), %ecx
movl (%rax,%rcx,4), %ecx
leaq 0x3(%rbx), %rax
movl $0x1, %edx
leal -0x41(%rcx), %esi
cmpl $0x7, %esi
ja 0x8669
movslq (%r12,%rsi,4), %rsi
addq %r12, %rsi
jmpq *%rsi
movzbl (%rax), %ecx
leal -0x41(%rcx), %esi
cmpl $0x22, %esi
ja 0x86bb
movl $0x1, %edx
movabsq $0x400000005, %rdi      # imm = 0x400000005
btq %rsi, %rdi
jae 0x86bb
movslq 0x4(%rbx), %rcx
movl %edx, %edx
imulq %rcx, %rdx
addq %rdx, %rax
addq $0x5, %rax
jmp 0x86ad
cmpl $0x63, %ecx
je 0x86aa
cmpl $0x5a, %ecx
jne 0x867e
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x8673
jmp 0x86ad
movl %ecx, %esi
andl $-0x21, %esi
movl $0x2, %edx
cmpl $0x53, %esi
je 0x86aa
addl $-0x46, %ecx
cmpl $0x23, %ecx
ja 0x86f4
movl $0x4, %edx
movabsq $0x900000009, %rsi      # imm = 0x900000009
btq %rcx, %rsi
jae 0x86f4
addq %rdx, %rax
movq %rax, %rbx
cmpl %ebp, %r15d
jne 0x85e5
jmp 0x86fb
movl %ecx, %esi
andb $-0x21, %sil
movl $0x2, %edx
cmpb $0x53, %sil
je 0x8656
addl $-0x46, %ecx
cmpl $0x23, %ecx
ja 0x86ed
movl $0x4, %edx
movabsq $0x900000009, %rsi      # imm = 0x900000009
btq %rcx, %rsi
jb 0x8656
xorl %edx, %edx
jmp 0x8656
xorl %edx, %edx
jmp 0x86aa
xorl %r13d, %r13d
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_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 0x3030
movq (%rax), %rax
movzbl (%r14), %ecx
movl (%rax,%rcx,4), %ecx
leaq 0x1(%r14), %rax
movl $0x1, %edx
leal -0x41(%rcx), %esi
cmpl $0x7, %esi
ja 0x8796
leaq 0x1223f(%rip), %rdi     # 0x1a990
movslq (%rdi,%rsi,4), %rsi
addq %rdi, %rsi
jmpq *%rsi
movzbl (%rax), %ecx
leal -0x41(%rcx), %esi
cmpl $0x22, %esi
ja 0x884d
movl $0x1, %edx
movabsq $0x400000005, %rdi      # imm = 0x400000005
btq %rsi, %rdi
jae 0x884d
movslq 0x2(%r14), %rcx
movl %edx, %edx
imulq %rcx, %rdx
leaq (%rax,%rdx), %r15
addq $0x5, %r15
jmp 0x87e8
cmpl $0x63, %ecx
je 0x87e2
cmpl $0x5a, %ecx
jne 0x87ae
leaq 0x1(%rax), %r15
cmpb $0x0, (%rax)
movq %r15, %rax
jne 0x87a0
jmp 0x87e8
movl %ecx, %esi
andl $-0x21, %esi
movl $0x2, %edx
cmpl $0x53, %esi
je 0x87e2
addl $-0x46, %ecx
cmpl $0x23, %ecx
ja 0x888a
movl $0x4, %edx
movabsq $0x900000009, %rsi      # imm = 0x900000009
btq %rcx, %rsi
jae 0x888a
addq %rdx, %rax
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 0x3470
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
movl %ecx, %esi
andb $-0x21, %sil
movl $0x2, %edx
cmpb $0x53, %sil
je 0x8782
addl $-0x46, %ecx
cmpl $0x23, %ecx
ja 0x8883
movl $0x4, %edx
movabsq $0x900000009, %rsi      # imm = 0x900000009
btq %rcx, %rsi
jb 0x8782
xorl %edx, %edx
jmp 0x8782
xorl %edx, %edx
jmp 0x87e2
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_aux.c
// Function: bam_aux_drop_other
int bam_aux_drop_other(bam1_t *b, uint8_t *s)
{
	if (s) {
		uint8_t *p, *aux;
		aux = bam1_aux(b);
		p = s - 2;
		__skip_tag(s);
		memmove(aux, p, s - p);
		b->data_len -= b->l_aux - (s - p);
		b->l_aux = s - p;
	} else {
		b->data_len -= b->l_aux;
		b->l_aux = 0;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rsi, %rsi
je 0x894e
movq %rsi, %r12
movq 0x8(%rbx), %rax
movq %rax, %rcx
shrq $0x30, %rcx
shlq $0x2, %rcx
addq 0x30(%rbx), %rcx
shrl $0x18, %eax
movslq 0x10(%rbx), %rdx
addq %rdx, %rax
leal 0x1(%rdx), %esi
shrl $0x1f, %esi
addl %esi, %edx
incl %edx
sarl %edx
movslq %edx, %r14
addq %rax, %r14
addq %rcx, %r14
leaq -0x2(%r12), %r15
callq 0x3030
movq (%rax), %rax
movzbl (%r12), %ecx
movl (%rax,%rcx,4), %ecx
leaq 0x1(%r12), %rax
movl $0x1, %edx
leal -0x41(%rcx), %esi
cmpl $0x7, %esi
ja 0x895d
leaq 0x120a8(%rip), %rdi     # 0x1a9b0
movslq (%rdi,%rsi,4), %rsi
addq %rdi, %rsi
jmpq *%rsi
movzbl (%rax), %ecx
leal -0x41(%rcx), %esi
cmpl $0x22, %esi
ja 0x89d7
movl $0x1, %edx
movabsq $0x400000005, %rdi      # imm = 0x400000005
btq %rsi, %rdi
jae 0x89d7
movslq 0x2(%r12), %rcx
movl %edx, %edx
imulq %rcx, %rdx
leaq (%rax,%rdx), %r12
addq $0x5, %r12
jmp 0x89ab
movl 0x20(%rbx), %eax
subl %eax, 0x24(%rbx)
movl $0x0, 0x20(%rbx)
jmp 0x89c9
cmpl $0x63, %ecx
je 0x89a5
cmpl $0x5a, %ecx
jne 0x8975
leaq 0x1(%rax), %r12
cmpb $0x0, (%rax)
movq %r12, %rax
jne 0x8967
jmp 0x89ab
movl %ecx, %esi
andl $-0x21, %esi
movl $0x2, %edx
cmpl $0x53, %esi
je 0x89a5
addl $-0x46, %ecx
cmpl $0x23, %ecx
ja 0x8a14
movl $0x4, %edx
movabsq $0x900000009, %rsi      # imm = 0x900000009
btq %rcx, %rsi
jae 0x8a14
addq %rdx, %rax
movq %rax, %r12
subq %r15, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3470
movl %r12d, %eax
subl 0x20(%rbx), %eax
addl %eax, 0x24(%rbx)
movl %r12d, 0x20(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl %ecx, %esi
andb $-0x21, %sil
movl $0x2, %edx
cmpb $0x53, %sil
je 0x8939
addl $-0x46, %ecx
cmpl $0x23, %ecx
ja 0x8a0d
movl $0x4, %edx
movabsq $0x900000009, %rsi      # imm = 0x900000009
btq %rcx, %rsi
jb 0x8939
xorl %edx, %edx
jmp 0x8939
xorl %edx, %edx
jmp 0x89a5
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0x8cbb
movq %rsi, %rbx
movsbl (%rsi), %edi
xorl %r8d, %r8d
movl $0x0, %ecx
testl %edi, %edi
je 0x8cc5
movb 0x1(%rbx), %al
testb %al, %al
je 0x8cc3
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 0x8ca4
jmp 0x8cc5
xorl %r13d, %r13d
jmp 0x8d67
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 0x8d5a
testb $0x1, %al
jne 0x8d40
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rdi
movq %rbx, %rsi
callq 0x3300
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r10
xorl %r8d, %r8d
testl %eax, %eax
je 0x8d5a
addl %r12d, %r13d
cmpl %r10d, %r13d
movl %r10d, %eax
cmovbl %r8d, %eax
subl %eax, %r13d
cmpl %r14d, %r13d
jne 0x8cf4
movl %r10d, %r13d
jmp 0x8d67
movl %r15d, %ecx
shrl %cl, %ebp
testb $0x3, %bpl
cmovnel %r10d, %r13d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %r10d, %r13d
je 0x8d7f
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_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0x9391
movb (%rdi), %cl
leal -0x43(%rcx), %edx
rolb $0x4, %dl
cmpb $0x3, %dl
ja 0x9386
movzbl %dl, %eax
leaq 0x11667(%rip), %rcx     # 0x1a9d0
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 0x9391
movl 0x1(%rdi), %eax
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam.c
// Function: bam_calend
uint32_t bam_calend(const bam1_core_t *c, const uint32_t *cigar)
{
	int k, end = c->pos;
	for (k = 0; k < c->n_cigar; ++k) {
		int op  = bam_cigar_op(cigar[k]);
		int len = bam_cigar_oplen(cigar[k]);
		if (op == BAM_CBACK) { // move backward
			int l, u, v;
			if (k == c->n_cigar - 1) break; // skip trailing 'B'
			for (l = k - 1, u = v = 0; l >= 0; --l) {
				int op1  = bam_cigar_op(cigar[l]);
				int len1 = bam_cigar_oplen(cigar[l]);
				if (bam_cigar_type(op1)&1) { // consume query
					if (u + len1 >= len) { // stop
						if (bam_cigar_type(op1)&2) v += len - u;
						break;
					} else u += len1;
				}
				if (bam_cigar_type(op1)&2) v += len1;
			}
			end = l < 0? c->pos : end - v;
		} else if (bam_cigar_type(op)&2) end += bam_cigar_oplen(cigar[k]);
	}
	return end;
}

// Assembly:
movl 0x4(%rdi), %eax
movq 0x8(%rdi), %rdi
shrq $0x30, %rdi
je 0x972d
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leal -0x1(%rdi), %r8d
xorl %r9d, %r9d
movl $0x3c1a7, %r10d         # imm = 0x3C1A7
movl %eax, -0xc(%rsp)
movq %r8, -0x8(%rsp)
movl (%rsi,%r9,4), %ebx
movl %ebx, %ecx
andl $0xf, %ecx
shrl $0x4, %ebx
cmpl $0x9, %ecx
jne 0x96f1
cmpq %r8, %r9
setne %r11b
je 0x9712
xorl %r14d, %r14d
movq %r9, %r15
xorl %r12d, %r12d
xorl %ebp, %ebp
testq %r15, %r15
jle 0x96e8
movl -0x4(%rsi,%r15,4), %ecx
movl %ecx, %edx
shrl $0x4, %edx
addl %ecx, %ecx
movl $0x3c1a7, %r13d         # imm = 0x3C1A7
shrl %cl, %r13d
btl %ecx, %r10d
jb 0x96ab
movl %r12d, %r8d
jmp 0x96b4
leal (%rdx,%r12), %r8d
cmpl %ebx, %r8d
jge 0x96c6
shll $0x1e, %r13d
sarl $0x1f, %r13d
andl %edx, %r13d
movb $0x1, %cl
movl %r8d, %r12d
jmp 0x96d8
shll $0x1e, %r13d
sarl $0x1f, %r13d
movl %ebx, %ecx
subl %r12d, %ecx
andl %ecx, %r13d
xorl %ecx, %ecx
addl %r13d, %ebp
decq %r15
testb %cl, %cl
jne 0x9686
incl %r15d
movl %r15d, %r14d
testl %r14d, %r14d
jle 0x9709
subl %ebp, %eax
jmp 0x970d
addl %ecx, %ecx
movl $0x3c1a7, %edx          # imm = 0x3C1A7
shrl %cl, %edx
shll $0x1e, %edx
sarl $0x1f, %edx
andl %ebx, %edx
addl %edx, %eax
movb $0x1, %r11b
jmp 0x9712
movl -0xc(%rsp), %eax
movq -0x8(%rsp), %r8
testb %r11b, %r11b
je 0x9723
incq %r9
cmpq %rdi, %r9
jne 0x9659
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam.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)
		if (bam_cigar_type(bam_cigar_op(cigar[k]))&1)
			l += bam_cigar_oplen(cigar[k]);
	return l;
}

// Assembly:
movq 0x8(%rdi), %rcx
xorl %eax, %eax
shrq $0x30, %rcx
je 0x976a
xorl %edx, %edx
movl $0x3c1a7, %edi          # imm = 0x3C1A7
xorl %eax, %eax
movl (%rsi,%rdx,4), %r8d
leal (%r8,%r8), %r9d
btl %r9d, %edi
movl $0x0, %r9d
sbbl %r9d, %r9d
shrl $0x4, %r8d
andl %r9d, %r8d
addl %r8d, %eax
incq %rdx
cmpq %rdx, %rcx
jne 0x9743
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0x9805
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
je 0x97c9
cmpl $0x0, (%rbx)
jle 0x97b7
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3060
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x979f
movq 0x8(%rbx), %rdi
callq 0x3060
movq 0x10(%rbx), %rdi
callq 0x3060
movq 0x38(%rbx), %rdi
callq 0x3060
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x97e0
callq 0x15a0c
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x97ee
callq 0x16782
movq %rbx, %rdi
callq 0x8c37
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3060
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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);
	}
	bgzf_flush(fp);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x14(%rsp), %rsi
movl $0x14d4142, (%rsi)      # imm = 0x14D4142
movl $0x4, %edx
callq 0x17d81
leaq 0x30(%r14), %r15
cmpl $0x0, 0x19047(%rip)     # 0x22a50
je 0x9a4e
movl (%r15), %eax
bswapl %eax
leaq 0xc(%rsp), %rsi
movl %eax, (%rsi)
movl $0x4, %edx
movq %rbx, %rdi
callq 0x17d81
movl (%r15), %edx
testq %rdx, %rdx
je 0x9a38
movq 0x38(%r14), %rsi
movq %rbx, %rdi
callq 0x17d81
movl (%r14), %eax
bswapl %eax
leaq 0xc(%rsp), %rsi
movl %eax, (%rsi)
movl $0x4, %edx
movq %rbx, %rdi
jmp 0x9a7d
movl $0x4, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x17d81
movl (%r15), %edx
testq %rdx, %rdx
je 0x9a72
movq 0x38(%r14), %rsi
movq %rbx, %rdi
callq 0x17d81
movl $0x4, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x17d81
cmpl $0x0, (%r14)
je 0x9b2b
xorl %r13d, %r13d
leaq 0xc(%rsp), %r15
xorl %ebp, %ebp
movq 0x8(%r14), %rax
movq (%rax,%r13,2), %r12
movq %r12, %rdi
callq 0x31e0
incl %eax
movl %eax, 0x10(%rsp)
cmpl $0x0, 0x18f9d(%rip)     # 0x22a50
leaq 0x10(%rsp), %rsi
je 0x9ac3
bswapl %eax
movl %eax, 0xc(%rsp)
movq %r15, %rsi
movl $0x4, %edx
movq %rbx, %rdi
callq 0x17d81
movslq 0x10(%rsp), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x17d81
cmpl $0x0, 0x18f69(%rip)     # 0x22a50
je 0x9b04
movq 0x10(%r14), %rax
movl (%rax,%r13), %eax
bswapl %eax
movl %eax, 0xc(%rsp)
movl $0x4, %edx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0x9b13
movq 0x10(%r14), %rsi
addq %r13, %rsi
movl $0x4, %edx
movq %rbx, %rdi
callq 0x17d81
incq %rbp
movl (%r14), %eax
addq $0x4, %r13
cmpq %rax, %rbp
jne 0x9a96
movq %rbx, %rdi
callq 0x17b83
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam.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;
	bgzf_flush_try(fp, 4 + block_len);
	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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r12
movslq %edx, %r15
leal 0x20(%r15), %eax
movl %eax, 0xc(%rsp)
movl (%rsi), %eax
movl %eax, 0x10(%rsp)
movl 0x4(%rsi), %eax
movl %eax, 0x14(%rsp)
movq 0x8(%rsi), %rax
movl %eax, %ecx
shll $0x10, %ecx
movl %eax, %edx
shrl $0x8, %edx
andl $0xff00, %edx           # imm = 0xFF00
orl %ecx, %edx
movl %eax, %ecx
shrl $0x18, %ecx
orl %edx, %ecx
movl %ecx, 0x18(%rsp)
movq %rax, %rcx
shrq $0x10, %rcx
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
shrq $0x30, %rax
orl %ecx, %eax
movl %eax, 0x1c(%rsp)
movl 0x10(%rsi), %eax
movl %eax, 0x20(%rsp)
movl 0x14(%rsi), %eax
movl %eax, 0x24(%rsp)
movl 0x18(%rsi), %eax
movl %eax, 0x28(%rsp)
movl 0x1c(%rsi), %eax
movl %eax, 0x2c(%rsp)
leal 0x24(%r15), %esi
callq 0x17d26
cmpl $0x0, 0x18511(%rip)     # 0x22a50
je 0xa57f
xorl %eax, %eax
movl 0x10(%rsp,%rax,4), %ecx
bswapl %ecx
movl %ecx, 0x10(%rsp,%rax,4)
incq %rax
cmpq $0x8, %rax
jne 0xa543
movl 0xc(%rsp), %eax
bswapl %eax
leaq 0x3c(%rsp), %rsi
movl %eax, (%rsi)
movl $0x4, %edx
movq %r12, %rdi
callq 0x17d81
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x9d08
jmp 0xa591
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
movq %r12, %rdi
callq 0x17d81
leaq 0x10(%rsp), %rsi
movl $0x20, %edx
movq %r12, %rdi
callq 0x17d81
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x17d81
cmpl $0x0, 0x18498(%rip)     # 0x22a50
je 0xa5c7
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x9d08
movl 0xc(%rsp), %eax
addl $0x4, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/./kstring.h
// Function: kputw
static inline int kputw(int c, kstring_t *s)
{
	char buf[16];
	int l, x;
	if (c == 0) return kputc('0', s);
        if(c < 0) for (l = 0, x = c; x < 0; x /= 10) buf[l++] = '0' - (x%10);
        else for (l = 0, x = c; x > 0; x /= 10) buf[l++] = x%10 + '0';
	if (c < 0) buf[l++] = '-';
	if (s->l + l + 1 >= s->m) {
		s->m = s->l + l + 2;
		kroundup32(s->m);
		s->s = (char*)realloc(s->s, s->m);
	}
	for (x = l - 1; x >= 0; --x) s->s[s->l++] = buf[x];
	s->s[s->l] = 0;
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
testl %edi, %edi
je 0xc0a9
js 0xc111
xorl %r14d, %r14d
movl $0xcccccccd, %eax       # imm = 0xCCCCCCCD
movl %edi, %ecx
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x23, %rdx
leal (%rdx,%rdx), %esi
leal (%rsi,%rsi,4), %esi
movl %ecx, %r8d
subl %esi, %r8d
orb $0x30, %r8b
movb %r8b, (%rsp,%r14)
incq %r14
cmpl $0x9, %ecx
movl %edx, %ecx
ja 0xc07c
jmp 0xc148
movq (%rbx), %rax
incq %rax
cmpq 0x8(%rbx), %rax
jb 0xc0fa
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 0x3430
movq %rax, 0x10(%rbx)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
movb $0x30, (%rcx,%rax)
jmp 0xc1da
xorl %r14d, %r14d
movl %edi, %eax
movslq %eax, %rcx
imulq $0x66666667, %rcx, %rax # imm = 0x66666667
movq %rax, %rdx
shrq $0x3f, %rdx
sarq $0x22, %rax
addl %edx, %eax
leal (%rax,%rax), %edx
leal (%rdx,%rdx,4), %edx
movl %ecx, %esi
subl %edx, %esi
movb $0x30, %dl
subb %sil, %dl
movb %dl, (%rsp,%r14)
incq %r14
cmpl $-0x9, %ecx
jl 0xc116
testl %edi, %edi
jns 0xc15a
movl %r14d, %eax
leal 0x1(%r14), %ecx
movb $0x2d, (%rsp,%rax)
movl %ecx, %r14d
movq (%rbx), %rax
movslq %r14d, %rcx
addq %rcx, %rax
incq %rax
cmpq 0x8(%rbx), %rax
jb 0xc1b1
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 0x3430
movq %rax, 0x10(%rbx)
testl %r14d, %r14d
jle 0xc1da
movl %r14d, %eax
incq %rax
movb -0x2(%rsp,%rax), %cl
movq (%rbx), %rdx
movq 0x10(%rbx), %rsi
leaq 0x1(%rdx), %rdi
movq %rdi, (%rbx)
movb %cl, (%rsi,%rdx)
decq %rax
cmpq $0x1, %rax
jg 0xc1bc
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movb $0x0, (%rcx,%rax)
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam.c
// Function: bam_validate1
int bam_validate1(const bam_header_t *header, const bam1_t *b)
{
	char *s;

	if (b->core.tid < -1 || b->core.mtid < -1) return 0;
	if (header && (b->core.tid >= header->n_targets || b->core.mtid >= header->n_targets)) return 0;

	if (b->data_len < b->core.l_qname) return 0;
	s = memchr(bam1_qname(b), '\0', b->core.l_qname);
	if (s != &bam1_qname(b)[b->core.l_qname-1]) return 0;

	// FIXME: Other fields could also be checked, especially the auxiliary data

	return 1;
}

// Assembly:
movl (%rsi), %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
jl 0xc272
movl 0x14(%rsi), %edx
cmpl $-0x1, %edx
jl 0xc272
testq %rdi, %rdi
je 0xc236
movl (%rdi), %edi
cmpl %edi, %ecx
setge %cl
cmpl %edi, %edx
setge %dl
orb %cl, %dl
jne 0xc272
movl 0x8(%rsi), %ecx
shrl $0x18, %ecx
cmpl %ecx, 0x24(%rsi)
jl 0xc272
pushq %r14
pushq %rbx
pushq %rax
movq 0x30(%rsi), %rbx
movl %ecx, %r14d
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x32a0
movq %rax, %rcx
leaq (%rbx,%r14), %rdx
decq %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0xc291
movq 0x38(%rbx), %rdi
callq 0x15ce3
movq %rax, 0x18(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0xc2ba
movq 0x18(%rbx), %rdi
leaq 0xd31c(%rip), %rsi      # 0x195bf
leaq 0xda3b(%rip), %rdx      # 0x19ce5
leaq 0xe933(%rip), %rcx      # 0x1abe4
callq 0x160c0
movq %rax, 0x28(%rbx)
leaq 0xd2fe(%rip), %rsi      # 0x195bf
movq %r14, %rdi
callq 0x858e
testq %rax, %rax
je 0xc2e4
movq 0x28(%rbx), %rdi
incq %rax
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x16654
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0xdb60(%rip), %rsi      # 0x19e6d
callq 0x3300
testl %eax, %eax
je 0xc327
leaq 0xf4e9(%rip), %rsi      # 0x1b806
movq %r14, %rdi
callq 0x3350
jmp 0xc344
movq 0x15c9a(%rip), %rax     # 0x21fc8
movq (%rax), %rdi
callq 0x3390
leaq 0xf4c9(%rip), %rsi      # 0x1b806
movl %eax, %edi
callq 0x31a0
movq %rax, %r14
movl $0x1, %edi
movl $0x18, %esi
callq 0x32e0
movq %rax, %r15
movl $0x1, %edi
movl $0x20, %esi
callq 0x32e0
movq %rax, %r12
movq %r14, 0x18(%rax)
movl $0x4000, %edi           # imm = 0x4000
callq 0x33e0
movq %rax, (%r12)
leaq 0xc(%rsp), %rcx
movq %r12, %rdi
movl $0xa, %esi
movq %r15, %rdx
callq 0xc490
testl %eax, %eax
jle 0xc448
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 0xc3e8
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 0x3430
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 0xc402
leaq -0x1(%rax), %rdx
movq %rdx, (%r15)
movb $0x0, -0x1(%rcx,%rax)
movq (%r15), %rdi
incq %rdi
movl $0x1, %esi
callq 0x32e0
movq %rax, (%r13,%rbx,8)
incq %rbx
movq 0x10(%r15), %rsi
movq %rax, %rdi
callq 0x30d0
movq %r12, %rdi
movl $0xa, %esi
movq %r15, %rdx
movq %rbp, %rcx
callq 0xc490
testl %eax, %eax
jg 0xc3b1
movq 0x10(%rsp), %r14
jmp 0xc44d
xorl %ebx, %ebx
xorl %r13d, %r13d
movq (%r12), %rdi
callq 0x3060
movq %r12, %rdi
callq 0x3060
movq %r14, %rdi
callq 0x3050
movq 0x10(%r15), %rdi
callq 0x3060
movq %r15, %rdi
callq 0x3060
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_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_import.c
// Function: hash2header
static bam_header_t *hash2header(const kh_ref_t *hash)
{
	bam_header_t *header;
	khiter_t k;
	header = bam_header_init();
	header->n_targets = kh_size(hash);
	header->target_name = (char**)calloc(kh_size(hash), sizeof(char*));
	header->target_len = (uint32_t*)calloc(kh_size(hash), 4);
	for (k = kh_begin(hash); k != kh_end(hash); ++k) {
		if (kh_exist(hash, k)) {
			int i = (int)kh_value(hash, k);
			header->target_name[i] = (char*)kh_key(hash, k);
			header->target_len[i] = kh_value(hash, k)>>32;
		}
	}
	bam_init_header_hash(header);
	return header;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
callq 0x976b
movq %rax, %rbx
movl 0x4(%r14), %r15d
movl %r15d, (%rax)
movl $0x8, %esi
movq %r15, %rdi
callq 0x32e0
movq %rax, 0x8(%rbx)
movl $0x4, %esi
movq %r15, %rdi
callq 0x32e0
movq %rax, 0x10(%rbx)
cmpl $0x0, (%r14)
je 0xc82f
xorl %eax, %eax
xorl %edx, %edx
movq 0x10(%r14), %rcx
movl %edx, %esi
shrl $0x4, %esi
movl (%rcx,%rsi,4), %esi
movl %eax, %ecx
andb $0x1e, %cl
shrl %cl, %esi
testb $0x3, %sil
jne 0xc825
movq 0x18(%r14), %rcx
movq 0x20(%r14), %rsi
movl %edx, %edi
movslq (%rsi,%rdi,8), %rsi
movq (%rcx,%rdi,8), %rcx
movq 0x8(%rbx), %r8
movq %rcx, (%r8,%rsi,8)
movq 0x20(%r14), %rcx
movl 0x4(%rcx,%rdi,8), %ecx
movq 0x10(%rbx), %rdi
movl %ecx, (%rdi,%rsi,4)
incl %edx
addl $0x2, %eax
cmpl (%r14), %edx
jne 0xc7e3
movq %rbx, %rdi
callq 0x8a18
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0x3060
movq 0x8(%rbx), %rdi
callq 0x3060
movl $0x0, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
xorl %ebp, %ebp
cmpl $0x3, 0x30(%rbx)
jb 0xc98c
cmpq $0x0, 0x18(%rbx)
jne 0xc8bb
movq 0x38(%rbx), %rdi
callq 0x15ce3
movq %rax, 0x18(%rbx)
movq 0x18(%rbx), %rdi
leaq 0xe465(%rip), %rsi      # 0x1ad2b
leaq 0xe461(%rip), %rdx      # 0x1ad2e
movq %rbx, %rcx
callq 0x164a5
movslq (%rbx), %r15
testq %r15, %r15
je 0xc98c
movq %rax, %r14
leaq 0x8(%rbx), %r12
movl $0x8, %esi
movq %r15, %rdi
callq 0x32e0
movq %rax, (%r12)
testl %r15d, %r15d
jle 0xc91a
xorl %r13d, %r13d
movq (%r14,%r13,8), %rdi
callq 0x3590
movq (%r12), %rcx
movq %rax, (%rcx,%r13,8)
incq %r13
cmpq %r13, %r15
jne 0xc901
movq %r14, %rdi
callq 0x3060
movq 0x18(%rbx), %rdi
leaq 0xe3fe(%rip), %rsi      # 0x1ad2b
leaq 0xe3fd(%rip), %rdx      # 0x1ad31
movq %rbx, %rcx
callq 0x164a5
movq %rax, %r14
movslq (%rbx), %r12
movl $0x4, %esi
movq %r12, %rdi
callq 0x32e0
movq %rax, 0x10(%rbx)
testq %r12, %r12
jle 0xc982
movq %rax, %r15
movl (%rbx), %eax
cmpl $0x2, %eax
movl $0x1, %r12d
cmovgel %eax, %r12d
xorl %r13d, %r13d
movq (%r14,%r13,8), %rdi
callq 0x34f0
movl %eax, (%r15,%r13,4)
incq %r13
cmpq %r13, %r12
jne 0xc96d
movq %r14, %rdi
callq 0x3060
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_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_import.c
// Function: sam_header_read
bam_header_t *sam_header_read(tamFile fp)
{
	int ret, dret;
	bam_header_t *header = bam_header_init();
	kstring_t *str = fp->str;
	while ((ret = ks_getuntil(fp->ks, KS_SEP_TAB, str, &dret)) >= 0 && str->s[0] == '@') { // skip header
		str->s[str->l] = dret; // note that str->s is NOT null terminated!!
		append_text(header, str);
		if (dret != '\n') {
			ret = ks_getuntil(fp->ks, '\n', str, &dret);
			str->s[str->l] = '\n'; // NOT null terminated!!
			append_text(header, str);
		}
		++fp->n_lines;
	}
	sam_header_parse(header);
	bam_init_header_hash(header);
	fp->is_first = 1;
	return header;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x976b
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %r15
leaq 0x4(%rsp), %rcx
movl $0x1, %esi
movq %r15, %rdx
callq 0xc490
testl %eax, %eax
js 0xca3e
leaq 0x4(%rsp), %r12
movq 0x10(%r15), %rax
cmpb $0x40, (%rax)
jne 0xca3e
movb 0x4(%rsp), %cl
movq (%r15), %rdx
movb %cl, (%rax,%rdx)
movq %r14, %rdi
movq %r15, %rsi
callq 0xca64
cmpl $0xa, 0x4(%rsp)
je 0xca22
movq 0x8(%rbx), %rdi
movl $0xa, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0xc490
movq (%r15), %rax
movq 0x10(%r15), %rcx
movb $0xa, (%rcx,%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0xca64
incq 0x18(%rbx)
movq 0x8(%rbx), %rdi
movl $0x1, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0xc490
testl %eax, %eax
jns 0xc9d3
movq %r14, %rdi
callq 0xc86e
movq %r14, %rdi
callq 0x8a18
movl $0x1, 0x20(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_import.c
// Function: append_text
static inline void append_text(bam_header_t *header, kstring_t *str)
{
	size_t x = header->l_text, y = header->l_text + str->l + 2; // 2 = 1 byte dret + 1 byte null
	kroundup32(x); kroundup32(y);
	if (x < y) 
    {
        header->n_text = y;
        header->text = (char*)realloc(header->text, y);
        if ( !header->text ) 
        {
            fprintf(stderr,"realloc failed to alloc %ld bytes\n", y);
            abort();
        }
    }
    // Sanity check
    if ( header->l_text+str->l+1 >= header->n_text )
    {
        fprintf(stderr,"append_text FIXME: %ld>=%ld, x=%ld,y=%ld\n",  header->l_text+str->l+1,(long)header->n_text,x,y);
        abort();
    }
	strncpy(header->text + header->l_text, str->s, str->l+1); // we cannot use strcpy() here.
	header->l_text += str->l + 1;
	header->text[header->l_text] = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x30(%rdi), %eax
movq (%rsi), %rcx
leaq -0x1(%rax), %rdx
movq %rdx, %rsi
shrq %rsi
orq %rdx, %rsi
movq %rsi, %rdx
shrq $0x2, %rdx
orq %rsi, %rdx
movq %rdx, %rsi
shrq $0x4, %rsi
orq %rdx, %rsi
movq %rsi, %rdx
shrq $0x8, %rdx
orq %rsi, %rdx
movq %rdx, %r15
shrq $0x10, %r15
orq %rdx, %r15
incq %r15
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, %r12
shrq $0x10, %r12
orq %rax, %r12
incq %r12
cmpq %r12, %r15
jae 0xcb08
movl %r12d, 0x34(%rbx)
movq 0x38(%rbx), %rdi
movq %r12, %rsi
callq 0x3430
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0xcb74
movl 0x30(%rbx), %edi
movl 0x34(%rbx), %ecx
movq (%r14), %rdx
leaq (%rdx,%rdi), %rax
incq %rax
cmpq %rcx, %rax
jae 0xcb4e
addq 0x38(%rbx), %rdi
movq 0x10(%r14), %rsi
incq %rdx
callq 0x30b0
movl (%r14), %eax
movl 0x30(%rbx), %ecx
addl %ecx, %eax
incl %eax
movl %eax, 0x30(%rbx)
movq 0x38(%rbx), %rcx
movb $0x0, (%rcx,%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x154a3(%rip), %rdx     # 0x21ff8
movq (%rdx), %rdi
leaq 0xe42e(%rip), %rsi      # 0x1af8d
movq %rax, %rdx
movq %r15, %r8
movq %r12, %r9
xorl %eax, %eax
callq 0x3320
callq 0x3080
movq %r12, %rdi
callq 0x3a77
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0xdd74
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 0x3430
movq %rax, 0x30(%rbx)
movq 0x30(%rbx), %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0xc0c0(%rip), %rsi      # 0x19e6d
callq 0x3300
testl %eax, %eax
je 0xddc7
leaq 0xbf96(%rip), %rsi      # 0x19d53
movq %rbx, %rdi
callq 0x3350
jmp 0xdde4
movq 0x141fa(%rip), %rax     # 0x21fc8
movq (%rax), %rdi
callq 0x3390
leaq 0xbf76(%rip), %rsi      # 0x19d53
movl %eax, %edi
callq 0x31a0
movq %rax, %rbx
testq %rax, %rax
je 0xde3d
movl $0x1, %edi
movl $0x28, %esi
callq 0x32e0
movq %rax, %r14
movl $0x1, %edi
movl $0x18, %esi
callq 0x32e0
movq %rax, 0x10(%r14)
movq %rbx, (%r14)
movl $0x1, %edi
movl $0x20, %esi
callq 0x32e0
movq %rax, %r15
movq %rbx, 0x18(%rax)
movl $0x4000, %edi           # imm = 0x4000
callq 0x33e0
movq %rax, (%r15)
movq %r15, 0x8(%r14)
jmp 0xde40
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0xde9b
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0xde6e
movq (%r14), %rdi
callq 0x3060
movq %r14, %rdi
callq 0x3060
movq (%rbx), %rdi
callq 0x3050
movq 0x10(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x3060
movq 0x10(%rbx), %rdi
callq 0x3060
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3060
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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
callq 0x976b
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)
movl 0x30(%rax), %r15d
leal 0x1(%r15), %edi
movl $0x1, %esi
callq 0x32e0
movq %rax, 0x38(%r14)
movq 0x38(%rbx), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x3370
movslq (%r14), %r15
movl $0x4, %esi
movq %r15, %rdi
callq 0x32e0
movq %rax, 0x10(%r14)
movl $0x8, %esi
movq %r15, %rdi
callq 0x32e0
movq %rax, 0x8(%r14)
cmpl $0x0, (%r14)
jle 0xe1b0
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 0x3590
movq 0x8(%r14), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
movslq (%r14), %rax
cmpq %rax, %r15
jl 0xe180
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0xe659
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0xe644
callq 0x9784
movl (%rbx), %eax
testb $0x1, %al
jne 0xe65a
movq 0x8(%rbx), %rdi
testb $0x2, %al
jne 0xe665
callq 0x31c0
jmp 0xe66a
retq
movq 0x8(%rbx), %rdi
callq 0x17e8e
jmp 0xe66a
callq 0xde49
movq %rbx, %rdi
popq %rbx
jmp 0x3060
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0xe709
movq %rdi, %rbx
movl (%rdi), %edx
testb $0x2, %dl
jne 0xe709
testb $0x1, %dl
jne 0xe712
movq 0x10(%rbx), %rdi
shrl $0x2, %edx
andl $0x3, %edx
callq 0xa5e7
movq %rax, %r15
movq %rax, %rdi
callq 0x31e0
movq %rax, %r14
movq 0x8(%rbx), %rsi
movq %r15, %rdi
callq 0x3240
movq 0x8(%rbx), %rsi
movl $0xa, %edi
callq 0x3280
movq %r15, %rdi
callq 0x3060
incl %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
movq 0x8(%rbx), %rdi
popq %rbx
popq %r14
popq %r15
jmp 0xa5db
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0x32e0
movq %rax, %rbx
movq %r12, %rdi
movq %r15, %rsi
callq 0x11ec1
movq %rax, %r15
movq %rax, %rdi
movl %ebp, %esi
callq 0x11efb
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe673
testl %eax, %eax
js 0xe779
movq %rbx, %rdi
movq %r15, %rsi
callq 0x11f11
jmp 0xe75d
xorl %edi, %edi
movq %r15, %rsi
callq 0x11f11
movq %r15, %rdi
callq 0x11f9e
testq %rbx, %rbx
je 0xe7a1
movq 0x30(%rbx), %rdi
callq 0x3060
movq %rbx, %rdi
callq 0x3060
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 {
			if (bam_verbose >= 3) 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 %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xe832
movq %rdi, %r14
callq 0x31e0
leaq 0x5(%rax), %rdi
movl $0x1, %esi
callq 0x32e0
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x30d0
movq %rbx, %rdi
callq 0x31e0
movl $0x6961662e, (%rbx,%rax) # imm = 0x6961662E
movb $0x0, 0x4(%rbx,%rax)
movq %rbx, %rdi
movl $0x4, %esi
callq 0x3490
cmpl $-0x1, %eax
jne 0xe834
movq %r14, %rdi
movl $0x4, %esi
callq 0x3490
cmpl $-0x1, %eax
je 0xe83f
leaq 0x13cf8(%rip), %rax     # 0x22510
cmpl $0x3, (%rax)
jge 0xe85c
movq %r14, %rdi
callq 0x13d27
cmpl $-0x1, %eax
jne 0xe834
movq %rbx, %rdi
callq 0x3bfa
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x137b2(%rip), %rax     # 0x21ff8
movq (%rax), %rdi
leaq 0xc83b(%rip), %rsi      # 0x1b08b
movq %r14, %rdx
xorl %eax, %eax
callq 0x3320
jmp 0xe834
callq 0x3bde
jmp 0xe81d
nop
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0xfbe2
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, (%rdi)
jle 0xfbba
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %r12
movq (%rax,%r15,8), %r14
cmpl $0x0, (%r14)
je 0xfb77
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 0xfb6c
movq 0x20(%r14), %rax
movl %r13d, %ecx
shlq $0x4, %rcx
movq 0x8(%rax,%rcx), %rdi
callq 0x3060
incl %r13d
addl $0x2, %ebp
cmpl (%r14), %r13d
jne 0xfb3f
movq 0x18(%r14), %rdi
callq 0x3060
movq 0x10(%r14), %rdi
callq 0x3060
movq 0x20(%r14), %rdi
callq 0x3060
movq %r14, %rdi
callq 0x3060
movq %r15, %rax
shlq $0x4, %rax
movq 0x8(%r12,%rax), %rdi
callq 0x3060
incq %r15
movslq (%rbx), %rax
cmpq %rax, %r15
jl 0xfb28
movq 0x10(%rbx), %rdi
callq 0x3060
movq 0x18(%rbx), %rdi
callq 0x3060
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3060
retq
// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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);
        free(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 0xff3d
movq %rax, %r14
testq %rax, %rax
jne 0x103c7
leaq 0xaefc(%rip), %rsi      # 0x1b297
movl $0x6, %edx
movq %rbx, %rdi
callq 0x30c0
testl %eax, %eax
je 0x103de
leaq 0xaeeb(%rip), %rsi      # 0x1b29e
movl $0x7, %edx
movq %rbx, %rdi
callq 0x30c0
testl %eax, %eax
je 0x103de
xorl %r14d, %r14d
testq %r14, %r14
je 0x103d7
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x3e33
jmp 0x103cc
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3c84
movq (%r14), %r14
jmp 0x103c7