// File: /workspace/github_cpp_makefile_star2_O3/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 $0x48, %rsp
movl %edx, -0x34(%rbp)
movq %rsi, %r15
movq %rdi, -0x30(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movq 0x8(%rsi), %rcx
xorl %r12d, %r12d
testq %rcx, %rcx
je 0xcc02
leaq -0x48(%rbp), %rbx
leaq -0x58(%rbp), %r13
leaq -0x70(%rbp), %r14
xorl %edx, %edx
xorl %eax, %eax
movq (%r15), %rsi
cmpb $0xa, (%rsi,%rdx)
jne 0xcbf2
movslq %eax, %rdx
movl %r12d, %ecx
subl %edx, %ecx
movq %r13, %rdi
movq %r15, %rsi
callq 0x3290
movq %r14, %rdi
movq %r13, %rsi
callq 0xdc98
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
je 0xcbe6
callq 0x3260
incl %r12d
movq 0x8(%r15), %rcx
movl %r12d, %eax
jmp 0xcbf5
incl %r12d
movl %r12d, %edx
cmpq %rdx, %rcx
ja 0xcbb1
movslq %eax, %r12
jmp 0xcc04
xorl %ecx, %ecx
subq %r12, %rcx
leaq -0x58(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3290
leaq 0x2fbc(%rip), %rsi      # 0xfbd9
leaq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0x30c0
movl %eax, %ebx
movq (%r14), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xcc3c
callq 0x3260
testl %ebx, %ebx
je 0xcc75
movq 0x8(%r15), %rcx
subq %r12, %rcx
leaq -0x58(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3290
leaq -0x70(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xdc98
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xcc75
callq 0x3260
xorps %xmm0, %xmm0
movq -0x30(%rbp), %rax
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq -0x70(%rbp), %rax
cmpq %rax, -0x68(%rbp)
je 0xcd89
movl -0x34(%rbp), %r14d
xorl %ebx, %ebx
leaq -0x58(%rbp), %r15
xorl %r12d, %r12d
shlq $0x5, %rbx
leaq (%rax,%rbx), %rsi
cmpq %r14, 0x8(%rax,%rbx)
jbe 0xcd62
movq %r12, %r13
movq %r14, %rax
decq %rax
testl %eax, %eax
js 0xccd5
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq (%rsi), %rdx
cmpb $0x20, (%rdx,%rcx)
jne 0xccbb
jmp 0xccd8
movl -0x34(%rbp), %eax
movslq %eax, %r12
movq %r15, %rdi
xorl %edx, %edx
movq %r12, %rcx
callq 0x3290
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0xdc98
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xcd06
callq 0x3260
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rcx
leal 0x1(%r12), %eax
movslq %eax, %rdx
subq %rsi, %rcx
addq %rbx, %rsi
sarq $0x5, %rcx
subq %r12, %rcx
movq %r15, %rdi
callq 0x3290
movq -0x70(%rbp), %rdi
addq %rbx, %rdi
movq %r15, %rsi
callq 0x32e0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xcd4c
callq 0x3260
movq -0x70(%rbp), %rax
leaq (%rax,%rbx), %rsi
cmpq %r14, 0x8(%rax,%rbx)
movq %r13, %r12
ja 0xccb8
movq -0x30(%rbp), %rdi
callq 0xd414
incl %r12d
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
movq %r12, %rbx
cmpq %r12, %rcx
ja 0xcca2
leaq -0x70(%rbp), %rdi
callq 0x7c92
movq -0x30(%rbp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
jne 0xcdcc
jmp 0xcde3
jmp 0xcdbb
jmp 0xcdbb
movq %rax, %r14
jmp 0xcde3
movq %rax, %r14
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
je 0xcde3
callq 0x3260
jmp 0xcde3
jmp 0xcdd7
jmp 0xcdd7
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x7c92
leaq -0x70(%rbp), %rdi
callq 0x7c92
movq %r14, %rdi
callq 0x3390
movq %rax, %r14
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xcdda
callq 0x3260
jmp 0xcdda