// File: /workspace/github_cpp_makefile_star2_O1/ALSchwalm[P]cppEvolve/examples/primes.cpp
// Function: main
int main() {

    //Construct a Tree generator which will return trees with a max-depth of 5
    tree::TreeFactory<int> factory(5);

    //Register the previous functions
    factory.addNode(sum, "sum");
    factory.addNode(product, "product");
    factory.addNode(difference, "difference");
    factory.addNode(negative, "negative");
    factory.addTerminator([]{return 5;}, "5");
    factory.addTerminator(getX, "X");

    //Construct the algorithm
    TreeGA<int, 100> gaTree(
        //Generator: The previously build TreeFactory
        factory,

        //Fitness: number of distince primes yielded by consecutive input
        treeFitness,

        //Crossover: Choose a single node in one parent tree and crossover with
        // a node from the other parent (hight will not increase)
        tree::crossover::singlePoint<int>,

        //Mutation: Replace a random node with a new random subtree
        tree::mutator::randomNode<int>,

        //Selector: Select the 10 most fit members of the population each generation
        selector::top<tree::Tree<int>*, 10>);

    //Set mutation rate to 2%
    gaTree.setMutationRate(0.02f);

    //Run and log statistics every 20 generations, should reach around 7 primes
    gaTree.run(500, 20);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x270, %rsp            # imm = 0x270
leaq -0xf8(%rbp), %rax
movq $0x5, -0x10(%rax)
xorl %ecx, %ecx
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq -0xc8(%rbp), %rax
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq -0x218(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x4ae9(%rip), %rsi      # 0x70a9
leaq 0x4ae5(%rip), %rdx      # 0x70ac
leaq -0x228(%rbp), %rdi
callq 0x38d8
leaq -0x1b7(%rip), %rsi      # 0x2423
leaq -0x108(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x2a36
movq -0x228(%rbp), %rdi
cmpq %r14, %rdi
je 0x25fe
callq 0x2140
leaq -0x228(%rbp), %rdi
movq %r14, (%rdi)
leaq 0x4a9e(%rip), %rsi      # 0x70ad
leaq 0x4a9e(%rip), %rdx      # 0x70b4
callq 0x38d8
leaq -0x1f6(%rip), %rsi      # 0x242c
leaq -0x108(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x2a36
movq -0x228(%rbp), %rdi
cmpq %r14, %rdi
je 0x2646
callq 0x2140
leaq -0x228(%rbp), %rdi
movq %r14, (%rdi)
leaq 0x4a5e(%rip), %rsi      # 0x70b5
leaq 0x4a61(%rip), %rdx      # 0x70bf
callq 0x38d8
leaq -0x233(%rip), %rsi      # 0x2437
leaq -0x108(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x2a36
movq -0x228(%rbp), %rdi
cmpq %r14, %rdi
je 0x268e
callq 0x2140
leaq -0x228(%rbp), %rdi
movq %r14, (%rdi)
leaq 0x4a21(%rip), %rsi      # 0x70c0
leaq 0x4a22(%rip), %rdx      # 0x70c8
callq 0x38d8
leaq -0x271(%rip), %rsi      # 0x2441
leaq -0x108(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x2b0e
movq -0x228(%rbp), %rdi
cmpq %r14, %rdi
je 0x26d6
callq 0x2140
leaq -0x228(%rbp), %rdi
movq %r14, (%rdi)
leaq 0x49e2(%rip), %rsi      # 0x70c9
leaq 0x49dc(%rip), %rdx      # 0x70ca
callq 0x38d8
leaq 0x330(%rip), %rsi       # 0x2a2a
leaq -0x108(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x2be6
movq -0x228(%rbp), %rdi
cmpq %r14, %rdi
je 0x271e
callq 0x2140
leaq -0x228(%rbp), %rdi
movq %r14, (%rdi)
leaq 0x499c(%rip), %rsi      # 0x70cb
leaq 0x4996(%rip), %rdx      # 0x70cc
callq 0x38d8
leaq -0x2f7(%rip), %rsi      # 0x244b
leaq -0x108(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x2be6
movq -0x228(%rbp), %rdi
cmpq %r14, %rdi
je 0x2766
callq 0x2140
leaq -0x100(%rbp), %rbx
movq -0x8(%rbx), %rax
leaq -0x288(%rbp), %r14
movq %rax, -0x8(%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x35c0
leaq -0x258(%rbp), %r15
leaq -0xd0(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x35c0
xorps %xmm0, %xmm0
leaq -0xa0(%rbp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
leaq -0x361(%rip), %rax      # 0x2457
movq %rax, (%rdx)
leaq 0x2c9a(%rip), %rax      # 0x545c
movq %rax, 0x18(%rdx)
leaq 0x2ca1(%rip), %rax      # 0x546e
movq %rax, 0x10(%rdx)
leaq -0x80(%rbp), %rcx
movaps %xmm0, (%rcx)
movaps %xmm0, 0x10(%rcx)
leaq 0x4da(%rip), %rax       # 0x2cbd
movq %rax, (%rcx)
leaq 0x2d2d(%rip), %rax      # 0x551a
movq %rax, 0x18(%rcx)
leaq 0x2d32(%rip), %rax      # 0x552a
movq %rax, 0x10(%rcx)
leaq -0x60(%rbp), %r8
movaps %xmm0, (%r8)
movaps %xmm0, 0x10(%r8)
leaq 0x5d2(%rip), %rax       # 0x2de2
movq %rax, (%r8)
leaq 0x2e92(%rip), %rax      # 0x56ac
movq %rax, 0x18(%r8)
leaq 0x2e97(%rip), %rax      # 0x56bc
movq %rax, 0x10(%r8)
leaq -0x40(%rbp), %r9
movaps %xmm0, (%r9)
movaps %xmm0, 0x10(%r9)
leaq 0x6d7(%rip), %rax       # 0x2f14
movq %rax, (%r9)
leaq 0x3cab(%rip), %rax      # 0x64f2
movq %rax, 0x18(%r9)
leaq 0x3caa(%rip), %rax      # 0x64fc
movq %rax, 0x10(%r9)
leaq -0x228(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x2f48
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0x2880
leaq -0x40(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x2897
leaq -0x60(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x70(%rbp), %rax
testq %rax, %rax
je 0x28ae
leaq -0x80(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x90(%rbp), %rax
testq %rax, %rax
je 0x28cb
leaq -0xa0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %r15, %rdi
callq 0x38c0
movq %r14, %rdi
callq 0x38c0
leaq -0x228(%rbp), %rdi
movl $0x3ca3d70a, 0x118(%rdi) # imm = 0x3CA3D70A
movl $0x1f4, %esi            # imm = 0x1F4
movl $0x14, %edx
callq 0x30ca
leaq -0x228(%rbp), %rdi
callq 0x3502
movq %r12, %rdi
callq 0x38c0
movq %rbx, %rdi
callq 0x38c0
xorl %eax, %eax
addq $0x270, %rsp            # imm = 0x270
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x29c6
jmp 0x29c6
jmp 0x29c6
jmp 0x29c6
movq %rax, %rbx
leaq -0x228(%rbp), %rdi
callq 0x3502
jmp 0x2a0a
movq %rax, %rbx
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0x296b
leaq -0x40(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x2982
leaq -0x60(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x70(%rbp), %rax
testq %rax, %rax
je 0x2999
leaq -0x80(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x90(%rbp), %rax
testq %rax, %rax
je 0x29b6
leaq -0xa0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %r15, %rdi
callq 0x38c0
jmp 0x29d1
jmp 0x29c6
jmp 0x29c6
jmp 0x29c6
movq %rax, %rdi
callq 0x3603
movq %rax, %rbx
movq %r14, %rdi
callq 0x38c0
jmp 0x2a0a
jmp 0x2a07
jmp 0x29f1
jmp 0x2a07
jmp 0x29f1
jmp 0x2a07
jmp 0x29f1
jmp 0x2a07
jmp 0x29f1
jmp 0x2a07
jmp 0x29f1
jmp 0x2a07
movq %rax, %rbx
movq -0x228(%rbp), %rdi
cmpq %r14, %rdi
je 0x2a0a
callq 0x2140
jmp 0x2a0a
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x38c0
leaq -0x100(%rbp), %rdi
callq 0x38c0
movq %rbx, %rdi
callq 0x21f0