// File: CK7[P]abawaca/src/abawaca.cpp
// Function: get_fasta(std::set<unsigned long, std::less<unsigned long>, std::allocator<unsigned long>> const&, ScafDpData const&, char const*)
size_t get_fasta(const set<size_t>& scafs, const ScafDpData& scaf_db, const char* fasta_out)
{
	size_t total_bps = 0;
	Bio::SeqIOWrite_fasta<Bio::DNASequence>  writer(fasta_out);


	for(auto sit=scafs.begin(); sit!=scafs.end(); sit++) {
		const Bio::DNASequence* seq_obj = scaf_db.get_scaf(*sit)->get_seq_obj();
		if(seq_obj == NULL) {
			cerr << "Warning: could not find scaffold " << scaf_db.scaf_id2name(*sit) << " (" << *sit << ") in fasta file" << endl;
			continue;
		}
		writer.write_seq(*seq_obj);
		total_bps += seq_obj->seq().size();
	}

	return total_bps;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x350, %rsp            # imm = 0x350
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x2e8(%rbp)
leaq -0x281(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x5760
movq -0x2e8(%rbp), %rsi
movq -0x2e0(%rbp), %rdx
leaq -0x280(%rbp), %rdi
callq 0x55b0
jmp 0x99f9
leaq -0x260(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0xa860
jmp 0x9a0e
leaq -0x280(%rbp), %rdi
callq 0x5250
leaq -0x281(%rbp), %rdi
callq 0x5460
movq -0x8(%rbp), %rdi
callq 0xa8e0
movq %rax, -0x2a0(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa910
movq %rax, -0x2a8(%rbp)
leaq -0x2a0(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0xa3a0
testb $0x1, %al
jne 0x9a62
jmp 0x9c90
movq -0x10(%rbp), %rax
movq %rax, -0x2f8(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0xa400
movq -0x2f8(%rbp), %rdi
movq (%rax), %rsi
callq 0xa940
movq %rax, -0x2f0(%rbp)
jmp 0x9a91
movq -0x2f0(%rbp), %rdi
callq 0xa9a0
movq %rax, -0x300(%rbp)
jmp 0x9aa6
movq -0x300(%rbp), %rax
movq %rax, -0x2b0(%rbp)
cmpq $0x0, -0x2b0(%rbp)
jne 0x9c28
movq 0x4351f(%rip), %rdi     # 0x4cfe8
leaq 0x2b73e(%rip), %rsi     # 0x3520e
callq 0x53f0
movq %rax, -0x308(%rbp)
jmp 0x9ade
movq -0x10(%rbp), %rax
movq %rax, -0x310(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0xa400
movq -0x310(%rbp), %rsi
movq (%rax), %rdx
leaq -0x2d0(%rbp), %rdi
callq 0x13c70
jmp 0x9b0d
movq -0x308(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x5360
movq %rax, -0x318(%rbp)
jmp 0x9b29
movq -0x318(%rbp), %rdi
leaq 0x2c3ee(%rip), %rsi     # 0x35f25
callq 0x53f0
movq %rax, -0x320(%rbp)
jmp 0x9b45
leaq -0x2a0(%rbp), %rdi
callq 0xa400
movq -0x320(%rbp), %rdi
movq (%rax), %rsi
callq 0x50f0
movq %rax, -0x328(%rbp)
jmp 0x9b69
movq -0x328(%rbp), %rdi
leaq 0x2b6b9(%rip), %rsi     # 0x35230
callq 0x53f0
movq %rax, -0x330(%rbp)
jmp 0x9b85
movq -0x330(%rbp), %rdi
movq 0x433fd(%rip), %rsi     # 0x4cf90
callq 0x5440
jmp 0x9b9a
leaq -0x2d0(%rbp), %rdi
callq 0x5250
jmp 0x9c76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x290(%rbp)
movl %eax, -0x294(%rbp)
jmp 0x9bdd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x290(%rbp)
movl %eax, -0x294(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x5250
leaq -0x281(%rbp), %rdi
callq 0x5460
jmp 0x9cc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x290(%rbp)
movl %eax, -0x294(%rbp)
jmp 0x9cb7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x290(%rbp)
movl %eax, -0x294(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x5250
jmp 0x9cb7
movq -0x2b0(%rbp), %rsi
leaq -0x260(%rbp), %rdi
callq 0xa9c0
jmp 0x9c3d
movq -0x2b0(%rbp), %rdi
callq 0xabe0
movq %rax, -0x338(%rbp)
jmp 0x9c52
movq -0x338(%rbp), %rdi
callq 0xac00
movq %rax, -0x340(%rbp)
jmp 0x9c67
movq -0x340(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0x2a0(%rbp), %rdi
xorl %esi, %esi
callq 0xa420
movq %rax, -0x2d8(%rbp)
jmp 0x9a36
movq -0x20(%rbp), %rax
movq %rax, -0x348(%rbp)
leaq -0x260(%rbp), %rdi
callq 0xac20
movq -0x348(%rbp), %rax
addq $0x350, %rsp            # imm = 0x350
popq %rbp
retq
leaq -0x260(%rbp), %rdi
callq 0xac20
movq -0x290(%rbp), %rdi
callq 0x5750
nop