// File: /workspace/github_cpp_makefile_star2_O1/ParkerLab[P]cta/src/cta.cpp
// Function: levenshtein_distance(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&, long long)
long long int levenshtein_distance(const std::string& s1, const std::string& s2, long long int maximum = 0) {
    // shortcuts
    if (s1 == s2) return 0;

    long long int s1_length = s1.size();
    long long int s2_length = s2.size();

    if (s1_length == 0) {
        return s2_length;
    }

    if (s2_length == 0) {
        return s1_length;
    }

    if (maximum) {
        long long int minimum_distance = llabs(s1_length - s2_length);
        if (maximum < minimum_distance) {
            return minimum_distance;
        }
    }

    // ok, not getting out of the work that easily
    std::vector<long long int> v1(s2_length + 1);
    std::vector<long long int> v2(s2_length + 1);

    for (long long int i = 0; i < s2_length; i++) {
        v1[i] = i;
    }

    long long int v1_size = v1.size();
    for (long long int i = 0; i < s1_length; i++) {
        v2[0] = i + 1;

        for (long long int j = 0; j < s2_length; j++) {
            int cost = s1[i] == s2[j] ? 0 : 1;
            v2[j + 1] = std::min(v2[j] + 1, std::min(v1[j + 1] + 1, v1[j] + cost));
        }

        long long int minimum = maximum + 1;
        for (long long int j = 0; j < v1_size; j++) {
            if (v2[j] < minimum) {
                minimum = v2[j];
            }
            v1[j] = v2[j];
        }
        if (minimum > maximum) {
            // abort early
            return maximum + 1;
        }
    }

    return v2[s2_length];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movq 0x8(%rdi), %r14
movq 0x8(%rsi), %rbx
movq %r14, %rbp
subq %rbx, %rbp
jne 0xc2da
testq %r14, %r14
je 0xc306
movq (%r12), %rsi
movq (%r13), %rdi
movq %r14, %rdx
callq 0xb4b0
testl %eax, %eax
je 0xc306
testq %r14, %r14
je 0xc30e
testq %rbx, %rbx
je 0xc465
movq %r14, 0x8(%rsp)
testq %r15, %r15
je 0xc316
movq %rbp, %r14
negq %r14
cmovsq %rbp, %r14
cmpq %r15, %r14
jle 0xc316
jmp 0xc465
xorl %r14d, %r14d
jmp 0xc465
movq %rbx, %r14
jmp 0xc465
leaq 0x1(%rbx), %rbp
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %rbp, %rsi
callq 0xf1de
leaq 0x30(%rsp), %rdi
leaq 0x7(%rsp), %rdx
movq %rbp, %rsi
callq 0xf1de
testq %rbx, %rbx
jle 0xc356
movq 0x10(%rsp), %rax
xorl %ecx, %ecx
movq %rcx, (%rax,%rcx,8)
incq %rcx
cmpq %rcx, %rbx
jne 0xc34a
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movq 0x30(%rsp), %rdx
movq (%r13), %rsi
movq (%r12), %rdi
leaq 0x1(%r15), %r8
xorl %r10d, %r10d
movq 0x8(%rsp), %r11
testq %r11, %r11
movl $0x0, %r9d
cmovgq %r11, %r9
movq %r9, 0x28(%rsp)
movq %r10, %r11
cmpq 0x28(%rsp), %r10
je 0xc427
movq %r15, %r9
leaq 0x1(%r11), %r10
movq %r10, (%rdx)
testq %rbx, %rbx
jle 0xc3f2
movq (%rdx), %r12
xorl %r13d, %r13d
movb (%rsi,%r11), %r15b
xorl %ebp, %ebp
cmpb (%rdi,%r13), %r15b
setne %bpl
movq 0x8(%rax,%r13,8), %r15
addq (%rax,%r13,8), %rbp
cmpq %r15, %rbp
jle 0xc3d7
incq %r15
movq %r15, %rbp
incq %r12
cmpq %r12, %rbp
cmovlq %rbp, %r12
movq %r12, 0x8(%rdx,%r13,8)
leaq 0x1(%r13), %r15
movq %r15, %r13
cmpq %r15, %rbx
jne 0xc3b5
movq %r8, %r12
testq %rcx, %rcx
jle 0xc417
xorl %r13d, %r13d
movq %r8, %r12
movq (%rdx,%r13,8), %r15
cmpq %r12, %r15
cmovlq %r15, %r12
movq %r15, (%rax,%r13,8)
incq %r13
cmpq %r13, %rcx
jne 0xc400
movq %r9, %r15
cmpq %r9, %r12
cmovgq %r8, %r14
jle 0xc392
cmpq 0x8(%rsp), %r11
jl 0xc437
movq 0x30(%rsp), %rax
movq (%rax,%rbx,8), %r14
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xc44e
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0xb480
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc465
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xb480
movq %r14, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc491
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0xb480
movq %rbx, %rdi
callq 0xb7d0