// File: /workspace/github_cpp_makefile_star2_O1/chuckwolber[P]Cube/order/cli.cpp
// Function: calculateOrder(unsigned int)
void calculateOrder(const unsigned int threadNum) {
    Algorithm algorithm(initialAlgorithm);
    std::vector<Turn> turnSet;
    Cube c(CubieColor::RED, 3);
    unsigned int order;
    unsigned long long int algorithmCount = threadNum;

    algorithm += threadNum;
    while (algorithmCount < algorithmCountMax) {
        if (algorithmCount % skip_nth != 0)
            goto bypass;
        if (keepDuplicates || !algorithm.isRedundant()) {
            order = 0;
            turnSet = algorithm.getAlgorithm();
            do {
                ++order;
                c.performAlgorithm(turnSet);
            } while (!c.isSolved());

            printResult(threadNum, algorithmCount, turnSet, order);
            if (skipFoundOrders && !numSkipFoundOrders)
                return;
        }
        
        bypass:
        algorithmCount += numThreads;
        algorithm += numThreads;

        if (heartbeat > 0 && algorithmCount % heartbeat == 0) {
            coutMutex.lock();
            std::cout << "HB:" << algorithmCount << std::endl;
            coutMutex.unlock();
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %edi, %ebx
leaq 0x9942(%rip), %rsi      # 0x12678
leaq 0x38(%rsp), %rdi
callq 0x49f2
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x60(%rsp), %rdi
movl $0x72, %esi
movl $0x3, %edx
callq 0x603a
movl %ebx, %r14d
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x4d08
cmpq %r14, 0x98d5(%rip)      # 0x12650
jbe 0x8f13
leaq 0x38(%rsp), %r12
leaq 0x60(%rsp), %r13
movq %rsp, %rbp
movq %r14, %rax
xorl %edx, %edx
divq 0x98ae(%rip)            # 0x12648
testq %rdx, %rdx
je 0x8e54
movl 0x98be(%rip), %r15d     # 0x12668
movq %r12, %rdi
movq %r15, %rsi
callq 0x4d08
addq %r15, %r14
movq 0x98a1(%rip), %rcx      # 0x12660
testq %rcx, %rcx
je 0x8e42
movq %r14, %rax
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
jne 0x8e42
leaq 0x9800(%rip), %rdi      # 0x125d8
callq 0x4400
testl %eax, %eax
jne 0x8f5c
movl $0x3, %edx
movq 0x91bf(%rip), %rdi      # 0x11fb0
leaq 0x3ca3(%rip), %rsi      # 0xca9b
callq 0x4340
movq 0x91ac(%rip), %rdi      # 0x11fb0
movq %r14, %rsi
callq 0x41d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41f0
leaq 0x979b(%rip), %rdi      # 0x125d8
callq 0x4230
cmpq 0x9807(%rip), %r14      # 0x12650
jb 0x8d8e
jmp 0x8f13
cmpb $0x0, 0x9815(%rip)      # 0x12670
jne 0x8e6d
movq %r12, %rdi
callq 0x51c0
testb %al, %al
jne 0x8da3
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x5110
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
testq %rdi, %rdi
je 0x8eb4
subq %rdi, %rsi
callq 0x42f0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8ecb
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x42f0
xorl %r15d, %r15d
movq %r13, %rdi
movq %rbp, %rsi
callq 0x6494
movq %r13, %rdi
callq 0x63ea
incl %r15d
testb %al, %al
je 0x8ece
movl %ebx, %edi
movq %r14, %rsi
movq %rbp, %rdx
movl %r15d, %ecx
callq 0x91e1
cmpb $0x1, 0x9772(%rip)      # 0x12671
jne 0x8da3
cmpq $0x0, 0x974b(%rip)      # 0x12658
jne 0x8da3
leaq 0x60(%rsp), %rdi
callq 0x6314
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x8f33
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x42f0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x8f4a
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x42f0
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x41c0
movq %rax, %rbx
jmp 0x8f7b
jmp 0x8f6e
jmp 0x8f6e
jmp 0x8f6e
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x6314
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x8f91
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x42f0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x8fa8
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x42f0
movq %rbx, %rdi
callq 0x44c0