// File: /workspace/github_c_makefile_star2_O3/michaelnmmeyer[P]gourgandine/src/lib/utf8proc.c
// Function: utf8proc_decompose_char
UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_char(utf8proc_int32_t uc, utf8proc_int32_t *dst, utf8proc_ssize_t bufsize, utf8proc_option_t options, int *last_boundclass) {
  const utf8proc_property_t *property;
  utf8proc_propval_t category;
  utf8proc_int32_t hangul_sindex;
  if (uc < 0 || uc >= 0x110000) return UTF8PROC_ERROR_NOTASSIGNED;
  property = unsafe_get_property(uc);
  category = property->category;
  hangul_sindex = uc - UTF8PROC_HANGUL_SBASE;
  if (options & (UTF8PROC_COMPOSE|UTF8PROC_DECOMPOSE)) {
    if (hangul_sindex >= 0 && hangul_sindex < UTF8PROC_HANGUL_SCOUNT) {
      utf8proc_int32_t hangul_tindex;
      if (bufsize >= 1) {
        dst[0] = UTF8PROC_HANGUL_LBASE +
          hangul_sindex / UTF8PROC_HANGUL_NCOUNT;
        if (bufsize >= 2) dst[1] = UTF8PROC_HANGUL_VBASE +
          (hangul_sindex % UTF8PROC_HANGUL_NCOUNT) / UTF8PROC_HANGUL_TCOUNT;
      }
      hangul_tindex = hangul_sindex % UTF8PROC_HANGUL_TCOUNT;
      if (!hangul_tindex) return 2;
      if (bufsize >= 3) dst[2] = UTF8PROC_HANGUL_TBASE + hangul_tindex;
      return 3;
    }
  }
  if (options & UTF8PROC_REJECTNA) {
    if (!category) return UTF8PROC_ERROR_NOTASSIGNED;
  }
  if (options & UTF8PROC_IGNORE) {
    if (property->ignorable) return 0;
  }
  if (options & UTF8PROC_LUMP) {
    if (category == UTF8PROC_CATEGORY_ZS) utf8proc_decompose_lump(0x0020);
    if (uc == 0x2018 || uc == 0x2019 || uc == 0x02BC || uc == 0x02C8)
      utf8proc_decompose_lump(0x0027);
    if (category == UTF8PROC_CATEGORY_PD || uc == 0x2212)
      utf8proc_decompose_lump(0x002D);
    if (uc == 0x2044 || uc == 0x2215) utf8proc_decompose_lump(0x002F);
    if (uc == 0x2236) utf8proc_decompose_lump(0x003A);
    if (uc == 0x2039 || uc == 0x2329 || uc == 0x3008)
      utf8proc_decompose_lump(0x003C);
    if (uc == 0x203A || uc == 0x232A || uc == 0x3009)
      utf8proc_decompose_lump(0x003E);
    if (uc == 0x2216) utf8proc_decompose_lump(0x005C);
    if (uc == 0x02C4 || uc == 0x02C6 || uc == 0x2038 || uc == 0x2303)
      utf8proc_decompose_lump(0x005E);
    if (category == UTF8PROC_CATEGORY_PC || uc == 0x02CD)
      utf8proc_decompose_lump(0x005F);
    if (uc == 0x02CB) utf8proc_decompose_lump(0x0060);
    if (uc == 0x2223) utf8proc_decompose_lump(0x007C);
    if (uc == 0x223C) utf8proc_decompose_lump(0x007E);
    if ((options & UTF8PROC_NLF2LS) && (options & UTF8PROC_NLF2PS)) {
      if (category == UTF8PROC_CATEGORY_ZL ||
          category == UTF8PROC_CATEGORY_ZP)
        utf8proc_decompose_lump(0x000A);
    }
  }
  if (options & UTF8PROC_STRIPMARK) {
    if (category == UTF8PROC_CATEGORY_MN ||
      category == UTF8PROC_CATEGORY_MC ||
      category == UTF8PROC_CATEGORY_ME) return 0;
  }
  if (options & UTF8PROC_CASEFOLD) {
    if (property->casefold_mapping != UINT16_MAX) {
      const utf8proc_int32_t *casefold_entry;
      utf8proc_ssize_t written = 0;
      for (casefold_entry = &utf8proc_sequences[property->casefold_mapping];
          *casefold_entry >= 0; casefold_entry++) {
        written += utf8proc_decompose_char(*casefold_entry, dst+written,
          (bufsize > written) ? (bufsize - written) : 0, options,
          last_boundclass);
        if (written < 0) return UTF8PROC_ERROR_OVERFLOW;
      }
      return written;
    }
  }
  if (options & (UTF8PROC_COMPOSE|UTF8PROC_DECOMPOSE)) {
    if (property->decomp_mapping != UINT16_MAX &&
        (!property->decomp_type || (options & UTF8PROC_COMPAT))) {
      const utf8proc_int32_t *decomp_entry;
      utf8proc_ssize_t written = 0;
      for (decomp_entry = &utf8proc_sequences[property->decomp_mapping];
          *decomp_entry >= 0; decomp_entry++) {
        written += utf8proc_decompose_char(*decomp_entry, dst+written,
          (bufsize > written) ? (bufsize - written) : 0, options,
        last_boundclass);
        if (written < 0) return UTF8PROC_ERROR_OVERFLOW;
      }
      return written;
    }
  }
  if (options & UTF8PROC_CHARBOUND) {
    utf8proc_bool boundary;
    int tbc = property->boundclass;
    boundary = grapheme_break(*last_boundclass, tbc);
    *last_boundclass = tbc;
    if (boundary) {
      if (bufsize >= 1) dst[0] = 0xFFFF;
      if (bufsize >= 2) dst[1] = uc;
      return 2;
    }
  }
  if (bufsize >= 1) *dst = uc;
  return 1;
}

// Assembly:
movq $-0x4, %rax
cmpl $0x10ffff, %edi         # imm = 0x10FFFF
ja 0x84f4
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leal -0xac00(%rdi), %r9d
testb $0x18, %cl
setne %bl
cmpl $0x2ba4, %r9d           # imm = 0x2BA4
setb %r10b
testb %r10b, %bl
je 0x8160
movzwl %r9w, %eax
testq %rdx, %rdx
jle 0x84ac
imull $0x6f75, %eax, %ecx     # imm = 0x6F75
shrl $0x18, %ecx
leal 0x1100(%rcx), %edi
movl %edi, (%rsi)
cmpq $0x1, %rdx
jne 0x8489
imull $0x6db7, %r9d, %eax     # imm = 0x6DB7
rorw $0x2, %ax
movzwl %ax, %eax
cmpl $0x925, %eax            # imm = 0x925
movl $0x3, %eax
sbbq $0x0, %rax
jmp 0x84e6
movq %r8, (%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
movl %ecx, %edx
andl $0xffffefff, %edx       # imm = 0xFFFFEFFF
movzbl %dil, %r8d
movl %edi, %r9d
shrl $0x8, %r9d
leaq 0x9c058(%rip), %r10     # 0xa41e0
movzwl (%r10,%r9,2), %r15d
addl %r8d, %r15d
testb $0x18, %cl
setne %sil
leaq 0x9e242(%rip), %r8      # 0xa63e0
leaq 0xb083b(%rip), %r9      # 0xb89e0
movl %ecx, %ebp
movl %edi, %r14d
movl %ebx, %r11d
movl %r15d, %ecx
movzwl (%r8,%rcx,2), %ecx
leaq (%rcx,%rcx,8), %rcx
movzwl (%r9,%rcx,4), %r13d
testb $0x40, %bpl
je 0x81ce
testw %r13w, %r13w
je 0x84e6
leaq (%r9,%rcx,4), %r10
testb $0x20, %bpl
je 0x81e3
testb $0x4, 0x20(%r10)
jne 0x8485
btl $0xc, %ebp
jae 0x8474
movl $0x20, %r15d
movl %esi, %ebx
movl $0x20, %edi
movl %edx, %ecx
cmpw $0x17, %r13w
je 0x81a5
movl %r14d, %r12d
andl $0x1ffffe, %r12d        # imm = 0x1FFFFE
movl $0x27, %r15d
movl %esi, %ebx
movl $0x27, %edi
movl %edx, %ecx
cmpl $0x2018, %r12d          # imm = 0x2018
je 0x81a5
movl %esi, %ebx
movl $0x27, %edi
movl %edx, %ecx
cmpl $0x2bc, %r14d           # imm = 0x2BC
je 0x81a5
movl %esi, %ebx
movl $0x27, %edi
movl %edx, %ecx
cmpl $0x2c8, %r14d           # imm = 0x2C8
je 0x81a5
movl $0x2d, %r15d
movl %esi, %ebx
movl $0x2d, %edi
movl %edx, %ecx
cmpl $0x2212, %r14d          # imm = 0x2212
je 0x81a5
movl %esi, %ebx
movl $0x2d, %edi
movl %edx, %ecx
cmpw $0xd, %r13w
je 0x81a5
cmpl $0x2235, %r14d          # imm = 0x2235
jg 0x82e6
cmpl $0x2043, %r14d          # imm = 0x2043
jle 0x830c
movl $0x2f, %r15d
movl %esi, %ebx
movl $0x2f, %edi
movl %edx, %ecx
cmpl $0x2044, %r14d          # imm = 0x2044
je 0x81a5
movl %esi, %ebx
movl $0x2f, %edi
movl %edx, %ecx
cmpl $0x2215, %r14d          # imm = 0x2215
je 0x81a5
cmpl $0x2216, %r14d          # imm = 0x2216
jne 0x836c
movl $0x5c, %r15d
movl %esi, %ebx
movl $0x5c, %edi
movl %edx, %ecx
jmp 0x81a5
cmpl $0x2329, %r14d          # imm = 0x2329
jle 0x8332
cmpl $0x232a, %r14d          # imm = 0x232A
je 0x831e
cmpl $0x3008, %r14d          # imm = 0x3008
je 0x8344
cmpl $0x3009, %r14d          # imm = 0x3009
je 0x831e
jmp 0x836c
cmpl $0x2039, %r14d          # imm = 0x2039
je 0x8344
cmpl $0x203a, %r14d          # imm = 0x203A
jne 0x836c
movl $0x3e, %r15d
movl %esi, %ebx
movl $0x3e, %edi
movl %edx, %ecx
jmp 0x81a5
cmpl $0x2236, %r14d          # imm = 0x2236
je 0x8358
cmpl $0x2329, %r14d          # imm = 0x2329
jne 0x836c
movl $0x3c, %r15d
movl %esi, %ebx
movl $0x3c, %edi
movl %edx, %ecx
jmp 0x81a5
movl $0x3a, %r15d
movl %esi, %ebx
movl $0x3a, %edi
movl %edx, %ecx
jmp 0x81a5
movl %r14d, %r12d
andl $0x1ffffd, %r12d        # imm = 0x1FFFFD
movl $0x5e, %r15d
movl %esi, %ebx
movl $0x5e, %edi
movl %edx, %ecx
cmpl $0x2c4, %r12d           # imm = 0x2C4
je 0x81a5
movl %esi, %ebx
movl $0x5e, %edi
movl %edx, %ecx
cmpl $0x2038, %r14d          # imm = 0x2038
je 0x81a5
movl %esi, %ebx
movl $0x5e, %edi
movl %edx, %ecx
cmpl $0x2303, %r14d          # imm = 0x2303
je 0x81a5
movl $0x5f, %r15d
movl %esi, %ebx
movl $0x5f, %edi
movl %edx, %ecx
cmpl $0x2cd, %r14d           # imm = 0x2CD
je 0x81a5
movl %esi, %ebx
movl $0x5f, %edi
movl %edx, %ecx
cmpw $0xc, %r13w
je 0x81a5
movl $0x60, %r15d
movl %esi, %ebx
movl $0x60, %edi
movl %edx, %ecx
cmpl $0x2cb, %r14d           # imm = 0x2CB
je 0x81a5
cmpl $0x223c, %r14d          # imm = 0x223C
je 0x8430
cmpl $0x2223, %r14d          # imm = 0x2223
jne 0x8444
movl $0x7c, %r15d
movl %esi, %ebx
movl $0x7c, %edi
movl %edx, %ecx
jmp 0x81a5
movl $0x7e, %r15d
movl %esi, %ebx
movl $0x7e, %edi
movl %edx, %ecx
jmp 0x81a5
movl %ebp, %ecx
notl %ecx
testl $0x180, %ecx            # imm = 0x180
jne 0x8474
movl %r13d, %r12d
andl $0xfffe, %r12d          # imm = 0xFFFE
movl $0xa, %r15d
movl %esi, %ebx
movl $0xa, %edi
movl %edx, %ecx
cmpw $0x18, %r12w
je 0x81a5
btl $0xd, %ebp
jae 0x84f5
addl $-0x6, %r13d
cmpw $0x3, %r13w
jae 0x84f5
xorl %eax, %eax
jmp 0x84e6
imull $0x24c, %ecx, %ecx      # imm = 0x24C
movl %r9d, %edi
subl %ecx, %edi
movzwl %di, %ecx
shrl $0x2, %ecx
imull $0x4925, %ecx, %ecx     # imm = 0x4925
shrl $0x11, %ecx
addl $0x1161, %ecx           # imm = 0x1161
movl %ecx, 0x4(%rsi)
shrl $0x2, %eax
imull $0x4925, %eax, %eax     # imm = 0x4925
shrl $0x11, %eax
leal (%rax,%rax,8), %ecx
leal (%rcx,%rcx,2), %ecx
addl %eax, %ecx
subw %cx, %r9w
je 0x84e1
movl $0x3, %eax
cmpq $0x3, %rdx
jl 0x84e6
addl $0x11a7, %r9d           # imm = 0x11A7
movzwl %r9w, %ecx
movl %ecx, 0x8(%rsi)
jmp 0x84e6
movl $0x2, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
btl $0xa, %ebp
movq 0x10(%rsp), %r12
jae 0x8562
movzwl 0xa(%r10), %eax
cmpq $0xffff, %rax           # imm = 0xFFFF
je 0x8562
leaq 0x8fa0c(%rip), %rcx     # 0x97f20
movl (%rcx,%rax,4), %edi
testl %edi, %edi
movq 0x8(%rsp), %r13
js 0x8485
leaq (%rcx,%rax,4), %rbx
addq $0x4, %rbx
xorl %r15d, %r15d
xorl %eax, %eax
movq %rax, %r14
leaq (%r12,%rax,4), %rsi
movq %r13, %rdx
subq %rax, %rdx
cmovleq %r15, %rdx
movl %ebp, %ecx
movq (%rsp), %r8
callq 0x80d9
addq %r14, %rax
js 0x863b
movl (%rbx), %edi
addq $0x4, %rbx
testl %edi, %edi
jns 0x8531
jmp 0x84e6
testb $0x1, %r11b
movq 0x8(%rsp), %r13
je 0x8588
movzwl 0x8(%r10), %eax
cmpq $0xffff, %rax           # imm = 0xFFFF
je 0x8588
testb $0x4, %bpl
jne 0x85ec
cmpw $0x0, 0x6(%r10)
je 0x85ec
btl $0xb, %ebp
jae 0x85d5
movl 0x20(%r10), %ebp
shrl $0x4, %ebp
andl $0xf, %ebp
movq (%rsp), %rbx
movl (%rbx), %edi
movl %ebp, %esi
callq 0x7edb
movl %ebp, (%rbx)
testb %al, %al
je 0x85d5
movl $0x2, %eax
testq %r13, %r13
jle 0x84e6
movl $0xffff, (%r12)         # imm = 0xFFFF
cmpq $0x1, %r13
je 0x84e6
movl %r14d, 0x4(%r12)
jmp 0x84e6
movl $0x1, %eax
testq %r13, %r13
jle 0x84e6
movl %r14d, (%r12)
jmp 0x84e6
leaq 0x8f92d(%rip), %rcx     # 0x97f20
movl (%rcx,%rax,4), %edi
testl %edi, %edi
js 0x8485
leaq (%rcx,%rax,4), %rbx
addq $0x4, %rbx
xorl %r15d, %r15d
xorl %eax, %eax
movq %rax, %r14
leaq (%r12,%rax,4), %rsi
movq %r13, %rdx
subq %rax, %rdx
cmovleq %r15, %rdx
movl %ebp, %ecx
movq (%rsp), %r8
callq 0x80d9
addq %r14, %rax
js 0x863b
movl (%rbx), %edi
addq $0x4, %rbx
testl %edi, %edi
jns 0x860b
jmp 0x84e6
movq $-0x2, %rax
jmp 0x84e6