// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq 0x8(%rsi), %rax
movq %rax, 0x48(%rsp)
movq 0x8(%rdx), %r13
leaq 0x1(%r13), %r12
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %r12, %rsi
callq 0x29dfe
leaq 0x8(%rsp), %rdi
leaq 0x24(%rsp), %rbp
movq %r12, %rsi
movq %rbp, %rdx
callq 0x29dfe
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
subq %rax, %rcx
je 0x28cb0
sarq $0x2, %rcx
xorl %edx, %edx
movl %edx, (%rax,%rdx,4)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rcx
ja 0x28ca3
cmpq $0x0, 0x48(%rsp)
je 0x28da8
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rsi
movq 0x30(%rsp), %r14
movq 0x38(%rsp), %r12
movq (%r15), %rcx
movq (%rbx), %rdx
movq 0x40(%rsp), %rdi
xorl %r9d, %r9d
movq 0x18(%rsp), %r15
xorl %r8d, %r8d
movq %r14, %r10
movq %r12, 0x50(%rsp)
movq %r15, %r14
incl %r8d
movl %r8d, (%r10)
testq %r13, %r13
je 0x28d65
xorl %r12d, %r12d
xorl %r15d, %r15d
incl %r15d
movl (%rax,%r15,4), %ebx
incl %ebx
movl %ebx, 0x24(%rsp)
movl (%r10,%r12,4), %ebx
incl %ebx
movl %ebx, 0x28(%rsp)
movb (%rcx,%r9), %bl
xorl %r11d, %r11d
cmpb (%rdx,%r12), %bl
setne %r11b
addl (%rax,%r12,4), %r11d
movl %r11d, 0x2c(%rsp)
movl $0x4, %r12d
movq %rbp, %rbx
movl 0x24(%rsp,%r12), %r11d
cmpl (%rbx), %r11d
jae 0x28d4c
leaq (%rsp,%r12), %rbx
addq $0x24, %rbx
addq $0x4, %r12
cmpq $0xc, %r12
jne 0x28d3a
movl (%rbx), %r11d
movl %r11d, (%r10,%r15,4)
movq %r15, %r12
cmpq %r15, %r13
ja 0x28d02
movq %rax, 0x30(%rsp)
movq %rsi, 0x38(%rsp)
movq %r14, 0x40(%rsp)
movq %r10, 0x8(%rsp)
movq 0x50(%rsp), %r11
movq %r11, 0x10(%rsp)
movq %rdi, 0x18(%rsp)
movl %r8d, %r9d
movq %rdi, %r15
movq %r14, %rdi
movq %rsi, %r12
movq %rax, %r14
movq %r10, %rax
movq %r11, %rsi
cmpq %r9, 0x48(%rsp)
ja 0x28ce6
movq 0x8(%rsp), %rdi
movl (%rdi,%r13,4), %ebx
testq %rdi, %rdi
je 0x28dc3
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x5340
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x28dda
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x5340
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x28e05
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x5340
movq %rbx, %rdi
callq 0x55c0
nop