// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %rbp
movq %rcx, (%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
movl 0x80(%rsp), %r13d
xorl %r15d, %r15d
testl %r9d, %r9d
cmovlel %r15d, %r9d
movq %r9, 0x8(%rsp)
imulq $0x30, %r9, %r12
cmpq %r15, %r12
je 0xd4dc
movq 0xad0(%r14), %rdi
addq %r15, %rdi
callq 0x9a62
movq 0xad8(%r14), %rdi
addq %r15, %rdi
callq 0x9a62
addq $0x30, %r15
jmp 0xd4b3
leaq 0x61aa(%rip), %rsi      # 0x1368d
movq %rbx, %rdi
callq 0x8830
testb %al, %al
jne 0xd506
leaq 0x619a(%rip), %rsi      # 0x13690
movq %rbx, %rdi
callq 0x8830
testb %al, %al
je 0xd630
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %r15
movl %r15d, %esi
callq 0xb088
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
shlq $0x2, %r15
movq %r15, 0x28(%rsp)
movq (%rsp), %r13
movq %rbp, 0x18(%rsp)
cmpq 0x8(%rsp), %r12
je 0xd617
pushq $0x1
popq %r15
movslq 0x9c8(%r14), %rax
cmpq %rax, %r15
jg 0xd5ab
movq (%r13), %rax
movq (%rax,%r15,8), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movq (%rbp), %rax
movq (%rax,%r12,8), %rax
movsd (%rax), %xmm2
movsd 0x8(%rax), %xmm3
movq 0x20(%rsp), %rdi
pushq $0x4b
popq %rsi
callq 0xa6aa
movsd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
callq 0xb25e
ucomisd 0x10(%rsp), %xmm0
jbe 0xd5a6
movq %rbx, %rdi
movsd 0x10(%rsp), %xmm0
movl %r15d, %esi
callq 0xb29c
incq %r15
jmp 0xd544
imulq $0x30, %r12, %r13
xorl %ebp, %ebp
cmpq %rbp, 0x28(%rsp)
je 0xd5fe
movq 0xad0(%r14), %r15
movq %rbx, %rdi
callq 0xb2b0
addq %r13, %r15
addq %rbp, %rax
movq %r15, %rdi
movq %rax, %rsi
callq 0x9ac4
movq 0xad8(%r14), %r15
movq %rbx, %rdi
callq 0xb2b0
addq %r13, %r15
addq %rbp, %rax
movq %r15, %rdi
movq %rax, %rsi
callq 0x9ac4
addq $0x4, %rbp
jmp 0xd5b1
movq %rbx, %rdi
callq 0xb36c
incq %r12
movq 0x18(%rsp), %rbp
movq (%rsp), %r13
jmp 0xd535
leaq 0x30(%rsp), %rdi
callq 0xb234
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x605c(%rip), %rsi      # 0x13693
movq %rbx, %rdi
callq 0x8830
testb %al, %al
jne 0xd656
leaq 0x6165(%rip), %rsi      # 0x137af
movq %rbx, %rdi
callq 0x8830
testb %al, %al
je 0xd621
incl %r13d
movslq %r13d, %r12
xorl %r13d, %r13d
leaq 0x30(%rsp), %rbx
cmpq 0x8(%rsp), %r13
jne 0xd6aa
jmp 0xd621
callq 0x30f0
movl 0x9c8(%r14), %ecx
incl %ecx
cltd
idivl %ecx
incl %edx
movl %edx, 0x30(%rsp)
je 0xd6aa
movq 0xad0(%r14), %rdi
addq %r15, %rdi
movq %rbx, %rsi
callq 0x9ac4
addq 0xad8(%r14), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x9ac4
movq 0xad0(%r14), %rax
imulq $0x30, %r13, %r15
cmpq %r12, 0x28(%rax,%r15)
jb 0xd66d
incq %r13
jmp 0xd664
jmp 0xd6c5
jmp 0xd6c5
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xb234
movq %rbx, %rdi
callq 0x3590