// File: /workspace/github_cpp_makefile_star2_O3/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, 0x8(%rsp)
movl %r8d, %ebx
movq %rsi, %r13
movq %rdx, (%rsp)
movq 0x8(%rdx), %rdx
leal (%rdx,%rbx), %eax
cmpl %ecx, %eax
setg %al
testl %ecx, %ecx
setg %sil
testb %al, %sil
je 0x764f
testl %edx, %edx
jle 0x7640
subl %ebx, %ecx
movl %edx, %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
leaq 0x3f43(%rip), %r12      # 0xb418
movq %r13, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movl %edx, %r14d
subl %ebp, %r14d
cmpl %r14d, %ecx
cmovll %ecx, %r14d
jg 0x7527
testl %r14d, %r14d
js 0x7527
movslq %ecx, %rax
movslq %ebp, %rsi
movq (%rsp), %rdx
addq (%rdx), %rsi
incq %rax
movl %ecx, %r14d
movzbl -0x1(%rsi,%rax), %edx
cmpl $0x20, %edx
je 0x7527
cmpl $0x2c, %edx
je 0x7527
cmpl $0x7c, %edx
je 0x7527
decl %r14d
decq %rax
jg 0x7506
movl %ecx, %r14d
jmp 0x752e
testl %r14d, %r14d
cmovlel %ecx, %r14d
testl %r14d, %r14d
movl %ecx, 0xc(%rsp)
jle 0x755a
movslq %ebp, %rax
movq (%rsp), %rcx
addq (%rcx), %rax
xorl %ecx, %ecx
cmpb $0xa, (%rax,%rcx)
leaq 0x1(%rcx), %rdx
cmovel %edx, %r14d
movslq %r14d, %rsi
movq %rdx, %rcx
cmpq %rsi, %rdx
jl 0x7543
movq %rbx, %rax
movq %rbx, 0x40(%rsp)
testl %eax, %eax
jle 0x757a
movl $0x1, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x3200
decl %ebx
jne 0x7566
movslq %ebp, %r12
testl %ebp, %ebp
movl $0x0, %ebx
cmovel 0x8(%rsp), %ebx
movslq %r14d, %r14
leaq 0x10(%rsp), %rdi
movq (%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x31e0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rdi
callq 0x3200
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x75f8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x31c0
movl 0xc(%rsp), %ecx
subl %ebx, %ecx
movq 0x40(%rsp), %rax
addl %ebx, %eax
movq %rax, %rbx
addl %r14d, %ebp
decl %ebp
movq (%rsp), %rax
addq (%rax), %r14
movq 0x38(%rsp), %r13
incl %ebp
cmpq %r15, %r12
jge 0x762c
cmpb $0x20, (%r14,%r12)
leaq 0x1(%r12), %r12
je 0x7619
movq 0x30(%rsp), %rdx
cmpl %edx, %ebp
leaq 0x3dde(%rip), %r12      # 0xb418
jl 0x74df
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %ebx, %ebx
jle 0x7676
leaq 0x3dbe(%rip), %r14      # 0xb418
movl $0x1, %edx
movq %r13, %rdi
movq %r14, %rsi
callq 0x3200
decl %ebx
jne 0x765a
movq (%rsp), %rax
movq 0x8(%rax), %rdx
movq (%rsp), %rax
movq (%rax), %rsi
movq %r13, %rdi
callq 0x3200
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3130
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x76dc
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x31c0
movq %rbx, %rdi
callq 0x3300