// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x278, %rsp            # imm = 0x278
leaq -0x68(%rbp), %rax
movq $0x5, -0x10(%rax)
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x38(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x4b6d(%rip), %rsi      # 0x708d
leaq -0x198(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x2070
leaq -0x175(%rip), %rsi      # 0x23c2
leaq -0x78(%rbp), %rdi
leaq -0x198(%rbp), %rdx
callq 0x2890
leaq -0x198(%rbp), %rdi
callq 0x2090
leaq 0x4b37(%rip), %rsi      # 0x7091
leaq -0x198(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x2070
leaq -0x1a6(%rip), %rsi      # 0x23cb
leaq -0x78(%rbp), %rdi
leaq -0x198(%rbp), %rdx
callq 0x2890
leaq -0x198(%rbp), %rdi
callq 0x2090
leaq 0x4b05(%rip), %rsi      # 0x7099
leaq -0x198(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x2070
leaq -0x1d5(%rip), %rsi      # 0x23d6
leaq -0x78(%rbp), %rdi
leaq -0x198(%rbp), %rdx
callq 0x2890
leaq -0x198(%rbp), %rdi
callq 0x2090
leaq 0x4ad6(%rip), %rsi      # 0x70a4
leaq -0x198(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x2070
leaq -0x205(%rip), %rsi      # 0x23e0
leaq -0x78(%rbp), %rdi
leaq -0x198(%rbp), %rdx
callq 0x292a
leaq -0x198(%rbp), %rdi
callq 0x2090
leaq 0x4aa5(%rip), %rsi      # 0x70ad
leaq -0x198(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x2070
leaq 0x231(%rip), %rsi       # 0x2850
leaq -0x78(%rbp), %rdi
leaq -0x198(%rbp), %rdx
callq 0x29c4
leaq -0x198(%rbp), %rdi
callq 0x2090
leaq 0x4a6d(%rip), %rsi      # 0x70af
leaq -0x198(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x2070
leaq -0x26f(%rip), %rsi      # 0x23ea
leaq -0x78(%rbp), %rdi
leaq -0x198(%rbp), %rdx
callq 0x29c4
leaq -0x198(%rbp), %rdi
callq 0x2090
leaq -0x280(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x2a5e
leaq -0x218(%rbp), %rdx
andq $0x0, 0x8(%rdx)
leaq -0x2a2(%rip), %rax      # 0x23f6
movq %rax, (%rdx)
leaq 0x25aa(%rip), %rax      # 0x4c4c
movq %rax, 0x18(%rdx)
leaq -0x1f8(%rbp), %rcx
andq $0x0, 0x8(%rcx)
leaq 0x25a5(%rip), %rax      # 0x4c5e
movq %rax, 0x10(%rdx)
leaq 0x3f1(%rip), %rax       # 0x2ab5
movq %rax, (%rcx)
leaq 0x263e(%rip), %rax      # 0x4d0c
movq %rax, 0x18(%rcx)
leaq 0x2643(%rip), %rax      # 0x4d1c
movq %rax, 0x10(%rcx)
leaq -0x1d8(%rbp), %r8
andq $0x0, 0x8(%r8)
leaq 0x4c2(%rip), %rax       # 0x2bb2
movq %rax, (%r8)
leaq 0x27c6(%rip), %rax      # 0x4ec0
movq %rax, 0x18(%r8)
leaq -0x1b8(%rbp), %r9
andq $0x0, 0x8(%r9)
leaq 0x27bf(%rip), %rax      # 0x4ed0
movq %rax, 0x10(%r8)
leaq 0x551(%rip), %rax       # 0x2c6d
movq %rax, (%r9)
leaq 0x364a(%rip), %rax      # 0x5d70
movq %rax, 0x18(%r9)
leaq 0x3649(%rip), %rax      # 0x5d7a
movq %rax, 0x10(%r9)
leaq -0x198(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x2ca0
leaq -0x1b8(%rbp), %rdi
callq 0x5e42
leaq -0x1d8(%rbp), %rdi
callq 0x5e42
leaq -0x1f8(%rbp), %rdi
callq 0x5e42
leaq -0x218(%rbp), %rdi
callq 0x5e42
leaq -0x280(%rbp), %rdi
callq 0x2da8
leaq -0x198(%rbp), %rdi
movl $0x3ca3d70a, 0x118(%rdi) # imm = 0x3CA3D70A
pushq $0x14
popq %rdx
movl $0x1f4, %esi            # imm = 0x1F4
callq 0x2dcc
leaq -0x198(%rbp), %rdi
callq 0x3084
leaq -0x78(%rbp), %rdi
callq 0x2da8
xorl %eax, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq -0x198(%rbp), %rdi
callq 0x3084
jmp 0x283f
movq %rax, %rbx
leaq -0x1b8(%rbp), %rdi
callq 0x5e42
leaq -0x1d8(%rbp), %rdi
callq 0x5e42
leaq -0x1f8(%rbp), %rdi
callq 0x5e42
leaq -0x218(%rbp), %rdi
callq 0x5e42
leaq -0x280(%rbp), %rdi
callq 0x2da8
jmp 0x283f
jmp 0x283c
jmp 0x282b
jmp 0x283c
jmp 0x282b
jmp 0x283c
jmp 0x282b
jmp 0x283c
jmp 0x282b
jmp 0x283c
jmp 0x282b
jmp 0x283c
movq %rax, %rbx
leaq -0x198(%rbp), %rdi
callq 0x2090
jmp 0x283f
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x2da8
movq %rbx, %rdi
callq 0x21f0