// File: /workspace/github_cpp_makefile_star2_O1/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 $0x168, %rsp            # imm = 0x168
movq %r8, 0x98(%rsp)
movq %rcx, 0xf8(%rsp)
movq %rdi, 0x48(%rsp)
movq %rsi, 0xf0(%rsp)
movq 0x18(%rsi), %r15
movq %r15, %rbp
addq $-0x1, %rbp
setb 0xd(%rsp)
movq %r9, 0x110(%rsp)
leal (%r9,%r9), %r12d
xorl %eax, %eax
cmpq $0x1, %r15
setne %al
movq %rax, 0x80(%rsp)
xorl %eax, %eax
movq %rdx, %r14
movq %rdx, 0x88(%rsp)
movq %r15, 0x28(%rsp)
movq %rbp, 0x38(%rsp)
movl %r12d, 0x78(%rsp)
testb $0x1, %al
jne 0x4432
movb $0x1, %al
movq %rax, 0x10(%rsp)
testq %r15, %r15
je 0x440e
movq 0x48(%rsp), %rax
movq (%rax), %rax
movzwl (%rax), %ecx
movw %cx, 0xa(%rsp)
movq 0x80(%rsp), %rcx
movzwl (%rax,%rcx,2), %eax
movw %ax, 0x8(%rsp)
callq 0x2040
movb 0xd(%rsp), %cl
movb %cl, 0x5(%rsp)
movq 0x1a0(%rsp), %rcx
cmpq %rax, (%rcx)
jl 0x4416
movb $0x1, %al
movq %rax, 0x10(%rsp)
movl $0x1, %ebx
movq 0x80(%rsp), %rax
movq %rax, 0x50(%rsp)
xorl %r13d, %r13d
movb 0xd(%rsp), %al
movb %al, 0x5(%rsp)
movq %rbx, 0x100(%rsp)
movq 0x20(%r14), %r8
testq %r8, %r8
je 0x4387
movq %r13, 0x108(%rsp)
movzwl 0xa(%rsp), %eax
movq %r8, %r9
imulq %rax, %r9
addq %r9, %r9
addq (%r14), %r9
movq 0x98(%rsp), %rcx
movl (%rcx), %r11d
movq 0xf8(%rsp), %rcx
movq (%rcx), %rbx
movq 0x48(%rsp), %rcx
movq (%rcx), %r13
movq 0xf0(%rsp), %rcx
movq (%rcx), %rdx
movq 0x20(%rcx), %rcx
imulq %rcx, %rax
leaq (%rdx,%rax,4), %rax
movq %rax, 0xc8(%rsp)
movzwl 0x8(%rsp), %esi
movq %rcx, 0xb0(%rsp)
movq %rcx, %rax
movq %rsi, 0xc0(%rsp)
imulq %rsi, %rax
movq %rdx, 0xb8(%rsp)
leaq (%rdx,%rax,4), %rax
movq %rax, 0x118(%rsp)
xorl %ecx, %ecx
movq 0x10(%rsp), %r10
movq %r8, 0xa8(%rsp)
movq %r9, 0xa0(%rsp)
movq %rbx, 0x60(%rsp)
movzwl (%r9,%rcx,2), %eax
movzwl (%rbx,%rax,2), %eax
movq %rax, 0x58(%rsp)
addq %rbp, %rax
xorl %edx, %edx
divq %r15
movzwl (%r13,%rdx,2), %r14d
cmpw %r14w, 0xa(%rsp)
je 0x4374
cmpw 0x8(%rsp), %r14w
je 0x4374
movq %rdx, %rsi
movq %r10, 0x10(%rsp)
movq %rcx, 0x90(%rsp)
movq 0x58(%rsp), %rax
movzwl (%r13,%rax,2), %r15d
movzwl %r15w, %r10d
movq 0xc8(%rsp), %rcx
movl (%rcx,%r10,4), %eax
addl %r12d, %eax
movq 0xc0(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
leal (%rcx,%r11,2), %edx
cmpl %edx, %eax
ja 0x438e
movq %rsi, 0x130(%rsp)
movzwl %r14w, %edx
imulq 0xb0(%rsp), %rdx
movq 0xb8(%rsp), %rsi
leaq (%rsi,%rdx,4), %rdx
addl %r11d, %ecx
movq %r10, 0xd0(%rsp)
movq %rdx, 0x138(%rsp)
addl (%rdx,%r10,4), %ecx
cmpl %ecx, %eax
jbe 0x3987
movq 0x90(%rsp), %rcx
movq 0x28(%rsp), %r15
movq 0x10(%rsp), %r10
jmp 0x4374
movq 0x48(%rsp), %rax
movq 0x8(%rax), %r12
subq %r13, %r12
sarq %r12
leaq -0x1(%r12), %rax
movq %rax, 0x30(%rsp)
xorl %eax, %eax
movq 0xd0(%rsp), %rcx
movw %r14w, 0xe(%rsp)
movw %r15w, 0x6(%rsp)
movq %r12, 0x68(%rsp)
movq %rax, 0x160(%rsp)
movzwl (%r9,%rax,2), %eax
movzwl (%rbx,%rax,2), %r10d
leaq (%r10,%rbp), %rax
xorl %edx, %edx
divq 0x28(%rsp)
movzwl (%r13,%r10,2), %eax
cmpw %r14w, %ax
je 0x3f4c
cmpw %r15w, %ax
je 0x3f4c
movq %rdx, %rsi
movzwl (%r13,%rdx,2), %edx
cmpw %r15w, %dx
je 0x3f4c
cmpw 0xa(%rsp), %dx
je 0x3f4c
cmpw 0x8(%rsp), %dx
je 0x3f4c
movq %rbp, %rdi
movzwl %ax, %ebp
leal (,%rcx,4), %eax
movq 0xc8(%rsp), %r14
movl (%r14,%rax), %ecx
addl 0x110(%rsp), %ecx
movq 0x118(%rsp), %r15
movq %rbp, 0x20(%rsp)
addl (%r15,%rbp,4), %ecx
movq 0x138(%rsp), %r15
movl (%r15,%rax), %eax
movq 0xc0(%rsp), %r15
addl (%r14,%r15,4), %eax
addl %r11d, %eax
cmpl %eax, %ecx
ja 0x4343
movq %r11, 0xe8(%rsp)
movq 0x130(%rsp), %rax
movq 0x108(%rsp), %rbx
cmpq %rbx, %rax
jae 0x3ab7
movzwl 0xe(%rsp), %ecx
movq %rax, %r11
movzwl 0x6(%rsp), %r15d
movq 0x58(%rsp), %r8
movzwl 0xa(%rsp), %ebp
movq %rbx, %r9
movzwl 0x8(%rsp), %r14d
movq 0x50(%rsp), %rdi
cmpq %rsi, %rbx
jb 0x3b1a
cmpq %rsi, %rbx
setb %dil
cmpq %rbx, %rax
setb %cl
cmpq %rax, %rsi
jae 0x3af4
orb %dil, %cl
movzwl 0xe(%rsp), %ecx
movq %rax, %r11
movzwl 0x6(%rsp), %r15d
movq 0x58(%rsp), %r8
movzwl 0xa(%rsp), %ebp
movq %rbx, %r9
movzwl 0x8(%rsp), %r14d
movq 0x50(%rsp), %rdi
jne 0x3b1a
movzwl 0xa(%rsp), %ecx
movq %rbx, %r11
movzwl 0x8(%rsp), %r15d
movq 0x50(%rsp), %r8
movzwl 0xe(%rsp), %ebp
movq %rax, %r9
movzwl 0x6(%rsp), %r14d
movq 0x58(%rsp), %rdi
movq %r8, 0xd8(%rsp)
movzwl %dx, %eax
movq %rax, 0x40(%rsp)
movl %ebp, %edx
movzwl %cx, %ebp
movq 0xb0(%rsp), %rcx
movq %rcx, %rax
imulq %rbp, %rax
movq 0xb8(%rsp), %rbx
leaq (%rbx,%rax,4), %r12
movzwl %r15w, %eax
movq %rax, 0x150(%rsp)
leal (,%rax,4), %r15d
movzwl %dx, %eax
movq %rax, 0xe0(%rsp)
imulq %rcx, %rax
leaq (%rbx,%rax,4), %rax
movq %rax, 0x18(%rsp)
movzwl %r14w, %r8d
movl (%rax,%r8,4), %r14d
movq %r12, 0x128(%rsp)
addl (%r15,%r12), %r14d
movq %rcx, %rax
movq 0x40(%rsp), %rdx
imulq %rdx, %rax
leaq (%rbx,%rax,4), %rax
movq 0x20(%rsp), %r12
movq %rax, 0x140(%rsp)
addl (%rax,%r12,4), %r14d
movq %rcx, %rax
movq %r8, 0x148(%rsp)
imulq %r8, %rax
leaq (%rbx,%rax,4), %rax
movq %rbp, 0x158(%rsp)
movq %rax, 0x120(%rsp)
movl (%rax,%rbp,4), %ebp
movq %rcx, %rax
imulq %r12, %rax
movq %rdx, %r12
leaq (%rbx,%rax,4), %r8
movl (%r15,%r8), %eax
movq 0x18(%rsp), %rdx
movl (%rdx,%r12,4), %edx
movq %rdx, 0x18(%rsp)
movq %rbp, 0x70(%rsp)
addl %ebp, %edx
movl %eax, 0x7c(%rsp)
addl %eax, %edx
cmpl %r14d, %edx
jae 0x3d48
movq %r11, %rax
subq %r10, %rax
movl $0x0, %ecx
movq 0x68(%rsp), %r12
cmovbq %r12, %rcx
leaq (%rax,%rcx), %r9
incq %r9
cmpq $0x2, %r9
movl $0xffff, %edx           # imm = 0xFFFF
movq 0x60(%rsp), %rbx
movq 0x30(%rsp), %r15
jb 0x3ca4
shrq %r9
cmpq $0x1, %r9
adcq $0x0, %r9
movq %r10, %rax
andq %rdx, %rax
movl %eax, %ecx
movq %r11, %r8
andq %rdx, %r8
movl %r8d, %edx
movzwl (%r13,%rcx,2), %ebp
movzwl (%r13,%rdx,2), %r14d
movw %r14w, (%r13,%rcx,2)
movw %bp, (%r13,%rdx,2)
movzwl (%r13,%rcx,2), %ecx
movw %r10w, (%rbx,%rcx,2)
movzwl (%r13,%rdx,2), %ecx
movw %r11w, (%rbx,%rcx,2)
incq %rax
xorl %edx, %edx
divq %r12
addq %r15, %r8
movq %rdx, %r10
movq %r8, %rax
xorl %edx, %edx
divq %r12
movq %rdx, %r11
movl $0xffff, %edx           # imm = 0xFFFF
decq %r9
jne 0x3c42
movq %rsi, %rax
subq %rdi, %rax
movl $0x0, %ecx
cmovbq %r12, %rcx
leaq (%rax,%rcx), %r9
incq %r9
cmpq $0x2, %r9
movq %rbx, %r14
movl $0xffff, %ebx           # imm = 0xFFFF
jb 0x3d30
shrq %r9
cmpq $0x1, %r9
adcq $0x0, %r9
movq %rdi, %rax
andq %rbx, %rax
movl %eax, %ecx
movq %rsi, %r8
andq %rbx, %r8
movl %r8d, %edx
movzwl (%r13,%rcx,2), %r10d
movzwl (%r13,%rdx,2), %r11d
movw %r11w, (%r13,%rcx,2)
movw %r10w, (%r13,%rdx,2)
movzwl (%r13,%rcx,2), %ecx
movw %di, (%r14,%rcx,2)
movzwl (%r13,%rdx,2), %ecx
movw %si, (%r14,%rcx,2)
incq %rax
xorl %edx, %edx
divq %r12
addq %r15, %r8
movq %rdx, %rdi
movq %r8, %rax
xorl %edx, %edx
divq %r12
movq %rdx, %rsi
decq %r9
jne 0x3cd3
movq 0x18(%rsp), %rax
movl 0x7c(%rsp), %ecx
cmpl %eax, %ecx
cmoval %ecx, %eax
movq 0x70(%rsp), %rcx
jmp 0x3ee3
movq 0x150(%rsp), %rax
imulq %rcx, %rax
leaq (%rbx,%rax,4), %rcx
movq 0x148(%rsp), %rax
movl (%rcx,%rax,4), %r15d
movq 0x158(%rsp), %rax
movq 0x140(%rsp), %rdx
movl (%rdx,%rax,4), %ebp
movq 0xe0(%rsp), %rax
movl (%r8,%rax,4), %edx
leal (%r15,%rdx), %eax
addl %ebp, %eax
cmpl %r14d, %eax
movq 0x60(%rsp), %rbx
jae 0x3f65
movl %ebp, 0x40(%rsp)
movq %r15, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %r11, %rax
subq %r10, %rax
movl $0x0, %ecx
movq 0x68(%rsp), %r12
cmovbq %r12, %rcx
leaq (%rax,%rcx), %rdi
incq %rdi
cmpq $0x2, %rdi
movl $0xffff, %r15d          # imm = 0xFFFF
movq 0x30(%rsp), %rbp
movq 0xd8(%rsp), %r8
jb 0x3e45
shrq %rdi
cmpq $0x1, %rdi
adcq $0x0, %rdi
movq %r10, %rax
andq %r15, %rax
movl %eax, %ecx
movq %r11, %rsi
andq %r15, %rsi
movl %esi, %edx
movzwl (%r13,%rcx,2), %ebp
movzwl (%r13,%rdx,2), %r14d
movw %r14w, (%r13,%rcx,2)
movw %bp, (%r13,%rdx,2)
movq 0x30(%rsp), %rbp
movzwl (%r13,%rcx,2), %ecx
movw %r10w, (%rbx,%rcx,2)
movzwl (%r13,%rdx,2), %ecx
movw %r11w, (%rbx,%rcx,2)
incq %rax
xorl %edx, %edx
divq %r12
addq %rbp, %rsi
movq %rdx, %r10
movq %rsi, %rax
xorl %edx, %edx
divq %r12
movq %rdx, %r11
decq %rdi
jne 0x3de4
movq %r9, %rax
subq %r8, %rax
movl $0x0, %ecx
cmovbq %r12, %rcx
leaq (%rax,%rcx), %rdi
incq %rdi
cmpq $0x2, %rdi
movq %rbx, %r14
movl $0xffff, %ebx           # imm = 0xFFFF
jb 0x3ed0
shrq %rdi
cmpq $0x1, %rdi
adcq $0x0, %rdi
movq %r8, %rax
andq %rbx, %rax
movl %eax, %ecx
movq %r9, %rsi
andq %rbx, %rsi
movl %esi, %edx
movzwl (%r13,%rcx,2), %r10d
movzwl (%r13,%rdx,2), %r11d
movw %r11w, (%r13,%rcx,2)
movw %r10w, (%r13,%rdx,2)
movzwl (%r13,%rcx,2), %ecx
movw %r8w, (%r14,%rcx,2)
movzwl (%r13,%rdx,2), %ecx
movw %r9w, (%r14,%rcx,2)
incq %rax
xorl %edx, %edx
divq %r12
addq %rbp, %rsi
movq %rdx, %r8
movq %rsi, %rax
xorl %edx, %edx
divq %r12
movq %rdx, %r9
decq %rdi
jne 0x3e74
movq 0x18(%rsp), %rax
movl 0x40(%rsp), %ecx
cmpl %eax, %ecx
cmoval %ecx, %eax
movq 0x20(%rsp), %rcx
cmpl %eax, %ecx
cmoval %ecx, %eax
movq 0x38(%rsp), %rbp
movq 0x10(%rsp), %r10
movq %r14, %rbx
movzwl 0x6(%rsp), %r15d
movq 0xe8(%rsp), %r11
cmpl %eax, %r11d
cmovbel %eax, %r11d
movq 0x98(%rsp), %rax
movl %r11d, (%rax)
movb $0x1, %al
movq 0xa8(%rsp), %r8
movq 0xa0(%rsp), %r9
movzwl 0xe(%rsp), %r14d
movzbl %r10b, %r10d
xorl %ecx, %ecx
testb %al, %al
cmovnel %ecx, %r10d
jne 0x4359
movq %r10, 0x10(%rsp)
movq 0xd0(%rsp), %rcx
movq 0x160(%rsp), %rax
incq %rax
cmpq %r8, %rax
jne 0x39bb
jmp 0x4330
movq 0x128(%rsp), %rax
movq 0xe0(%rsp), %r15
movl (%rax,%r15,4), %r15d
movl (%rcx,%r12,4), %ecx
movq 0x20(%rsp), %rax
movq 0x120(%rsp), %r12
movl (%r12,%rax,4), %eax
movq %rax, 0x18(%rsp)
addl %r15d, %eax
addl %ecx, %eax
cmpl %r14d, %eax
movq 0x30(%rsp), %rbp
movq 0x68(%rsp), %r12
movq 0xd8(%rsp), %r8
jae 0x4102
movq %r15, 0x40(%rsp)
movl %ecx, 0x20(%rsp)
movq %r9, %rax
subq %r8, %rax
movl $0x0, %ecx
cmovbq %r12, %rcx
leaq (%rax,%rcx), %r11
incq %r11
cmpq $0x2, %r11
movl $0xffff, %r15d          # imm = 0xFFFF
jb 0x404b
shrq %r11
cmpq $0x1, %r11
adcq $0x0, %r11
movq %r8, %rax
andq %r15, %rax
movl %eax, %ecx
movq %r9, %r10
andq %r15, %r10
movl %r10d, %edx
movzwl (%r13,%rcx,2), %ebp
movzwl (%r13,%rdx,2), %r14d
movw %r14w, (%r13,%rcx,2)
movw %bp, (%r13,%rdx,2)
movq 0x30(%rsp), %rbp
movzwl (%r13,%rcx,2), %ecx
movw %r8w, (%rbx,%rcx,2)
movzwl (%r13,%rdx,2), %ecx
movw %r9w, (%rbx,%rcx,2)
incq %rax
xorl %edx, %edx
divq %r12
addq %rbp, %r10
movq %rdx, %r8
movq %r10, %rax
xorl %edx, %edx
divq %r12
movq %rdx, %r9
decq %r11
jne 0x3fe9
movq %rsi, %rax
subq %rdi, %rax
movl $0x0, %ecx
cmovbq %r12, %rcx
leaq (%rax,%rcx), %r9
incq %r9
cmpq $0x2, %r9
movl $0xffff, %r14d          # imm = 0xFFFF
movzwl 0x6(%rsp), %r15d
jb 0x40d9
shrq %r9
cmpq $0x1, %r9
adcq $0x0, %r9
movq %rdi, %rax
andq %r14, %rax
movl %eax, %ecx
movq %rsi, %r8
andq %r14, %r8
movl %r8d, %edx
movzwl (%r13,%rcx,2), %r10d
movzwl (%r13,%rdx,2), %r11d
movw %r11w, (%r13,%rcx,2)
movw %r10w, (%r13,%rdx,2)
movzwl (%r13,%rcx,2), %ecx
movw %di, (%rbx,%rcx,2)
movzwl (%r13,%rdx,2), %ecx
movw %si, (%rbx,%rcx,2)
incq %rax
xorl %edx, %edx
divq %r12
addq %rbp, %r8
movq %rdx, %rdi
movq %r8, %rax
xorl %edx, %edx
divq %r12
movq %rdx, %rsi
decq %r9
jne 0x407e
movl 0x20(%rsp), %eax
movq 0x18(%rsp), %rcx
cmpl %ecx, %eax
cmoval %eax, %ecx
movq 0x40(%rsp), %rax
cmpl %ecx, %eax
cmoval %eax, %ecx
movl %ecx, %eax
movq 0x38(%rsp), %rbp
movq 0x10(%rsp), %r10
jmp 0x3efb
movq 0x70(%rsp), %rax
addl %edx, %eax
addl %ecx, %eax
cmpl %r14d, %eax
jae 0x42fb
movl %ecx, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %r10, %rax
subq %r11, %rax
movl $0x0, %ecx
cmovbq %r12, %rcx
leaq (%rax,%rcx), %r14
incq %r14
cmpq $0x2, %r14
movl $0xffff, %edx           # imm = 0xFFFF
jb 0x41b5
shrq %r14
cmpq $0x1, %r14
adcq $0x0, %r14
movq %r11, %rax
andq %rdx, %rax
movl %eax, %ecx
movq %r10, %r15
andq %rdx, %r15
movl %r15d, %edx
movzwl (%r13,%rcx,2), %ebp
movzwl (%r13,%rdx,2), %ebx
movw %bx, (%r13,%rcx,2)
movq 0x60(%rsp), %rbx
movw %bp, (%r13,%rdx,2)
movq 0x30(%rsp), %rbp
movzwl (%r13,%rcx,2), %ecx
movw %r11w, (%rbx,%rcx,2)
movzwl (%r13,%rdx,2), %ecx
movw %r10w, (%rbx,%rcx,2)
incq %rax
xorl %edx, %edx
divq %r12
addq %rbp, %r15
movq %rdx, %r11
movq %r15, %rax
xorl %edx, %edx
divq %r12
movq %rdx, %r10
movl $0xffff, %edx           # imm = 0xFFFF
decq %r14
jne 0x4149
movq %r9, %rax
subq %r8, %rax
movl $0x0, %ecx
cmovbq %r12, %rcx
leaq (%rax,%rcx), %r11
incq %r11
cmpq $0x2, %r11
movl $0xffff, %r15d          # imm = 0xFFFF
movq %rbp, %r14
jb 0x4247
shrq %r11
cmpq $0x1, %r11
adcq $0x0, %r11
movq %r8, %rax
andq %r15, %rax
movl %eax, %ecx
movq %r9, %r10
andq %r15, %r10
movl %r10d, %edx
movzwl (%r13,%rcx,2), %ebx
movzwl (%r13,%rdx,2), %ebp
movw %bp, (%r13,%rcx,2)
movw %bx, (%r13,%rdx,2)
movq 0x60(%rsp), %rbx
movzwl (%r13,%rcx,2), %ecx
movw %r8w, (%rbx,%rcx,2)
movzwl (%r13,%rdx,2), %ecx
movw %r9w, (%rbx,%rcx,2)
incq %rax
xorl %edx, %edx
divq %r12
addq %r14, %r10
movq %rdx, %r8
movq %r10, %rax
xorl %edx, %edx
divq %r12
movq %rdx, %r9
decq %r11
jne 0x41e5
movq %rsi, %rax
subq %rdi, %rax
movl $0x0, %ecx
cmovbq %r12, %rcx
leaq (%rax,%rcx), %r9
incq %r9
cmpq $0x2, %r9
movl $0xffff, %ebp           # imm = 0xFFFF
movzwl 0x6(%rsp), %r15d
jb 0x42d4
shrq %r9
cmpq $0x1, %r9
adcq $0x0, %r9
movq %rdi, %rax
andq %rbp, %rax
movl %eax, %ecx
movq %rsi, %r8
andq %rbp, %r8
movl %r8d, %edx
movzwl (%r13,%rcx,2), %r10d
movzwl (%r13,%rdx,2), %r11d
movw %r11w, (%r13,%rcx,2)
movw %r10w, (%r13,%rdx,2)
movzwl (%r13,%rcx,2), %ecx
movw %di, (%rbx,%rcx,2)
movzwl (%r13,%rdx,2), %ecx
movw %si, (%rbx,%rcx,2)
incq %rax
xorl %edx, %edx
divq %r12
addq %r14, %r8
movq %rdx, %rdi
movq %r8, %rax
xorl %edx, %edx
divq %r12
movq %rdx, %rsi
decq %r9
jne 0x4279
movq 0x18(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpl %eax, %ecx
cmoval %ecx, %eax
movl 0x20(%rsp), %ecx
cmpl %eax, %ecx
cmoval %ecx, %eax
movq 0x10(%rsp), %r10
movq 0x38(%rsp), %rbp
jmp 0x3efb
xorl %eax, %eax
movq 0x38(%rsp), %rbp
movq 0xa8(%rsp), %r8
movq 0xa0(%rsp), %r9
movq 0xe8(%rsp), %r11
movzwl 0xe(%rsp), %r14d
movzwl 0x6(%rsp), %r15d
movq 0x10(%rsp), %r10
jmp 0x3f2d
movl $0xa, %eax
movb $0x1, %cl
movq 0x28(%rsp), %r15
movq 0x10(%rsp), %r10
jmp 0x4363
movl $0xa, %eax
movb $0x1, %cl
movq 0x28(%rsp), %r15
movq 0x10(%rsp), %r10
movq %rdi, %rbp
jmp 0x4363
movl $0xd, %eax
movq 0x28(%rsp), %r15
testb %cl, %cl
movl 0x78(%rsp), %r12d
movq 0x90(%rsp), %rcx
je 0x439d
incq %rcx
cmpq %r8, %rcx
jne 0x38bb
movl $0x7, %eax
jmp 0x439d
movl $0x7, %eax
jmp 0x4398
movl $0x7, %eax
movq 0x28(%rsp), %r15
movq 0x10(%rsp), %r10
cmpl $0xd, %eax
movq %r10, 0x10(%rsp)
je 0x43ac
cmpl $0x7, %eax
jne 0x4428
movq 0x100(%rsp), %r13
cmpq %r15, %r13
setb 0x5(%rsp)
movq 0x88(%rsp), %r14
je 0x4416
leaq 0x1(%r13), %rbx
cmpq %r15, %rbx
movl $0x0, %edx
cmovneq %rbx, %rdx
movq 0x48(%rsp), %rax
movq (%rax), %rax
movzwl (%rax,%r13,2), %ecx
movw %cx, 0xa(%rsp)
movq %rdx, 0x50(%rsp)
movzwl (%rax,%rdx,2), %eax
movw %ax, 0x8(%rsp)
callq 0x2040
movq 0x1a0(%rsp), %rcx
cmpq %rax, (%rcx)
jge 0x3803
jmp 0x4416
movb 0xd(%rsp), %al
movb %al, 0x5(%rsp)
testb $0x1, 0x5(%rsp)
movq 0x10(%rsp), %rax
je 0x3788
jmp 0x4432
movq 0x88(%rsp), %r14
jmp 0x4416
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq