// File: /workspace/github_cpp_makefile_star2_O1/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, -0x34(%rbp)
movq %rsi, %r15
movq %rdi, -0x30(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq 0x8(%rsi), %rcx
xorl %r12d, %r12d
testq %rcx, %rcx
je 0xcc95
leaq -0x60(%rbp), %rbx
leaq -0x70(%rbp), %r13
leaq -0x50(%rbp), %r14
xorl %eax, %eax
movq (%r15), %rcx
cmpb $0xa, (%rcx,%r12)
jne 0xcc86
movslq %eax, %rdx
movl %r12d, %ecx
subl %edx, %ecx
movq %r13, %rdi
movq %r15, %rsi
callq 0x3290
movq %r14, %rdi
movq %r13, %rsi
callq 0xdd16
movq -0x70(%rbp), %rdi
cmpq %rbx, %rdi
je 0xcc81
callq 0x3260
leal 0x1(%r12), %eax
incl %r12d
movq 0x8(%r15), %rcx
cmpq %r12, %rcx
ja 0xcc4b
movslq %eax, %r12
subq %r12, %rcx
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3290
leaq 0x2f2b(%rip), %rsi      # 0xfbd9
leaq -0x70(%rbp), %r14
movq %r14, %rdi
callq 0x30c0
movl %eax, %ebx
movq (%r14), %rdi
leaq -0x60(%rbp), %r13
cmpq %r13, %rdi
je 0xcccd
callq 0x3260
testl %ebx, %ebx
je 0xcd02
movq 0x8(%r15), %rcx
subq %r12, %rcx
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3290
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xdd16
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0xcd02
callq 0x3260
xorps %xmm0, %xmm0
movq -0x30(%rbp), %rax
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
je 0xce05
movl -0x34(%rbp), %r14d
xorl %ebx, %ebx
leaq -0x70(%rbp), %r15
xorl %ecx, %ecx
movq %rcx, -0x78(%rbp)
movq -0x50(%rbp), %rax
shlq $0x5, %rbx
leaq (%rax,%rbx), %rsi
cmpq %r14, 0x8(%rax,%rbx)
jbe 0xcdde
movq %r14, %rax
decq %rax
testl %eax, %eax
js 0xcd66
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq (%rsi), %rdx
cmpb $0x20, (%rdx,%rcx)
jne 0xcd4c
jmp 0xcd69
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 0xdd16
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0xcd93
callq 0x3260
movq -0x50(%rbp), %rsi
movq -0x48(%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 -0x50(%rbp), %rdi
addq %rbx, %rdi
movq %r15, %rsi
callq 0x32e0
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0xcdd5
callq 0x3260
movq -0x50(%rbp), %rax
jmp 0xcd3a
movq -0x30(%rbp), %rdi
callq 0xd488
movq -0x78(%rbp), %rcx
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
incl %ecx
sarq $0x5, %rax
movq %rcx, %rbx
cmpq %rcx, %rax
ja 0xcd2e
leaq -0x50(%rbp), %rdi
callq 0x7d36
movq -0x30(%rbp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
jne 0xce44
jmp 0xce5b
jmp 0xce33
jmp 0xce33
movq %rax, %r14
jmp 0xce5b
movq %rax, %r14
movq -0x70(%rbp), %rdi
cmpq %rbx, %rdi
je 0xce5b
callq 0x3260
jmp 0xce5b
jmp 0xce4f
jmp 0xce4f
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x7d36
leaq -0x50(%rbp), %rdi
callq 0x7d36
movq %r14, %rdi
callq 0x3390
movq %rax, %r14
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0xce52
callq 0x3260
jmp 0xce52