// File: GAStudyGroup[P]GPX2/src/cross/gpx/sources/GPX2.cpp
// Function: GPX2::buildOffspring()
void GPX2::buildOffspring()
{   
    int index{ 0 };
    for (auto& allP : feasiblePartitions) {
        // if the blue is better than the red in that partition
        if (partitionsChoosen[index] == GPX2Structs::Parent::BLUE) { 
            for (string s : allP.second->getNodes()) {
                delete red[s];
                red.erase(s);

                Node* newNode = new Node(blue[s]->getId());
                newNode->setEdges(blue[s]->getEdges());
                red.insert(make_pair(s, newNode));
            }
        } else {
            for (string s : allP.second->getNodes()) {
                delete blue[s];
                blue.erase(s);

                Node* newNode = new Node(red[s]->getId());
                newNode->setEdges(red[s]->getEdges());
                blue.insert(make_pair(s, newNode));
            }
        }
        index++;
    }

    offspringChoosen = ((GPX2Support::totalDistance(red) < GPX2Support::totalDistance(blue)) ? (GPX2Structs::Parent::RED) : (GPX2Structs::Parent::BLUE));
}

// Assembly:
subq $0x268, %rsp            # imm = 0x268
movq %rdi, 0x260(%rsp)
movq 0x260(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl $0x0, 0x25c(%rsp)
addq $0x30, %rax
movq %rax, 0x250(%rsp)
movq 0x250(%rsp), %rdi
callq 0x54cc0
movq %rax, 0x248(%rsp)
movq 0x250(%rsp), %rdi
callq 0x54d10
movq %rax, 0x240(%rsp)
leaq 0x248(%rsp), %rdi
leaq 0x240(%rsp), %rsi
callq 0x54cf0
testb $0x1, %al
jne 0x6018e
jmp 0x608a6
leaq 0x248(%rsp), %rdi
callq 0x54d40
movq 0xb0(%rsp), %rdi
movq %rax, 0x238(%rsp)
addq $0x138, %rdi            # imm = 0x138
movslq 0x25c(%rsp), %rsi
callq 0x61520
cmpl $0x1, (%rax)
jne 0x6053f
movq 0x238(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x67e70
movq %rax, 0x230(%rsp)
movq 0x230(%rsp), %rdi
callq 0x1e310
movq %rax, 0x228(%rsp)
movq 0x230(%rsp), %rdi
callq 0x1e340
movq %rax, 0x220(%rsp)
leaq 0x228(%rsp), %rdi
leaq 0x220(%rsp), %rsi
callq 0x1e370
testb $0x1, %al
jne 0x60229
jmp 0x6053a
leaq 0x228(%rsp), %rdi
callq 0x1e3b0
movq %rax, %rsi
leaq 0x200(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
callq 0x6200
movq 0xb0(%rsp), %rdi
movq 0xa0(%rsp), %rsi
addq $0xd8, %rdi
callq 0x60c60
movq %rax, 0xa8(%rsp)
jmp 0x60274
movq 0xa8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x98(%rsp)
cmpq $0x0, %rax
je 0x602ac
movq 0x98(%rsp), %rdi
callq 0x61540
movq 0x98(%rsp), %rdi
movl $0x40, %esi
callq 0x64c0
movq 0xb0(%rsp), %rdi
addq $0xd8, %rdi
leaq 0x200(%rsp), %rsi
callq 0x61570
jmp 0x602ca
movl $0x40, %edi
callq 0x64b0
movq %rax, 0x90(%rsp)
jmp 0x602de
movq 0xb0(%rsp), %rdi
movb $0x1, 0x1c7(%rsp)
addq $0x108, %rdi            # imm = 0x108
leaq 0x200(%rsp), %rsi
callq 0x60c60
movq %rax, 0x88(%rsp)
jmp 0x6030c
movq 0x88(%rsp), %rax
movq (%rax), %rsi
leaq 0x1c8(%rsp), %rdi
callq 0x66190
jmp 0x60326
movq 0x90(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x66160
jmp 0x6033d
movb $0x0, 0x1c7(%rsp)
leaq 0x1c8(%rsp), %rdi
callq 0x6988
movq 0x90(%rsp), %rax
movq 0xb0(%rsp), %rdi
movq %rax, 0x1e8(%rsp)
movq 0x1e8(%rsp), %rax
movq %rax, 0x78(%rsp)
addq $0x108, %rdi            # imm = 0x108
leaq 0x200(%rsp), %rsi
callq 0x60c60
movq %rax, 0x80(%rsp)
jmp 0x60395
movq 0x80(%rsp), %rax
movq (%rax), %rdi
callq 0x661c0
movq %rax, 0x70(%rsp)
jmp 0x603ac
movq 0x70(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0x615a0
jmp 0x603c0
movq 0x78(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x66200
jmp 0x603d4
leaq 0x1a8(%rsp), %rdi
callq 0x616a0
movq 0xb0(%rsp), %rax
addq $0xd8, %rax
movq %rax, 0x68(%rsp)
leaq 0x180(%rsp), %rdi
leaq 0x200(%rsp), %rsi
leaq 0x1e8(%rsp), %rdx
callq 0x61700
jmp 0x60413
movq 0x68(%rsp), %rdi
leaq 0x180(%rsp), %rsi
callq 0x60df0
movb %dl, 0x5f(%rsp)
movq %rax, 0x60(%rsp)
jmp 0x60430
movb 0x5f(%rsp), %al
movq 0x60(%rsp), %rcx
movq %rcx, 0x170(%rsp)
movb %al, 0x178(%rsp)
leaq 0x180(%rsp), %rdi
callq 0x60e80
leaq 0x200(%rsp), %rdi
callq 0x6988
leaq 0x228(%rsp), %rdi
callq 0x1e3c0
jmp 0x6020b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
jmp 0x60528
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
jmp 0x604c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
leaq 0x1c8(%rsp), %rdi
callq 0x6988
testb $0x1, 0x1c7(%rsp)
jne 0x604d0
jmp 0x604e2
movq 0x90(%rsp), %rdi
movl $0x40, %esi
callq 0x64c0
jmp 0x60528
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x616a0
jmp 0x60528
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
leaq 0x180(%rsp), %rdi
callq 0x60e80
leaq 0x200(%rsp), %rdi
callq 0x6988
jmp 0x608f8
jmp 0x60883
movq 0x238(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x67e70
movq %rax, 0x168(%rsp)
movq 0x168(%rsp), %rdi
callq 0x1e310
movq %rax, 0x160(%rsp)
movq 0x168(%rsp), %rdi
callq 0x1e340
movq %rax, 0x158(%rsp)
leaq 0x160(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x1e370
testb $0x1, %al
jne 0x605a0
jmp 0x60881
leaq 0x160(%rsp), %rdi
callq 0x1e3b0
movq %rax, %rsi
leaq 0x138(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x6200
movq 0xb0(%rsp), %rdi
movq 0x48(%rsp), %rsi
addq $0x108, %rdi            # imm = 0x108
callq 0x60c60
movq %rax, 0x50(%rsp)
jmp 0x605e2
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, %rax
je 0x6060e
movq 0x40(%rsp), %rdi
callq 0x61540
movq 0x40(%rsp), %rdi
movl $0x40, %esi
callq 0x64c0
movq 0xb0(%rsp), %rdi
addq $0x108, %rdi            # imm = 0x108
leaq 0x138(%rsp), %rsi
callq 0x61570
jmp 0x6062c
movl $0x40, %edi
callq 0x64b0
movq %rax, 0x38(%rsp)
jmp 0x6063d
movq 0xb0(%rsp), %rdi
movb $0x1, 0x10f(%rsp)
addq $0xd8, %rdi
leaq 0x138(%rsp), %rsi
callq 0x60c60
movq %rax, 0x30(%rsp)
jmp 0x60668
movq 0x30(%rsp), %rax
movq (%rax), %rsi
leaq 0x110(%rsp), %rdi
callq 0x66190
jmp 0x6067f
movq 0x38(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x66160
jmp 0x60693
movb $0x0, 0x10f(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x6988
movq 0x38(%rsp), %rax
movq 0xb0(%rsp), %rdi
movq %rax, 0x130(%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0x20(%rsp)
addq $0xd8, %rdi
leaq 0x138(%rsp), %rsi
callq 0x60c60
movq %rax, 0x28(%rsp)
jmp 0x606e5
movq 0x28(%rsp), %rax
movq (%rax), %rdi
callq 0x661c0
movq %rax, 0x18(%rsp)
jmp 0x606f9
movq 0x18(%rsp), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x615a0
jmp 0x6070d
movq 0x20(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x66200
jmp 0x60721
leaq 0xf0(%rsp), %rdi
callq 0x616a0
movq 0xb0(%rsp), %rax
addq $0x108, %rax            # imm = 0x108
movq %rax, 0x10(%rsp)
leaq 0xc8(%rsp), %rdi
leaq 0x138(%rsp), %rsi
leaq 0x130(%rsp), %rdx
callq 0x61700
jmp 0x60760
movq 0x10(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x60df0
movb %dl, 0x7(%rsp)
movq %rax, 0x8(%rsp)
jmp 0x6077d
movb 0x7(%rsp), %al
movq 0x8(%rsp), %rcx
movq %rcx, 0xb8(%rsp)
movb %al, 0xc0(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x60e80
leaq 0x138(%rsp), %rdi
callq 0x6988
leaq 0x160(%rsp), %rdi
callq 0x1e3c0
jmp 0x60582
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
jmp 0x60872
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
jmp 0x60811
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x6988
testb $0x1, 0x10f(%rsp)
jne 0x6081d
jmp 0x6082c
movq 0x38(%rsp), %rdi
movl $0x40, %esi
callq 0x64c0
jmp 0x60872
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x616a0
jmp 0x60872
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x60e80
leaq 0x138(%rsp), %rdi
callq 0x6988
jmp 0x608f8
jmp 0x60883
movl 0x25c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x25c(%rsp)
leaq 0x248(%rsp), %rdi
callq 0x552a0
jmp 0x60170
movq 0xb0(%rsp), %rdi
addq $0xd8, %rdi
callq 0x6f670
movq 0xb0(%rsp), %rdi
movl %eax, (%rsp)
addq $0x108, %rdi            # imm = 0x108
callq 0x6f670
movl (%rsp), %esi
movl %eax, %edi
movq 0xb0(%rsp), %rax
movl $0x1, %ecx
xorl %edx, %edx
cmpl %edi, %esi
cmovll %edx, %ecx
movl %ecx, 0x150(%rax)
addq $0x268, %rsp            # imm = 0x268
retq
movq 0x1f8(%rsp), %rdi
callq 0x6850
nopw %cs:(%rax,%rax)