// File: /workspace/github_cpp_makefile_star2_O3/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 0x3892
leaq -0x1b7(%rip), %rsi      # 0x2423
leaq -0x108(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x2a26
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 0x3892
leaq -0x1f6(%rip), %rsi      # 0x242c
leaq -0x108(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x2a26
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 0x3892
leaq -0x233(%rip), %rsi      # 0x2437
leaq -0x108(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x2a26
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 0x3892
leaq -0x271(%rip), %rsi      # 0x2441
leaq -0x108(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x2afe
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 0x3892
leaq 0x320(%rip), %rsi       # 0x2a1a
leaq -0x108(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x2bd6
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 0x3892
leaq -0x2f7(%rip), %rsi      # 0x244b
leaq -0x108(%rbp), %rdi
leaq -0x228(%rbp), %rdx
callq 0x2bd6
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 0x357a
leaq -0x258(%rbp), %r15
leaq -0xd0(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x357a
xorl %eax, %eax
leaq -0xa0(%rbp), %rdx
movq %rax, 0x8(%rdx)
leaq -0x35d(%rip), %rcx      # 0x2457
movq %rcx, (%rdx)
leaq 0x2c60(%rip), %rcx      # 0x541e
movq %rcx, 0x18(%rdx)
leaq 0x2c67(%rip), %rcx      # 0x5430
movq %rcx, 0x10(%rdx)
leaq -0x80(%rbp), %rcx
movq %rax, 0x8(%rcx)
leaq 0x4d1(%rip), %rsi       # 0x2cad
movq %rsi, (%rcx)
leaq 0x2cf6(%rip), %rsi      # 0x54dc
movq %rsi, 0x18(%rcx)
leaq 0x2cfb(%rip), %rsi      # 0x54ec
movq %rsi, 0x10(%rcx)
leaq -0x60(%rbp), %r8
movq %rax, 0x8(%r8)
leaq 0x5d1(%rip), %rsi       # 0x2dd5
movq %rsi, (%r8)
leaq 0x2e60(%rip), %rsi      # 0x566e
movq %rsi, 0x18(%r8)
leaq 0x2e65(%rip), %rsi      # 0x567e
movq %rsi, 0x10(%r8)
leaq -0x40(%rbp), %r9
movq %rax, 0x8(%r9)
leaq 0x696(%rip), %rax       # 0x2ec2
movq %rax, (%r9)
leaq 0x3c34(%rip), %rax      # 0x646a
movq %rax, 0x18(%r9)
leaq 0x3c33(%rip), %rax      # 0x6474
movq %rax, 0x10(%r9)
leaq -0x228(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x2ef6
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0x286f
leaq -0x40(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x2886
leaq -0x60(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x70(%rbp), %rax
testq %rax, %rax
je 0x289d
leaq -0x80(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x90(%rbp), %rax
testq %rax, %rax
je 0x28ba
leaq -0xa0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %r15, %rdi
callq 0x387a
movq %r14, %rdi
callq 0x387a
leaq -0x228(%rbp), %rdi
movl $0x3ca3d70a, 0x118(%rdi) # imm = 0x3CA3D70A
movl $0x1f4, %esi            # imm = 0x1F4
movl $0x14, %edx
callq 0x3078
leaq -0x228(%rbp), %rdi
callq 0x34bc
movq %r12, %rdi
callq 0x387a
movq %rbx, %rdi
callq 0x387a
xorl %eax, %eax
addq $0x270, %rsp            # imm = 0x270
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x29b5
jmp 0x29b5
jmp 0x29b5
jmp 0x29b5
movq %rax, %rbx
leaq -0x228(%rbp), %rdi
callq 0x34bc
jmp 0x29f9
movq %rax, %rbx
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0x295a
leaq -0x40(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x2971
leaq -0x60(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x70(%rbp), %rax
testq %rax, %rax
je 0x2988
leaq -0x80(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x90(%rbp), %rax
testq %rax, %rax
je 0x29a5
leaq -0xa0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %r15, %rdi
callq 0x387a
jmp 0x29c0
jmp 0x29b5
jmp 0x29b5
jmp 0x29b5
movq %rax, %rdi
callq 0x35bd
movq %rax, %rbx
movq %r14, %rdi
callq 0x387a
jmp 0x29f9
jmp 0x29f6
jmp 0x29e0
jmp 0x29f6
jmp 0x29e0
jmp 0x29f6
jmp 0x29e0
jmp 0x29f6
jmp 0x29e0
jmp 0x29f6
jmp 0x29e0
jmp 0x29f6
movq %rax, %rbx
movq -0x228(%rbp), %rdi
cmpq %r14, %rdi
je 0x29f9
callq 0x2140
jmp 0x29f9
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x387a
leaq -0x100(%rbp), %rdi
callq 0x387a
movq %rbx, %rdi
callq 0x21f0
nop