// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_stat.c
// Function: bam_flagstat
int bam_flagstat(int argc, char *argv[])
{
	bamFile fp;
	bam_header_t *header;
	bam_flagstat_t *s;
	if (argc == optind) {
		fprintf(stderr, "Usage: samtools flagstat <in.bam>\n");
		return 1;
	}
	fp = strcmp(argv[optind], "-")? bam_open(argv[optind], "r") : bam_dopen(fileno(stdin), "r");
	assert(fp);
	header = bam_header_read(fp);
	s = bam_flagstat_core(fp);
	printf("%lld + %lld in total (QC-passed reads + QC-failed reads)\n", s->n_reads[0], s->n_reads[1]);
	printf("%lld + %lld duplicates\n", s->n_dup[0], s->n_dup[1]);
	printf("%lld + %lld mapped (%.2f%%:%.2f%%)\n", s->n_mapped[0], s->n_mapped[1], (float)s->n_mapped[0] / s->n_reads[0] * 100.0, (float)s->n_mapped[1] / s->n_reads[1] * 100.0);
	printf("%lld + %lld paired in sequencing\n", s->n_pair_all[0], s->n_pair_all[1]);
	printf("%lld + %lld read1\n", s->n_read1[0], s->n_read1[1]);
	printf("%lld + %lld read2\n", s->n_read2[0], s->n_read2[1]);
	printf("%lld + %lld properly paired (%.2f%%:%.2f%%)\n", s->n_pair_good[0], s->n_pair_good[1], (float)s->n_pair_good[0] / s->n_pair_all[0] * 100.0, (float)s->n_pair_good[1] / s->n_pair_all[1] * 100.0);
	printf("%lld + %lld with itself and mate mapped\n", s->n_pair_map[0], s->n_pair_map[1]);
	printf("%lld + %lld singletons (%.2f%%:%.2f%%)\n", s->n_sgltn[0], s->n_sgltn[1], (float)s->n_sgltn[0] / s->n_pair_all[0] * 100.0, (float)s->n_sgltn[1] / s->n_pair_all[1] * 100.0);
	printf("%lld + %lld with mate mapped to a different chr\n", s->n_diffchr[0], s->n_diffchr[1]);
	printf("%lld + %lld with mate mapped to a different chr (mapQ>=5)\n", s->n_diffhigh[0], s->n_diffhigh[1]);
	free(s);
	bam_header_destroy(header);
	bam_close(fp);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x41765(%rip), %rax     # 0x4ffb8
movslq (%rax), %rax
cmpl %edi, %eax
je 0xeab0
movq (%rsi,%rax,8), %rdi
cmpb $0x2d, (%rdi)
jne 0xe871
cmpb $0x0, 0x1(%rdi)
je 0xea8e
leaq 0x374d7(%rip), %rsi     # 0x45d4f
callq 0x20308
movq %rax, %rbx
testq %rax, %rax
je 0xeabc
movq %rbx, %rdi
callq 0x235fb
movq %rax, %r14
movq %rbx, %rdi
callq 0xe70c
movq %rax, %r15
movq (%rax), %r13
movq 0x8(%rax), %r12
leaq 0x32ad6(%rip), %rdi     # 0x41383
xorl %ebp, %ebp
movq %r13, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3060
movq 0x80(%r15), %rsi
movq 0x88(%r15), %rdx
leaq 0x32aec(%rip), %rdi     # 0x413bd
xorl %eax, %eax
callq 0x3060
movq 0x10(%r15), %rsi
movq 0x18(%r15), %rdx
cvtsi2ss %rsi, %xmm0
cvtsi2ss %r13, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %rdx, %xmm1
movsd 0x329f6(%rip), %xmm3    # 0x412f8
cvtsi2ss %r12, %xmm2
mulsd %xmm3, %xmm0
divss %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
mulsd %xmm3, %xmm1
leaq 0x32ab7(%rip), %rdi     # 0x413d5
movb $0x2, %al
callq 0x3060
movq 0x20(%r15), %r13
movq 0x28(%r15), %r12
leaq 0x32ac5(%rip), %rdi     # 0x413f9
movq %r13, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3060
movq 0x60(%r15), %rsi
movq 0x68(%r15), %rdx
leaq 0x32acb(%rip), %rdi     # 0x4141b
xorl %eax, %eax
callq 0x3060
movq 0x70(%r15), %rsi
movq 0x78(%r15), %rdx
leaq 0x32ac8(%rip), %rdi     # 0x4142e
xorl %eax, %eax
callq 0x3060
movq 0x40(%r15), %rsi
xorps %xmm0, %xmm0
cvtsi2ss %rsi, %xmm0
movq 0x48(%r15), %rdx
xorps %xmm1, %xmm1
cvtsi2ss %r13, %xmm1
movss %xmm1, 0x4(%rsp)
divss %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %rdx, %xmm1
cvtss2sd %xmm0, %xmm0
xorps %xmm3, %xmm3
cvtsi2ss %r12, %xmm3
movss %xmm3, (%rsp)
movsd 0x32948(%rip), %xmm2    # 0x412f8
mulsd %xmm2, %xmm0
divss %xmm3, %xmm1
cvtss2sd %xmm1, %xmm1
mulsd %xmm2, %xmm1
leaq 0x32a7a(%rip), %rdi     # 0x41441
movb $0x2, %al
callq 0x3060
movq 0x30(%r15), %rsi
movq 0x38(%r15), %rdx
leaq 0x32a91(%rip), %rdi     # 0x4146e
xorl %eax, %eax
callq 0x3060
movq 0x50(%r15), %rsi
movq 0x58(%r15), %rdx
xorps %xmm0, %xmm0
cvtsi2ss %rsi, %xmm0
divss 0x4(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %rdx, %xmm1
movsd 0x328ea(%rip), %xmm2    # 0x412f8
mulsd %xmm2, %xmm0
divss (%rsp), %xmm1
cvtss2sd %xmm1, %xmm1
mulsd %xmm2, %xmm1
leaq 0x32a71(%rip), %rdi     # 0x41497
movb $0x2, %al
callq 0x3060
movq 0x90(%r15), %rsi
movq 0x98(%r15), %rdx
leaq 0x32a7d(%rip), %rdi     # 0x414bf
xorl %eax, %eax
callq 0x3060
movq 0xa0(%r15), %rsi
movq 0xa8(%r15), %rdx
leaq 0x32a92(%rip), %rdi     # 0x414f0
xorl %eax, %eax
callq 0x3060
movq %r15, %rdi
callq 0x3350
movq %r14, %rdi
callq 0x23577
movq %rbx, %rdi
callq 0x21311
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4153b(%rip), %rax     # 0x4ffd0
movq (%rax), %rdi
callq 0x3030
leaq 0x372ab(%rip), %rsi     # 0x45d4f
movl %eax, %edi
callq 0x20487
jmp 0xe87d
callq 0x3f9a
movl $0x1, %ebp
jmp 0xea7d
leaq 0x306b6(%rip), %rdi     # 0x3f179
leaq 0x3288f(%rip), %rsi     # 0x41359
leaq 0x32893(%rip), %rcx     # 0x41364
movl $0x3b, %edx
callq 0x31b0
nop