// File: /workspace/github_c_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %rbx
movl %edi, %r12d
leaq 0x9cd63(%rip), %rcx     # 0xa51e0
leaq 0x9ef5c(%rip), %rdx     # 0xa73e0
leaq 0xb1555(%rip), %rsi     # 0xb99e0
movq $-0x4, %rax
cmpl $0x10ffff, %r12d        # imm = 0x10FFFF
ja 0x88fb
leal -0xac00(%r12), %edi
testb $0x18, %bpl
setne %r8b
cmpl $0x2ba4, %edi           # imm = 0x2BA4
setb %r9b
andb %r8b, %r9b
cmpb $0x1, %r9b
je 0x8734
movl %r12d, %edi
shrl $0x8, %edi
movzwl (%rcx,%rdi,2), %edi
movzbl %r12b, %r8d
addl %edi, %r8d
movzwl (%rdx,%r8,2), %edi
leaq (%rdi,%rdi,8), %r8
movzwl (%rsi,%r8,4), %edi
testb $0x40, %bpl
je 0x84f4
testw %di, %di
je 0x88fb
leaq (%rsi,%r8,4), %rax
testb $0x20, %bpl
je 0x8508
testb $0x4, 0x20(%rax)
jne 0x87c4
btl $0xc, %ebp
jae 0x87b5
cmpw $0x17, %di
jne 0x8529
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x20, %r12d
jmp 0x848b
movl %r12d, %r8d
andl $0x1ffffe, %r8d         # imm = 0x1FFFFE
cmpl $0x2018, %r8d           # imm = 0x2018
je 0x854e
cmpl $0x2c8, %r12d           # imm = 0x2C8
je 0x854e
cmpl $0x2bc, %r12d           # imm = 0x2BC
jne 0x855f
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x27, %r12d
jmp 0x848b
cmpl $0x2212, %r12d          # imm = 0x2212
je 0x85b8
cmpw $0xd, %di
je 0x85b8
cmpl $0x2235, %r12d          # imm = 0x2235
jg 0x85c9
cmpl $0x2043, %r12d          # imm = 0x2043
jle 0x85ef
cmpl $0x2044, %r12d          # imm = 0x2044
je 0x8635
cmpl $0x2215, %r12d          # imm = 0x2215
je 0x8635
cmpl $0x2216, %r12d          # imm = 0x2216
jne 0x8657
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x5c, %r12d
jmp 0x848b
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x2d, %r12d
jmp 0x848b
cmpl $0x2329, %r12d          # imm = 0x2329
jle 0x8612
cmpl $0x232a, %r12d          # imm = 0x232A
je 0x8601
cmpl $0x3008, %r12d          # imm = 0x3008
je 0x8624
cmpl $0x3009, %r12d          # imm = 0x3009
je 0x8601
jmp 0x8657
cmpl $0x2039, %r12d          # imm = 0x2039
je 0x8624
cmpl $0x203a, %r12d          # imm = 0x203A
jne 0x8657
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x3e, %r12d
jmp 0x848b
cmpl $0x2236, %r12d          # imm = 0x2236
je 0x8646
cmpl $0x2329, %r12d          # imm = 0x2329
jne 0x8657
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x3c, %r12d
jmp 0x848b
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x2f, %r12d
jmp 0x848b
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x3a, %r12d
jmp 0x848b
movl %r12d, %r8d
andl $0x1ffffd, %r8d         # imm = 0x1FFFFD
cmpl $0x2c4, %r8d            # imm = 0x2C4
je 0x867c
cmpl $0x2303, %r12d          # imm = 0x2303
je 0x867c
cmpl $0x2038, %r12d          # imm = 0x2038
jne 0x868d
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x5e, %r12d
jmp 0x848b
cmpl $0x2cd, %r12d           # imm = 0x2CD
je 0x86c8
cmpw $0xc, %di
je 0x86c8
cmpl $0x223c, %r12d          # imm = 0x223C
je 0x86ea
cmpl $0x2223, %r12d          # imm = 0x2223
je 0x86d9
cmpl $0x2cb, %r12d           # imm = 0x2CB
jne 0x86fb
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x60, %r12d
jmp 0x848b
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x5f, %r12d
jmp 0x848b
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x7c, %r12d
jmp 0x848b
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0x7e, %r12d
jmp 0x848b
movl %ebp, %r8d
notl %r8d
testl $0x180, %r8d            # imm = 0x180
jne 0x87b5
movl %edi, %r8d
andl $0xfffe, %r8d           # imm = 0xFFFE
cmpw $0x18, %r8w
jne 0x87b5
andl $0xffffefff, %ebp       # imm = 0xFFFFEFFF
movl $0xa, %r12d
jmp 0x848b
testq %r14, %r14
jle 0x8778
movl %edi, %ecx
movl $0xdee95c4d, %eax       # imm = 0xDEE95C4D
imulq %rcx, %rax
shrq $0x29, %rax
movl %eax, %ecx
orl $0x1100, %ecx           # imm = 0x1100
movl %ecx, (%rbx)
cmpq $0x1, %r14
je 0x8778
imull $0x24c, %eax, %eax      # imm = 0x24C
movl %edi, %ecx
subl %eax, %ecx
shrl $0x2, %ecx
imulq $0x24924925, %rcx, %rax # imm = 0x24924925
shrq $0x20, %rax
addl $0x1161, %eax           # imm = 0x1161
movl %eax, 0x4(%rbx)
movl %edi, %eax
shrl $0x2, %eax
imulq $0x24924925, %rax, %rax # imm = 0x24924925
shrq $0x20, %rax
leal (%rax,%rax,8), %ecx
leal (%rcx,%rcx,2), %ecx
addl %eax, %ecx
subl %ecx, %edi
je 0x8830
movl $0x3, %eax
cmpq $0x3, %r14
jl 0x88fb
addl $0x11a7, %edi           # imm = 0x11A7
movl %edi, 0x8(%rbx)
jmp 0x88fb
btl $0xd, %ebp
jae 0x87cb
addl $-0x6, %edi
cmpw $0x3, %di
jae 0x87cb
xorl %eax, %eax
jmp 0x88fb
btl $0xa, %ebp
jae 0x883a
movzwl 0xa(%rax), %ecx
cmpq $0xffff, %rcx           # imm = 0xFFFF
je 0x883a
leaq 0x9073b(%rip), %rax     # 0x98f20
movl (%rax,%rcx,4), %edi
testl %edi, %edi
js 0x87c4
leaq (%rax,%rcx,4), %r12
addq $0x4, %r12
xorl %eax, %eax
movq %rax, %r13
leaq (%rbx,%rax,4), %rsi
movq %r14, %rdx
subq %rax, %rdx
movl $0x0, %eax
cmovleq %rax, %rdx
movl %ebp, %ecx
movq %r15, %r8
callq 0x845d
addq %r13, %rax
js 0x88f4
movl (%r12), %edi
addq $0x4, %r12
testl %edi, %edi
jns 0x87f6
jmp 0x88fb
movl $0x2, %eax
jmp 0x88fb
testb $0x18, %bpl
je 0x885a
movzwl 0x8(%rax), %ecx
cmpq $0xffff, %rcx           # imm = 0xFFFF
je 0x885a
testb $0x4, %bpl
jne 0x88a5
cmpw $0x0, 0x6(%rax)
je 0x88a5
btl $0xb, %ebp
jae 0x8896
movl 0x20(%rax), %ebp
shrl $0x4, %ebp
andl $0xf, %ebp
movl (%r15), %edi
movl %ebp, %esi
callq 0x8257
movl %ebp, (%r15)
testb %al, %al
je 0x8896
testq %r14, %r14
jle 0x8885
movl $0xffff, (%rbx)         # imm = 0xFFFF
movl $0x2, %eax
cmpq $0x2, %r14
jl 0x88fb
movl %r12d, 0x4(%rbx)
jmp 0x88fb
movl $0x1, %eax
testq %r14, %r14
jle 0x88fb
movl %r12d, (%rbx)
jmp 0x88fb
leaq 0x90674(%rip), %rax     # 0x98f20
movl (%rax,%rcx,4), %edi
testl %edi, %edi
js 0x87c4
leaq (%rax,%rcx,4), %r12
addq $0x4, %r12
xorl %eax, %eax
movq %rax, %r13
leaq (%rbx,%rax,4), %rsi
movq %r14, %rdx
subq %rax, %rdx
movl $0x0, %eax
cmovleq %rax, %rdx
movl %ebp, %ecx
movq %r15, %r8
callq 0x845d
addq %r13, %rax
js 0x88f4
movl (%r12), %edi
addq $0x4, %r12
testl %edi, %edi
jns 0x88c1
jmp 0x88fb
movq $-0x2, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq