// File: sile[P]unf/src/unf/trie/searcher.hh
// Function: UNF::Trie::CanonicalCombiningClass::sort(char*, std::vector<unsigned char, std::allocator<unsigned char>>&) const
void sort(char* str, std::vector<unsigned char>& classes) const {
	CharStream in(str);
	unsigned sort_beg=0;
	unsigned sort_end=0;
	unsigned unicode_char_count=0;

      loop_head:
	unsigned beg = in.cur()-str;
	
	for(unsigned node_index=root;;){
	  node_index = nodes[node_index].jump(in.read());
	  
	  if(nodes[node_index].check_char()==in.prev()) {
	    unsigned terminal_index = nodes[node_index].jump('\0');
	    if(nodes[terminal_index].check_char()=='\0') {
	      if((unicode_char_count++)==0)
		sort_beg = beg;
	      sort_end = in.cur()-str;
	      
	      unsigned char klass = nodes[terminal_index].value();
	      for(unsigned i=beg; i < sort_end; i++) 
		classes[i] = klass;
 	      break;
	    }
	  } else {
	    if(unicode_char_count > 1)
	      bubble_sort(str, classes, sort_beg, sort_end);
	    unicode_char_count = 0;
	    break;
	  }
	} 
	Util::eat_until_utf8_char_start_point(in);

	if(in.eos()==false)
	  goto loop_head;

	if(unicode_char_count > 1)
	  bubble_sort(str, classes, sort_beg, sort_end);
      }

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x58(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x3c60
movl $0x0, 0x44(%rsp)
movl $0x0, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x50d0
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq 0x58(%rsp), %rdx
subq %rdx, %rcx
movl %ecx, 0x38(%rsp)
movl 0x8(%rax), %eax
movl %eax, 0x34(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rax
movl 0x34(%rsp), %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x3ce0
movq 0x10(%rsp), %rdi
movzbl %al, %esi
callq 0x3c80
movl %eax, %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x34(%rsp)
movq (%rax), %rdi
movl 0x34(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x3cc0
movl %eax, 0x1c(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x50e0
movb %al, %cl
movl 0x1c(%rsp), %eax
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x42a6
movq 0x20(%rsp), %rax
movq (%rax), %rdi
movl 0x34(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x3c80
movl %eax, %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x30(%rsp)
movq (%rax), %rdi
movl 0x30(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x3cc0
cmpl $0x0, %eax
jne 0x42a4
movl 0x3c(%rsp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x3c(%rsp)
cmpl $0x0, %eax
jne 0x4230
movl 0x38(%rsp), %eax
movl %eax, 0x44(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x50d0
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq 0x58(%rsp), %rdx
subq %rdx, %rcx
movl %ecx, 0x40(%rsp)
movq (%rax), %rdi
movl 0x30(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x3cd0
movb %al, 0x2f(%rsp)
movl 0x38(%rsp), %eax
movl %eax, 0x28(%rsp)
movl 0x28(%rsp), %eax
cmpl 0x40(%rsp), %eax
jae 0x42a2
movb 0x2f(%rsp), %al
movb %al, 0xf(%rsp)
movq 0x50(%rsp), %rdi
movl 0x28(%rsp), %eax
movl %eax, %esi
callq 0x5100
movb 0xf(%rsp), %cl
movb %cl, (%rax)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x426d
jmp 0x42d9
jmp 0x42d4
cmpl $0x1, 0x3c(%rsp)
jbe 0x42ca
movq 0x20(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %rdx
movl 0x44(%rsp), %ecx
movl 0x40(%rsp), %r8d
callq 0x5120
movl $0x0, 0x3c(%rsp)
jmp 0x42d9
jmp 0x4169
leaq 0x48(%rsp), %rdi
callq 0x5230
leaq 0x48(%rsp), %rdi
callq 0x3d50
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x42fc
jmp 0x4144
cmpl $0x1, 0x3c(%rsp)
jbe 0x4320
movq 0x20(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %rdx
movl 0x44(%rsp), %ecx
movl 0x40(%rsp), %r8d
callq 0x5120
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)
nop