// File: /workspace/github_cpp_makefile_star2_O3/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 $0xa8, %rsp
movq %rsi, %rbx
movq %rdi, %r12
movq 0x560b(%rip), %r15      # 0xcfd0
leaq 0x18b9(%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 0x188f(%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 0x1891(%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(%r12), %rax
xorl %r14d, %r14d
movl $0x0, %r8d
testq %rax, %rax
je 0x7aa4
movq (%r12), %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 0x7a8e
movq %r12, %r13
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x7ad0
movq (%rbx), %rcx
xorl %esi, %esi
xorl %r14d, %r14d
xorl %edx, %edx
movzbl (%rcx,%rsi), %esi
shrl $0x7, %esi
incl %r14d
addl %esi, %edx
incl %edx
movslq %edx, %rsi
cmpq %rsi, %rax
jne 0x7aba
movq %rbx, -0x98(%rbp)
leal 0x1(%r8), %eax
movq %rax, -0x38(%rbp)
movslq %eax, %rdi
shlq $0x3, %rdi
movq %r8, -0x40(%rbp)
cmpl $-0x1, %r8d
movq $-0x1, %r15
cmovlq %r15, %rdi
callq 0x3030
leaq -0x70(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %ebx, %ebx
movq %rbx, -0x8(%rcx)
movb %bl, (%rcx)
leaq -0x50(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rbx, -0x8(%rcx)
movb %bl, (%rcx)
movq %r14, %rcx
incl %r14d
movslq %r14d, %r12
shlq $0x2, %r12
movq %rcx, -0x88(%rbp)
cmpl $-0x1, %ecx
cmovlq %r15, %r12
movq %rax, %r15
movq %r12, %rdi
callq 0x3030
movq %rax, (%r15,%rbx,8)
incq %rbx
cmpq %rbx, -0x38(%rbp)
jne 0x7b3a
movq (%r15), %rax
movl %r14d, %edx
xorl %ecx, %ecx
movq %r13, %rsi
movl %ecx, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %rdx
jne 0x7b5a
movq %rdx, -0xa8(%rbp)
cmpl $0x0, -0x40(%rbp)
movq -0x98(%rbp), %r14
jle 0x7d43
movl $0x1, %eax
movq -0x38(%rbp), %rdx
movq (%r15,%rax,8), %rcx
movl %eax, (%rcx)
incq %rax
cmpq %rax, %rdx
jne 0x7b86
cmpl $0x0, -0x40(%rbp)
jle 0x7d43
xorl %ebx, %ebx
movl $0x1, %eax
movq %rax, -0x30(%rbp)
leaq -0xc8(%rbp), %rdi
movq %rsi, -0xa0(%rbp)
movslq %ebx, %rdx
movq (%rsi), %rax
movb (%rax,%rdx), %al
testb %al, %al
js 0x7be5
movq %rbx, -0x90(%rbp)
movq -0x78(%rbp), %rdx
movsbl %al, %r8d
movl $0x1, %ecx
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
callq 0x3500
jmp 0x7c1f
movl $0x2, %ecx
movq %rdi, %r13
callq 0x32e0
leaq -0x80(%rbp), %rdi
movq %r13, %rsi
callq 0x3370
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x7c16
callq 0x3280
incl %ebx
movq %rbx, -0x90(%rbp)
cmpl $0x0, -0x88(%rbp)
leaq -0xc8(%rbp), %rdi
jle 0x7d1e
xorl %r13d, %r13d
movl $0x1, %ebx
movslq %r13d, %rdx
movq (%r14), %rax
movb (%rax,%rdx), %al
testb %al, %al
js 0x7c62
movq -0x58(%rbp), %rdx
movsbl %al, %r8d
movl $0x1, %ecx
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
callq 0x3500
jmp 0x7c99
movl $0x2, %ecx
movq %rdi, %r12
movq %r14, %rsi
callq 0x32e0
leaq -0x60(%rbp), %rdi
movq %r12, %rsi
callq 0x3370
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x7c96
callq 0x3280
incl %r13d
movq %r15, %r12
movq -0x30(%rbp), %rax
movq -0x8(%r15,%rax,8), %r14
movl -0x4(%r14,%rbx,4), %r15d
movq -0x78(%rbp), %rdx
movl $0x1, %ecx
cmpq -0x58(%rbp), %rdx
jne 0x7cd6
testq %rdx, %rdx
je 0x7cd4
movq -0x60(%rbp), %rsi
movq -0x80(%rbp), %rdi
callq 0x32d0
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
jmp 0x7cd6
xorl %ecx, %ecx
addl %r15d, %ecx
movl (%r14,%rbx,4), %eax
incl %eax
movq %r12, %r15
movq -0x30(%rbp), %rdx
movq (%r12,%rdx,8), %rdx
movl -0x4(%rdx,%rbx,4), %esi
incl %esi
cmpl %eax, %ecx
cmovll %ecx, %eax
cmpl %esi, %eax
cmovgel %esi, %eax
movl %eax, (%rdx,%rbx,4)
incq %rbx
incl %r13d
cmpq %rbx, -0xa8(%rbp)
movq -0x98(%rbp), %r14
leaq -0xc8(%rbp), %rdi
jne 0x7c3b
movq -0x30(%rbp), %rcx
incq %rcx
movq -0x90(%rbp), %rbx
incl %ebx
movq %rcx, -0x30(%rbp)
cmpq -0x38(%rbp), %rcx
movq -0xa0(%rbp), %rsi
jne 0x7bb7
movslq -0x40(%rbp), %rax
movq %r15, %rbx
movq (%r15,%rax,8), %rax
movslq -0x88(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
xorl %r14d, %r14d
leaq -0x70(%rbp), %r15
leaq -0x50(%rbp), %r12
movq -0x38(%rbp), %r13
movq (%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x7d78
callq 0x3390
incq %r14
cmpq %r14, %r13
jne 0x7d6a
movq %rbx, %rdi
callq 0x3390
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x7d96
callq 0x3280
movq -0x80(%rbp), %rdi
cmpq %r15, %rdi
je 0x7da4
callq 0x3280
movl -0x30(%rbp), %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7dc1
jmp 0x7dc1
jmp 0x7dc1
jmp 0x7dc1
movq %rax, %rbx
leaq -0x70(%rbp), %r14
leaq -0x50(%rbp), %rax
movq -0x60(%rbp), %rdi
cmpq %rax, %rdi
je 0x7dda
callq 0x3280
movq -0x80(%rbp), %rdi
cmpq %r14, %rdi
je 0x7de8
callq 0x3280
movq %rbx, %rdi
callq 0x34b0