// File: 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
movq %rsp, %rbp
subq $0xc0, %rsp
movq 0x50(%rbp), %rax
movl 0x48(%rbp), %eax
movl 0x40(%rbp), %eax
movl 0x38(%rbp), %eax
movl 0x30(%rbp), %eax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl 0x30(%rbp), %eax
addl 0x38(%rbp), %eax
cmpl 0x20(%rbp), %eax
jne 0xfb57e
movq -0x18(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0xfe540
movq %rax, %rdi
movslq 0x38(%rbp), %rsi
callq 0xfe560
movq %rax, %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movslq 0x48(%rbp), %rsi
callq 0x145d0
movl $0xfffffffe, (%rax)     # imm = 0xFFFFFFFE
movl $0x0, -0x3c(%rbp)
movl 0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl 0x28(%rbp), %ecx
subl 0x40(%rbp), %ecx
cmpl %ecx, %eax
jg 0xfb573
movq 0x50(%rbp), %rdi
movslq 0x20(%rbp), %rsi
callq 0x993b0
movq %rax, -0x88(%rbp)
movq -0x38(%rbp), %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movslq -0x40(%rbp), %rsi
callq 0x145d0
movq -0x88(%rbp), %rdi
movslq (%rax), %rsi
callq 0x145d0
movl (%rax), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xfb517
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xfba03
movl 0x40(%rbp), %eax
addl 0x48(%rbp), %eax
cmpl 0x28(%rbp), %eax
jne 0xfb63e
movq -0x18(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0xfe540
movq %rax, %rdi
movslq 0x38(%rbp), %rsi
callq 0xfe560
movq %rax, %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movslq 0x48(%rbp), %rsi
callq 0x145d0
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x0, -0x44(%rbp)
movl 0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl 0x20(%rbp), %ecx
subl 0x30(%rbp), %ecx
cmpl %ecx, %eax
jg 0xfb633
movq 0x50(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movslq -0x48(%rbp), %rsi
callq 0x145d0
movq -0x90(%rbp), %rdi
movslq (%rax), %rsi
callq 0x993b0
movq %rax, %rdi
movslq 0x28(%rbp), %rsi
callq 0x145d0
movl (%rax), %eax
addl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xfb5d4
movl -0x44(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xfba03
movq -0x30(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movl 0x38(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x145d0
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x38(%rbp), %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movl 0x48(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x145d0
movl (%rax), %eax
movl %eax, -0x50(%rbp)
movq 0x10(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movl 0x38(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x145d0
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movq 0x18(%rbp), %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movl 0x48(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x145d0
movl (%rax), %eax
movl %eax, -0x58(%rbp)
movl 0x20(%rbp), %eax
subl -0x54(%rbp), %eax
movl %eax, -0xc0(%rbp)
movq -0x20(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movl 0x38(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x145d0
movq %rax, %rcx
movl -0xc0(%rbp), %eax
subl (%rcx), %eax
movl %eax, -0x5c(%rbp)
movl 0x28(%rbp), %eax
subl -0x58(%rbp), %eax
movl %eax, -0xbc(%rbp)
movq -0x28(%rbp), %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movl 0x48(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x145d0
movq %rax, %rcx
movl -0xbc(%rbp), %eax
subl (%rcx), %eax
movl %eax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0xfe540
movq %rax, %rdi
movl 0x38(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xfe560
movq %rax, %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movslq 0x48(%rbp), %rsi
callq 0x145d0
movl (%rax), %eax
movl %eax, -0xb8(%rbp)
movq 0x50(%rbp), %rdi
movslq -0x4c(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movslq 0x28(%rbp), %rsi
callq 0x145d0
movq %rax, %rcx
movl -0xb8(%rbp), %eax
addl (%rcx), %eax
movl %eax, -0x64(%rbp)
movq -0x10(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0xfe540
movq %rax, %rdi
movslq 0x38(%rbp), %rsi
callq 0xfe560
movq %rax, %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movl 0x48(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x145d0
movl (%rax), %eax
movl %eax, -0xb4(%rbp)
movq 0x50(%rbp), %rdi
movslq 0x20(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movslq -0x50(%rbp), %rsi
callq 0x145d0
movq %rax, %rcx
movl -0xb4(%rbp), %eax
addl (%rcx), %eax
movl %eax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0xfe540
movq %rax, -0xb0(%rbp)
movl 0x38(%rbp), %eax
movl %eax, -0xa4(%rbp)
movq -0x20(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movl 0x38(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x145d0
movq -0xb0(%rbp), %rdi
movq %rax, %rcx
movl -0xa4(%rbp), %eax
addl (%rcx), %eax
movslq %eax, %rsi
callq 0xfe560
movq %rax, %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, -0xa0(%rbp)
movl 0x48(%rbp), %eax
movl %eax, -0x94(%rbp)
movq -0x28(%rbp), %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movl 0x48(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x145d0
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movl -0x94(%rbp), %eax
addl (%rcx), %eax
movslq %eax, %rsi
callq 0x145d0
movl (%rax), %eax
movl %eax, -0x6c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x54(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xfe540
movq %rax, %rdi
movslq -0x5c(%rbp), %rsi
callq 0xfe560
movq %rax, %rdi
movl -0x58(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x993b0
movq %rax, %rdi
movslq -0x60(%rbp), %rsi
callq 0x145d0
movl (%rax), %eax
movl %eax, -0x70(%rbp)
movq 0x50(%rbp), %rdi
movslq -0x4c(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movslq -0x50(%rbp), %rsi
callq 0x145d0
movl (%rax), %eax
movl %eax, -0x74(%rbp)
leaq -0x64(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xeddb0
movq %rax, %rdi
movl -0x6c(%rbp), %eax
addl -0x70(%rbp), %eax
addl -0x74(%rbp), %eax
movl %eax, -0x7c(%rbp)
leaq -0x7c(%rbp), %rsi
callq 0xeddb0
movl (%rax), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
movl -0x6c(%rbp), %ecx
addl -0x70(%rbp), %ecx
addl -0x74(%rbp), %ecx
cmpl %ecx, %eax
jne 0xfb983
movq -0x18(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0xfe540
movq %rax, %rdi
movslq 0x38(%rbp), %rsi
callq 0xfe560
movq %rax, %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movslq 0x48(%rbp), %rsi
callq 0x145d0
movl $0x0, (%rax)
jmp 0xfb9fd
movl -0x78(%rbp), %eax
cmpl -0x64(%rbp), %eax
jne 0xfb9c4
movq -0x18(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0xfe540
movq %rax, %rdi
movslq 0x38(%rbp), %rsi
callq 0xfe560
movq %rax, %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movslq 0x48(%rbp), %rsi
callq 0x145d0
movl $0x1, (%rax)
jmp 0xfb9fb
movq -0x18(%rbp), %rdi
movslq 0x30(%rbp), %rsi
callq 0xfe540
movq %rax, %rdi
movslq 0x38(%rbp), %rsi
callq 0xfe560
movq %rax, %rdi
movslq 0x40(%rbp), %rsi
callq 0x993b0
movq %rax, %rdi
movslq 0x48(%rbp), %rsi
callq 0x145d0
movl $0x2, (%rax)
jmp 0xfb9fd
movl -0x78(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nop