// File: /workspace/github_cpp_makefile_star2_O2/AsherGlick[P]CommentHeader/source/main.cpp
// Function: wrap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int)
vector<string> wrap(string text, unsigned int width) {
  vector<string> lines;
  int lastSplit = 0;
  // Split on newlines
  for (unsigned int i = 0; i < text.size(); i++) {
    if (text[i] == '\n') {
      lines.push_back(text.substr(lastSplit, i-lastSplit));
      lastSplit = i + 1;
    }
  }
  if (text.substr(lastSplit, text.size() - lastSplit) != "") {
    lines.push_back(text.substr(lastSplit, text.size() - lastSplit));
  }

  // Split lines that are too long
  vector<string> wrappedLines;
  for (unsigned int i = 0; i < lines.size(); i++) {
    while (lines[i].size() > width) {
      int splitIndex = width;
      // Find the last space to prevent splitting mid-word
      for (int j = width-1; j >= 0; j--) {
        if (lines[i][j] == ' ') {
          splitIndex = j;
          break;
        }
      }

      wrappedLines.push_back(lines[i].substr(0, splitIndex));
      lines[i] = lines[i].substr(splitIndex + 1, lines.size() - splitIndex);
    }
    wrappedLines.push_back(lines[i]);
  }

  // Return the lines
  return wrappedLines;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edx, -0x2c(%rbp)
movq %rsi, %r15
movq %rdi, %rbx
leaq -0x50(%rbp), %rax
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
xorl %eax, %eax
leaq -0x70(%rbp), %r13
movq 0x8(%r15), %rcx
xorl %edx, %edx
movl %eax, %r14d
movl %r14d, %r14d
movslq %eax, %r12
cmpq %r14, %rcx
jbe 0x9c6c
movq (%r15), %rsi
cmpb $0xa, (%rsi,%r14)
je 0x9c40
incl %r14d
incl %edx
jmp 0x9c24
movl %edx, %ecx
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3280
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0xadf8
movq %r13, %rdi
callq 0x3120
incl %r14d
movl %r14d, %eax
jmp 0x9c1b
subq %r12, %rcx
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3280
leaq 0x2f28(%rip), %rsi      # 0xcbad
leaq -0x70(%rbp), %r14
movq %r14, %rdi
callq 0xa38f
movl %eax, %r13d
movq %r14, %rdi
callq 0x3120
testb %r13b, %r13b
je 0x9ccd
movq 0x8(%r15), %rcx
subq %r12, %rcx
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3280
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xadf8
leaq -0x70(%rbp), %rdi
callq 0x3120
xorps %xmm0, %xmm0
andq $0x0, 0x10(%rbx)
movups %xmm0, (%rbx)
movl -0x2c(%rbp), %r13d
xorl %r14d, %r14d
leaq -0x70(%rbp), %r15
movl %r14d, %r14d
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r14, %rcx
jbe 0x9db1
movq %r14, -0x78(%rbp)
shlq $0x5, %r14
leaq (%rax,%r14), %rsi
cmpq %r13, 0x8(%rax,%r14)
jbe 0x9d9d
movq %r13, %rax
decq %rax
testl %eax, %eax
js 0x9d32
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq (%rsi), %rdx
cmpb $0x20, (%rdx,%rcx)
jne 0x9d18
jmp 0x9d35
movl -0x2c(%rbp), %eax
movslq %eax, %r12
movq %r15, %rdi
xorl %edx, %edx
movq %r12, %rcx
callq 0x3280
movq %rbx, %rdi
movq %r15, %rsi
callq 0xadf8
movq %r15, %rdi
callq 0x3120
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rcx
leal 0x1(%r12), %eax
movslq %eax, %rdx
subq %rsi, %rcx
addq %r14, %rsi
sarq $0x5, %rcx
subq %r12, %rcx
movq %r15, %rdi
callq 0x3280
movq -0x50(%rbp), %rdi
addq %r14, %rdi
movq %r15, %rsi
callq 0x32e0
movq %r15, %rdi
callq 0x3120
movq -0x50(%rbp), %rax
jmp 0x9d06
movq %rbx, %rdi
callq 0xa39c
movq -0x78(%rbp), %r14
incl %r14d
jmp 0x9ce3
leaq -0x50(%rbp), %rdi
callq 0x684a
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9dd0
jmp 0x9de0
movq %rax, %r14
leaq -0x70(%rbp), %rdi
callq 0x3120
jmp 0x9e02
jmp 0x9de0
movq %rax, %r14
jmp 0x9e02
jmp 0x9df7
jmp 0x9df7
movq %rax, %r14
leaq -0x70(%rbp), %rdi
callq 0x3120
jmp 0x9dfa
movq %rax, %r14
movq %rbx, %rdi
callq 0x684a
leaq -0x50(%rbp), %rdi
callq 0x684a
movq %r14, %rdi
callq 0x3390