// File: /workspace/github_cpp_makefile_star2_O1/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, %r12
movq %rdx, (%rsp)
movq 0x8(%rdx), %rsi
leal (%rsi,%rbx), %eax
cmpl %ecx, %eax
setg %al
testl %ecx, %ecx
setg %dl
testb %al, %dl
je 0x772c
testl %esi, %esi
jle 0x771d
subl %ebx, %ecx
movl %esi, %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %r13d, %r13d
leaq 0x3e6a(%rip), %rbp      # 0xb418
movq %rsi, 0x30(%rsp)
movq %r12, 0x38(%rsp)
movl %esi, %r14d
subl %r13d, %r14d
cmpl %r14d, %ecx
cmovll %ecx, %r14d
jg 0x7601
testl %r14d, %r14d
js 0x7601
movslq %ecx, %rax
movslq %r13d, %rsi
movq (%rsp), %rdx
addq (%rdx), %rsi
incq %rax
movl %ecx, %r14d
movzbl -0x1(%rsi,%rax), %edx
cmpl $0x20, %edx
je 0x7601
cmpl $0x2c, %edx
je 0x7601
cmpl $0x7c, %edx
je 0x7601
decl %r14d
decq %rax
jg 0x75df
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testl %r14d, %r14d
cmovlel %ecx, %r14d
testl %r14d, %r14d
movl %ecx, 0xc(%rsp)
jle 0x7634
movslq %r13d, %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 0x761d
movq %rbx, %rax
movq %rbx, 0x40(%rsp)
testl %eax, %eax
jle 0x7654
movl $0x1, %edx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x3200
decl %ebx
jne 0x7640
movslq %r13d, %rbp
testl %r13d, %r13d
movl $0x0, %ebx
cmovel 0x8(%rsp), %ebx
movslq %r14d, %r14
leaq 0x10(%rsp), %rdi
movq (%rsp), %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x31e0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0x3200
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3190
movsbl %al, %esi
movq %r12, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x76d3
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, %r13d
decl %r13d
movq (%rsp), %rax
addq (%rax), %r14
movq 0x38(%rsp), %r12
incl %r13d
cmpq %r15, %rbp
jge 0x7708
cmpb $0x20, (%r14,%rbp)
leaq 0x1(%rbp), %rbp
je 0x76f5
movq 0x30(%rsp), %rsi
cmpl %esi, %r13d
leaq 0x3d01(%rip), %rbp      # 0xb418
jl 0x75b8
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %ebx, %ebx
jle 0x774b
leaq 0x3ce1(%rip), %r14      # 0xb418
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rsi
callq 0x3200
decl %ebx
jne 0x7737
movq (%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r12, %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 0x77b5
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x31c0
movq %rbx, %rdi
callq 0x3300
nop