// File: /workspace/github_cpp_makefile_star2_O3/ncbi[P]amr/fasta2parts.cpp
// Function: (anonymous namespace)::ThisApplication::body() const
void body () const final
  {
    const string fName     =               getArg ("in");
    const size_t parts_max = str2<size_t> (getArg ("parts_max"));
    const string dirName   =               getArg ("dir");
    
    if (parts_max <= 1)
      throw runtime_error ("Number of parts must be >= 2");
      

    const size_t chunk_min = (size_t) getFileSize (fName) / parts_max + 1;

    size_t part = 0;
    unique_ptr<OFStream> out;
    size_t seqSize = 0;
    LineInput f (fName); 
    while (f. nextLine ())
    {
      trimTrailing (f. line);
      if (f. line. empty ())
      	continue;
    	if (   f. line [0] == '>'
    	    && seqSize >= chunk_min
    	    && part < parts_max
    	   )
    	{
    	  out. reset ();
    	  seqSize = 0;
    	}
    	if (! out. get ())
    	{
    	  part++;
    	  ASSERT (part <= parts_max);
    	  out. reset (new OFStream (dirName, toString (part), ""));
    	}
   		*out << f. line << endl;
   		seqSize += f. line. size ();
	  }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f8, %rsp            # imm = 0x3F8
movq %rdi, %r14
leaq 0x160(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x47e82(%rip), %rsi     # 0x5204b
leaq 0x47e7d(%rip), %rdx     # 0x5204d
leaq 0x150(%rsp), %rdi
callq 0xaf30
leaq 0x90(%rsp), %rdi
leaq 0x150(%rsp), %rdx
movq %r14, %rsi
callq 0x31fae
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0xa212
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x9530
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x48033(%rip), %rsi     # 0x52255
leaq 0x48035(%rip), %rdx     # 0x5225e
leaq 0x28(%rsp), %rdi
callq 0xaf30
leaq 0x150(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %r14, %rsi
callq 0x31fae
leaq 0x150(%rsp), %rdi
callq 0xb33d
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0xa275
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x9530
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xa291
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x9530
leaq 0x150(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x47dd2(%rip), %rsi     # 0x52075
leaq 0x47dce(%rip), %rdx     # 0x52078
callq 0xaf30
leaq 0x28(%rsp), %rdi
leaq 0x150(%rsp), %rdx
movq %r14, %rsi
callq 0x31fae
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0xa2e1
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x9530
cmpq $0x1, %rbx
jbe 0xa602
leaq 0x90(%rsp), %rdi
callq 0x127b2
xorl %edx, %edx
divq %rbx
movq %rax, 0x68(%rsp)
movq $0x0, (%rsp)
leaq 0x150(%rsp), %rdi
leaq 0x90(%rsp), %rsi
xorl %edx, %edx
callq 0xb906
leaq 0x5f6c8(%rip), %rax     # 0x699f0
leaq 0x3b8(%rsp), %r12
movq %rax, -0x268(%r12)
movl $0x0, -0x8(%r12)
leaq 0x3c8(%rsp), %rax
movq %rax, -0x10(%rax)
xorl %r14d, %r14d
movq %r14, -0x8(%rax)
movb %r14b, (%rax)
leaq 0x3e8(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r14, -0x8(%rax)
movb %r14b, (%rax)
leaq 0x150(%rsp), %r13
xorl %r15d, %r15d
movq %r13, %rdi
callq 0xc2c2
testb %al, %al
je 0xa4d9
movq %r12, %rdi
callq 0xf9c1
movq 0x3c0(%rsp), %rdx
testq %rdx, %rdx
je 0xa375
movq 0x3b8(%rsp), %rsi
cmpb $0x3e, (%rsi)
sete %al
cmpq 0x68(%rsp), %r15
seta %cl
movq (%rsp), %rbp
cmpq %rbx, %rbp
setb %dil
andb %cl, %dil
andb %al, %dil
cmpb $0x1, %dil
jne 0xa3de
testq %r14, %r14
je 0xa3d9
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
movq (%rsp), %rbp
xorl %r15d, %r15d
jmp 0xa3e7
testq %r14, %r14
jne 0xa49a
incq %rbp
movq %rbp, (%rsp)
callq 0x9070
movl $0x0, (%rax)
cmpq %rbx, %rbp
ja 0xa634
movl $0x200, %edi            # imm = 0x200
callq 0x9520
movq %rax, %r14
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0xb676
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x48(%rsp), %rbp
movq %rbp, %rdi
leaq 0x4a345(%rip), %rdx     # 0x5477a
movq %rdx, %rsi
callq 0xaf30
movq %r14, %rdi
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbp, %rcx
callq 0xb6fe
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xa46e
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x9530
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xa48a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x9530
movq 0x3b8(%rsp), %rsi
movq 0x3c0(%rsp), %rdx
movq %r14, %rdi
callq 0x95d0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x9500
movsbl %al, %esi
movq %rbp, %rdi
callq 0x9040
movq %rax, %rdi
callq 0x93c0
addq 0x3c0(%rsp), %r15
jmp 0xa375
leaq 0x5f510(%rip), %rax     # 0x699f0
movq %rax, 0x150(%rsp)
movq 0x3d8(%rsp), %rdi
leaq 0x3e8(%rsp), %rax
cmpq %rax, %rdi
je 0xa50d
movq 0x3e8(%rsp), %rsi
incq %rsi
callq 0x9530
movq 0x3b8(%rsp), %rdi
leaq 0x3c8(%rsp), %rax
cmpq %rax, %rdi
je 0xa532
movq 0x3c8(%rsp), %rsi
incq %rsi
callq 0x9530
leaq 0x5f56f(%rip), %rax     # 0x69aa8
leaq 0x370(%rsp), %rbx
movq %rax, -0x220(%rbx)
movq %rbx, %rdi
callq 0x1be48
leaq 0x5f5b1(%rip), %rax     # 0x69b08
movq %rax, -0x218(%rbx)
leaq 0x258(%rsp), %rbx
leaq 0x5f5c3(%rip), %rax     # 0x69b30
movq %rax, (%rbx)
leaq 0x168(%rsp), %r15
movq %r15, %rdi
callq 0x9460
leaq 0x5f5d1(%rip), %rax     # 0x69b58
movq %rax, -0x10(%r15)
leaq 0x5f5ee(%rip), %rax     # 0x69b80
movq %rax, (%rbx)
movq $0x0, -0x8(%r15)
movq %rbx, %rdi
callq 0x91b0
testq %r14, %r14
je 0xa5b3
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xa5cf
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x9530
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa5f0
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x9530
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x92a0
movq %rax, %r14
leaq 0x47bb9(%rip), %rsi     # 0x521cf
movq %rax, %rdi
callq 0x9220
movq 0x609cb(%rip), %rsi     # 0x6aff0
movq 0x60944(%rip), %rdx     # 0x6af70
movq %r14, %rdi
callq 0x9900
callq 0x9640
testl %eax, %eax
jne 0xa6cf
leaq 0x100(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x47b98(%rip), %rsi     # 0x521ec
leaq 0x47ba9(%rip), %rdx     # 0x52204
leaq 0xf0(%rsp), %rdi
callq 0xaf30
leaq 0x110(%rsp), %rdi
movl $0x5e, %esi
callq 0xb5d4
leaq 0x130(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
leaq 0x110(%rsp), %rdx
callq 0xb52c
leaq 0x47b67(%rip), %rsi     # 0x52205
leaq 0x130(%rsp), %rdi
callq 0x9a00
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0xa6d9
movups (%rcx), %xmm0
movups %xmm0, (%r15)
jmp 0xa6e9
movl $0x1, %edi
callq 0x9650
movq %rdx, 0x70(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x80(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x78(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xe0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x47af6(%rip), %rsi     # 0x5220b
leaq 0x47b30(%rip), %rdx     # 0x5224c
leaq 0xd0(%rsp), %rdi
callq 0xaf30
leaq 0x48071(%rip), %rsi     # 0x527a1
leaq 0xd0(%rsp), %rdi
callq 0x9a00
leaq 0xc0(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0xa762
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0xa775
movq %rdx, 0xb0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xc0(%rsp)
movq 0x8(%rax), %rsi
leaq 0xb0(%rsp), %rdx
movq %rsi, 0x8(%rdx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x48(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xb52c
leaq 0x47aa3(%rip), %rsi     # 0x5224d
leaq 0x48(%rsp), %rdi
callq 0x9a00
leaq 0x18(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0xa7da
movups (%rcx), %xmm0
leaq 0x18(%rsp), %rdx
movups %xmm0, (%rdx)
jmp 0xa7e7
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0xd6ee
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xa82c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x9530
jmp 0xa82c
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xa84d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x9530
jmp 0xa84d
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r13, %rdi
je 0xa86f
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x9530
jmp 0xa86f
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
cmpq %r12, %rdi
je 0xa891
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x9530
jmp 0xa891
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0xa8b0
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x9530
jmp 0xa8b0
movq %rax, %rbx
leaq 0x140(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa8d6
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x9530
jmp 0xa8d6
movq %rax, %rbx
leaq 0x120(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa8fc
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x9530
jmp 0xa8fc
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0xa984
movq 0x100(%rsp), %rsi
incq %rsi
jmp 0xa97a
jmp 0xa981
jmp 0xa9df
movq %rax, %rbx
movq %r14, %rdi
callq 0x9400
jmp 0xaa38
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xa951
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x9530
jmp 0xa951
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xa972
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x9530
jmp 0xa972
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq %r14, %rdi
callq 0x9530
jmp 0xa984
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0xb7da
jmp 0xaa38
jmp 0xa9df
jmp 0xa9df
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0xaa54
movq 0x160(%rsp), %rsi
jmp 0xaa4c
jmp 0xa9e4
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0xaa38
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x9530
jmp 0xaa38
movq %rax, %rbx
jmp 0xaa38
movq %rax, %rbx
jmp 0xaa54
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %r15, %rdi
je 0xaa75
movq 0x160(%rsp), %rsi
jmp 0xaa6d
movq %rax, %rbx
jmp 0xaa75
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0xb7da
jmp 0xaa2f
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0xb7da
testq %r14, %r14
je 0xaa38
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xaa54
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x9530
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xaa75
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x9530
movq %rbx, %rdi
callq 0x9950
nop