// File: /workspace/github_cpp_makefile_star2_O3/sile[P]unf/src/unf/trie/searcher.hh
// Function: UNF::Trie::NormalizationForm::compose(UNF::Trie::CharStreamForComposition&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) const
void compose(CharStreamForComposition& in, std::string& buf) const {
	in.init_skipinfo();

	const char* const beg = in.cur();
	const char* current_char_head = in.cur();
	unsigned composed_char_info = 0;
	
	unsigned node_index = root;
	unsigned retry_root_node = root;
	unsigned char retry_root_class = 0;

	for(bool first=true;;) {
	  if(Util::is_utf8_char_start_byte(in.peek())) {
	    if(node_index != root)
	      first=false;
	    current_char_head = in.cur();

	    retry_root_node = node_index;
	    retry_root_class = in.get_canonical_class();
	  }

	retry:
	  unsigned next_index = nodes[node_index].jump(in.peek());
	  if(nodes[next_index].check_char()==in.read()) {
	    // succeeded
	    node_index = next_index;
	    unsigned terminal_index = nodes[node_index].jump('\0');
	    if(nodes[terminal_index].check_char()=='\0') {
	      composed_char_info = nodes[terminal_index].value();
              
	      in.mark_as_last_valid_point();
	      if(in.eos() || retry_root_class > in.get_canonical_class())
		break;
	    }
	  } else if (first==true) {
	    // no retry if current point is a part of first starter
	    break;
	  } else if (in.next_combining_char(retry_root_class, current_char_head)==true) { 
	    // back previous code-point and retry
	    node_index = retry_root_node;
	    current_char_head = in.cur();
	    goto retry;
	  } else {
	    break;
	  }
	}  
	
	if(composed_char_info != 0) {
	  // append composed unicode-character and skipped combining-characters
	  word_append(buf, value, composed_char_info);
	  in.append_skipped_chars_to_str(buf);
	  in.reset_at_marked_point();
	} else {
	  // append one unicode-character
	  in.setCur(Util::nearest_utf8_char_start_point(beg+1));
	  in.append_read_char_to_str(buf, beg);
	}
      }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x18(%rsp)
movq %rsi, %rbx
movq 0x28(%rsi), %rax
movq $0x0, 0x8(%rax)
movq (%rax), %rax
movb $0x0, (%rax)
movl $0x0, 0x30(%rsi)
leaq 0x10(%rsi), %rbp
movq 0x10(%rsi), %rsi
movq 0x18(%rbx), %rax
movb (%rsi), %r8b
testb %r8b, %r8b
movq %rsi, %rdx
cmoveq %rax, %rdx
leaq 0x18(%rbx), %r13
movq %rdi, 0x10(%rsp)
movl 0x8(%rdi), %ecx
xorl %r15d, %r15d
movb $0x1, 0xb(%rsp)
movl $0xffffff, %r14d        # imm = 0xFFFFFF
movl %ecx, %r12d
movl $0x0, 0xc(%rsp)
movq %rdx, 0x20(%rsp)
testb %r8b, %r8b
movq %rsi, %rdi
cmoveq %rax, %rdi
movb (%rdi), %r8b
andb $-0x40, %r8b
negb %r8b
jno 0x356b
movq %rdx, %rdi
jmp 0x35a0
movq 0x10(%rsp), %rdx
cmpl 0x8(%rdx), %ecx
sete %dl
andb %dl, 0xb(%rsp)
subl (%rbx), %esi
addl %esi, %eax
subl 0x8(%rbx), %eax
movq 0x20(%rbx), %rsi
movq (%rsi), %rdx
movq 0x8(%rsi), %rsi
subq %rdx, %rsi
cmpq %rax, %rsi
jbe 0x359a
movb (%rdx,%rax), %r15b
jmp 0x359d
xorl %r15d, %r15d
movl %ecx, %r12d
movq %rdi, %rdx
movq (%rbp), %rax
movb (%rax), %r8b
movq (%r13), %rsi
movq %rsi, %rdi
testb %r8b, %r8b
je 0x35b9
movq %rax, %rdi
movq 0x10(%rsp), %r9
movq (%r9), %r9
movl %ecx, %ecx
movzbl (%rdi), %edi
movl (%r9,%rcx,4), %ecx
andl %r14d, %ecx
addl %edi, %ecx
movzbl 0x3(%r9,%rcx,4), %edi
movq %rbp, %r9
testb %r8b, %r8b
jne 0x35e8
cmpb $0x0, (%rsi)
movq %rsi, %rax
movq %r13, %r9
je 0x362a
leaq 0x1(%rax), %rsi
movq %rsi, (%r9)
movzbl (%rax), %eax
cmpl %eax, %edi
je 0x362e
testb $0x1, 0xb(%rsp)
jne 0x36b2
movzbl %r15b, %esi
movq %rbx, %rdi
callq 0x3768
testb %al, %al
je 0x36b2
movq (%rbp), %rdx
cmpb $0x0, (%rdx)
jne 0x3622
movq (%r13), %rdx
movl %r12d, %ecx
jmp 0x35a3
xorl %eax, %eax
jmp 0x35f2
movq 0x10(%rsp), %rax
movq (%rax), %rax
movl (%rax,%rcx,4), %esi
movl $0xffffff, %edi         # imm = 0xFFFFFF
andl %edi, %esi
movl (%rax,%rsi,4), %eax
movl $0xffffff, %r14d        # imm = 0xFFFFFF
cmpl %edi, %eax
ja 0x36a2
movq 0x28(%rbx), %rsi
movl 0x8(%rsi), %esi
movl %esi, 0x30(%rbx)
movq 0x10(%rbx), %rdi
cmpb $0x0, (%rdi)
movq 0x18(%rbx), %rsi
movq %rdi, %r8
cmoveq %rsi, %r8
movq %r8, 0x38(%rbx)
cmpb $0x0, (%rdi)
jne 0x3677
cmpb $0x0, (%rsi)
je 0x36b6
subl (%rbx), %edi
addl %edi, %esi
subl 0x8(%rbx), %esi
movq 0x20(%rbx), %r8
movq (%r8), %rdi
movq 0x8(%r8), %r8
subq %rdi, %r8
cmpq %rsi, %r8
jbe 0x3697
movb (%rdi,%rsi), %sil
jmp 0x3699
xorl %esi, %esi
movl %eax, 0xc(%rsp)
cmpb %sil, %r15b
ja 0x36b6
movq (%rbp), %rsi
movb (%rsi), %r8b
movq (%r13), %rax
jmp 0x3550
movl 0xc(%rsp), %eax
testl %eax, %eax
je 0x3721
movl %eax, %esi
andl $0x3ffff, %esi          # imm = 0x3FFFF
movq 0x10(%rsp), %rcx
addq 0x10(%rcx), %rsi
shrl $0x12, %eax
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rax, %rdx
callq 0x2040
movq 0x28(%rbx), %rax
movq (%rax), %rcx
movl 0x30(%rbx), %r8d
movq 0x8(%r14), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x2140
movq 0x38(%rbx), %rax
cmpq %rax, (%rbx)
ja 0x370e
cmpq %rax, 0x10(%rbx)
jb 0x370e
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rax
movq %rax, (%r13)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rsp), %rdx
movq %rdx, %rax
movb 0x1(%rax), %cl
incq %rax
andb $-0x40, %cl
negb %cl
jo 0x3729
cmpq %rax, (%rbx)
ja 0x3749
cmpq %rax, 0x10(%rbx)
jb 0x3749
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rax
movq %rax, 0x18(%rbx)
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3880