// File: /workspace/github_cpp_makefile_star2_O3/estan[P]tsp/tsp.cpp
// Function: threeOpt(std::vector<unsigned short, std::allocator<unsigned short>>&, Matrix<unsigned int> const&, Matrix<unsigned short> const&, std::vector<unsigned short, std::allocator<unsigned short>>&, unsigned int&, unsigned int, std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l>>> const&)
inline void threeOpt(vector<uint16_t>& tour, const Matrix<uint32_t>& d,
        const Matrix<uint16_t>& neighbor, vector<uint16_t>& position,
        uint32_t& max, uint32_t min,
        const chrono::time_point<chrono::high_resolution_clock>& deadline) {
    const size_t N = d.rows(); // Number of cities.

    // Candidate edges PQ, RS, TU and their positions in tour.
    uint16_t P, Q, R, S, T, U;
    size_t P_i, Q_i, R_i, S_i, T_i, U_i;

    // AB, CD, EF is PQ, RS, TU, but in tour order.
    uint16_t A, B, C, D, E, F;
    size_t A_i, B_i, C_i, D_i, E_i, F_i;

    bool locallyOptimal = false;
    while (!locallyOptimal) {
        locallyOptimal = true;

        // For each edge PQ.
        for (size_t i = 0; i < N; ++i) {
            P_i = i;
            Q_i = (P_i + 1) % N;
            P = tour[P_i];
            Q = tour[Q_i];

            if (chrono::high_resolution_clock::now() > deadline)
                return; // Deadline has passed, return early.

            // For each edge RS (S j:th nearest neighbor of P).
            for (size_t j = 0; j < neighbor.cols(); ++j) {
                S_i = position[neighbor[P][j]];
                R_i = (S_i + N - 1) % N;
                R = tour[R_i];
                S = tour[S_i];

                if (P == R || R == Q) // RS same as, or follows, PQ.
                    continue; // Go to next edge RS.

                if (d[P][S] + 2 * min > d[P][Q] + 2 * max)
                    break; // Go to next edge PQ.

                if (d[P][S] + 2 * min > d[P][Q] + d[R][S] + max)
                    continue; // Go to next edge RS.

                // For each edge TU (U k:th nearest neighbor of P).
                for (size_t k = 0; k < neighbor.cols(); ++k) {
                    U_i = position[neighbor[P][k]];
                    T_i = (U_i + N - 1) % N;
                    T = tour[T_i];
                    U = tour[U_i];

                    if (U == S || // TU same as RS.
                        T == S || // TU follows RS.
                        U == R || // TU preceeds RS.
                        T == P || // TU same as PQ.
                        T == Q)   // TU follows PQ.
                        continue; // Go to next edge TU.

                    if (d[P][S] + d[Q][U] + min > d[P][Q] + d[R][S] + max)
                        break; // Go to next edge RS.

                    // Let AB, CD, EF be the edges PQ, RS, TU in tour order.
                    ordered(A, A_i, B, B_i, C, C_i, D, D_i, E, E_i, F, F_i,
                            P, P_i, Q, Q_i, R, R_i, S, S_i, T, T_i, U, U_i);

                    // Try exchanging AB, CD and EF for another edge triple.
                    // See 3opt_cases.png for an illustration.
                    bool changed = false;
                    uint32_t d_AB_CD_EF = d[A][B] + d[C][D] + d[E][F];
                    if (d[D][A] + d[F][B] + d[C][E] < d_AB_CD_EF) {
                        // Change AB, CD, EF to DA, FB, CE.
                        reverse(tour, F_i, A_i, position);
                        reverse(tour, D_i, E_i, position);
                        max = maximum(max, d[D][A], d[F][B], d[C][E]);
                        changed = true;
                    } else if (d[B][D] + d[E][A] + d[F][C] < d_AB_CD_EF) {
                        // Change AB, CD, EF to BD, EA, FC.
                        reverse(tour, F_i, A_i, position);
                        reverse(tour, B_i, C_i, position);
                        max = maximum(max, d[B][D], d[E][A], d[F][C]);
                        changed = true;
                    } else if (d[A][C] + d[B][E] + d[D][F] < d_AB_CD_EF) {
                        // Change AB, CD, EF to AC, BE, DF.
                        reverse(tour, B_i, C_i, position);
                        reverse(tour, D_i, E_i, position);
                        max = maximum(max, d[A][C], d[B][E], d[D][F]);
                        changed = true;
                    } else if (d[B][E] + d[D][A] + d[F][C] < d_AB_CD_EF) {
                        // Change AB, CD, EF to BE, DA, FC.
                        reverse(tour, A_i, F_i, position);
                        reverse(tour, B_i, C_i, position);
                        reverse(tour, D_i, E_i, position);
                        max = maximum(max, d[B][E], d[D][A], d[F][C]);
                        changed = true;
                    }

                    if (changed) {
                        locallyOptimal = false;
                        goto next_PQ; // Go to next edge PQ.
                    }
                }
            }
            next_PQ: continue;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %r8, 0xd8(%rsp)
movq %rcx, 0x118(%rsp)
movq %rdx, %r14
movq %rdi, %rbx
movq %rsi, 0x110(%rsp)
movq 0x18(%rsi), %r12
leaq -0x1(%r12), %rbp
movq %r9, 0x120(%rsp)
leal (%r9,%r9), %eax
movq %rax, 0x128(%rsp)
movb $0x1, %r15b
xorl %r13d, %r13d
movq %rdx, 0x68(%rsp)
movq %rdi, 0x20(%rsp)
movq %r12, 0x50(%rsp)
movq %rbp, 0x30(%rsp)
cmpq %r12, %r13
jae 0x40c0
movq %r13, %rcx
incq %r13
cmpq %r12, %r13
movl $0x0, %edx
cmovneq %r13, %rdx
movq (%rbx), %rax
movq %rcx, 0xf0(%rsp)
movzwl (%rax,%rcx,2), %ecx
movq %rcx, 0xe8(%rsp)
movq %rdx, 0xa0(%rsp)
movzwl (%rax,%rdx,2), %eax
movq %rax, 0x8(%rsp)
callq 0x2040
movq 0x1b0(%rsp), %rcx
cmpq %rax, (%rcx)
jl 0x4742
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0x3b85
movl %r15d, 0x4c(%rsp)
movq %r13, 0x28(%rsp)
movq %rdi, %rsi
movq 0xe8(%rsp), %rcx
imulq %rcx, %rsi
addq %rsi, %rsi
addq (%r14), %rsi
movq 0x118(%rsp), %rax
movq (%rax), %r15
movq (%rbx), %r14
movq %rcx, %rbx
movq 0x110(%rsp), %rax
movq (%rax), %rcx
movq 0x20(%rax), %rdx
movq %rdx, %rax
imulq %rbx, %rax
movq %rax, 0x98(%rsp)
leaq (%rcx,%rax,4), %rax
movq %rax, 0x140(%rsp)
movq 0xd8(%rsp), %rax
movl (%rax), %eax
movq %rax, 0x70(%rsp)
addl %eax, %eax
movq %rax, 0x138(%rsp)
movq %rdx, 0xa8(%rsp)
imulq 0x8(%rsp), %rdx
movq %rcx, 0x100(%rsp)
movq %rdx, 0xe0(%rsp)
leaq (%rcx,%rdx,4), %rax
movq %rax, 0x150(%rsp)
xorl %eax, %eax
movq 0xf0(%rsp), %r10
movq %r15, 0x58(%rsp)
movq %rdi, 0x148(%rsp)
movq %rsi, 0xf8(%rsp)
movq %r14, 0x90(%rsp)
movq %rax, 0x158(%rsp)
movzwl (%rsi,%rax,2), %eax
movzwl (%r15,%rax,2), %eax
movq %rax, 0x10(%rsp)
addq %rbp, %rax
xorl %edx, %edx
divq %r12
movq %rdx, 0x160(%rsp)
movzwl (%r14,%rdx,2), %ecx
cmpw %cx, %bx
je 0x4093
cmpw 0x8(%rsp), %cx
je 0x4093
movq 0x10(%rsp), %rax
movzwl (%r14,%rax,2), %r8d
movq 0x140(%rsp), %rsi
movl (%rsi,%r8,4), %edx
movq 0x128(%rsp), %rax
movq %rdx, 0xb8(%rsp)
addl %eax, %edx
movq 0x8(%rsp), %rax
movl (%rsi,%rax,4), %eax
movq 0x138(%rsp), %rsi
addl %eax, %esi
cmpl %esi, %edx
ja 0x40a7
movzwl %cx, %ecx
movq 0xa8(%rsp), %rsi
movq %rcx, 0x18(%rsp)
imulq %rcx, %rsi
movq 0x100(%rsp), %rcx
movq %rsi, 0xb0(%rsp)
leaq (%rcx,%rsi,4), %rcx
movl (%rcx,%r8,4), %esi
movq 0x70(%rsp), %rcx
addl %eax, %ecx
movl %esi, %r9d
addl %esi, %ecx
cmpl %ecx, %edx
movq 0xf8(%rsp), %rsi
ja 0x4093
movq %r8, %rcx
movq 0xb8(%rsp), %rdx
addl 0x120(%rsp), %edx
movq %rdx, 0xb8(%rsp)
addl %eax, %r9d
addl 0x70(%rsp), %r9d
movl %r9d, 0xd4(%rsp)
movq 0xa8(%rsp), %rax
imulq %r8, %rax
movq %rax, 0x130(%rsp)
xorl %r13d, %r13d
movq %r8, 0x60(%rsp)
movzwl (%rsi,%r13,2), %eax
movzwl (%r15,%rax,2), %r8d
leaq (%r8,%rbp), %rax
xorl %edx, %edx
divq %r12
movzwl (%r14,%r8,2), %eax
cmpw 0x18(%rsp), %ax
je 0x4087
cmpw %cx, %ax
je 0x4087
movzwl (%r14,%rdx,2), %r11d
cmpw %cx, %r11w
je 0x4087
cmpw %bx, %r11w
je 0x4087
cmpw 0x8(%rsp), %r11w
je 0x4087
movzwl %ax, %eax
movq 0x150(%rsp), %rcx
movl (%rcx,%rax,4), %ecx
addl 0xb8(%rsp), %ecx
cmpl 0xd4(%rsp), %ecx
ja 0x4093
movq %r8, 0x108(%rsp)
movq 0x160(%rsp), %r14
cmpq %r10, %r14
jae 0x3e94
movq 0xe0(%rsp), %rbp
movq 0x98(%rsp), %rcx
movq 0xb0(%rsp), %r15
movq %rbx, 0xc8(%rsp)
movq 0x18(%rsp), %r12
movq 0x8(%rsp), %rsi
movq 0x60(%rsp), %r9
movq %r14, 0x40(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movq %r10, %rdi
movq 0xa0(%rsp), %r8
cmpq %rdx, %r10
jb 0x3f40
cmpq %rdx, %r10
setb %cl
cmpq %r10, %r14
setb %sil
cmpq %r14, %rdx
jae 0x3ef4
orb %cl, %sil
movq 0xe0(%rsp), %rbp
movq 0x98(%rsp), %rcx
movq 0xb0(%rsp), %r15
movq %rbx, 0xc8(%rsp)
movq 0x18(%rsp), %r12
movq 0x8(%rsp), %rsi
movq 0x60(%rsp), %r9
movq %r14, 0x40(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movq %r10, %rdi
movq 0xa0(%rsp), %r8
jne 0x3f40
movq 0x130(%rsp), %rbp
movq 0xb0(%rsp), %rcx
movq 0x98(%rsp), %r15
movq 0x18(%rsp), %rsi
movq %rsi, 0xc8(%rsp)
movq %rbx, %r12
movq 0x60(%rsp), %rsi
movq 0x8(%rsp), %r9
movq %r10, 0x40(%rsp)
movq 0xa0(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movq %r14, %rdi
movq 0x10(%rsp), %r8
movq %rdi, 0x78(%rsp)
movq %r8, 0x80(%rsp)
movq %rdx, 0x88(%rsp)
movq 0x100(%rsp), %r14
leaq (%r14,%r15,4), %rdx
movq %r9, 0x170(%rsp)
leal (,%r9,4), %r8d
leaq (%r14,%rcx,4), %r10
movq %rsi, %r15
movl (%r10,%rsi,4), %ecx
movq %rdx, 0x168(%rsp)
addl (%r8,%rdx), %ecx
movzwl %r11w, %edx
movq %r12, %rsi
movq 0xa8(%rsp), %r12
movq %r12, %r11
imulq %rdx, %r11
leaq (%r14,%r11,4), %rbx
addl (%rbx,%rax,4), %ecx
leaq (%r14,%rbp,4), %rbp
movq %rsi, %r9
movl (%rbp,%rsi,4), %edi
movq %r12, %r11
imulq %rax, %r11
leaq (%r14,%r11,4), %r11
movl (%r8,%r11), %esi
movl (%r10,%rdx,4), %r10d
movq %rdi, 0xc0(%rsp)
leal (%rdi,%r10), %r8d
addl %esi, %r8d
cmpl %ecx, %r8d
jb 0x40d8
movq 0x170(%rsp), %rsi
imulq %r12, %rsi
leaq (%r14,%rsi,4), %rsi
movl (%rsi,%r15,4), %r14d
movl (%rbx,%r9,4), %ebx
movq 0xc8(%rsp), %r10
movl (%r11,%r10,4), %r8d
leal (%r14,%r8), %edi
addl %ebx, %edi
cmpl %ecx, %edi
movq 0x108(%rsp), %r9
jb 0x424d
movq 0x168(%rsp), %rdi
movl (%rdi,%r10,4), %r12d
movl (%rsi,%rdx,4), %edx
movl (%rbp,%rax,4), %ebx
leal (%r12,%rbx), %eax
addl %edx, %eax
cmpl %ecx, %eax
movq 0x90(%rsp), %r14
jb 0x43c9
movq 0xc0(%rsp), %rax
addl %r8d, %eax
addl %edx, %eax
cmpl %ecx, %eax
movq 0x50(%rsp), %r12
movq 0x30(%rsp), %rbp
movq 0x58(%rsp), %r15
movq 0xf0(%rsp), %r10
movq 0xe8(%rsp), %rbx
movq 0x148(%rsp), %rdi
movq 0xf8(%rsp), %rsi
movq 0x60(%rsp), %rcx
jb 0x452e
incq %r13
cmpq %r13, %rdi
jne 0x3dba
movq 0x158(%rsp), %rax
incq %rax
cmpq %rdi, %rax
jne 0x3cab
movq 0x68(%rsp), %r14
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r13
movl 0x4c(%rsp), %r15d
jmp 0x3b85
movl $0x0, %r13d
testb $0x1, %r15b
movb $0x1, %r15b
je 0x3b85
jmp 0x4742
movl %esi, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x90(%rsp), %r14
subq %r14, %rsi
sarq %rsi
movq 0x40(%rsp), %rdx
movq %rdx, %rax
movq 0x108(%rsp), %r9
subq %r9, %rax
movl $0x0, %ecx
cmovbq %rsi, %rcx
leaq (%rax,%rcx), %r8
incq %r8
cmpq $0x2, %r8
movl $0xffff, %r12d          # imm = 0xFFFF
movq 0x58(%rsp), %r15
jb 0x4188
shrq %r8
leaq -0x1(%rsi), %rcx
movq %r9, %rax
andq %r12, %rax
movl %eax, %r13d
movq %rdx, %rdi
andq %r12, %rdi
movl %edi, %r10d
movzwl (%r14,%r13,2), %r11d
movzwl (%r14,%r10,2), %ebx
movw %bx, (%r14,%r13,2)
movw %r11w, (%r14,%r10,2)
movzwl (%r14,%r13,2), %r11d
movw %r9w, (%r15,%r11,2)
movzwl (%r14,%r10,2), %r9d
movw %dx, (%r15,%r9,2)
incq %rax
xorl %edx, %edx
divq %rsi
addq %rcx, %rdi
movq %rdx, %r9
movq %rdi, %rax
xorl %edx, %edx
divq %rsi
decq %r8
jne 0x4133
movq 0x88(%rsp), %rdx
movq %rdx, %rax
movq 0x80(%rsp), %rbp
subq %rbp, %rax
movl $0x0, %ecx
cmovbq %rsi, %rcx
leaq (%rax,%rcx), %r8
incq %r8
cmpq $0x2, %r8
movq 0x50(%rsp), %r12
movl $0xffff, %ecx           # imm = 0xFFFF
movq 0x28(%rsp), %r13
jb 0x422d
shrq %r8
leaq -0x1(%rsi), %rax
movq %rax, 0x8(%rsp)
movq %rbp, %rax
andq %rcx, %rax
movl %eax, %ebx
movq %rdx, %rdi
andq %rcx, %rdi
movl %edi, %r9d
movq %rdx, %rcx
movzwl (%r14,%rbx,2), %r10d
movzwl (%r14,%r9,2), %r11d
movw %r11w, (%r14,%rbx,2)
movw %r10w, (%r14,%r9,2)
movzwl (%r14,%rbx,2), %edx
movw %bp, (%r15,%rdx,2)
movzwl (%r14,%r9,2), %edx
movw %cx, (%r15,%rdx,2)
movl $0xffff, %ecx           # imm = 0xFFFF
incq %rax
xorl %edx, %edx
divq %rsi
addq 0x8(%rsp), %rdi
movq %rdx, %rbp
movq %rdi, %rax
xorl %edx, %edx
divq %rsi
decq %r8
jne 0x41cf
movq 0x18(%rsp), %rcx
movl 0x10(%rsp), %eax
cmpl %ecx, %eax
cmoval %eax, %ecx
movq 0xc0(%rsp), %rax
cmpl %ecx, %eax
cmoval %eax, %ecx
jmp 0x4717
movq %r14, 0x10(%rsp)
movq %r8, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %r15
movq 0x90(%rsp), %r14
subq %r14, %r15
sarq %r15
movq 0x40(%rsp), %rsi
movq %rsi, %rax
subq %r9, %rax
movl $0x0, %ecx
cmovbq %r15, %rcx
leaq (%rax,%rcx), %rdi
incq %rdi
cmpq $0x2, %rdi
movl $0xffff, %r13d          # imm = 0xFFFF
movq 0x58(%rsp), %r8
jb 0x4312
shrq %rdi
leaq -0x1(%r15), %rax
movq %rax, 0x8(%rsp)
movq %r9, %rax
andq %r13, %rax
movq %r15, %r12
movq %r8, %r15
movl %eax, %r8d
movq %rsi, %rcx
andq %r13, %rcx
movl %ecx, %r10d
movzwl (%r14,%r8,2), %r11d
movzwl (%r14,%r10,2), %ebp
movw %bp, (%r14,%r8,2)
movl $0xffff, %r13d          # imm = 0xFFFF
movw %r11w, (%r14,%r10,2)
movzwl (%r14,%r8,2), %edx
movq %r15, %r8
movq %r12, %r15
movw %r9w, (%r8,%rdx,2)
movzwl (%r14,%r10,2), %edx
movw %si, (%r8,%rdx,2)
incq %rax
xorl %edx, %edx
divq %r12
addq 0x8(%rsp), %rcx
movq %rdx, %r9
movq %rcx, %rax
xorl %edx, %edx
divq %r12
movq %rdx, %rsi
decq %rdi
jne 0x42a6
movq 0x78(%rsp), %rsi
movq %rsi, %rax
movq 0x38(%rsp), %rbp
subq %rbp, %rax
movl $0x0, %ecx
cmovbq %r15, %rcx
leaq (%rax,%rcx), %rdi
incq %rdi
cmpq $0x2, %rdi
jb 0x43a1
movq %r8, %r12
shrq %rdi
leaq -0x1(%r15), %rax
movq %rax, 0x8(%rsp)
movq %rbp, %rax
andq %r13, %rax
movl %eax, %r8d
movq %rsi, %rcx
andq %r13, %rcx
movl %ecx, %r9d
movzwl (%r14,%r8,2), %r10d
movzwl (%r14,%r9,2), %r11d
movw %r11w, (%r14,%r8,2)
movw %r10w, (%r14,%r9,2)
movzwl (%r14,%r8,2), %edx
movw %bp, (%r12,%rdx,2)
movzwl (%r14,%r9,2), %edx
movw %si, (%r12,%rdx,2)
incq %rax
xorl %edx, %edx
divq %r15
addq 0x8(%rsp), %rcx
movq %rdx, %rbp
movq %rcx, %rax
xorl %edx, %edx
divq %r15
movq %rdx, %rsi
decq %rdi
jne 0x4347
movq 0x18(%rsp), %rcx
cmpl %ecx, %ebx
cmoval %ebx, %ecx
movq 0x10(%rsp), %rax
cmpl %ecx, %eax
cmoval %eax, %ecx
movq 0x50(%rsp), %r12
movq 0x30(%rsp), %rbp
movq 0x28(%rsp), %r13
jmp 0x471c
movl %edx, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
subq %r14, %rsi
sarq %rsi
movq 0x78(%rsp), %rdx
movq %rdx, %rax
movq 0x38(%rsp), %r13
subq %r13, %rax
movl $0x0, %ecx
cmovbq %rsi, %rcx
leaq (%rax,%rcx), %rdi
incq %rdi
cmpq $0x2, %rdi
movl $0xffff, %r11d          # imm = 0xFFFF
movq 0x58(%rsp), %r15
jb 0x4478
shrq %rdi
leaq -0x1(%rsi), %rax
movq %rax, 0x8(%rsp)
movq %r13, %rax
andq %r11, %rax
movl %eax, %ebp
movq %rdx, %r9
andq %r11, %r9
movl %r9d, %r8d
movq %rdx, %rcx
movzwl (%r14,%rbp,2), %r10d
movzwl (%r14,%r8,2), %r11d
movw %r11w, (%r14,%rbp,2)
movl $0xffff, %r11d          # imm = 0xFFFF
movw %r10w, (%r14,%r8,2)
movzwl (%r14,%rbp,2), %edx
movw %r13w, (%r15,%rdx,2)
movzwl (%r14,%r8,2), %edx
movw %cx, (%r15,%rdx,2)
incq %rax
xorl %edx, %edx
divq %rsi
addq 0x8(%rsp), %r9
movq %rdx, %r13
movq %r9, %rax
xorl %edx, %edx
divq %rsi
decq %rdi
jne 0x4419
movq 0x88(%rsp), %r13
movq %r13, %rax
movq 0x80(%rsp), %r10
subq %r10, %rax
movl $0x0, %ecx
cmovbq %rsi, %rcx
leaq (%rax,%rcx), %r8
incq %r8
cmpq $0x2, %r8
jb 0x4512
shrq %r8
leaq -0x1(%rsi), %rax
movq %rax, 0x8(%rsp)
movq %r10, %rax
andq %r11, %rax
movl %eax, %ecx
movq %r13, %rdi
andq %r11, %rdi
movl %edi, %r9d
movq %r10, %rbp
movzwl (%r14,%rcx,2), %r10d
movzwl (%r14,%r9,2), %r11d
movw %r11w, (%r14,%rcx,2)
movl $0xffff, %r11d          # imm = 0xFFFF
movw %r10w, (%r14,%r9,2)
movzwl (%r14,%rcx,2), %edx
movw %bp, (%r15,%rdx,2)
movzwl (%r14,%r9,2), %edx
movw %r13w, (%r15,%rdx,2)
incq %rax
xorl %edx, %edx
divq %rsi
addq 0x8(%rsp), %rdi
movq %rdx, %r10
movq %rdi, %rax
xorl %edx, %edx
divq %rsi
movq %rdx, %r13
decq %r8
jne 0x44b0
movl 0x10(%rsp), %eax
cmpl %ebx, %eax
cmoval %eax, %ebx
cmpl %ebx, %r12d
cmoval %r12d, %ebx
movl %ebx, %ecx
movq 0x50(%rsp), %r12
jmp 0x4712
movl %edx, 0x10(%rsp)
movq %r8, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
subq %r14, %rsi
sarq %rsi
movq %r9, %rax
movq 0x40(%rsp), %r13
subq %r13, %rax
movl $0x0, %ecx
cmovbq %rsi, %rcx
leaq (%rax,%rcx), %rdi
incq %rdi
cmpq $0x2, %rdi
movl $0xffff, %r8d           # imm = 0xFFFF
jb 0x45d1
shrq %rdi
leaq -0x1(%rsi), %rcx
movq %r13, %rax
andq %r8, %rax
movl %eax, %edx
movq %r9, %r11
andq %r8, %r11
movl %r11d, %r8d
movzwl (%r14,%rdx,2), %r10d
movzwl (%r14,%r8,2), %ebx
movw %bx, (%r14,%rdx,2)
movw %r10w, (%r14,%r8,2)
movzwl (%r14,%rdx,2), %edx
movw %r13w, (%r15,%rdx,2)
movzwl (%r14,%r8,2), %edx
movl $0xffff, %r8d           # imm = 0xFFFF
movw %r9w, (%r15,%rdx,2)
incq %rax
xorl %edx, %edx
divq %rsi
addq %rcx, %r11
movq %rdx, %r13
movq %r11, %rax
xorl %edx, %edx
divq %rsi
movq %rdx, %r9
decq %rdi
jne 0x4574
movq 0x78(%rsp), %rdx
movq %rdx, %rax
movq 0x38(%rsp), %rbp
subq %rbp, %rax
movl $0x0, %ecx
cmovbq %rsi, %rcx
leaq (%rax,%rcx), %rdi
incq %rdi
cmpq $0x2, %rdi
movq %r15, %rbx
movl $0xffff, %r13d          # imm = 0xFFFF
jb 0x4664
shrq %rdi
leaq -0x1(%rsi), %rax
movq %rax, 0x8(%rsp)
movq %rbp, %rax
andq %r13, %rax
movl %eax, %r15d
movq %rdx, %r9
andq %r13, %r9
movl %r9d, %r8d
movq %rdx, %rcx
movzwl (%r14,%r15,2), %r10d
movzwl (%r14,%r8,2), %r11d
movw %r11w, (%r14,%r15,2)
movw %r10w, (%r14,%r8,2)
movzwl (%r14,%r15,2), %edx
movw %bp, (%rbx,%rdx,2)
movzwl (%r14,%r8,2), %edx
movw %cx, (%rbx,%rdx,2)
incq %rax
xorl %edx, %edx
divq %rsi
addq 0x8(%rsp), %r9
movq %rdx, %rbp
movq %r9, %rax
xorl %edx, %edx
divq %rsi
decq %rdi
jne 0x460c
movq 0x88(%rsp), %rdx
movq %rdx, %rax
movq 0x80(%rsp), %r10
subq %r10, %rax
movl $0x0, %ecx
cmovbq %rsi, %rcx
leaq (%rax,%rcx), %r8
incq %r8
cmpq $0x2, %r8
jb 0x46f7
shrq %r8
leaq -0x1(%rsi), %rax
movq %rax, 0x8(%rsp)
movq %r10, %rax
andq %r13, %rax
movl %eax, %r15d
movq %rdx, %rdi
andq %r13, %rdi
movl %edi, %r9d
movq %rdx, %rcx
movq %r10, %rbp
movzwl (%r14,%r15,2), %r10d
movzwl (%r14,%r9,2), %r11d
movw %r11w, (%r14,%r15,2)
movw %r10w, (%r14,%r9,2)
movzwl (%r14,%r15,2), %edx
movw %bp, (%rbx,%rdx,2)
movzwl (%r14,%r9,2), %edx
movw %cx, (%rbx,%rdx,2)
incq %rax
xorl %edx, %edx
divq %rsi
addq 0x8(%rsp), %rdi
movq %rdx, %r10
movq %rdi, %rax
xorl %edx, %edx
divq %rsi
decq %r8
jne 0x469c
movq 0x18(%rsp), %rcx
movq 0xc0(%rsp), %rax
cmpl %ecx, %eax
cmoval %eax, %ecx
movl 0x10(%rsp), %eax
cmpl %ecx, %eax
cmoval %eax, %ecx
movq 0x28(%rsp), %r13
movq 0x30(%rsp), %rbp
movq 0x70(%rsp), %rax
cmpl %ecx, %eax
cmoval %eax, %ecx
movq 0xd8(%rsp), %rax
movl %ecx, (%rax)
xorl %r15d, %r15d
movq 0x20(%rsp), %rbx
movq 0x68(%rsp), %r14
jmp 0x3b85
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq