// File: /workspace/github_cpp_makefile_star2_O3/jaudoux[P]countTags/src/optionparser.h
// Function: option::PrintUsageImplementation::LineWrapper::process(option::PrintUsageImplementation::IStringWriter&, char const*, int)
void process(IStringWriter& write, const char* data, int len)
    {
      wrote_something = false;

      while (len > 0)
      {
        if (len <= width) // quick test that works because utf8width <= len (all wide chars have at least 2 bytes)
        {
          output(write, data, len);
          len = 0;
        }
        else // if (len > width)  it's possible (but not guaranteed) that utf8len > width
        {
          int utf8width = 0;
          int maxi = 0;
          while (maxi < len && utf8width < width)
          {
            int charbytes = 1;
            unsigned ch = (unsigned char) data[maxi];
            if (ch > 0xC1) // everything <= 0xC1 (yes, even 0xC1 itself) is not a valid UTF-8 start byte
            {
              // int __builtin_clz (unsigned int x)
              // Returns the number of leading 0-bits in x, starting at the most significant bit
              unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff);
              ch = ch & mask; // mask out length bits, we don't verify their correctness
              while ((maxi + charbytes < len) && //
                  (((unsigned char) data[maxi + charbytes] ^ 0x80) <= 0x3F)) // while next byte is continuation byte
              {
                ch = (ch << 6) ^ (unsigned char) data[maxi + charbytes] ^ 0x80; // add continuation to char code
                ++charbytes;
              }
              // ch is the decoded unicode code point
              if (ch >= 0x1100 && isWideChar(ch)) // the test for 0x1100 is here to avoid the function call in the Latin case
              {
                if (utf8width + 2 > width)
                  break;
                ++utf8width;
              }
            }
            ++utf8width;
            maxi += charbytes;
          }

          // data[maxi-1] is the last byte of the UTF-8 sequence of the last character that fits
          // onto the 1st line. If maxi == len, all characters fit on the line.

          if (maxi == len)
          {
            output(write, data, len);
            len = 0;
          }
          else // if (maxi < len)  at least 1 character (data[maxi] that is) doesn't fit on the line
          {
            int i;
            for (i = maxi; i >= 0; --i)
              if (data[i] == ' ')
                break;

            if (i >= 0)
            {
              output(write, data, i);
              data += i + 1;
              len -= i + 1;
            }
            else // did not find a space to split at => split before data[maxi]
            { // data[maxi] is always the beginning of a character, never a continuation byte
              output(write, data, maxi);
              data += maxi;
              len -= maxi;
            }
          }
        }
      }
      if (!wrote_something) // if we didn't already write something to make space in the buffer
        write_one_line(write); // write at most one line of actual output
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, 0xd0(%rdi)
testl %ecx, %ecx
jle 0x49ea
movl %ecx, %ebp
movq %rdx, %r15
movq %rbx, (%rsp)
movl 0xc4(%r14), %edx
cmpl %edx, %ebp
jle 0x49c1
xorl %r12d, %r12d
testl %edx, %edx
jle 0x496d
xorl %r13d, %r13d
movl %r12d, %eax
movzbl (%r15,%rax), %edi
movl $0x1, %ebx
cmpl $0xc2, %edi
jb 0x494b
leal 0x1(%r12), %ecx
cmpl %ebp, %ecx
jge 0x494b
movl %edi, %ecx
xorl $0xff, %ecx
bsrl %ecx, %ecx
notl %ecx
shll %cl, %edi
shrl %cl, %edi
movl %ebp, %ebx
subl %r12d, %ebx
movl $0x1, %ecx
leal (%rax,%rcx), %esi
movzbl (%r15,%rsi), %esi
movl %esi, %r8d
xorl $0x80, %r8d
cmpl $0x3f, %r8d
ja 0x4926
shll $0x6, %edi
xorl %esi, %edi
xorl $0x80, %edi
incq %rcx
cmpq %rcx, %rbx
jne 0x48f9
jmp 0x4928
movl %ecx, %ebx
cmpl $0x1100, %edi           # imm = 0x1100
jb 0x494b
callq 0x4b36
movl 0xc4(%r14), %edx
testb %al, %al
je 0x494b
leal 0x2(%r13), %eax
cmpl %edx, %eax
jg 0x495f
incl %r13d
addl %ebx, %r12d
cmpl %ebp, %r12d
jge 0x495f
incl %r13d
cmpl %edx, %r13d
jl 0x48c0
cmpl %ebp, %r12d
movq (%rsp), %rbx
je 0x49c1
testl %r12d, %r12d
js 0x4986
movl %r12d, %r13d
movl %r13d, %eax
cmpb $0x20, (%r15,%rax)
je 0x4999
leal -0x1(%r13), %eax
testl %r13d, %r13d
movl %eax, %r13d
jg 0x4970
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x4baa
jmp 0x49b0
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %r13d, %ecx
callq 0x4baa
incl %r13d
movl %r13d, %r12d
movl %r12d, %eax
addq %rax, %r15
subl %r12d, %ebp
jg 0x48a3
jmp 0x49d1
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %ebp, %ecx
callq 0x4baa
testb $0x1, 0xd0(%r14)
je 0x49ea
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4bf4
nop