LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/misc/bamcheck.c
// Function: realloc_gcd_buffer
void realloc_gcd_buffer(stats_t *stats, int seq_len)
{
    if ( seq_len >= stats->gcd_bin_size )
        error("The --GC-depth bin size (%d) is set too low for the read length %d\n", stats->gcd_bin_size, seq_len);

    int n = 1 + stats->gcd_ref_size / (stats->gcd_bin_size - seq_len);
    if ( n <= stats->igcd )
        error("The --GC-depth bin size is too small or reference genome too big; please decrease the bin size or increase the reference length\n");
        
    if ( n > stats->ngcd )
    {
        stats->gcd = realloc(stats->gcd, n*sizeof(gc_depth_t));
        if ( !stats->gcd )
            error("Could not realloc GCD buffer, too many chromosomes or the genome too long?? [%u %u]\n", stats->ngcd,n);
        memset(&(stats->gcd[stats->ngcd]),0,(n-stats->ngcd)*sizeof(gc_depth_t));
        stats->ngcd = n;
    }

    realloc_rseq_buffer(stats);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %edx
movl 0x138(%rdi), %esi
movl %esi, %ecx
subl %edx, %ecx
jle 0x545d
movq %rdi, %rbx
movl 0x13c(%rdi), %eax
xorl %edx, %edx
divl %ecx
movl %eax, %ebp
incl %ebp
cmpl 0x12c(%rdi), %ebp
jbe 0x5466
cmpl 0x128(%rbx), %ebp
jbe 0x544f
movq 0x130(%rbx), %rdi
movslq %ebp, %rsi
shlq $0x3, %rsi
callq 0x3430
movq %rax, 0x130(%rbx)
movl 0x128(%rbx), %esi
testq %rax, %rax
je 0x5474
leaq (%rax,%rsi,8), %rdi
movl %ebp, %edx
subl %esi, %edx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x3260
movl %ebp, 0x128(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5395
leaq 0x15077(%rip), %rdi     # 0x1a4db
jmp 0x547d
leaq 0x150b2(%rip), %rdi     # 0x1a51f
xorl %eax, %eax
callq 0x4926
leaq 0x15125(%rip), %rdi     # 0x1a5a0
movl %ebp, %edx
xorl %eax, %eax
callq 0x4926
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/misc/bamcheck.c
// Function: is_in_regions
int is_in_regions(bam1_t *bam_line, stats_t *stats)
{
    if ( !stats->regions ) return 1;

    if ( bam_line->core.tid >= stats->nregions || bam_line->core.tid<0 ) return 0;
    if ( !stats->is_sorted ) error("The BAM must be sorted in order for -t to work.\n");

    regions_t *reg = &stats->regions[bam_line->core.tid];
    if ( reg->cpos==reg->npos ) return 0;       // done for this chr

    // Find a matching interval or skip this read. No splicing of reads is done, no indels or soft clips considered, 
    //  even small overlap is enough to include the read in the stats.
    int i = reg->cpos;
    while ( i<reg->npos && reg->pos[i].to<=bam_line->core.pos ) i++;
    if ( i>=reg->npos ) { reg->cpos = reg->npos; return 0; }
    if ( bam_line->core.pos + bam_line->core.l_qseq + 1 < reg->pos[i].from ) return 0;
    reg->cpos = i;
    stats->reg_from = reg->pos[i].from;
    stats->reg_to   = reg->pos[i].to;

    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x1b0(%rsi), %rdx
movl $0x1, %eax
testq %rdx, %rdx
je 0x61c1
movslq (%rdi), %rcx
xorl %eax, %eax
testq %rcx, %rcx
js 0x61c1
cmpl 0x1a4(%rsi), %ecx
jge 0x61c1
cmpl $0x0, 0x9c(%rsi)
je 0x620b
leaq (%rcx,%rcx,2), %r8
movslq 0x8(%rdx,%r8,8), %rcx
movl (%rdx,%r8,8), %r10d
cmpl %r10d, %ecx
je 0x61c1
leaq (%rdx,%r8,8), %rdx
cmpl %r10d, %ecx
jge 0x61bd
movslq %r10d, %r14
movq 0x10(%rdx), %r8
movl 0x4(%rdi), %ebx
movq %rcx, %r9
shlq $0x20, %r9
leaq (%r8,%rcx,8), %r15
addq $0x4, %r15
subq %rcx, %r14
xorl %r11d, %r11d
movabsq $0x100000000, %r12      # imm = 0x100000000
cmpl %ebx, (%r15,%r11,8)
ja 0x61cd
addq %r12, %r9
incq %r11
cmpq %r11, %r14
jne 0x61ac
movl %r10d, 0x8(%rdx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl 0x10(%rdi), %eax
leal (%rbx,%rax), %r10d
incl %r10d
movq %r9, %rax
sarq $0x1d, %rax
movl (%r8,%rax), %edi
xorl %eax, %eax
cmpl %edi, %r10d
jb 0x61c1
sarq $0x20, %r9
addl %r11d, %ecx
movl %ecx, 0x8(%rdx)
movl %edi, 0x1a8(%rsi)
movl 0x4(%r8,%r9,8), %eax
movl %eax, 0x1ac(%rsi)
movl $0x1, %eax
jmp 0x61c1
leaq 0x14b52(%rip), %rdi     # 0x1ad64
xorl %eax, %eax
callq 0x4926
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/misc/bamcheck.c
// Function: gcd_percentile
float gcd_percentile(gc_depth_t *gcd, int N, int p)
{
    float n,d;
    int k;

    n = p*(N+1)/100;
    k = n;
    if ( k<=0 ) 
        return gcd[0].depth;
    if ( k>=N ) 
        return gcd[N-1].depth;

    d = n - k;
    return gcd[k-1].depth + d*(gcd[k].depth - gcd[k-1].depth);
}

// Assembly:
leal 0x1(%rsi), %eax
imull %edx, %eax
cltq
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x25, %rax
addl %ecx, %eax
cvtsi2ss %eax, %xmm1
cvttss2si %xmm1, %eax
testl %eax, %eax
jle 0x626c
cmpl %esi, %eax
jge 0x6271
cvtsi2ss %eax, %xmm2
movl %eax, %eax
movl -0x4(%rdi,%rax,8), %ecx
movl 0x4(%rdi,%rax,8), %eax
cvtsi2ss %rcx, %xmm3
subl %ecx, %eax
cvtsi2ss %rax, %xmm0
subss %xmm2, %xmm1
mulss %xmm1, %xmm0
addss %xmm3, %xmm0
retq
movl 0x4(%rdi), %eax
jmp 0x6278
movslq %esi, %rax
movl -0x4(%rdi,%rax,8), %eax
cvtsi2ss %rax, %xmm0
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/misc/bamcheck.c
// Function: gcd_cmp
static int gcd_cmp(const void *a, const void *b)
{
    if ( GCD_t(a)->gc < GCD_t(b)->gc ) return -1;
    if ( GCD_t(a)->gc > GCD_t(b)->gc ) return 1;
    if ( GCD_t(a)->depth < GCD_t(b)->depth ) return -1;
    if ( GCD_t(a)->depth > GCD_t(b)->depth ) return 1;
    return 0;
}

// Assembly:
movss (%rdi), %xmm0
movss (%rsi), %xmm1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
ucomiss %xmm0, %xmm1
ja 0x7306
movl $0x1, %eax
ucomiss %xmm1, %xmm0
ja 0x7306
movl 0x4(%rsi), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, 0x4(%rdi)
jb 0x7306
seta %al
movzbl %al, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/misc/bamcheck.c
// Function: mygetline
size_t mygetline(char **line, size_t *n, FILE *fp)
{
    if (line == NULL || n == NULL || fp == NULL)
    {
        errno = EINVAL;
        return -1;
    }
    if (*n==0 || !*line)
    {
        *line = NULL;
        *n = 0;
    }

    size_t nread=0;
    int c;
    while ((c=getc(fp))!= EOF && c!='\n')
    {
        if ( ++nread>=*n )
        {
            *n += 255;
            *line = realloc(*line, sizeof(char)*(*n));
        }
        (*line)[nread-1] = c;
    }
    if ( nread>=*n )
    {
        *n += 255;
        *line = realloc(*line, sizeof(char)*(*n));
    }
    (*line)[nread] = 0;
    return nread>0 ? nread : -1;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
setne %al
testq %rsi, %rsi
setne %cl
andb %al, %cl
testq %rdx, %rdx
setne %al
testb %al, %cl
jne 0x7341
callq 0x3090
movl $0x16, (%rax)
movq $-0x1, %rax
jmp 0x73d4
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, (%rsi)
je 0x7356
cmpq $0x0, (%rbx)
jne 0x735e
xorl %eax, %eax
movq %rax, (%rbx)
movq %rax, (%r14)
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x35c0
cmpl $-0x1, %eax
je 0x73a3
movl %eax, %ebp
cmpl $0xa, %eax
je 0x73a3
leaq 0x1(%r12), %r13
movq (%r14), %rsi
movq (%rbx), %rax
cmpq %rsi, %r13
jb 0x739a
addq $0xff, %rsi
movq %rsi, (%r14)
movq %rax, %rdi
callq 0x3430
movq %rax, (%rbx)
movb %bpl, (%rax,%r12)
movq %r13, %r12
jmp 0x7361
movq (%r14), %rsi
movq (%rbx), %rax
cmpq %rsi, %r12
jb 0x73c3
addq $0xff, %rsi
movq %rsi, (%r14)
movq %rax, %rdi
callq 0x3430
movq %rax, (%rbx)
movb $0x0, (%rax,%r12)
xorl %eax, %eax
cmpq $0x1, %r12
sbbq %rax, %rax
orq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl 0x1a4(%rdi), %eax
testl %eax, %eax
jle 0x7839
movl $0x10, %r14d
xorl %r15d, %r15d
movq 0x1b0(%rbx), %rcx
cmpl $0x0, -0xc(%rcx,%r14)
je 0x782a
movq (%rcx,%r14), %rdi
callq 0x3060
movl 0x1a4(%rbx), %eax
incq %r15
movslq %eax, %rcx
addq $0x18, %r14
cmpq %rcx, %r15
jl 0x780c
movq 0x1b0(%rbx), %rdi
testq %rdi, %rdi
je 0x784f
popq %rbx
popq %r14
popq %r15
jmp 0x3060
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_aux.c
// Function: bam_aux_append
void bam_aux_append(bam1_t *b, const char tag[2], char type, int len, uint8_t *data)
{
	int ori_len = b->data_len;
	b->data_len += 3 + len;
	b->l_aux += 3 + len;
	if (b->m_data < b->data_len) {
		b->m_data = b->data_len;
		kroundup32(b->m_data);
		b->data = (uint8_t*)realloc(b->data, b->m_data);
	}
	b->data[ori_len] = tag[0]; b->data[ori_len + 1] = tag[1];
	b->data[ori_len + 2] = type;
	memcpy(b->data + ori_len + 3, data, len);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movl %ecx, %r14d
movq %rdi, %r15
movslq 0x24(%rdi), %r13
leal 0x3(%r14), %ecx
leal (%r14,%r13), %eax
addl $0x3, %eax
movl %eax, 0x24(%rdi)
addl %ecx, 0x20(%rdi)
movl %edx, %ebp
movq %rsi, %r12
cmpl %eax, 0x28(%rdi)
jge 0x8927
decl %eax
movl %eax, %ecx
sarl %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x8, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x10, %ecx
orl %eax, %ecx
incl %ecx
movl %ecx, 0x28(%r15)
movq 0x30(%r15), %rdi
movslq %ecx, %rsi
callq 0x3430
movq %rax, 0x30(%r15)
jmp 0x892b
movq 0x30(%r15), %rax
movb (%r12), %cl
movb %cl, (%rax,%r13)
movb 0x1(%r12), %al
movq 0x30(%r15), %rcx
movb %al, 0x1(%rcx,%r13)
movq 0x30(%r15), %rax
movb %bpl, 0x2(%rax,%r13)
movq 0x30(%r15), %rax
leaq (%rax,%r13), %rdi
addq $0x3, %rdi
movslq %r14d, %rdx
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3370
// File: /workspace/github_c_makefile_star2_O3/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
movq 0x8(%rdi), %rax
movq 0x30(%rdi), %rcx
movq %rax, %rdx
shrq $0x30, %rdx
leaq (%rcx,%rdx,4), %rdx
shrl $0x18, %eax
movslq 0x10(%rdi), %r8
addq %r8, %rax
addq %rdx, %rax
leal 0x1(%r8), %edx
shrl $0x1f, %edx
addl %r8d, %edx
incl %edx
sarl %edx
movslq %edx, %rbx
addq %rax, %rbx
movslq 0x24(%rdi), %r14
addq %rcx, %r14
cmpq %r14, %rbx
jae 0x8acd
movsbl (%rsi), %eax
shll $0x8, %eax
movsbl 0x1(%rsi), %ebp
orl %eax, %ebp
movabsq $0x900000009, %r15      # imm = 0x900000009
leaq 0x13040(%rip), %r12     # 0x1ba20
movabsq $0x400000005, %r13      # imm = 0x400000005
movzwl (%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
cmpl %ebp, %eax
je 0x8ad1
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 0x8a4f
movslq (%r12,%rsi,4), %rsi
addq %r12, %rsi
jmpq *%rsi
movzbl (%rax), %ecx
leal -0x41(%rcx), %esi
cmpl $0x22, %esi
ja 0x8a9a
movl $0x1, %edx
btq %rsi, %r13
jae 0x8a9a
movslq 0x4(%rbx), %rcx
movl %edx, %edx
imulq %rcx, %rdx
leaq (%rax,%rdx), %rbx
addq $0x5, %rbx
jmp 0x8a8f
cmpl $0x63, %ecx
je 0x8a89
cmpl $0x5a, %ecx
jne 0x8a67
leaq 0x1(%rax), %rbx
cmpb $0x0, (%rax)
movq %rbx, %rax
jne 0x8a59
jmp 0x8a8f
movl %ecx, %esi
andl $-0x21, %esi
movl $0x2, %edx
cmpl $0x53, %esi
je 0x8a89
addl $-0x46, %ecx
cmpl $0x23, %ecx
ja 0x8ac9
movl $0x4, %edx
btq %rcx, %r15
jae 0x8ac9
addq %rdx, %rax
movq %rax, %rbx
cmpq %r14, %rbx
jb 0x89ea
jmp 0x8acd
movl %ecx, %esi
andb $-0x21, %sil
movl $0x2, %edx
cmpb $0x53, %sil
je 0x8a3b
addl $-0x46, %ecx
cmpl $0x23, %ecx
ja 0x8ac2
movl $0x4, %edx
btq %rcx, %r15
jb 0x8a3b
xorl %edx, %edx
jmp 0x8a3b
xorl %edx, %edx
jmp 0x8a89
xorl %ebx, %ebx
jmp 0x8ad5
addq $0x2, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8b70
leaq 0x12f15(%rip), %rdi     # 0x1ba40
movslq (%rdi,%rsi,4), %rsi
addq %rdi, %rsi
jmpq *%rsi
movzbl (%rax), %ecx
leal -0x41(%rcx), %esi
cmpl $0x22, %esi
ja 0x8c37
movl $0x1, %edx
movabsq $0x400000005, %rdi      # imm = 0x400000005
btq %rsi, %rdi
jae 0x8c37
movslq 0x2(%r14), %rcx
movl %edx, %edx
imulq %rcx, %rdx
leaq (%rax,%rdx), %r15
addq $0x5, %r15
jmp 0x8bc2
cmpl $0x63, %ecx
je 0x8bbc
cmpl $0x5a, %ecx
jne 0x8b88
leaq 0x1(%rax), %r15
cmpb $0x0, (%rax)
movq %r15, %rax
jne 0x8b7a
jmp 0x8bc2
movl %ecx, %esi
andl $-0x21, %esi
movl $0x2, %edx
cmpl $0x53, %esi
je 0x8bbc
addl $-0x46, %ecx
cmpl $0x23, %ecx
ja 0x8c74
movl $0x4, %edx
movabsq $0x900000009, %rsi      # imm = 0x900000009
btq %rcx, %rsi
jae 0x8c74
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 %r15d, %r14d
movq 0x20(%rbx), %xmm0
movd %r14d, %xmm1
pshufd $0x50, %xmm1, %xmm1     # xmm1 = xmm1[0,0,1,1]
paddd %xmm0, %xmm1
movq %xmm1, 0x20(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ecx, %esi
andb $-0x21, %sil
movl $0x2, %edx
cmpb $0x53, %sil
je 0x8b5c
addl $-0x46, %ecx
cmpl $0x23, %ecx
ja 0x8c6d
movl $0x4, %edx
movabsq $0x900000009, %rsi      # imm = 0x900000009
btq %rcx, %rsi
jb 0x8b5c
xorl %edx, %edx
jmp 0x8b5c
xorl %edx, %edx
jmp 0x8bbc
// File: /workspace/github_c_makefile_star2_O3/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 0x8d38
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 0x8d47
leaq 0x12d6e(%rip), %rdi     # 0x1ba60
movslq (%rdi,%rsi,4), %rsi
addq %rdi, %rsi
jmpq *%rsi
movzbl (%rax), %ecx
leal -0x41(%rcx), %esi
cmpl $0x22, %esi
ja 0x8dc1
movl $0x1, %edx
movabsq $0x400000005, %rdi      # imm = 0x400000005
btq %rsi, %rdi
jae 0x8dc1
movslq 0x2(%r12), %rcx
movl %edx, %edx
imulq %rcx, %rdx
leaq (%rax,%rdx), %r12
addq $0x5, %r12
jmp 0x8d95
movl 0x20(%rbx), %eax
subl %eax, 0x24(%rbx)
movl $0x0, 0x20(%rbx)
jmp 0x8db3
cmpl $0x63, %ecx
je 0x8d8f
cmpl $0x5a, %ecx
jne 0x8d5f
leaq 0x1(%rax), %r12
cmpb $0x0, (%rax)
movq %r12, %rax
jne 0x8d51
jmp 0x8d95
movl %ecx, %esi
andl $-0x21, %esi
movl $0x2, %edx
cmpl $0x53, %esi
je 0x8d8f
addl $-0x46, %ecx
cmpl $0x23, %ecx
ja 0x8dfe
movl $0x4, %edx
movabsq $0x900000009, %rsi      # imm = 0x900000009
btq %rcx, %rsi
jae 0x8dfe
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 0x8d23
addl $-0x46, %ecx
cmpl $0x23, %ecx
ja 0x8df7
movl $0x4, %edx
movabsq $0x900000009, %rsi      # imm = 0x900000009
btq %rcx, %rsi
jb 0x8d23
xorl %edx, %edx
jmp 0x8d23
xorl %edx, %edx
jmp 0x8d8f
// File: /workspace/github_c_makefile_star2_O3/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 0x9337
movq %rsi, %rbx
movsbl (%rsi), %edi
xorl %r8d, %r8d
movl $0x0, %ecx
testl %edi, %edi
je 0x9341
movb 0x1(%rbx), %al
testb %al, %al
je 0x933f
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 0x9320
jmp 0x9341
xorl %r12d, %r12d
jmp 0x93e1
movl %edi, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %r10d
movl %edx, %r14d
leal -0x1(%r10), %edi
movl %ecx, %eax
xorl %edx, %edx
divl %edi
movl %edx, %r13d
incl %r13d
movq (%rsp), %rax
movq 0x10(%rax), %rdi
movl %r14d, %r12d
movq %r10, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %ebp
leal (%r12,%r12), %r15d
andl $0x1e, %r15d
movl %ebp, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x93d4
testb $0x1, %al
jne 0x93b8
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl %r12d, %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 0x93d4
addl %r13d, %r12d
cmpl %r10d, %r12d
movl %r10d, %eax
cmovbl %r8d, %eax
subl %eax, %r12d
cmpl %r14d, %r12d
jne 0x9370
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x93f9
movl %r15d, %ecx
shrl %cl, %ebp
testb $0x3, %bpl
cmovnel %r10d, %r12d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %r10d, %r12d
je 0x93f9
movq (%rsp), %rax
movq 0x20(%rax), %rax
movl %r12d, %ecx
movl (%rax,%rcx,4), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x99fa
movb (%rdi), %cl
leal -0x43(%rcx), %edx
rolb $0x4, %dl
cmpb $0x3, %dl
ja 0x99ef
movzbl %dl, %eax
leaq 0x120ae(%rip), %rcx     # 0x1ba80
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 0x99fa
movl 0x1(%rdi), %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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), %edx
movq 0x8(%rdi), %rdi
shrq $0x30, %rdi
jne 0x9a4c
movl %edx, %eax
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leal -0x1(%rdi), %r8d
xorl %r9d, %r9d
movl $0x3c1a7, %r10d         # imm = 0x3C1A7
xorl %r11d, %r11d
movl %edx, %ebx
movl (%rsi,%r11,4), %ebp
movl %ebp, %ecx
andl $0xf, %ecx
shrl $0x4, %ebp
cmpl $0x9, %ecx
jne 0x9ad6
cmpq %r8, %r11
je 0x9b14
movl %edx, %eax
testq %r11, %r11
je 0x9ae9
xorl %eax, %eax
movq %r9, %r14
xorl %r15d, %r15d
movl -0x4(%rsi,%r14), %ecx
movl %ecx, %r13d
shrl $0x4, %r13d
addl %ecx, %ecx
movl $0x3c1a7, %r12d         # imm = 0x3C1A7
shrl %cl, %r12d
btl %ecx, %r10d
jb 0x9ab3
movl %r15d, %ecx
jmp 0x9abb
leal (%r15,%r13), %ecx
cmpl %ebp, %ecx
jge 0x9afd
shll $0x1e, %r12d
sarl $0x1f, %r12d
andl %r13d, %r12d
addl %r12d, %eax
movl %ecx, %r15d
addq $-0x4, %r14
jne 0x9a91
movl %edx, %eax
jmp 0x9ae9
addl %ecx, %ecx
movl $0x3c1a7, %eax          # imm = 0x3C1A7
shrl %cl, %eax
shll $0x1e, %eax
sarl $0x1f, %eax
andl %ebp, %eax
addl %ebx, %eax
incq %r11
addq $0x4, %r9
movl %eax, %ebx
cmpq %rdi, %r11
jne 0x9a68
jmp 0x9b16
shll $0x1e, %r12d
sarl $0x1f, %r12d
subl %ebp, %r15d
andl %r12d, %r15d
subl %eax, %ebx
addl %r15d, %ebx
movl %ebx, %eax
jmp 0x9ae9
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x9b5d
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 0x9b36
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x9bfa
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x9bbe
cmpl $0x0, (%rbx)
jle 0x9bb0
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3060
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x9b94
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 0x9bd5
callq 0x15ff8
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x9be3
callq 0x16fcb
movq %rbx, %rdi
callq 0x92b3
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3060
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1860c
leaq 0x30(%r14), %r12
cmpl $0x0, 0x19c4c(%rip)     # 0x23a50
je 0x9e44
movl (%r12), %eax
bswapl %eax
leaq 0xc(%rsp), %r15
movl %eax, (%r15)
movl $0x4, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1860c
movl (%r12), %edx
testq %rdx, %rdx
je 0x9e39
movq 0x38(%r14), %rsi
movq %rbx, %rdi
callq 0x1860c
movl (%r14), %eax
bswapl %eax
movl %eax, 0xc(%rsp)
jmp 0x9e6f
movl $0x4, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1860c
movl (%r12), %edx
movq %r14, %r15
testq %rdx, %rdx
je 0x9e6f
movq 0x38(%r14), %rsi
movq %rbx, %rdi
callq 0x1860c
movq %r14, %r15
movl $0x4, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1860c
cmpl $0x0, (%r14)
je 0x9f22
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, 0x19ba0(%rip)     # 0x23a50
leaq 0x10(%rsp), %rsi
je 0x9ec0
bswapl %eax
movl %eax, 0xc(%rsp)
movq %r15, %rsi
movl $0x4, %edx
movq %rbx, %rdi
callq 0x1860c
movslq 0x10(%rsp), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1860c
movq 0x10(%r14), %rsi
addq %r13, %rsi
cmpl $0x0, 0x19b65(%rip)     # 0x23a50
je 0x9f02
movl (%rsi), %eax
bswapl %eax
movl %eax, 0xc(%rsp)
movl $0x4, %edx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0x9f0a
movl $0x4, %edx
movq %rbx, %rdi
callq 0x1860c
incq %rbp
movl (%r14), %eax
addq $0x4, %r13
cmpq %rax, %rbp
jne 0x9e93
movq %rbx, %rdi
callq 0x1831c
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_O3/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 %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r12
movslq %edx, %r15
leal 0x20(%r15), %r13d
movl %r13d, 0x8(%rsp)
movq (%rsi), %rax
movq %rax, 0x10(%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)
movdqu 0x10(%rsi), %xmm0
movdqa %xmm0, 0x20(%rsp)
leal 0x24(%r15), %esi
callq 0x185b1
cmpl $0x0, 0x191a7(%rip)     # 0x23a50
je 0xa912
xorl %eax, %eax
pxor %xmm0, %xmm0
movdqa 0x10(%rsp,%rax,4), %xmm1
movdqa %xmm1, %xmm2
punpckhbw %xmm0, %xmm2    # xmm2 = xmm2[8],xmm0[8],xmm2[9],xmm0[9],xmm2[10],xmm0[10],xmm2[11],xmm0[11],xmm2[12],xmm0[12],xmm2[13],xmm0[13],xmm2[14],xmm0[14],xmm2[15],xmm0[15]
pshuflw $0x1b, %xmm2, %xmm2     # xmm2 = xmm2[3,2,1,0,4,5,6,7]
pshufhw $0x1b, %xmm2, %xmm2     # xmm2 = xmm2[0,1,2,3,7,6,5,4]
punpcklbw %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
pshuflw $0x1b, %xmm1, %xmm1     # xmm1 = xmm1[3,2,1,0,4,5,6,7]
pshufhw $0x1b, %xmm1, %xmm1     # xmm1 = xmm1[0,1,2,3,7,6,5,4]
packuswb %xmm2, %xmm1
movdqa %xmm1, 0x10(%rsp,%rax,4)
addq $0x4, %rax
cmpq $0x8, %rax
jne 0xa8b1
bswapl %r13d
leaq 0xc(%rsp), %rsi
movl %r13d, (%rsi)
movl $0x4, %edx
movq %r12, %rdi
callq 0x1860c
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0xa106
jmp 0xa924
leaq 0x8(%rsp), %rsi
movl $0x4, %edx
movq %r12, %rdi
callq 0x1860c
leaq 0x10(%rsp), %rsi
movl $0x20, %edx
movq %r12, %rdi
callq 0x1860c
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x1860c
cmpl $0x0, 0x19105(%rip)     # 0x23a50
je 0xa95a
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0xa106
movl 0x8(%rsp), %eax
addl $0x4, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xc5cc
js 0xc5e6
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 0xc5a2
jmp 0xc61d
movq (%rbx), %rdx
leaq 0x1(%rdx), %rcx
cmpq 0x8(%rbx), %rcx
jae 0xc6b1
movq 0x10(%rbx), %rax
jmp 0xc6fd
xorl %r14d, %r14d
movl $0xcccccccd, %eax       # imm = 0xCCCCCCCD
movl %edi, %ecx
negl %ecx
movq %rcx, %rdx
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
negl %edx
cmpl $0xa, %ecx
movl %edx, %ecx
jae 0xc5f0
testl %edi, %edi
jns 0xc62f
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 0xc686
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 0xc704
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
ja 0xc691
jmp 0xc704
movq %rcx, %rax
shrq %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x3430
movq %rax, 0x10(%rbx)
movq (%rbx), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, (%rbx)
movb $0x30, (%rax,%rdx)
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_O3/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 0xc79c
movl 0x14(%rsi), %edx
cmpl $-0x1, %edx
jl 0xc79c
testq %rdi, %rdi
je 0xc760
movl (%rdi), %edi
cmpl %edi, %ecx
setge %cl
cmpl %edi, %edx
setge %dl
orb %cl, %dl
jne 0xc79c
movl 0x8(%rsi), %ecx
shrl $0x18, %ecx
cmpl %ecx, 0x24(%rsi)
jl 0xc79c
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_O3/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
movq 0x18(%rdi), %rax
testq %rax, %rax
jne 0xc7bd
movq 0x38(%rbx), %rdi
callq 0x162ec
movq %rax, 0x18(%rbx)
cmpq $0x0, 0x28(%rbx)
jne 0xc7e5
leaq 0xdea4(%rip), %rsi      # 0x1a66f
leaq 0xe5c3(%rip), %rdx      # 0x1ad95
leaq 0xf4bb(%rip), %rcx      # 0x1bc94
movq %rax, %rdi
callq 0x1664d
movq %rax, 0x28(%rbx)
leaq 0xde83(%rip), %rsi      # 0x1a66f
movq %r14, %rdi
callq 0x8974
testq %rax, %rax
je 0xc80f
movq 0x28(%rbx), %rdi
incq %rax
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x16ea2
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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 $0x18, %rsp
movq %rsi, %r14
cmpb $0x2d, (%rdi)
jne 0xc83c
cmpb $0x0, 0x1(%rdi)
je 0xc999
leaq 0x100e3(%rip), %rsi     # 0x1c926
callq 0x3350
movq %rax, %rbx
movl $0x1, %edi
movl $0x18, %esi
callq 0x32e0
movq %rax, %r15
movl $0x1, %edi
movl $0x20, %esi
callq 0x32e0
movq %rax, %r12
movq %rbx, 0x10(%rsp)
movq %rbx, 0x18(%rax)
movl $0x4000, %edi           # imm = 0x4000
callq 0x33e0
movq %rax, (%r12)
leaq 0x4(%rsp), %rcx
movq %r12, %rdi
movl $0xa, %esi
movq %r15, %rdx
callq 0xc9bb
testl %eax, %eax
jle 0xc953
movq %r14, 0x8(%rsp)
xorl %ebx, %ebx
leaq 0x4(%rsp), %rbp
xorl %r13d, %r13d
xorl %r14d, %r14d
movq %r13, %rdx
movl %r14d, %eax
cmpq %rax, %rbx
jne 0xc8f0
movq %r12, %r13
movq %rbp, %r12
leal (%r14,%r14), %ebp
testl %r14d, %r14d
movl $0x10, %eax
cmovel %eax, %ebp
movslq %ebp, %rsi
shlq $0x3, %rsi
movq %rdx, %rdi
callq 0x3430
movq %rax, %rdx
movl %ebp, %r14d
movq %r12, %rbp
movq %r13, %r12
movq (%r15), %rdi
movq 0x10(%r15), %rax
cmpb $0xd, -0x1(%rax,%rdi)
jne 0xc90d
leaq -0x1(%rdi), %rcx
movq %rcx, (%r15)
movb $0x0, -0x1(%rax,%rdi)
movq %rcx, %rdi
movq %rdx, %r13
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 0xc9bb
testl %eax, %eax
jg 0xc8b5
movq 0x8(%rsp), %r14
jmp 0xc958
xorl %ebx, %ebx
xorl %r13d, %r13d
movq (%r12), %rdi
callq 0x3060
movq %r12, %rdi
callq 0x3060
movq 0x10(%rsp), %rdi
callq 0x3050
movq 0x10(%r15), %rdi
callq 0x3060
movq %r15, %rdi
callq 0x3060
movl %ebx, (%r14)
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x16628(%rip), %rax     # 0x22fc8
movq (%rax), %rdi
callq 0x3390
leaq 0xff77(%rip), %rsi      # 0x1c926
movl %eax, %edi
callq 0x31a0
jmp 0xc848
// File: /workspace/github_c_makefile_star2_O3/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 0x9b5e
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)
movl (%r14), %esi
testl %esi, %esi
je 0xcd59
xorl %eax, %eax
xorl %edx, %edx
movq 0x10(%r14), %rcx
movl %edx, %edi
shrl $0x4, %edi
movl (%rcx,%rdi,4), %edi
movl %eax, %ecx
andb $0x1e, %cl
shrl %cl, %edi
testb $0x3, %dil
jne 0xcd50
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)
movl (%r14), %esi
incl %edx
addl $0x2, %eax
cmpl %esi, %edx
jne 0xcd0b
movq %rbx, %rdi
callq 0x8e02
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xcea8
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
jne 0xcdea
movq 0x38(%rbx), %rdi
callq 0x162ec
movq %rax, %rdi
movq %rax, 0x18(%rbx)
leaq 0xeffa(%rip), %rsi      # 0x1bdeb
leaq 0xeff6(%rip), %rdx      # 0x1bdee
movq %rbx, %rcx
callq 0x16d31
movslq (%rbx), %r15
testq %r15, %r15
je 0xcea8
movq %rax, %r14
leaq 0x8(%rbx), %r12
movl $0x8, %esi
movq %r15, %rdi
callq 0x32e0
movq %rax, (%r12)
testl %r15d, %r15d
jle 0xce45
xorl %r13d, %r13d
movq (%r14,%r13,8), %rdi
callq 0x3590
movq (%r12), %rcx
movq %rax, (%rcx,%r13,8)
incq %r13
cmpq %r13, %r15
jne 0xce2c
movq %r14, %rdi
callq 0x3060
movq 0x18(%rbx), %rdi
leaq 0xef93(%rip), %rsi      # 0x1bdeb
leaq 0xef92(%rip), %rdx      # 0x1bdf1
movq %rbx, %rcx
callq 0x16d31
movq %rax, %r14
movslq (%rbx), %r15
movl $0x4, %esi
movq %r15, %rdi
callq 0x32e0
movq %rax, 0x10(%rbx)
testq %r15, %r15
jle 0xce9e
movq %rax, %r12
xorl %r13d, %r13d
movq (%r14,%r13,8), %rdi
callq 0x34f0
movl %eax, (%r12,%r13,4)
incq %r13
cmpq %r13, %r15
jne 0xce89
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_O3/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 0x9b5e
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %r15
leaq 0x4(%rsp), %rcx
movl $0x1, %esi
movq %r15, %rdx
callq 0xc9bb
testl %eax, %eax
js 0xcf5a
leaq 0x4(%rsp), %r12
movq 0x10(%r15), %rax
cmpb $0x40, (%rax)
jne 0xcf5a
movb 0x4(%rsp), %cl
movq (%r15), %rdx
movb %cl, (%rax,%rdx)
movq %r14, %rdi
movq %r15, %rsi
callq 0xcf80
cmpl $0xa, 0x4(%rsp)
je 0xcf3e
movq 0x8(%rbx), %rdi
movl $0xa, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0xc9bb
movq (%r15), %rax
movq 0x10(%r15), %rcx
movb $0xa, (%rcx,%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0xcf80
incq 0x18(%rbx)
movq 0x8(%rbx), %rdi
movl $0x1, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0xc9bb
testl %eax, %eax
jns 0xceef
movq %r14, %rdi
callq 0xcd98
movq %r14, %rdi
callq 0x8e02
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_O3/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), %edi
movq (%rsi), %rdx
leaq 0x1(%rdi), %rax
movq %rax, %xmm0
movdqa 0xecfb(%rip), %xmm1     # 0x1bca0
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movq %rdx, %xmm0
movq %rdi, %xmm2
punpcklqdq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0]
paddq %xmm1, %xmm2
movdqa %xmm2, %xmm0
psrlq $0x1, %xmm0
por %xmm2, %xmm0
movdqa %xmm0, %xmm1
psrlq $0x2, %xmm1
por %xmm0, %xmm1
movdqa %xmm1, %xmm0
psrlq $0x4, %xmm0
por %xmm1, %xmm0
movdqa %xmm0, %xmm1
psrlq $0x8, %xmm1
por %xmm0, %xmm1
movdqa %xmm1, %xmm0
psrlq $0x10, %xmm0
por %xmm1, %xmm0
pcmpeqd %xmm1, %xmm1
psubq %xmm1, %xmm0
movq %xmm0, %r12
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movq %xmm0, %r15
cmpq %r15, %r12
jae 0xd037
movl %r15d, 0x34(%rbx)
movq 0x38(%rbx), %rdi
movq %r15, %rsi
callq 0x3430
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0xd09d
movl 0x30(%rbx), %edi
movq (%r14), %rdx
leaq (%rdx,%rdi), %rax
incq %rax
movl 0x34(%rbx), %ecx
cmpq %rcx, %rax
jae 0xd077
incq %rdx
addq 0x38(%rbx), %rdi
movq 0x10(%r14), %rsi
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 0x15f7a(%rip), %rdx     # 0x22ff8
movq (%rdx), %rdi
leaq 0xefc3(%rip), %rsi      # 0x1c04b
movq %rax, %rdx
movq %r12, %r8
movq %r15, %r9
xorl %eax, %eax
callq 0x3320
callq 0x3080
movq %r15, %rdi
callq 0x3d6f
// File: /workspace/github_c_makefile_star2_O3/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
cmpb $0x2d, (%rdi)
jne 0xe321
cmpb $0x0, 0x1(%rdi)
je 0xe392
leaq 0xcadb(%rip), %rsi      # 0x1ae03
callq 0x3350
movq %rax, %rbx
testq %rax, %rax
je 0xe386
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 0xe389
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
movq 0x14c2f(%rip), %rax     # 0x22fc8
movq (%rax), %rdi
callq 0x3390
leaq 0xca5b(%rip), %rsi      # 0x1ae03
movl %eax, %edi
callq 0x31a0
jmp 0xe32d
// File: /workspace/github_c_makefile_star2_O3/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 0xe406
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0xe3d9
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
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x9b5e
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)
testq %r15, %r15
jle 0xe4c7
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 0xe497
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq