// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
movq %rdx, 0x20(%rsp)
movq %rsi, %rbx
movq 0x28(%rsi), %rax
movq $0x0, 0x8(%rax)
movq (%rax), %rax
movb $0x0, (%rax)
movl $0x0, 0x30(%rsi)
movq 0x10(%rsi), %rax
cmpb $0x0, (%rax)
jne 0x3572
movq 0x18(%rbx), %rax
leaq 0x10(%rbx), %r15
leaq 0x18(%rbx), %r14
movl 0x8(%rdi), %ecx
movl $0x0, (%rsp)
movb $0x1, %r10b
movl $0xffffff, %r12d        # imm = 0xFFFFFF
movl %ecx, %r8d
movl %ecx, 0x4(%rsp)
movq $0x0, 0x18(%rsp)
movq %rax, 0x30(%rsp)
movq %rax, 0x8(%rsp)
movq %rbx, 0x28(%rsp)
movq (%r15), %rdx
cmpb $0x0, (%rdx)
movq (%r14), %rcx
movq %rdx, %rax
cmoveq %rcx, %rax
movb (%rax), %sil
andb $-0x40, %sil
negb %sil
jno 0x35cf
movq 0x8(%rsp), %rax
jmp 0x3609
xorl %esi, %esi
cmpl 0x8(%rdi), %r8d
movzbl %r10b, %r10d
movl $0x0, (%rsp)
cmovnel %esi, %r10d
subl (%rbx), %edx
addl %edx, %ecx
subl 0x8(%rbx), %ecx
movq 0x20(%rbx), %rsi
movq (%rsi), %rdx
movq 0x8(%rsi), %rsi
subq %rdx, %rsi
cmpq %rcx, %rsi
jbe 0x3604
movb (%rdx,%rcx), %cl
movl %ecx, (%rsp)
movl %r8d, 0x4(%rsp)
movl %r8d, %edx
movq %rax, 0x8(%rsp)
movl %r10d, 0x14(%rsp)
movq (%r15), %rsi
movb (%rsi), %r8b
movq (%r14), %r11
movq %r11, %rax
testb %r8b, %r8b
je 0x362a
movq %rsi, %rax
movq (%rdi), %rcx
movl %edx, %ebp
movl %edx, %edx
movzbl (%rax), %r9d
movl (%rcx,%rdx,4), %eax
andl %r12d, %eax
addl %r9d, %eax
movl (%rcx,%rax,4), %edx
movq %r15, %r9
testb %r8b, %r8b
jne 0x3659
cmpb $0x0, (%r11)
movq %r11, %rsi
movq %r14, %r9
je 0x373d
leaq 0x1(%rsi), %r8
movq %r8, (%r9)
movzbl (%rsi), %esi
movl %edx, %r8d
shrl $0x18, %r8d
cmpl %esi, %r8d
jne 0x36d6
andl %r12d, %edx
movl (%rcx,%rdx,4), %ecx
xorl %r13d, %r13d
cmpl %r12d, %ecx
ja 0x3739
movq 0x28(%rbx), %rdx
movl 0x8(%rdx), %edx
movl %edx, 0x30(%rbx)
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
cmpb $0x0, (%rsi)
movq %rdx, %r8
je 0x369e
movq %rsi, %r8
movq %r8, 0x38(%rbx)
cmpb $0x0, (%rsi)
jne 0x36b0
cmpb $0x0, (%rdx)
je 0x3782
subl (%rbx), %esi
addl %esi, %edx
subl 0x8(%rbx), %edx
movq 0x20(%rbx), %r8
movq (%r8), %rsi
movq 0x8(%r8), %r8
subq %rsi, %r8
cmpq %rdx, %r8
jbe 0x375e
movb (%rsi,%rdx), %dl
jmp 0x3760
movl $0x2, %r13d
testb $0x1, %r10b
jne 0x375a
movq %rbx, %rax
movq %r14, %rbx
movq %rdi, %r14
movl (%rsp), %ecx
movzbl %cl, %esi
movq %rax, %rdi
movq 0x8(%rsp), %rdx
callq 0x384c
testb %al, %al
je 0x3744
movq (%r15), %rax
movq %rax, 0x8(%rsp)
cmpb $0x0, (%rax)
movq %r14, %rdi
movq %rbx, %r14
jne 0x371d
movq (%r14), %rax
movq %rax, 0x8(%rsp)
movl $0x4, %r13d
movl 0x4(%rsp), %edx
movl 0x14(%rsp), %r10d
movq 0x28(%rsp), %rbx
movl $0xffffff, %r12d        # imm = 0xFFFFFF
jmp 0x3776
movl %eax, %edx
jmp 0x3776
xorl %esi, %esi
jmp 0x3663
movl 0x14(%rsp), %r10d
movq %r14, %rdi
movq %rbx, %r14
movq 0x28(%rsp), %rbx
movl $0xffffff, %r12d        # imm = 0xFFFFFF
movl %ebp, %edx
jmp 0x3776
xorl %edx, %edx
xorl %r13d, %r13d
cmpb %dl, (%rsp)
seta %r13b
addl %r13d, %r13d
movl %eax, %edx
movl %ecx, %eax
movq %rax, 0x18(%rsp)
cmpl $0x4, %r13d
je 0x3616
jmp 0x378a
movl $0x2, %r13d
jmp 0x376d
testl %r13d, %r13d
jne 0x3797
movl %edx, %r8d
jmp 0x35ac
movq 0x18(%rsp), %rdx
testl %edx, %edx
je 0x37f2
movl %edx, %esi
andl $0x3ffff, %esi          # imm = 0x3FFFF
addq 0x10(%rdi), %rsi
shrl $0x12, %edx
movq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x2040
movq 0x28(%rbx), %rax
movq (%rax), %rcx
movl 0x30(%rbx), %r8d
movq 0x8(%r15), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x2140
movq 0x38(%rbx), %rax
cmpq %rax, (%rbx)
ja 0x3839
cmpq %rax, 0x10(%rbx)
jb 0x3839
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rax
movq %rax, 0x18(%rbx)
jmp 0x383c
movq 0x30(%rsp), %rdx
movq %rdx, %rax
movb 0x1(%rax), %cl
incq %rax
andb $-0x40, %cl
negb %cl
jo 0x37fa
cmpq %rax, (%rbx)
ja 0x381a
cmpq %rax, 0x10(%rbx)
jb 0x381a
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rax
movq %rax, 0x18(%rbx)
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x394a
movq %rax, (%r14)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop