// File: /workspace/github_cpp_makefile_star2_O2/statgen[P]statgen/lib/tclap-1.2.0/examples/../include/tclap/StdOutput.h
// Function: TCLAP::StdOutput::spacePrint(std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, int, int) const
inline void StdOutput::spacePrint( std::ostream& os, 
						           const std::string& s, 
						           int maxWidth, 
						           int indentSpaces, 
						           int secondLineOffset ) const
{
	int len = static_cast<int>(s.length());

	if ( (len + indentSpaces > maxWidth) && maxWidth > 0 )
		{
			int allowedLen = maxWidth - indentSpaces;
			int start = 0;
			while ( start < len )
				{
					// find the substring length
					// int stringLen = std::min<int>( len - start, allowedLen );
					// doing it this way to support a VisualC++ 2005 bug 
					using namespace std; 
					int stringLen = min<int>( len - start, allowedLen );

					// trim the length so it doesn't end in middle of a word
					if ( stringLen == allowedLen )
						while ( stringLen >= 0 &&
								s[stringLen+start] != ' ' && 
								s[stringLen+start] != ',' &&
								s[stringLen+start] != '|' ) 
							stringLen--;
	
					// ok, the word is longer than the line, so just split 
					// wherever the line ends
					if ( stringLen <= 0 )
						stringLen = allowedLen;

					// check for newlines
					for ( int i = 0; i < stringLen; i++ )
						if ( s[start+i] == '\n' )
							stringLen = i+1;

					// print the indent	
					for ( int i = 0; i < indentSpaces; i++ )
						os << " ";

					if ( start == 0 )
						{
							// handle second line offsets
							indentSpaces += secondLineOffset;

							// adjust allowed len
							allowedLen -= secondLineOffset;
						}

					os << s.substr(start,stringLen) << std::endl;

					// so we don't start a line with a space
					while ( s[stringLen+start] == ' ' && start < len )
						start++;
			
					start += stringLen;
				}
		}
	else
		{
			for ( int i = 0; i < indentSpaces; i++ )
				os << " ";
			os << s << std::endl;
		}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, 0x14(%rsp)
movl %r8d, %ebp
movq %rsi, %r14
movq %rdx, 0x8(%rsp)
movq 0x8(%rdx), %r8
leal (%r8,%rbp), %eax
cmpl %ecx, %eax
setg %al
testl %ecx, %ecx
setg %dl
testb %al, %dl
je 0x5a74
subl %ebp, %ecx
movslq %r8d, %r15
xorl %r12d, %r12d
movq %r8, 0x18(%rsp)
movl %r8d, %eax
subl %r12d, %eax
jle 0x5aba
cmpl %eax, %ecx
cmovll %ecx, %eax
jg 0x599c
testl %eax, %eax
js 0x599c
movslq %ecx, %rdi
movslq %r12d, %rdx
movq 0x8(%rsp), %rax
addq (%rax), %rdx
incq %rdi
movl %ecx, %eax
movzbl -0x1(%rdx,%rdi), %esi
cmpl $0x20, %esi
je 0x599c
cmpl $0x2c, %esi
je 0x599c
cmpl $0x7c, %esi
je 0x599c
decl %eax
decq %rdi
jg 0x597f
jmp 0x59a0
testl %eax, %eax
jg 0x59a2
movl %ecx, %eax
movl %ecx, 0x4(%rsp)
movslq %r12d, %r13
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
addq %r13, %rcx
xorl %edx, %edx
movslq %eax, %rbx
cmpq %rbx, %rdx
jge 0x59cb
cmpb $0xa, (%rcx,%rdx)
leaq 0x1(%rdx), %rdx
cmovel %edx, %eax
jmp 0x59b6
testl %ebp, %ebp
movq %rbp, %rax
movl $0x0, %ebp
movq %rax, 0x20(%rsp)
cmovgl %eax, %ebp
subl $0x1, %ebp
jb 0x59f3
movq %r14, %rdi
leaq 0x3a2c(%rip), %rsi      # 0x9418
callq 0x3190
jmp 0x59dd
testl %r12d, %r12d
movl $0x0, %ebp
cmovel 0x14(%rsp), %ebp
leaq 0x28(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x31c0
movq %r14, %rdi
leaq 0x28(%rsp), %rsi
callq 0x3180
movq %rax, %rdi
callq 0x30d0
subl %ebp, 0x4(%rsp)
movq 0x20(%rsp), %rax
addl %ebp, %eax
movq %rax, %rbp
leaq 0x28(%rsp), %rdi
callq 0x3348
addl %ebx, %r12d
decl %r12d
movq 0x8(%rsp), %rax
addq (%rax), %rbx
movq %r13, %rcx
movb (%rbx,%r13), %al
incq %r13
incl %r12d
cmpq %r15, %rcx
jge 0x5a66
cmpb $0x20, %al
je 0x5a50
movl 0x4(%rsp), %ecx
movq 0x18(%rsp), %r8
jmp 0x5955
movq %rbp, %rax
xorl %ebp, %ebp
testl %eax, %eax
cmovgl %eax, %ebp
leaq 0x3993(%rip), %rbx      # 0x9418
subl $0x1, %ebp
jb 0x5a97
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3190
jmp 0x5a85
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x3180
movq %rax, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x30d0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3348
movq %rbx, %rdi
callq 0x32c0