// File: /workspace/github_cpp_makefile_star2_O1/jianxinzhou[P]Smart/./src/MyTask.cpp
// Function: MyTask::editdistance(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int MyTask::editdistance(const std::string& right)
{
	std::cout << __FILE__ << std::endl ;
	std::cout << " ----------edit_dist right:------------" << right <<"  size:" << right.size() << std::endl ;
	int len_left = length(queryWord_);
	int len_right = length(right);
	int ** arr_dist = new int* [len_left + 1];
	int index , index_left, index_right;
	std::string subleft , subright ;
	for(index = 0 ; index <= len_left ; index ++)
	{
		arr_dist[index] = new int[len_right + 1];
	}
	int index_i , index_j ;
	for(index_i = 0 , index_j = 0 ; index_j <= len_right ; index_j ++)
	{
		arr_dist[index_i][index_j] = index_j ;
	}
	for(index_i = 1 , index_j = 0 ; index_i <= len_left; index_i ++)
	{
		arr_dist[index_i][index_j] = index_i ;
	}
	for(index_i = 1 , index_left = 0;  index_i <= len_left; index_i ++, index_left ++)
	{
		if(queryWord_[index_left] & (1 << 7))
		{
			subleft = queryWord_.substr(index_left, 2);
			index_left ++ ; 
		}else 
		{
			subleft = queryWord_[index_left];

		}
		for(index_j = 1 , index_right = 0; index_j <= len_right; index_j ++ ,index_right ++)
		{
			if(right[index_right] & (1 << 7)) 
			{
				subright = right.substr(index_right, 2);
				index_right ++ ; 
			}else 
			{
				subright = right[index_right];
			}
			int a = arr_dist[index_i - 1][index_j - 1] + (subleft == subright ? 0 : 1) ;
			arr_dist[index_i][index_j] =  triple_min(a, arr_dist[index_i - 1][index_j] + 1, arr_dist[index_i][index_j - 1] + 1);
		}
	}
	int result = arr_dist[len_left][len_right] ;
	for(index = 0 ; index <= len_left; index ++)
	{
		delete [] arr_dist[index];
	}
	delete [] arr_dist ;
	return result ;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x5623(%rip), %r15      # 0xcfd0
leaq 0x18d1(%rip), %rsi      # 0x9285
movl $0x10, %edx
movq %r15, %rdi
callq 0x3310
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
leaq 0x18a7(%rip), %rsi      # 0x9296
movl $0x27, %edx
movq %r15, %rdi
callq 0x3310
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r15, %rdi
callq 0x3310
movq %rax, %r15
leaq 0x18a9(%rip), %rsi      # 0x92be
movl $0x7, %edx
movq %rax, %rdi
callq 0x3310
movq 0x8(%rbx), %rsi
movq %r15, %rdi
callq 0x31c0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
movq 0x8(%r14), %rax
xorl %r15d, %r15d
movl $0x0, %r8d
testq %rax, %rax
je 0x7a8a
movq (%r14), %rcx
xorl %esi, %esi
xorl %r8d, %r8d
xorl %edx, %edx
movzbl (%rcx,%rsi), %esi
shrl $0x7, %esi
incl %r8d
addl %esi, %edx
incl %edx
movslq %edx, %rsi
cmpq %rsi, %rax
jne 0x7a74
movq %r14, %r13
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x7ab6
movq (%rbx), %rcx
xorl %esi, %esi
xorl %r15d, %r15d
xorl %edx, %edx
movzbl (%rcx,%rsi), %esi
shrl $0x7, %esi
incl %r15d
addl %esi, %edx
incl %edx
movslq %edx, %rsi
cmpq %rsi, %rax
jne 0x7aa0
movq %rbx, -0x60(%rbp)
leal 0x1(%r8), %eax
movq %rax, -0x30(%rbp)
movslq %eax, %rdi
shlq $0x3, %rdi
movq %r8, -0x48(%rbp)
cmpl $-0x1, %r8d
movq $-0x1, %r14
cmovlq %r14, %rdi
callq 0x3030
movq %rax, -0x38(%rbp)
leaq -0x90(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %ebx, %ebx
movq %rbx, -0x8(%rcx)
movb %bl, (%rcx)
leaq -0x70(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rbx, -0x8(%rcx)
movb %bl, (%rcx)
movq %r15, -0x50(%rbp)
movslq %r15d, %rcx
leaq 0x4(,%rcx,4), %r12
movq %rcx, -0xa8(%rbp)
cmpl $-0x1, %ecx
cmovlq %r14, %r12
movq %r12, %rdi
callq 0x3030
movq -0x38(%rbp), %rcx
movq %rax, (%rcx,%rbx,8)
incq %rbx
cmpq %rbx, -0x30(%rbp)
jne 0x7b23
movq -0x38(%rbp), %r8
movq (%r8), %rax
movq -0x50(%rbp), %rcx
leal 0x1(%rcx), %r12d
xorl %ecx, %ecx
movl %ecx, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r12
jne 0x7b4d
movq -0x48(%rbp), %rdx
testl %edx, %edx
movq -0x60(%rbp), %r14
movq -0x30(%rbp), %rdi
movq %r13, %rsi
jle 0x7b7e
movl $0x1, %eax
movq (%r8,%rax,8), %rcx
movl %eax, (%rcx)
incq %rax
cmpq %rax, %rdi
jne 0x7b70
testl %edx, %edx
jle 0x7d37
xorl %ebx, %ebx
movl $0x1, %eax
movq %rax, -0x40(%rbp)
leaq -0xd8(%rbp), %r15
movq %rsi, -0xb0(%rbp)
movq %r12, -0xb8(%rbp)
movslq %ebx, %rdx
movq (%rsi), %rax
movb (%rax,%rdx), %al
testb %al, %al
js 0x7bd7
movq %rbx, -0x58(%rbp)
movq -0x98(%rbp), %rdx
movsbl %al, %r8d
movl $0x1, %ecx
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
callq 0x3500
jmp 0x7c11
movl $0x2, %ecx
movq %r15, %rdi
callq 0x32e0
leaq -0xa0(%rbp), %rdi
movq %r15, %rsi
callq 0x3370
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x7c0b
callq 0x3280
incl %ebx
movq %rbx, -0x58(%rbp)
cmpl $0x0, -0x50(%rbp)
leaq -0xd8(%rbp), %r15
jle 0x7d15
xorl %r13d, %r13d
movl $0x1, %ebx
movslq %r13d, %rdx
movq (%r14), %rax
movb (%rax,%rdx), %al
testb %al, %al
js 0x7c51
movq -0x78(%rbp), %rdx
movsbl %al, %r8d
movl $0x1, %ecx
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
callq 0x3500
jmp 0x7c88
movl $0x2, %ecx
movq %r15, %rdi
movq %r14, %rsi
callq 0x32e0
leaq -0x80(%rbp), %rdi
movq %r15, %rsi
callq 0x3370
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x7c85
callq 0x3280
incl %r13d
movq -0x38(%rbp), %rcx
movq %rcx, %r12
movq -0x40(%rbp), %rax
movq -0x8(%rcx,%rax,8), %r14
movl -0x4(%r14,%rbx,4), %r15d
movq -0x98(%rbp), %rdx
movl $0x1, %ecx
cmpq -0x78(%rbp), %rdx
jne 0x7ccf
testq %rdx, %rdx
je 0x7ccd
movq -0x80(%rbp), %rsi
movq -0xa0(%rbp), %rdi
callq 0x32d0
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
jmp 0x7ccf
xorl %ecx, %ecx
addl %r15d, %ecx
movl (%r14,%rbx,4), %eax
movq -0x40(%rbp), %rdx
movq (%r12,%rdx,8), %rdx
movl -0x4(%rdx,%rbx,4), %esi
incl %esi
leal 0x1(%rax), %edi
cmpl %eax, %ecx
cmovlel %ecx, %edi
cmpl %esi, %edi
cmovgel %esi, %edi
movl %edi, (%rdx,%rbx,4)
incq %rbx
incl %r13d
movq -0xb8(%rbp), %r12
cmpq %rbx, %r12
movq -0x60(%rbp), %r14
leaq -0xd8(%rbp), %r15
jne 0x7c2a
movq -0x40(%rbp), %rcx
incq %rcx
movq -0x58(%rbp), %rbx
incl %ebx
movq %rcx, -0x40(%rbp)
cmpq -0x30(%rbp), %rcx
movq -0xb0(%rbp), %rsi
jne 0x7ba6
movslq -0x48(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, %r12
movq (%rcx,%rax,8), %rax
movq -0xa8(%rbp), %rcx
movl (%rax,%rcx,4), %ebx
xorl %r14d, %r14d
movq -0x30(%rbp), %r15
movq (%r12,%r14,8), %rdi
testq %rdi, %rdi
je 0x7d65
callq 0x3390
incq %r14
cmpq %r14, %r15
jne 0x7d57
movq %r12, %rdi
callq 0x3390
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x7d87
callq 0x3280
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x7d9f
callq 0x3280
movl %ebx, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7dbb
jmp 0x7dbb
jmp 0x7dbb
jmp 0x7dbb
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x7dd0
callq 0x3280
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x7de8
callq 0x3280
movq %rbx, %rdi
callq 0x34b0