// File: /workspace/github_c_makefile_star2_O0/michaelnmmeyer[P]gourgandine/src/lib/utf8proc.c
// Function: utf8proc_reencode
UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_reencode(utf8proc_int32_t *buffer, utf8proc_ssize_t length, utf8proc_option_t options) {
  /* UTF8PROC_NULLTERM option will be ignored, 'length' is never ignored
     ASSERT: 'buffer' has one spare byte of free space at the end! */
  if (options & (UTF8PROC_NLF2LS | UTF8PROC_NLF2PS | UTF8PROC_STRIPCC)) {
    utf8proc_ssize_t rpos;
    utf8proc_ssize_t wpos = 0;
    utf8proc_int32_t uc;
    for (rpos = 0; rpos < length; rpos++) {
      uc = buffer[rpos];
      if (uc == 0x000D && rpos < length-1 && buffer[rpos+1] == 0x000A) rpos++;
      if (uc == 0x000A || uc == 0x000D || uc == 0x0085 ||
          ((options & UTF8PROC_STRIPCC) && (uc == 0x000B || uc == 0x000C))) {
        if (options & UTF8PROC_NLF2LS) {
          if (options & UTF8PROC_NLF2PS) {
            buffer[wpos++] = 0x000A;
          } else {
            buffer[wpos++] = 0x2028;
          }
        } else {
          if (options & UTF8PROC_NLF2PS) {
            buffer[wpos++] = 0x2029;
          } else {
            buffer[wpos++] = 0x0020;
          }
        }
      } else if ((options & UTF8PROC_STRIPCC) &&
          (uc < 0x0020 || (uc >= 0x007F && uc < 0x00A0))) {
        if (uc == 0x0009) buffer[wpos++] = 0x0020;
      } else {
        buffer[wpos++] = uc;
      }
    }
    length = wpos;
  }
  if (options & UTF8PROC_COMPOSE) {
    utf8proc_int32_t *starter = NULL;
    utf8proc_int32_t current_char;
    const utf8proc_property_t *starter_property = NULL, *current_property;
    utf8proc_propval_t max_combining_class = -1;
    utf8proc_ssize_t rpos;
    utf8proc_ssize_t wpos = 0;
    utf8proc_int32_t composition;
    for (rpos = 0; rpos < length; rpos++) {
      current_char = buffer[rpos];
      current_property = unsafe_get_property(current_char);
      if (starter && current_property->combining_class > max_combining_class) {
        /* combination perhaps possible */
        utf8proc_int32_t hangul_lindex;
        utf8proc_int32_t hangul_sindex;
        hangul_lindex = *starter - UTF8PROC_HANGUL_LBASE;
        if (hangul_lindex >= 0 && hangul_lindex < UTF8PROC_HANGUL_LCOUNT) {
          utf8proc_int32_t hangul_vindex;
          hangul_vindex = current_char - UTF8PROC_HANGUL_VBASE;
          if (hangul_vindex >= 0 && hangul_vindex < UTF8PROC_HANGUL_VCOUNT) {
            *starter = UTF8PROC_HANGUL_SBASE +
              (hangul_lindex * UTF8PROC_HANGUL_VCOUNT + hangul_vindex) *
              UTF8PROC_HANGUL_TCOUNT;
            starter_property = NULL;
            continue;
          }
        }
        hangul_sindex = *starter - UTF8PROC_HANGUL_SBASE;
        if (hangul_sindex >= 0 && hangul_sindex < UTF8PROC_HANGUL_SCOUNT &&
            (hangul_sindex % UTF8PROC_HANGUL_TCOUNT) == 0) {
          utf8proc_int32_t hangul_tindex;
          hangul_tindex = current_char - UTF8PROC_HANGUL_TBASE;
          if (hangul_tindex >= 0 && hangul_tindex < UTF8PROC_HANGUL_TCOUNT) {
            *starter += hangul_tindex;
            starter_property = NULL;
            continue;
          }
        }
        if (!starter_property) {
          starter_property = unsafe_get_property(*starter);
        }
        if (starter_property->comb1st_index >= 0 &&
            current_property->comb2nd_index >= 0) {
          composition = utf8proc_combinations[
            starter_property->comb1st_index +
            current_property->comb2nd_index
          ];
          if (composition >= 0 && (!(options & UTF8PROC_STABLE) ||
              !(unsafe_get_property(composition)->comp_exclusion))) {
            *starter = composition;
            starter_property = NULL;
            continue;
          }
        }
      }
      buffer[wpos] = current_char;
      if (current_property->combining_class) {
        if (current_property->combining_class > max_combining_class) {
          max_combining_class = current_property->combining_class;
        }
      } else {
        starter = buffer + wpos;
        starter_property = NULL;
        max_combining_class = -1;
      }
      wpos++;
    }
    length = wpos;
  }
  {
    utf8proc_ssize_t rpos, wpos = 0;
    utf8proc_int32_t uc;
    if (options & UTF8PROC_CHARBOUND) {
        for (rpos = 0; rpos < length; rpos++) {
            uc = buffer[rpos];
            wpos += unsafe_encode_char(uc, ((utf8proc_uint8_t *)buffer) + wpos);
        }
    } else {
        for (rpos = 0; rpos < length; rpos++) {
            uc = buffer[rpos];
            wpos += utf8proc_encode_char(uc, ((utf8proc_uint8_t *)buffer) + wpos);
        }
    }
    ((utf8proc_uint8_t *)buffer)[wpos] = 0;
    return wpos;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl -0x14(%rbp), %eax
andl $0x380, %eax            # imm = 0x380
cmpl $0x0, %eax
je 0x10bee
movq $0x0, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x10(%rbp), %rax
jge 0x10be6
movq -0x8(%rbp), %rax
movq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x2c(%rbp)
cmpl $0xd, -0x2c(%rbp)
jne 0x10aa5
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jge 0x10aa5
movq -0x8(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpl $0xa, 0x4(%rax,%rcx,4)
jne 0x10aa5
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
cmpl $0xa, -0x2c(%rbp)
je 0x10adb
cmpl $0xd, -0x2c(%rbp)
je 0x10adb
cmpl $0x85, -0x2c(%rbp)
je 0x10adb
movl -0x14(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x10b74
cmpl $0xb, -0x2c(%rbp)
je 0x10adb
cmpl $0xc, -0x2c(%rbp)
jne 0x10b74
movl -0x14(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x10b2d
movl -0x14(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x10b11
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movl $0xa, (%rax,%rcx,4)
jmp 0x10b2b
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movl $0x2028, (%rax,%rcx,4)  # imm = 0x2028
jmp 0x10b72
movl -0x14(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x10b56
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movl $0x2029, (%rax,%rcx,4)  # imm = 0x2029
jmp 0x10b70
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movl $0x20, (%rax,%rcx,4)
jmp 0x10b72
jmp 0x10bd3
movl -0x14(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x10bb8
cmpl $0x20, -0x2c(%rbp)
jl 0x10b96
cmpl $0x7f, -0x2c(%rbp)
jl 0x10bb8
cmpl $0xa0, -0x2c(%rbp)
jge 0x10bb8
cmpl $0x9, -0x2c(%rbp)
jne 0x10bb6
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movl $0x20, (%rax,%rcx,4)
jmp 0x10bd1
movl -0x2c(%rbp), %edx
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x28(%rbp)
movl %edx, (%rax,%rcx,4)
jmp 0x10bd3
jmp 0x10bd5
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x10a57
movq -0x28(%rbp), %rax
movq %rax, -0x10(%rbp)
movl -0x14(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x10e26
movq $0x0, -0x38(%rbp)
movq $0x0, -0x48(%rbp)
movw $0xffff, -0x52(%rbp)    # imm = 0xFFFF
movq $0x0, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x10(%rbp), %rax
jge 0x10e1e
movq -0x8(%rbp), %rax
movq -0x60(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %edi
callq 0xfcc0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x10da9
movq -0x50(%rbp), %rax
movswl 0x2(%rax), %eax
movswl -0x52(%rbp), %ecx
cmpl %ecx, %eax
jle 0x10da9
movq -0x38(%rbp), %rax
movl (%rax), %eax
subl $0x1100, %eax           # imm = 0x1100
movl %eax, -0x70(%rbp)
cmpl $0x0, -0x70(%rbp)
jl 0x10cc0
cmpl $0x13, -0x70(%rbp)
jge 0x10cc0
movl -0x3c(%rbp), %eax
subl $0x1161, %eax           # imm = 0x1161
movl %eax, -0x78(%rbp)
cmpl $0x0, -0x78(%rbp)
jl 0x10cbe
cmpl $0x15, -0x78(%rbp)
jge 0x10cbe
imull $0x15, -0x70(%rbp), %eax
addl -0x78(%rbp), %eax
imull $0x1c, %eax, %ecx
addl $0xac00, %ecx           # imm = 0xAC00
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movq $0x0, -0x48(%rbp)
jmp 0x10e0d
jmp 0x10cc0
movq -0x38(%rbp), %rax
movl (%rax), %eax
subl $0xac00, %eax           # imm = 0xAC00
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jl 0x10d1e
cmpl $0x2ba4, -0x74(%rbp)    # imm = 0x2BA4
jge 0x10d1e
movl -0x74(%rbp), %eax
movl $0x1c, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x10d1e
movl -0x3c(%rbp), %eax
subl $0x11a7, %eax           # imm = 0x11A7
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jl 0x10d1c
cmpl $0x1c, -0x7c(%rbp)
jge 0x10d1c
movl -0x7c(%rbp), %ecx
movq -0x38(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq $0x0, -0x48(%rbp)
jmp 0x10e0d
jmp 0x10d1e
cmpq $0x0, -0x48(%rbp)
jne 0x10d34
movq -0x38(%rbp), %rax
movl (%rax), %edi
callq 0xfcc0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jl 0x10da7
movq -0x50(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jl 0x10da7
movq -0x48(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x50(%rbp), %rcx
addl 0x1c(%rcx), %eax
movslq %eax, %rcx
leaq 0xeb6e0(%rip), %rax     # 0xfc440
movl (%rax,%rcx,4), %eax
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x6c(%rbp)
jl 0x10da5
movl -0x14(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x10d92
movl -0x6c(%rbp), %edi
callq 0xfcc0
movw 0x20(%rax), %ax
shrw %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x10da5
movl -0x6c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movq $0x0, -0x48(%rbp)
jmp 0x10e0d
jmp 0x10da7
jmp 0x10da9
movl -0x3c(%rbp), %edx
movq -0x8(%rbp), %rax
movq -0x68(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x50(%rbp), %rax
cmpw $0x0, 0x2(%rax)
je 0x10de0
movq -0x50(%rbp), %rax
movswl 0x2(%rax), %eax
movswl -0x52(%rbp), %ecx
cmpl %ecx, %eax
jle 0x10dde
movq -0x50(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x52(%rbp)
jmp 0x10e01
movq -0x8(%rbp), %rax
movq -0x68(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x48(%rbp)
movw $0xffff, -0x52(%rbp)    # imm = 0xFFFF
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x10c23
movq -0x68(%rbp), %rax
movq %rax, -0x10(%rbp)
movq $0x0, -0x90(%rbp)
movl -0x14(%rbp), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x10ea4
movq $0x0, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x10(%rbp), %rax
jge 0x10ea2
movq -0x8(%rbp), %rax
movq -0x88(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %edi
movq -0x8(%rbp), %rsi
addq -0x90(%rbp), %rsi
callq 0x10f30
addq -0x90(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x10e49
jmp 0x10f0a
movq $0x0, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x10(%rbp), %rax
jge 0x10f08
movq -0x8(%rbp), %rax
movq -0x88(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %edi
movq -0x8(%rbp), %rsi
addq -0x90(%rbp), %rsi
callq 0xfb30
addq -0x90(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x10eaf
jmp 0x10f0a
movq -0x8(%rbp), %rax
movq -0x90(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x90(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)