// File: dtsaras[P]GCW/rwgraph.cpp
// Function: Graph::initial_seedset(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Utilities&, Locations*, Locations*, int, int)
void Graph::initial_seedset(string alg, Utilities &util, Locations * usersLocations, Locations * eventsLocations, int P, int k){
    for (int p = 0; p < P; ++p){
        seedSets[p].clear();
        seedSets_before[p].clear();
    }
    

    ///////////////////////// Closest seedset (CG) (NN)////////////////////////
    if (alg == "CG" || alg == "NN" ){
        double dist;
        BinaryHeap heap(k);
        for (int p = 0; p < P; ++p){
            for (int v = 1; v <= getSize(); ++v){
                dist = util.computeMinimumDistance(usersLocations->locations[v][0], usersLocations->locations[v][1], eventsLocations->locations[p][0], eventsLocations->locations[p][1], 'K');
                if (dist < heap.getMaxDistance()){
                    heap.insertNewMax(dist, v);
                }
            }
            for (int i = 0; i < k; ++i){
                seedSets[p].insert(heap.getVertices()[i]);
                seedSets_before[p].insert(heap.getVertices()[i]);
            }
            heap.init();
        }
    }

    ///////////////////////// Random seedset (RG) (RD) ////////////////////////
    else if (alg == "RG" || alg == "RD"){
        int randomSeed;
        double dist;
        for (int p = 0; p < P; ++p){
            while (seedSets[p].size() < k + 1){
                randomSeed = rand()%(getSize() + 1) + 1;
                if (randomSeed != 0){
                    seedSets[p].insert(randomSeed);
                    seedSets_before[p].insert(randomSeed);
                }
            }
        }
    }

    // ///////////////////////// Empty seedset (EG) ////////////////////////
    // The seedset is already empty 
}

// Assembly:
subq $0x138, %rsp            # imm = 0x138
movq %rsi, 0x68(%rsp)
movl 0x140(%rsp), %eax
movq %rdi, 0x130(%rsp)
movq %rsi, 0x128(%rsp)
movq %rdx, 0x120(%rsp)
movq %rcx, 0x118(%rsp)
movq %r8, 0x110(%rsp)
movl %r9d, 0x10c(%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0x70(%rsp)
movl $0x0, 0x108(%rsp)
movl 0x108(%rsp), %eax
cmpl 0x10c(%rsp), %eax
jge 0x2113e
movq 0x70(%rsp), %rax
movq 0xad0(%rax), %rdi
movslq 0x108(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
callq 0xf300
movq 0x70(%rsp), %rax
movq 0xad8(%rax), %rdi
movslq 0x108(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
callq 0xf300
movl 0x108(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x108(%rsp)
jmp 0x210db
movq 0x68(%rsp), %rdi
leaq 0x11513(%rip), %rsi     # 0x3265d
callq 0xf390
testb $0x1, %al
jne 0x2116d
movq 0x68(%rsp), %rdi
leaq 0x11501(%rip), %rsi     # 0x32660
callq 0xf390
testb $0x1, %al
jne 0x2116d
jmp 0x21426
movl 0x140(%rsp), %esi
leaq 0xe8(%rsp), %rdi
callq 0x1c7e0
movl $0x0, 0xe4(%rsp)
movl 0xe4(%rsp), %eax
cmpl 0x10c(%rsp), %eax
jge 0x21414
movl $0x1, 0xe0(%rsp)
movq 0x70(%rsp), %rdi
movl 0xe0(%rsp), %eax
movl %eax, 0x64(%rsp)
callq 0x1db70
movl %eax, %ecx
movl 0x64(%rsp), %eax
cmpl %ecx, %eax
jg 0x212cc
movq 0x120(%rsp), %rdi
movq 0x118(%rsp), %rax
movq (%rax), %rax
movslq 0xe0(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movq 0x110(%rsp), %rax
movq (%rax), %rax
movslq 0xe4(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax), %xmm2
movsd 0x8(%rax), %xmm3
movl $0x4b, %esi
callq 0x1a690
movsd %xmm0, 0x58(%rsp)
jmp 0x21228
movsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x100(%rsp)
movsd 0x100(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x1cc20
movsd %xmm0, 0x50(%rsp)
jmp 0x2125b
movsd 0x50(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x212b4
movsd 0x100(%rsp), %xmm0
movl 0xe0(%rsp), %esi
leaq 0xe8(%rsp), %rdi
callq 0x1cca0
jmp 0x2128c
jmp 0x212b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x1cbb0
jmp 0x21576
jmp 0x212b6
movl 0xe0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe0(%rsp)
jmp 0x211ab
movl $0x0, 0xd0(%rsp)
movl 0xd0(%rsp), %eax
cmpl 0x140(%rsp), %eax
jge 0x213ed
movq 0x70(%rsp), %rax
movq 0xad0(%rax), %rax
movslq 0xe4(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, 0x38(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x1cce0
movq %rax, 0x40(%rsp)
jmp 0x21323
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rax
movslq 0xd0(%rsp), %rcx
leaq (%rax,%rcx,4), %rsi
callq 0xf310
movb %dl, 0x2f(%rsp)
movq %rax, 0x30(%rsp)
jmp 0x21349
movq 0x70(%rsp), %rax
movb 0x2f(%rsp), %cl
movq 0x30(%rsp), %rdx
movq %rdx, 0xc0(%rsp)
movb %cl, 0xc8(%rsp)
movq 0xad8(%rax), %rax
movslq 0xe4(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x1cce0
movq %rax, 0x20(%rsp)
jmp 0x21399
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rax
movslq 0xd0(%rsp), %rcx
leaq (%rax,%rcx,4), %rsi
callq 0xf310
movb %dl, 0xf(%rsp)
movq %rax, 0x10(%rsp)
jmp 0x213bf
movb 0xf(%rsp), %al
movq 0x10(%rsp), %rcx
movq %rcx, 0xb0(%rsp)
movb %al, 0xb8(%rsp)
movl 0xd0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd0(%rsp)
jmp 0x212d7
leaq 0xe8(%rsp), %rdi
callq 0x1cdd0
jmp 0x213fc
jmp 0x213fe
movl 0xe4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe4(%rsp)
jmp 0x2118c
leaq 0xe8(%rsp), %rdi
callq 0x1cbb0
jmp 0x2156e
movq 0x68(%rsp), %rdi
leaq 0x11231(%rip), %rsi     # 0x32663
callq 0xf390
testb $0x1, %al
jne 0x21455
movq 0x68(%rsp), %rdi
leaq 0x11324(%rip), %rsi     # 0x3276b
callq 0xf390
testb $0x1, %al
jne 0x21455
jmp 0x2156c
movl $0x0, 0x9c(%rsp)
movl 0x9c(%rsp), %eax
cmpl 0x10c(%rsp), %eax
jge 0x2156a
jmp 0x21476
movq 0x70(%rsp), %rax
movq 0xad0(%rax), %rdi
movslq 0x9c(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
callq 0x250a0
movl 0x140(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jae 0x21552
callq 0x4110
movq 0x70(%rsp), %rdi
movl %eax, 0x8(%rsp)
callq 0x1db70
movl %eax, %ecx
movl 0x8(%rsp), %eax
addl $0x1, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, 0xac(%rsp)
cmpl $0x0, 0xac(%rsp)
je 0x2154d
movq 0x70(%rsp), %rax
movq 0xad0(%rax), %rdi
movslq 0x9c(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
leaq 0xac(%rsp), %rsi
callq 0xf310
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x88(%rsp)
movb %dl, 0x90(%rsp)
movq 0xad8(%rax), %rdi
movslq 0x9c(%rsp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
leaq 0xac(%rsp), %rsi
callq 0xf310
movq %rax, 0x78(%rsp)
movb %dl, 0x80(%rsp)
jmp 0x21476
jmp 0x21554
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
jmp 0x21460
jmp 0x2156c
jmp 0x2156e
addq $0x138, %rsp            # imm = 0x138
retq
movq 0xd8(%rsp), %rdi
callq 0x4690
nopw %cs:(%rax,%rax)