// File: /workspace/github_cpp_makefile_star2_O3/hanhwi[P]SimPoint/analysiscode/CmdLineParser.cpp
// Function: CmdLineParser::printExplanationPretty(CmdLineOption const*, unsigned int, std::ostream&, unsigned int)
void CmdLineParser::printExplanationPretty(const CmdLineOption *option,
        unsigned int prefixWidth, ostream &os, unsigned int lineWidth) {
    prefixWidth += 3;  // to account for the string " : " below
    string nameAndArg = prettyOptionNameAndArg(option);
    os << nameAndArg;
    if (nameAndArg.size() < prefixWidth - 3) { os << ' '; }
    for (unsigned int i = nameAndArg.size() + 1; i < prefixWidth - 3; i++) {
        os << '.';
    }
    os << " : ";

    // strip the explanation of leading, trailing, and duplicate spaces
    string expl, explanation = option->getExplanation();
    unsigned int start = 0, end = explanation.size() - 1;
    while ((start < end) && (explanation[start] == ' ')) { start++; }
    while ((start < end) && (explanation[end] == ' ')) { end--; }
    for (unsigned int i = start; i <= end; i++) {
        expl += explanation[i];
        if (explanation[i] == ' ') {
            while ((i <= end) && (explanation[i+1] == ' ')) {
                i++;
            }
        }
    }

    unsigned int position = 0;
    bool firstLine = true;
    while (expl.size() - position > lineWidth - prefixWidth) {
        if (! firstLine) {
            for (unsigned int i = 0; i < prefixWidth; i++) {
                os << ' ';
            }
        }

        // find the first index of a space that is earlier than the limit of the
        // line width
        unsigned long searchStart = min((unsigned long)position + lineWidth - prefixWidth, 
                                        (unsigned long)expl.size() - 1);
        unsigned long spaceNdx = expl.rfind(' ', searchStart);
        if ((spaceNdx == string::npos) || (spaceNdx <= position)) {
            spaceNdx = expl.find(' ', searchStart);
            if (spaceNdx == string::npos) {
                spaceNdx = expl.size();
            }
        }
        os << expl.substr(position, spaceNdx - position) << endl;
        position = spaceNdx + 1;
        firstLine = false;
    }

    if (position < expl.size()) {
        if (! firstLine) {
            for (unsigned int i = 0; i < prefixWidth; i++) {
                os << ' ';
            }
        }
        os << expl.substr(position) << endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %ecx, 0x40(%rsp)
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r15
leaq 0x78(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x5820
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %rbx, %rdi
callq 0x4330
movq 0x80(%rsp), %r13
movl %ebp, %eax
cmpq %rax, %r13
jae 0x5416
leaq 0x20(%rsp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x4330
movq 0x80(%rsp), %r13
leal 0x1(%r13), %eax
cmpl %ebp, %eax
jae 0x5443
notl %r13d
addl %ebp, %r13d
leaq 0x20(%rsp), %r12
movb $0x2e, 0x20(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4330
decl %r13d
jne 0x5429
leaq 0x16c5d(%rip), %rsi     # 0x1c0a7
movl $0x3, %edx
movq %rbx, %rdi
callq 0x4330
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x48(%r15), %rsi
movq 0x50(%r15), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x5fc2
movl 0x50(%rsp), %r12d
decl %r12d
je 0x54b2
movq 0x48(%rsp), %rax
movl %r12d, %ecx
xorl %r13d, %r13d
cmpb $0x20, (%rax,%r13)
jne 0x54b5
incq %r13
cmpq %r13, %rcx
jne 0x549e
movl %r12d, %r13d
jmp 0x54da
xorl %r13d, %r13d
cmpl %r12d, %r13d
jae 0x54d5
movq 0x48(%rsp), %rax
movl %r12d, %ecx
cmpb $0x20, (%rax,%rcx)
jne 0x54d5
decl %r12d
cmpl %r12d, %r13d
jb 0x54bf
movl %r13d, %r12d
jmp 0x54da
cmpl %r12d, %r13d
ja 0x5522
movq 0x48(%rsp), %rax
leaq 0x20(%rsp), %r15
movl %r13d, %r14d
movsbl (%rax,%r14), %esi
movq %r15, %rdi
callq 0x4250
movq 0x48(%rsp), %rax
cmpb $0x20, (%rax,%r14)
jne 0x5515
movl %r13d, %ecx
cmpl %r12d, %r13d
ja 0x5518
leal 0x1(%rcx), %r13d
cmpb $0x20, (%rax,%r13)
je 0x5500
jmp 0x5518
movl %r13d, %ecx
incl %ecx
movl %ecx, %r13d
cmpl %r12d, %ecx
jbe 0x54e4
addl $0x3, %ebp
movl 0x40(%rsp), %eax
movl %eax, %ecx
subl %ebp, %ecx
movq 0x28(%rsp), %r14
movq %rcx, 0x68(%rsp)
cmpq %rcx, %r14
movq %r14, 0x70(%rsp)
jbe 0x5664
movl %eax, %ecx
movl %ebp, %eax
subq %rax, %rcx
movq %rcx, 0x40(%rsp)
movb $0x1, %al
xorl %r13d, %r13d
movq %rsp, %r15
testl %ebp, %ebp
sete %cl
orb %al, %cl
testb $0x1, %cl
jne 0x5586
movl %ebp, %r14d
movb $0x20, (%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4330
decl %r14d
jne 0x5568
movq 0x28(%rsp), %r14
movq 0x40(%rsp), %rax
addq %r13, %rax
decq %r14
cmpq %rax, %r14
cmovaeq %rax, %r14
leaq 0x20(%rsp), %rdi
movl $0x20, %esi
movq %r14, %rdx
callq 0x45f0
cmpq $-0x1, %rax
je 0x55b8
movq %rax, %r12
cmpq %r13, %rax
ja 0x55d8
leaq 0x20(%rsp), %rdi
movl $0x20, %esi
movq %r14, %rdx
callq 0x43d0
movq %rax, %r12
cmpq $-0x1, %rax
jne 0x55d8
movq 0x28(%rsp), %r12
movq %r12, %rcx
subq %r13, %rcx
movq %r15, %rdi
leaq 0x20(%rsp), %rsi
movq %r13, %rdx
callq 0x42f0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x4330
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
movq %r14, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x41d0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x5644
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42d0
incl %r12d
movq 0x28(%rsp), %r14
movq %r14, %rcx
subq %r12, %rcx
xorl %eax, %eax
movq %r12, %r13
cmpq 0x68(%rsp), %rcx
ja 0x5559
jmp 0x5667
xorl %r12d, %r12d
cmpq %r14, %r12
jae 0x570e
movq 0x70(%rsp), %rax
cmpq 0x68(%rsp), %rax
setbe %al
testl %ebp, %ebp
sete %cl
orb %al, %cl
jne 0x56a1
movq %rsp, %r14
movb $0x20, (%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4330
decl %ebp
jne 0x5689
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
movq %r12, %rdx
movq $-0x1, %rcx
callq 0x42f0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x4330
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x41d0
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x570e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x572a
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x5746
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x42d0
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5767
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x42d0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x57bb
movq %rax, %rbx
jmp 0x57da
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x57a7
jmp 0x5794
jmp 0x57bb
jmp 0x57bb
movq %rax, %rbx
jmp 0x57f6
jmp 0x57bb
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x57be
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0x57be
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x57da
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x57f6
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x42d0
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5817
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %rbx, %rdi
callq 0x4580
nop