// File: /workspace/github_cpp_makefile_star2_O1/canzarlab[P]Trajan/src/EditDist.cpp
// Function: Distance(std::vector<std::vector<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>, std::allocator<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>>>, std::allocator<std::vector<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>, std::allocator<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>>>>>&, std::vector<std::vector<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>, std::allocator<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>>>, std::allocator<std::vector<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>, std::allocator<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>>>>>&, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>&, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>&, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>&, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>&, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>&, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>&, int, int, int, int, int, int, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>&)
int Distance(vvvvi& DP, vvvvi& P, vvi& T1, vvi& T2, vvi& L1, vvi& L2, vvi& D1, vvi& D2, int n, int m, int i, int j, int k, int l, vector<vector<int>> & cost_matrix)
{
    if (i + j == n)
    {
        P[i][j][k][l] = INS_TREE;
        int cost = 0;
        for (int iter = l+1; iter <= m-k; ++iter)
            cost += cost_matrix[n][L2[k][iter]];
        return cost;
    }
    if (k + l == m)
    {
        P[i][j][k][l] = DEL_TREE;
        int cost = 0;
        for (int iter = j+1; iter <= n-i; ++iter)
            cost += cost_matrix[L1[i][iter]][m];
        return cost;
    }
    int del_i = L1[i][j+1];
    int insert_j = L2[k][l+1];
    int p = D1[i][j + 1], q = D2[k][l + 1];
    int x = n - p - T1[i][j + 1], y = m - q - T2[k][l + 1];
    int o = DP[i][j + 1][k][l] + cost_matrix[del_i][m];
    int a = DP[i][j][k][l + 1] + cost_matrix[n][insert_j];
    int b = DP[i][j + T1[i][j + 1]][k][l + T2[k][l + 1]];
    int c = DP[p + 1][x][q + 1][y];
    int d = cost_matrix[del_i][insert_j];
    int mm = min(min(o, a), b + c + d);
    if (mm == b + c + d)
        P[i][j][k][l] = MATCH;
    else if (mm == o)
        P[i][j][k][l] = DEL_NODE;
    else
        P[i][j][k][l] = INS_NODE;
    return mm;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl 0x70(%rsp), %r11d
movl 0x68(%rsp), %r10d
movl 0x60(%rsp), %r15d
movl 0x58(%rsp), %r12d
movl 0x50(%rsp), %ebx
movl 0x48(%rsp), %eax
leal (%r15,%r12), %ebp
cmpl %eax, %ebp
jne 0x55835
movslq %r12d, %rcx
movq (%rsi), %rdx
leaq (%rcx,%rcx,2), %rcx
movslq %r15d, %rsi
movq (%rdx,%rcx,8), %rcx
leaq (%rsi,%rsi,2), %rdx
movslq %r10d, %rsi
movq (%rcx,%rdx,8), %rdi
leaq (%rsi,%rsi,2), %rdx
movslq %r11d, %rcx
movq (%rdi,%rdx,8), %rsi
movl $0xfffffffe, (%rsi,%rcx,4) # imm = 0xFFFFFFFE
subl %r10d, %ebx
cmpl %r11d, %ebx
jle 0x558a9
cltq
movq 0x78(%rsp), %rsi
movq (%rsi), %rsi
leaq (%rax,%rax,2), %rax
movq (%r9), %rdi
movq (%rdi,%rdx,8), %rdx
movq (%rsi,%rax,8), %rsi
movslq %ebx, %rdi
xorl %eax, %eax
movslq 0x4(%rdx,%rcx,4), %r8
incq %rcx
addl (%rsi,%r8,4), %eax
cmpq %rdi, %rcx
jl 0x5581f
jmp 0x55a69
leal (%r11,%r10), %ebp
movslq %r12d, %r12
cmpl %ebx, %ebp
jne 0x558b0
movq (%rsi), %rsi
leaq (%r12,%r12,2), %rdx
movslq %r15d, %rcx
movq (%rsi,%rdx,8), %rsi
leaq (%rcx,%rcx,2), %rdi
movslq %r10d, %r9
movq (%rsi,%rdi,8), %rsi
leaq (%r9,%r9,2), %rdi
movslq %r11d, %r9
movq (%rsi,%rdi,8), %rsi
movl $0xffffffff, (%rsi,%r9,4) # imm = 0xFFFFFFFF
subl %r12d, %eax
cmpl %r15d, %eax
jle 0x558a9
movq (%r8), %rsi
movq (%rsi,%rdx,8), %rdx
movq 0x78(%rsp), %rsi
movq (%rsi), %rsi
movslq %ebx, %rdi
movslq %eax, %r8
xorl %eax, %eax
movslq 0x4(%rdx,%rcx,4), %r9
incq %rcx
leaq (%r9,%r9,2), %r9
movq (%rsi,%r9,8), %r9
addl (%r9,%rdi,4), %eax
cmpq %r8, %rcx
jl 0x5588b
jmp 0x55a69
xorl %eax, %eax
jmp 0x55a69
movq 0x38(%rsp), %r14
movq %r12, -0x30(%rsp)
leaq (,%r12,8), %r12
leaq (%r12,%r12,2), %rbp
movq %r8, -0x8(%rsp)
movslq %r15d, %r12
movq %r12, -0x20(%rsp)
movq (%r14), %r8
movq (%r8,%rbp), %r8
movslq 0x4(%r8,%r12,4), %r8
movq %r8, -0x28(%rsp)
movq (%rdx), %rdx
movq (%rdx,%rbp), %rdx
movq %r9, -0x10(%rsp)
movl 0x4(%rdx,%r12,4), %r12d
leal (%r8,%r12), %edx
movl %eax, %r8d
subl %edx, %r8d
movslq %r10d, %rdx
movq %rdx, -0x38(%rsp)
leaq (,%rdx,8), %rdx
leaq (%rdx,%rdx,2), %r10
movq 0x40(%rsp), %rdx
movq (%rdx), %rdx
movq (%rdx,%r10), %r9
movslq %r11d, %rdx
movslq 0x4(%r9,%rdx,4), %r9
movq (%rcx), %rcx
movq (%rcx,%r10), %rcx
movl 0x4(%rcx,%rdx,4), %ecx
movslq %ebx, %r13
movq %r13, -0x18(%rsp)
subl %r9d, %ebx
subl %ecx, %ebx
addl %r15d, %r12d
addl %r11d, %ecx
movq (%rdi), %r11
movq -0x28(%rsp), %rdi
leaq (%rdi,%rdi,2), %rdi
movslq %r8d, %r8
movq 0x18(%r11,%rdi,8), %rdi
leaq (%r8,%r8,2), %r8
movq (%rdi,%r8,8), %rdi
leaq (%r9,%r9,2), %r8
movq 0x18(%rdi,%r8,8), %rdi
movslq %ebx, %r8
movl (%rdi,%r8,4), %edi
movq (%r11,%rbp), %r9
movslq %r12d, %r8
leaq (%r8,%r8,2), %r8
movq (%r9,%r8,8), %r8
movslq %ecx, %rcx
movq (%r8,%r10), %r8
addl (%r8,%rcx,4), %edi
movq -0x8(%rsp), %rcx
movq (%rcx), %rcx
movq (%rcx,%rbp), %rcx
movq -0x20(%rsp), %r11
movslq 0x4(%rcx,%r11,4), %r8
leaq (%r11,%r11,2), %rcx
movq 0x18(%r9,%rcx,8), %r11
movq (%r11,%r10), %r11
movq 0x78(%rsp), %rbx
movq (%rbx), %rbx
leaq (%r8,%r8,2), %r8
movq (%rbx,%r8,8), %r14
movq -0x18(%rsp), %r8
movl (%r14,%r8,4), %r8d
addl (%r11,%rdx,4), %r8d
movq -0x10(%rsp), %r11
movq (%r11), %r11
movq (%r11,%r10), %r11
movq (%r9,%rcx,8), %r9
movq (%r9,%r10), %r9
movslq 0x4(%r11,%rdx,4), %r10
addl (%r14,%r10,4), %edi
cltq
leaq (%rax,%rax,2), %rax
movq (%rbx,%rax,8), %rax
movl (%rax,%r10,4), %eax
addl 0x4(%r9,%rdx,4), %eax
cmpl %r8d, %eax
cmovgel %r8d, %eax
cmpl %eax, %edi
cmovll %edi, %eax
jle 0x55a38
movq (%rsi), %rsi
movq -0x30(%rsp), %rdi
leaq (%rdi,%rdi,2), %rdi
movq (%rsi,%rdi,8), %rsi
movq (%rsi,%rcx,8), %rcx
movq -0x38(%rsp), %rsi
leaq (%rsi,%rsi,2), %rsi
movq (%rcx,%rsi,8), %rcx
cmpl %r8d, %eax
jne 0x55a62
movl $0x1, (%rcx,%rdx,4)
jmp 0x55a69
movq (%rsi), %rsi
movq -0x30(%rsp), %rdi
leaq (%rdi,%rdi,2), %rdi
movq (%rsi,%rdi,8), %rsi
movq (%rsi,%rcx,8), %rcx
movq -0x38(%rsp), %rsi
leaq (%rsi,%rsi,2), %rsi
movq (%rcx,%rsi,8), %rcx
movl $0x0, (%rcx,%rdx,4)
jmp 0x55a69
movl $0x2, (%rcx,%rdx,4)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq