// File: /workspace/github_cpp_makefile_star2_O1/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
subq $0x28, %rsp
movq %rsi, 0x18(%rsp)
movq %rdi, %r9
movb $0x0, 0xd0(%rdi)
testl %ecx, %ecx
jle 0x4bf2
movl %ecx, %r10d
movq %rdx, %r15
movq %r9, 0x10(%rsp)
cmpl 0xc4(%r9), %r10d
movl %r10d, 0xc(%rsp)
jle 0x4acc
movl %r10d, %r13d
xorl %r11d, %r11d
xorl %r12d, %r12d
movl %r10d, %ebp
subl %r12d, %ebp
jle 0x4ac7
cmpl 0xc4(%r9), %r11d
jge 0x4ac7
movslq %r12d, %rax
movzbl (%r15,%rax), %edi
cmpl $0xc2, %edi
jb 0x4a46
movl %edi, %ecx
xorl $0xff, %ecx
bsrl %ecx, %ecx
notl %ecx
shll %cl, %edi
shrl %cl, %edi
leal 0x1(%r12), %ecx
cmpl %r10d, %ecx
jge 0x4a4d
movl %r12d, %edx
movl $0x1, %ecx
leal (%rdx,%rcx), %esi
movslq %esi, %rsi
movzbl (%r15,%rsi), %esi
movl %esi, %r8d
xorl $0x80, %r8d
cmpl $0x3f, %r8d
ja 0x4a54
shll $0x6, %edi
xorl %esi, %edi
xorl $0x80, %edi
leaq (%rax,%rcx), %rsi
incq %rsi
incq %rcx
cmpq %r13, %rsi
jl 0x4a0f
jmp 0x4a56
movl $0x1, %ebp
jmp 0x4ab2
movl $0x1, %ebp
jmp 0x4a56
movl %ecx, %ebp
xorl %r14d, %r14d
movb $0x1, %bl
cmpl $0x1100, %edi           # imm = 0x1100
jb 0x4aae
movq %r11, 0x20(%rsp)
callq 0x4d54
testb %al, %al
je 0x4a95
movq 0x20(%rsp), %r11
leal 0x2(%r11), %eax
xorl %r14d, %r14d
movq 0x10(%rsp), %r9
cmpl 0xc4(%r9), %eax
jle 0x4aa6
movl $0x5, %r14d
xorl %ebx, %ebx
jmp 0x4aa9
movq 0x10(%rsp), %r9
movl 0xc(%rsp), %r10d
movq 0x20(%rsp), %r11
jmp 0x4aae
incl %r11d
movl 0xc(%rsp), %r10d
testb %bl, %bl
je 0x4abe
incl %r11d
addl %r12d, %ebp
xorl %r14d, %r14d
movl %ebp, %r12d
testl %r14d, %r14d
je 0x49c3
cmpl %r10d, %r12d
jne 0x4b1e
movl 0xcc(%r9), %eax
cmpl 0xc8(%r9), %eax
jne 0x4af3
movq %r9, %rdi
movq 0x18(%rsp), %rsi
callq 0x4df8
movl 0xc(%rsp), %r10d
movq 0x10(%rsp), %r9
movslq 0xc8(%r9), %rax
movl %r10d, (%r9,%rax,4)
movslq 0xc8(%r9), %rax
movq %r15, 0x40(%r9,%rax,8)
incl %eax
andl $0xf, %eax
movl %eax, 0xc8(%r9)
xorl %r10d, %r10d
jmp 0x4be9
testl %r12d, %r12d
js 0x4b44
leal 0x1(%r12), %ebx
movl %r12d, %r14d
movl %r14d, %eax
cmpb $0x20, (%r15,%rax)
je 0x4b93
leal -0x1(%r14), %eax
decq %rbx
testl %r14d, %r14d
movl %eax, %r14d
jg 0x4b2b
movl 0xcc(%r9), %eax
cmpl 0xc8(%r9), %eax
jne 0x4b6b
movq %r9, %rdi
movq 0x18(%rsp), %rsi
callq 0x4df8
movl 0xc(%rsp), %r10d
movq 0x10(%rsp), %r9
movslq 0xc8(%r9), %rax
movl %r12d, (%r9,%rax,4)
movslq 0xc8(%r9), %rax
movq %r15, 0x40(%r9,%rax,8)
incl %eax
andl $0xf, %eax
movl %eax, 0xc8(%r9)
movslq %r12d, %rbx
jmp 0x4be3
movl 0xcc(%r9), %eax
cmpl 0xc8(%r9), %eax
jne 0x4bba
movq %r9, %rdi
movq 0x18(%rsp), %rsi
callq 0x4df8
movl 0xc(%rsp), %r10d
movq 0x10(%rsp), %r9
movslq 0xc8(%r9), %rax
movl %r14d, (%r9,%rax,4)
movslq 0xc8(%r9), %rax
movq %r15, 0x40(%r9,%rax,8)
incl %eax
andl $0xf, %eax
movl %eax, 0xc8(%r9)
incl %r14d
movl %r14d, %r12d
addq %rbx, %r15
subl %r12d, %r10d
testl %r10d, %r10d
jg 0x49a8
cmpb $0x0, 0xd0(%r9)
je 0x4c0b
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r9, %rdi
movq 0x18(%rsp), %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4df8