// File: medvedevgroup[P]varmatch/src/wholegenome.cpp
// Function: WholeGenome::EditDistance(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
inline int WholeGenome::EditDistance(const std::string& s1, const std::string& s2)
{
	const std::size_t len1 = s1.size(), len2 = s2.size();
	std::vector<unsigned int> col(len2+1), prevCol(len2+1);

	for (unsigned int i = 0; i < prevCol.size(); i++)
		prevCol[i] = i;
	for (unsigned int i = 0; i < len1; i++) {
		col[0] = i+1;
		for (unsigned int j = 0; j < len2; j++)
                        // note that std::min({arg1, arg2, arg3}) works only in C++11,
                        // for C++98 use std::min(std::min(arg1, arg2), arg3)
			col[j+1] = std::min({ prevCol[1 + j] + 1, col[j] + 1, prevCol[j] + (s1[i]==s2[j] ? 0 : 1) });
		col.swap(prevCol);
	}
	return prevCol[len2];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6320
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x6320
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
incq %rax
movq %rax, -0xb0(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x37590
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
leaq -0x40(%rbp), %rdi
callq 0x375b0
jmp 0x33178
leaq -0x41(%rbp), %rdi
callq 0x37620
movq -0x28(%rbp), %rax
incq %rax
movq %rax, -0xc0(%rbp)
leaq -0x71(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x37590
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rdx
leaq -0x70(%rbp), %rdi
callq 0x375b0
jmp 0x331b8
leaq -0x71(%rbp), %rdi
callq 0x37620
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
movq %rax, -0xc8(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x37640
movq %rax, %rcx
movq -0xc8(%rbp), %rax
cmpq %rcx, %rax
jae 0x33248
movl -0x78(%rbp), %eax
movl %eax, -0xcc(%rbp)
movl -0x78(%rbp), %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x37660
movl -0xcc(%rbp), %ecx
movl %ecx, (%rax)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x331c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x41(%rbp), %rdi
callq 0x37620
jmp 0x333f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x71(%rbp), %rdi
callq 0x37620
jmp 0x333ef
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpq -0x20(%rbp), %rax
jae 0x333b9
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd0(%rbp)
leaq -0x40(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x37660
movl -0xd0(%rbp), %ecx
movl %ecx, (%rax)
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
cmpq -0x28(%rbp), %rax
jae 0x3339e
movl -0x80(%rbp), %eax
incl %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x37660
movl (%rax), %eax
incl %eax
movl %eax, -0x9c(%rbp)
movl -0x80(%rbp), %eax
movl %eax, %esi
leaq -0x40(%rbp), %rdi
callq 0x37660
movq -0xe8(%rbp), %rdi
movl (%rax), %eax
incl %eax
movl %eax, -0x98(%rbp)
movl -0x80(%rbp), %eax
movl %eax, %esi
callq 0x37660
movl (%rax), %eax
movl %eax, -0xd8(%rbp)
movq -0x10(%rbp), %rdi
movl -0x7c(%rbp), %eax
movl %eax, %esi
callq 0x64d0
movsbl (%rax), %eax
movl %eax, -0xdc(%rbp)
movq -0x18(%rbp), %rdi
movl -0x80(%rbp), %eax
movl %eax, %esi
callq 0x64d0
movl -0xdc(%rbp), %ecx
movq %rax, %rdx
movl -0xd8(%rbp), %eax
movsbl (%rdx), %edx
subl %edx, %ecx
setne %cl
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, -0x94(%rbp)
leaq -0x9c(%rbp), %rax
movq %rax, -0x90(%rbp)
movq $0x3, -0x88(%rbp)
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x37680
movl %eax, -0xd4(%rbp)
jmp 0x3335e
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq -0x40(%rbp), %rdi
callq 0x37660
movl -0xd4(%rbp), %ecx
movl %ecx, (%rax)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x33284
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x37720
jmp 0x333ef
leaq -0x40(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x376c0
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x3324f
movq -0x28(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x37660
movl (%rax), %eax
movl %eax, -0xec(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x37720
leaq -0x40(%rbp), %rdi
callq 0x37720
movl -0xec(%rbp), %eax
addq $0xf0, %rsp
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0x37720
movq -0x50(%rbp), %rdi
callq 0x6750
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)