// File: conchoecia[P]fasta_stats/src/fasta_stats.cc
// Function: print_stats(std::__cxx11::list<Scaffold, std::allocator<Scaffold>> const&)
static void print_stats(const std::list<Scaffold> &scaffolds) {
	// make contig list
	std::list<Contig> contigs;
	std::list<Scaffold>::const_iterator a = scaffolds.begin();
	std::list<Scaffold>::const_iterator end_a = scaffolds.end();
	for (; a != end_a; ++a) {
		contigs.insert(contigs.end(), a->contigs.begin(), a->contigs.end());
	}
	contigs.sort();
	// collect statistics
	long scaffold_seq = 0;
	long contig_seq = 0;
	long gap_seq = 0;
	long big_scaffolds = 0;
	long big_scaffold_seq = 0;
	for (a = scaffolds.begin(); a != end_a; ++a) {
		scaffold_seq += a->total_size;
		contig_seq += a->contig_size;
		gap_seq += a->gap_size;
		if (a->total_size > opt_big_size) {
			++big_scaffolds;
			big_scaffold_seq += a->total_size;
		}
	}
	long n50_scafs = 0;
	long x = 0;
	for (a = scaffolds.begin(); a != end_a && 2 * x < scaffold_seq; ++a) {
		++n50_scafs;
		x += a->total_size;
	}
	if (a != scaffolds.begin()) {
		--a;
	}
	long n50_contigs = 0;
	std::list<Contig>::const_iterator b = contigs.begin();
	std::list<Contig>::const_iterator end_b = contigs.end();
	for (x = 0; b != end_b && 2 * x < contig_seq; ++b) {
		++n50_contigs;
		x += b->size();
	}
	if (b != contigs.begin()) {
		--b;
	}
	// print statistics
	printf("Main genome scaffold total: %lu\n", scaffolds.size());
	printf("Main genome contig total:   %lu\n", contigs.size());
	printf("Main genome scaffold sequence total: ");
	scaled_print(scaffold_seq);
	printf("\nMain genome contig sequence total:   ");
	scaled_print(contig_seq);
	printf(" (-> %4.1f%% gap)\n", (double)100 * gap_seq / scaffold_seq);
	printf("Main genome scaffold N/L50: %ld/", n50_scafs);
	scaled_print(a->total_size);
	printf("\nMain genome contig N/L50:   %ld/", n50_contigs);
	scaled_print(b->size());
	printf("\nNumber of scaffolds > %ld KB: %ld\n", opt_big_size / 1000, big_scaffolds);
	printf("%% main genome in scaffolds > %ld KB: %4.1f%%\n", opt_big_size / 1000, (double)100 * big_scaffold_seq / scaffold_seq);
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x110(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x7bb0
movq 0x110(%rsp), %rdi
callq 0x7bc0
movq %rax, 0xf0(%rsp)
movq 0x110(%rsp), %rdi
callq 0x7bf0
movq %rax, 0xe8(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x7a70
testb $0x1, %al
jne 0x3364
jmp 0x3445
leaq 0xf8(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x5bf0
movq %rax, 0xd8(%rsp)
leaq 0xe0(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x7160
leaq 0xf0(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x7d30
movq %rax, %rdi
addq $0x20, %rdi
callq 0x59b0
movq 0x10(%rsp), %rdi
movq %rax, 0xd0(%rsp)
callq 0x7d30
movq %rax, %rdi
addq $0x20, %rdi
callq 0x59e0
movq 0x18(%rsp), %rdi
movq %rax, 0xc8(%rsp)
movq 0xe0(%rsp), %rsi
movq 0xd0(%rsp), %rdx
movq 0xc8(%rsp), %rcx
callq 0x7c20
movq %rax, 0x20(%rsp)
jmp 0x3400
movq 0x20(%rsp), %rax
movq %rax, 0xb0(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x7a50
jmp 0x3346
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc0(%rsp)
movl %eax, 0xbc(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x58c0
jmp 0x393d
leaq 0xf8(%rsp), %rdi
callq 0x7d60
jmp 0x3454
movq $0x0, 0xa8(%rsp)
movq $0x0, 0xa0(%rsp)
movq $0x0, 0x98(%rsp)
movq $0x0, 0x90(%rsp)
movq $0x0, 0x88(%rsp)
movq 0x110(%rsp), %rdi
callq 0x7bc0
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0xf0(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x7a70
testb $0x1, %al
jne 0x34d3
jmp 0x3596
leaq 0xf0(%rsp), %rdi
callq 0x7d30
movq (%rax), %rax
addq 0xa8(%rsp), %rax
movq %rax, 0xa8(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x7d30
movq 0x8(%rax), %rax
addq 0xa0(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x7d30
movq 0x10(%rax), %rax
addq 0x98(%rsp), %rax
movq %rax, 0x98(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x7d30
movq (%rax), %rax
cmpq 0x12d24(%rip), %rax     # 0x16270
jle 0x3582
movq 0x90(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x7d30
movq (%rax), %rax
addq 0x88(%rsp), %rax
movq %rax, 0x88(%rsp)
jmp 0x3584
leaq 0xf0(%rsp), %rdi
callq 0x7a50
jmp 0x34b5
movq $0x0, 0x78(%rsp)
movq $0x0, 0x70(%rsp)
movq 0x110(%rsp), %rdi
callq 0x7bc0
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0xf0(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x7a70
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xf(%rsp)
jne 0x35eb
jmp 0x3602
movq 0x70(%rsp), %rax
shlq %rax
cmpq 0xa8(%rsp), %rax
setl %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x360c
jmp 0x3643
movq 0x78(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x78(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x7d30
movq (%rax), %rax
addq 0x70(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x7a50
jmp 0x35c7
movq 0x110(%rsp), %rdi
callq 0x7bc0
movq %rax, 0x60(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x7a70
testb $0x1, %al
jne 0x366d
jmp 0x367a
leaq 0xf0(%rsp), %rdi
callq 0x8150
movq $0x0, 0x58(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x7130
movq %rax, 0x48(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x7160
leaq 0xf8(%rsp), %rdi
callq 0x5bf0
movq %rax, 0x38(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x7160
movq $0x0, 0x70(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x5af0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xe(%rsp)
jne 0x36ec
jmp 0x3703
movq 0x70(%rsp), %rax
shlq %rax
cmpq 0xa0(%rsp), %rax
setl %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
testb $0x1, %al
jne 0x370d
jmp 0x3743
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x7180
movq %rax, %rdi
callq 0x71a0
addq 0x70(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x5b80
jmp 0x36ce
leaq 0xf8(%rsp), %rdi
callq 0x7130
movq %rax, 0x28(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x7160
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x5af0
testb $0x1, %al
jne 0x3779
jmp 0x3783
leaq 0x50(%rsp), %rdi
callq 0x8170
movq 0x110(%rsp), %rdi
callq 0x8190
movq %rax, %rsi
leaq 0xbb0b(%rip), %rdi      # 0xf2a5
xorl %eax, %eax
callq 0x2050
jmp 0x37a3
leaq 0xf8(%rsp), %rdi
callq 0x6c80
movq %rax, %rsi
leaq 0xbb0c(%rip), %rdi      # 0xf2c6
xorl %eax, %eax
callq 0x2050
jmp 0x37c3
leaq 0xbb1d(%rip), %rdi      # 0xf2e7
xorl %eax, %eax
callq 0x2050
jmp 0x37d3
movq 0xa8(%rsp), %rdi
callq 0x4720
jmp 0x37e2
leaq 0xbb24(%rip), %rdi      # 0xf30d
xorl %eax, %eax
callq 0x2050
jmp 0x37f2
movq 0xa0(%rsp), %rdi
callq 0x4720
jmp 0x3801
cvtsi2sdq 0x98(%rsp), %xmm0
movsd 0xb925(%rip), %xmm1     # 0xf138
mulsd %xmm1, %xmm0
cvtsi2sdq 0xa8(%rsp), %xmm1
divsd %xmm1, %xmm0
leaq 0xbb08(%rip), %rdi      # 0xf334
movb $0x1, %al
callq 0x2050
jmp 0x3835
movq 0x78(%rsp), %rsi
leaq 0xbb06(%rip), %rdi      # 0xf347
xorl %eax, %eax
callq 0x2050
jmp 0x384a
leaq 0xf0(%rsp), %rdi
callq 0x7d30
movq (%rax), %rdi
callq 0x4720
jmp 0x3861
movq 0x58(%rsp), %rsi
leaq 0xbafb(%rip), %rdi      # 0xf368
xorl %eax, %eax
callq 0x2050
jmp 0x3876
leaq 0x50(%rsp), %rdi
callq 0x7180
movq %rax, %rdi
callq 0x71a0
movq %rax, %rdi
callq 0x4720
jmp 0x3892
movq 0x129d7(%rip), %rax     # 0x16270
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
imulq %rcx
movq %rdx, %rsi
movq %rsi, %rdx
shrq $0x3f, %rdx
sarq $0x7, %rsi
addq %rdx, %rsi
movq 0x90(%rsp), %rdx
leaq 0xbac4(%rip), %rdi      # 0xf38a
xorl %eax, %eax
callq 0x2050
jmp 0x38cf
movq 0x1299a(%rip), %rax     # 0x16270
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
imulq %rcx
movq %rdx, %rsi
movq %rsi, %rdx
shrq $0x3f, %rdx
sarq $0x7, %rsi
addq %rdx, %rsi
cvtsi2sdq 0x88(%rsp), %xmm0
movsd 0xb832(%rip), %xmm1     # 0xf138
mulsd %xmm1, %xmm0
cvtsi2sdq 0xa8(%rsp), %xmm1
divsd %xmm1, %xmm0
leaq 0xba8f(%rip), %rdi      # 0xf3ae
movb $0x1, %al
callq 0x2050
jmp 0x3928
leaq 0xf8(%rsp), %rdi
callq 0x58c0
addq $0x118, %rsp            # imm = 0x118
retq
movq 0xc0(%rsp), %rdi
callq 0x2420
nopw (%rax,%rax)