// File: /workspace/github_cpp_makefile_star2_O2/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 %rsi, %rbx
movq 0x28(%rsi), %rax
andq $0x0, 0x8(%rax)
movq (%rax), %rax
movb $0x0, (%rax)
andl $0x0, 0x30(%rsi)
movq %rdx, 0x18(%rsp)
movq 0x10(%rsi), %rax
movq 0x18(%rsi), %r14
movb (%rax), %cl
testb %cl, %cl
movq %rax, %r13
cmoveq %r14, %r13
movq %rdi, %r12
movl 0x8(%rdi), %ebp
movl $0x0, 0x10(%rsp)
movb $0x1, 0xb(%rsp)
movl $0xffffff, %r15d        # imm = 0xFFFFFF
movl %ebp, 0x14(%rsp)
movl $0x0, 0xc(%rsp)
movq %r13, 0x20(%rsp)
testb %cl, %cl
cmovneq %rax, %r14
movb (%r14), %al
andb $-0x40, %al
negb %al
jo 0x332c
cmpl 0x8(%r12), %ebp
sete %al
andb %al, 0xb(%rsp)
movq %rbx, %rdi
callq 0x346e
movl %eax, 0x10(%rsp)
movl %ebp, 0x14(%rsp)
movq %r14, %r13
movq (%r12), %rax
movq 0x10(%rbx), %rcx
cmpb $0x0, (%rcx)
jne 0x333d
movq 0x18(%rbx), %rcx
movl %ebp, %edx
movzbl (%rcx), %ecx
movl (%rax,%rdx,4), %ebp
andl %r15d, %ebp
addl %ecx, %ebp
movzbl 0x3(%rax,%rbp,4), %r14d
movq %rbx, %rdi
callq 0x3494
movzbl %al, %eax
cmpl %eax, %r14d
je 0x3396
testb $0x1, 0xb(%rsp)
jne 0x33f6
movzbl 0x10(%rsp), %esi
movq %rbx, %rdi
movq %r13, %rdx
callq 0x34da
testb %al, %al
je 0x33f6
movq 0x10(%rbx), %r13
cmpb $0x0, (%r13)
jne 0x338e
movq 0x18(%rbx), %r13
movl 0x14(%rsp), %eax
movl %eax, %ebp
jmp 0x332c
movq (%r12), %rax
movl (%rax,%rbp,4), %ecx
movl $0xffffff, %edx         # imm = 0xFFFFFF
andl %edx, %ecx
movl (%rax,%rcx,4), %r14d
movl $0xffffff, %r15d        # imm = 0xFFFFFF
cmpl %edx, %r14d
ja 0x33e7
movq %rbx, %rdi
callq 0x34be
movq 0x10(%rbx), %rax
cmpb $0x0, (%rax)
jne 0x33d1
movq 0x18(%rbx), %rax
cmpb $0x0, (%rax)
je 0x3468
movq %rbx, %rdi
callq 0x346e
movl %r14d, %edx
movl %r14d, 0xc(%rsp)
cmpb %al, 0x10(%rsp)
ja 0x33fa
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %r14
movb (%rax), %cl
jmp 0x32fe
movl 0xc(%rsp), %edx
testl %edx, %edx
je 0x3431
movq 0x10(%r12), %rsi
movq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x2dee
movq %rbx, %rdi
movq %r14, %rsi
callq 0x356c
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3584
movq 0x20(%rsp), %r14
leaq 0x1(%r14), %rdi
callq 0x2c85
movq %rbx, %rdi
movq %rax, %rsi
callq 0x358e
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
movq %r14, %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x35a6
movl %r14d, %edx
jmp 0x33fa
nop