// File: /workspace/github_cpp_makefile_star2_O1/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 0x10573
movl %ebp, %eax
shlq $0x4, %rax
leaq (%rax,%rax,2), %r14
xorl %r15d, %r15d
movq 0xad0(%rbx), %rdi
addq %r15, %rdi
callq 0xbe12
movq 0xad8(%rbx), %rdi
addq %r15, %rdi
callq 0xbe12
addq $0x30, %r15
cmpq %r15, %r14
jne 0x1054c
leaq 0x81c3(%rip), %rsi      # 0x1873d
movq %r13, %rdi
callq 0x3100
testl %eax, %eax
je 0x10667
leaq 0x81af(%rip), %rsi      # 0x18740
movq %r13, %rdi
callq 0x3100
testl %eax, %eax
je 0x10667
leaq 0x819b(%rip), %rsi      # 0x18743
movq %r13, %rdi
callq 0x3100
testl %eax, %eax
je 0x105cb
leaq 0x8290(%rip), %rsi      # 0x1884b
movq %r13, %rdi
callq 0x3100
testl %eax, %eax
jne 0x107a7
testl %ebp, %ebp
jle 0x107a7
movl 0x80(%rsp), %eax
incl %eax
movslq %eax, %r12
movl %ebp, %eax
movq %rax, (%rsp)
xorl %ebp, %ebp
leaq 0x30(%rsp), %r14
movq 0xad0(%rbx), %rax
leaq (,%rbp,2), %r13
addq %rbp, %r13
shlq $0x4, %r13
cmpq %r12, 0x28(%rax,%r13)
jae 0x10659
callq 0x30e0
movl 0x9c8(%rbx), %ecx
incl %ecx
cltd
idivl %ecx
incl %edx
movl %edx, 0x30(%rsp)
je 0x10650
movq %rbp, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %r15
movq 0xad0(%rbx), %rdi
addq %r15, %rdi
movq %r14, %rsi
callq 0xbe76
addq 0xad8(%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xbe76
movq 0xad0(%rbx), %rax
jmp 0x10602
incq %rbp
cmpq (%rsp), %rbp
jne 0x105ec
jmp 0x107a7
leaq 0x30(%rsp), %rdi
movl 0x80(%rsp), %esi
callq 0xd590
testl %ebp, %ebp
movq 0x8(%rsp), %r14
jle 0x1079d
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 0x1071d
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 0xcacc
movsd %xmm0, (%rsp)
movq %r13, %rdi
callq 0xd82c
ucomisd (%rsp), %xmm0
jbe 0x1070a
movq %r13, %rdi
movsd (%rsp), %xmm0
movl %ebp, %esi
callq 0xd87a
leaq 0x1(%rbp), %rax
movslq 0x9c8(%rbx), %rcx
cmpq %rcx, %rbp
movq %rax, %rbp
jl 0x106b7
cmpl $0x0, 0x80(%rsp)
jle 0x1077d
leaq (%r15,%r15,2), %r12
shlq $0x4, %r12
xorl %r14d, %r14d
movq 0xad0(%rbx), %rbp
movq %r13, %rdi
callq 0xd88e
addq %r12, %rbp
addq %r14, %rax
movq %rbp, %rdi
movq %rax, %rsi
callq 0xbe76
movq 0xad8(%rbx), %rbp
movq %r13, %rdi
callq 0xd88e
addq %r12, %rbp
addq %r14, %rax
movq %rbp, %rdi
movq %rax, %rsi
callq 0xbe76
addq $0x4, %r14
cmpq %r14, 0x20(%rsp)
jne 0x10732
movq %r13, %rdi
callq 0xd992
incq %r15
cmpq 0x10(%rsp), %r15
movq 0x18(%rsp), %r12
movq 0x8(%rsp), %r14
jne 0x106a9
leaq 0x30(%rsp), %rdi
callq 0xd802
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x107ba
jmp 0x107ba
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xd802
movq %rbx, %rdi
callq 0x35c0
nop