// File: jovermann[P]streplace/src/MiscUtils.cpp
// Function: ut1::splitLines(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long)
std::vector<std::string> splitLines(const std::string& s, size_t wrapCol)
{
    std::vector<std::string> r;
    size_t                   start    = 0;
    size_t                   pos      = 0;
    size_t                   splitPos = 0;
    size_t                   col      = 0;
    std::string              indent;
    bool                     firstPart = true; // First subline of a wrapped line.
    while (pos < s.length())
    {
        if (s[pos] == '\n')
        {
            std::string line = s.substr(start, pos - start);
            r.push_back(indent + line);
            pos++;
            start     = pos;
            splitPos  = pos;
            col       = 0;
            indent    = "";
            firstPart = true;
            continue;
        }
        if (std::isspace(unsigned(s[pos])))
        {
            splitPos = pos + 1;
        }
        if ((wrapCol > 0) && (col == wrapCol))
        {
            if (splitPos == start)
            {
                splitPos = pos;
            }
            std::string line = s.substr(start, splitPos - start);
            r.push_back(indent + line);
            pos   = splitPos;
            start = pos;
            col   = indent.length();
            if (firstPart)
            {
                firstPart = false;
                size_t i  = 0;
                while ((i < line.size()) && ((line[i] == ' ') || (line[i] == '-')))
                {
                    i++;
                    indent += ' ';
                }
            }
            continue;
        }
        pos++;
        col++;
    }
    if (start < s.length())
    {
        r.push_back(s.substr(start, s.length() - start));
    }
    return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x130(%rbp)
movq %rdi, %rax
movq %rax, -0x128(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
callq 0xb2d0
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x7860
movb $0x1, -0x61(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x10(%rbp), %rdi
callq 0x78e0
movq %rax, %rcx
movq -0x138(%rbp), %rax
cmpq %rcx, %rax
jae 0x123b0
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x76a0
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x12189
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
subq %rdx, %rcx
leaq -0x88(%rbp), %rdi
callq 0x7630
jmp 0x120ab
leaq -0xb8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x13da0
jmp 0x120c4
movq -0x130(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0xc080
jmp 0x120d9
leaq -0xb8(%rbp), %rdi
callq 0x73c0
movq -0x30(%rbp), %rax
incq %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
leaq 0x37f7f(%rip), %rsi     # 0x4a08e
leaq -0x60(%rbp), %rdi
callq 0x7850
jmp 0x1211a
movb $0x1, -0x61(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x73c0
jmp 0x1204e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x12470
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x12178
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x73c0
leaq -0x88(%rbp), %rdi
callq 0x73c0
jmp 0x12470
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x76a0
movsbl (%rax), %edi
callq 0x7080
cmpl $0x0, %eax
je 0x121af
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x18(%rbp)
jbe 0x12393
movq -0x40(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x12393
movq -0x38(%rbp), %rax
cmpq -0x28(%rbp), %rax
jne 0x121da
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x38(%rbp), %rcx
subq %rdx, %rcx
leaq -0xd8(%rbp), %rdi
callq 0x7630
jmp 0x121f7
leaq -0xf8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x13da0
jmp 0x12210
movq -0x130(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0xc080
jmp 0x12225
leaq -0xf8(%rbp), %rdi
callq 0x73c0
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x78e0
movq %rax, -0x40(%rbp)
testb $0x1, -0x61(%rbp)
je 0x12371
movb $0x0, -0x61(%rbp)
movq $0x0, -0x100(%rbp)
movq -0x100(%rbp), %rax
movq %rax, -0x148(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x7460
movq -0x148(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x139(%rbp)
jae 0x12309
movq -0x100(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x7b50
movq %rax, -0x150(%rbp)
jmp 0x122b4
movq -0x150(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x151(%rbp)
je 0x122fd
movq -0x100(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x7b50
movq %rax, -0x160(%rbp)
jmp 0x122e7
movq -0x160(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
sete %al
movb %al, -0x151(%rbp)
movb -0x151(%rbp), %al
movb %al, -0x139(%rbp)
movb -0x139(%rbp), %al
testb $0x1, %al
jne 0x12315
jmp 0x1236f
movq -0x100(%rbp), %rax
incq %rax
movq %rax, -0x100(%rbp)
leaq -0x60(%rbp), %rdi
movl $0x20, %esi
callq 0x73f0
jmp 0x12336
jmp 0x12267
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x12382
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x73c0
jmp 0x12382
jmp 0x12371
leaq -0xd8(%rbp), %rdi
callq 0x73c0
jmp 0x1204e
leaq -0xd8(%rbp), %rdi
callq 0x73c0
jmp 0x12470
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x1204e
movq -0x28(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x10(%rbp), %rdi
callq 0x78e0
movq %rax, %rcx
movq -0x168(%rbp), %rax
cmpq %rcx, %rax
jae 0x1245b
movq -0x10(%rbp), %rdi
movq %rdi, -0x178(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x170(%rbp)
callq 0x78e0
movq -0x178(%rbp), %rsi
movq -0x170(%rbp), %rdx
movq %rax, %rcx
movq -0x28(%rbp), %rax
subq %rax, %rcx
leaq -0x120(%rbp), %rdi
callq 0x7630
jmp 0x12418
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0xc080
jmp 0x1242d
leaq -0x120(%rbp), %rdi
callq 0x73c0
jmp 0x1245b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x73c0
jmp 0x12470
movb $0x1, -0x19(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x73c0
testb $0x1, -0x19(%rbp)
jne 0x12493
jmp 0x12487
leaq -0x60(%rbp), %rdi
callq 0x73c0
movq -0x130(%rbp), %rdi
callq 0xb3c0
jmp 0x124a3
movq -0x130(%rbp), %rdi
callq 0xb3c0
movq -0x128(%rbp), %rax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0x90(%rbp), %rdi
callq 0x7a30
nop