// File: /workspace/github_cpp_makefile_star2_O3/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 0x9b87(%rip), %rsi      # 0x12678
leaq 0x38(%rsp), %rdi
callq 0x49e2
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x60(%rsp), %rdi
movl $0x72, %esi
movl $0x3, %edx
callq 0x5ed4
movl %ebx, %r14d
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x4cfe
cmpq %r14, 0x9b1a(%rip)      # 0x12650
jbe 0x8cce
leaq 0x38(%rsp), %r12
leaq 0x60(%rsp), %r13
movq %rsp, %rbp
movq %r14, %rax
xorl %edx, %edx
divq 0x9af3(%rip)            # 0x12648
testq %rdx, %rdx
je 0x8c0f
movl 0x9b03(%rip), %r15d     # 0x12668
movq %r12, %rdi
movq %r15, %rsi
callq 0x4cfe
addq %r15, %r14
movq 0x9ae6(%rip), %rcx      # 0x12660
testq %rcx, %rcx
je 0x8bfd
movq %r14, %rax
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
jne 0x8bfd
leaq 0x9a45(%rip), %rdi      # 0x125d8
callq 0x4400
testl %eax, %eax
jne 0x8d17
movl $0x3, %edx
movq 0x9404(%rip), %rdi      # 0x11fb0
leaq 0x3ee8(%rip), %rsi      # 0xca9b
callq 0x4340
movq 0x93f1(%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 0x99e0(%rip), %rdi      # 0x125d8
callq 0x4230
cmpq 0x9a4c(%rip), %r14      # 0x12650
jb 0x8b49
jmp 0x8cce
cmpb $0x0, 0x9a5a(%rip)      # 0x12670
jne 0x8c28
movq %r12, %rdi
callq 0x5194
testb %al, %al
jne 0x8b5e
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x50e4
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
movaps 0x20(%rsp), %xmm0
movaps %xmm0, (%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
testq %rdi, %rdi
je 0x8c86
subq %rdi, %rsi
callq 0x42f0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8c86
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x42f0
xorl %r15d, %r15d
movq %r13, %rdi
movq %rbp, %rsi
callq 0x62f8
movq %r13, %rdi
callq 0x6242
incl %r15d
testb %al, %al
je 0x8c89
movl %ebx, %edi
movq %r14, %rsi
movq %rbp, %rdx
movl %r15d, %ecx
callq 0x8f9c
cmpb $0x1, 0x99b7(%rip)      # 0x12671
jne 0x8b5e
cmpq $0x0, 0x9990(%rip)      # 0x12658
jne 0x8b5e
leaq 0x60(%rsp), %rdi
callq 0x6164
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x8cee
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x42f0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x8d05
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 0x8d4c
jmp 0x8d29
jmp 0x8d29
jmp 0x8d29
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x6164
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x8d4c
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x42f0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x8d63
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x42f0
movq %rbx, %rdi
callq 0x44c0