// File: /workspace/github_cpp_makefile_star2_O3/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
movl %r9d, %ebp
movq %r8, %r12
movq %rcx, 0x8(%rsp)
movq %rdx, 0x28(%rsp)
movq %rsi, %r13
movq %rdi, %rbx
testl %r9d, %r9d
jle 0x10383
movl %ebp, %eax
shlq $0x4, %rax
leaq (%rax,%rax,2), %r14
xorl %r15d, %r15d
movq 0xad0(%rbx), %rdi
addq %r15, %rdi
callq 0xbc94
movq 0xad8(%rbx), %rdi
addq %r15, %rdi
callq 0xbc94
addq $0x30, %r15
cmpq %r15, %r14
jne 0x1035c
leaq 0x73b3(%rip), %rsi      # 0x1773d
movq %r13, %rdi
callq 0x3100
testl %eax, %eax
je 0x10477
leaq 0x739f(%rip), %rsi      # 0x17740
movq %r13, %rdi
callq 0x3100
testl %eax, %eax
je 0x10477
leaq 0x738b(%rip), %rsi      # 0x17743
movq %r13, %rdi
callq 0x3100
testl %eax, %eax
je 0x103db
leaq 0x7494(%rip), %rsi      # 0x1785f
movq %r13, %rdi
callq 0x3100
testl %eax, %eax
jne 0x105b7
testl %ebp, %ebp
jle 0x105b7
movl 0x80(%rsp), %eax
incl %eax
movslq %eax, %r12
movl %ebp, %eax
movq %rax, (%rsp)
movq 0xad0(%rbx), %rax
xorl %ebp, %ebp
leaq 0x30(%rsp), %r14
leaq (,%rbp,2), %r13
addq %rbp, %r13
shlq $0x4, %r13
cmpq %r12, 0x28(%rax,%r13)
jae 0x10469
callq 0x30e0
movl 0x9c8(%rbx), %ecx
incl %ecx
cltd
idivl %ecx
incl %edx
movl %edx, 0x30(%rsp)
je 0x10460
movq %rbp, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %r15
movq 0xad0(%rbx), %rdi
addq %r15, %rdi
movq %r14, %rsi
callq 0xbcf8
addq 0xad8(%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xbcf8
movq 0xad0(%rbx), %rax
jmp 0x10412
incq %rbp
cmpq (%rsp), %rbp
jne 0x10403
jmp 0x105b7
leaq 0x30(%rsp), %rdi
movl 0x80(%rsp), %esi
callq 0xd3dc
testl %ebp, %ebp
movq 0x8(%rsp), %r14
jle 0x105ad
movl %ebp, %eax
movq %rax, 0x10(%rsp)
movl 0x80(%rsp), %eax
shlq $0x2, %rax
movq %rax, 0x20(%rsp)
xorl %r15d, %r15d
leaq 0x30(%rsp), %r13
movq %r12, 0x18(%rsp)
cmpl $0x0, 0x9c8(%rbx)
jle 0x1052d
movl $0x1, %ebp
movq (%r14), %rax
movq (%rax,%rbp,8), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movq (%r12), %rax
movq (%rax,%r15,8), %rax
movsd (%rax), %xmm2
movsd 0x8(%rax), %xmm3
movq 0x28(%rsp), %rdi
movl $0x4b, %esi
callq 0xc948
movsd %xmm0, (%rsp)
movq %r13, %rdi
callq 0xd676
ucomisd (%rsp), %xmm0
jbe 0x1051a
movq %r13, %rdi
movsd (%rsp), %xmm0
movl %ebp, %esi
callq 0xd6c4
leaq 0x1(%rbp), %rax
movslq 0x9c8(%rbx), %rcx
cmpq %rcx, %rbp
movq %rax, %rbp
jl 0x104c7
cmpl $0x0, 0x80(%rsp)
jle 0x1058d
leaq (%r15,%r15,2), %r12
shlq $0x4, %r12
xorl %r14d, %r14d
movq 0xad0(%rbx), %rbp
movq %r13, %rdi
callq 0xd6d8
addq %r12, %rbp
addq %r14, %rax
movq %rbp, %rdi
movq %rax, %rsi
callq 0xbcf8
movq 0xad8(%rbx), %rbp
movq %r13, %rdi
callq 0xd6d8
addq %r12, %rbp
addq %r14, %rax
movq %rbp, %rdi
movq %rax, %rsi
callq 0xbcf8
addq $0x4, %r14
cmpq %r14, 0x20(%rsp)
jne 0x10542
movq %r13, %rdi
callq 0xd7dc
incq %r15
cmpq 0x10(%rsp), %r15
movq 0x18(%rsp), %r12
movq 0x8(%rsp), %r14
jne 0x104b9
leaq 0x30(%rsp), %rdi
callq 0xd64c
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x105ca
jmp 0x105ca
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xd64c
movq %rbx, %rdi
callq 0x35c0
nop