// File: dtsaras[P]GCW/rwgraph.cpp
// Function: Graph::BFS_LT(int, float**)
void Graph::BFS_LT(int p, float** APc){
    // (u) ---> (v)
    queue<int> myqueue;
    vector<bool> active(getSize() + 1,false); //tracks the users that are active
    vector<double> active_prob(getSize() + 1,0); //tracks the probability of the active incoming edges for each node
    int user_front, user_front_friend;
    int u, v;

    for (int seed : seedSets[p]){ // Sets seeds as active and counts that they are Aware of p
        active[seed] = true;
        APc[p][seed]++;
    }

    for (int seed : seedSets[p]){
        for (int i = 0; i < node_deg[seed]; i++){ // Inserts all the users that are not active to the queue and could be activated (seed) ---> (v)
            v = adjList[seed][i];
            active_prob[v] += probabilities[seed][i];
            if (active[v] == false){
                myqueue.push(v); // Now we need to check if (v) will become active since the seeds were active
            }
        }
    }

    while (!myqueue.empty()){ // Continues till none can get aware
        user_front = myqueue.front(); // Gets the first guy from the queue
        u = myqueue.front(); // Gets the first guy from the queue
        myqueue.pop();
        // if (active[user_front] == false && similarities[user_front][p] >= sfmt_to_real1(LT_node[user_front]) && active_prob[user_front] * similarities[user_front][p] >= sfmt_to_real1(LT_node[user_front])){ // Making sure the first guy is not active

        // if (active[u] == false && get_AP_LT(active_prob[u], u, p)  >= sfmt_to_real1(LT_node[user_front])){ // Making sure the first guy is not active
        if (active[u] == false && get_AP_LT(active_prob[u], u, p)  >= LT_node[user_front]){ // Making sure the first guy is not active
            active[u] = true;
            APc[p][u]++;
            for (int i = 0; i < node_deg[u]; i++){ // Inserts all the outgoing neighbors that are not active since they can become aware
                v = adjList[u][i];
                if (active[v] == false)
                    active_prob[v] += probabilities[u][i];
                    myqueue.push(v);
            }
        }
    }  
}

// Assembly:
subq $0x238, %rsp            # imm = 0x238
movq %rdi, 0x230(%rsp)
movl %esi, 0x22c(%rsp)
movq %rdx, 0x220(%rsp)
movq 0x230(%rsp), %rax
movq %rax, 0xa8(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x250b0
movq 0xa8(%rsp), %rdi
callq 0x1db70
incl %eax
cltq
movq %rax, 0xb0(%rsp)
movb $0x0, 0x1a7(%rsp)
leaq 0x1a6(%rsp), %rdi
movq %rdi, 0xb8(%rsp)
callq 0xe220
movq 0xb0(%rsp), %rsi
movq 0xb8(%rsp), %rcx
leaq 0x1a8(%rsp), %rdi
leaq 0x1a7(%rsp), %rdx
callq 0xe230
jmp 0x21b18
leaq 0x1a6(%rsp), %rdi
callq 0xe2b0
movq 0xa8(%rsp), %rdi
callq 0x1db70
incl %eax
cltq
movq %rax, 0x98(%rsp)
movq $0x0, 0x170(%rsp)
leaq 0x16f(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
callq 0xef70
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rcx
leaq 0x178(%rsp), %rdi
leaq 0x170(%rsp), %rdx
callq 0xef80
jmp 0x21b86
leaq 0x16f(%rsp), %rdi
callq 0xf000
movq 0xa8(%rsp), %rax
movq 0xad0(%rax), %rax
movslq 0x22c(%rsp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x150(%rsp)
movq 0x150(%rsp), %rdi
callq 0xf1c0
movq %rax, 0x148(%rsp)
movq 0x150(%rsp), %rdi
callq 0xf1f0
movq %rax, 0x140(%rsp)
leaq 0x148(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0xf220
testb $0x1, %al
jne 0x21c01
jmp 0x21d22
leaq 0x148(%rsp), %rdi
callq 0xf240
movl (%rax), %eax
movl %eax, 0x13c(%rsp)
movslq 0x13c(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0xe790
movq %rdx, 0x88(%rsp)
movq %rax, 0x90(%rsp)
jmp 0x21c3e
movq 0x88(%rsp), %rax
movq 0x90(%rsp), %rcx
movq %rcx, 0x128(%rsp)
movq %rax, 0x130(%rsp)
leaq 0x128(%rsp), %rdi
movl $0x1, %esi
callq 0xe7f0
movq 0x220(%rsp), %rax
movslq 0x22c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x13c(%rsp), %rcx
movss 0x103b8(%rip), %xmm0    # 0x3204c
addss (%rax,%rcx,4), %xmm0
movss %xmm0, (%rax,%rcx,4)
leaq 0x148(%rsp), %rdi
callq 0xf2d0
jmp 0x21be3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x198(%rsp)
movl %eax, 0x194(%rsp)
leaq 0x1a6(%rsp), %rdi
callq 0xe2b0
jmp 0x22272
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x198(%rsp)
movl %eax, 0x194(%rsp)
leaq 0x16f(%rsp), %rdi
callq 0xf000
jmp 0x22265
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x198(%rsp)
movl %eax, 0x194(%rsp)
leaq 0x178(%rsp), %rdi
callq 0xf030
jmp 0x22265
movq 0xa8(%rsp), %rax
movq 0xad0(%rax), %rax
movslq 0x22c(%rsp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x120(%rsp)
movq 0x120(%rsp), %rdi
callq 0xf1c0
movq %rax, 0x118(%rsp)
movq 0x120(%rsp), %rdi
callq 0xf1f0
movq %rax, 0x110(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0xf220
testb $0x1, %al
jne 0x21d90
jmp 0x21f1a
leaq 0x118(%rsp), %rdi
callq 0xf240
movl (%rax), %eax
movl %eax, 0x10c(%rsp)
movl $0x0, 0x108(%rsp)
movq 0xa8(%rsp), %rdi
movl 0x108(%rsp), %eax
movl %eax, 0x84(%rsp)
addq $0xa20, %rdi            # imm = 0xA20
movslq 0x10c(%rsp), %rsi
callq 0xe3b0
movq %rax, %rcx
movl 0x84(%rsp), %eax
cmpl (%rcx), %eax
jge 0x21f06
movq 0xa8(%rsp), %rdi
addq $0x9d8, %rdi            # imm = 0x9D8
movslq 0x10c(%rsp), %rsi
callq 0x24850
movq %rax, %rdi
movslq 0x108(%rsp), %rsi
callq 0xe3b0
movq 0xa8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x15c(%rsp)
addq $0x9f0, %rdi            # imm = 0x9F0
movslq 0x10c(%rsp), %rsi
callq 0x24890
movq %rax, %rdi
movslq 0x108(%rsp), %rsi
callq 0xf1a0
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x68(%rsp)
movslq 0x15c(%rsp), %rsi
leaq 0x178(%rsp), %rdi
callq 0xeb00
movsd 0x68(%rsp), %xmm1
movsd (%rax), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movslq 0x15c(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0xe790
movq %rdx, 0x70(%rsp)
movq %rax, 0x78(%rsp)
jmp 0x21ea4
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
movq %rcx, 0xf8(%rsp)
movq %rax, 0x100(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xeb50
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x21eee
leaq 0x1d0(%rsp), %rdi
leaq 0x15c(%rsp), %rsi
callq 0x250e0
jmp 0x21eec
jmp 0x21eee
jmp 0x21ef0
movl 0x108(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x108(%rsp)
jmp 0x21db1
jmp 0x21f08
leaq 0x118(%rsp), %rdi
callq 0xf2d0
jmp 0x21d72
jmp 0x21f1c
leaq 0x1d0(%rsp), %rdi
callq 0x25110
movb %al, 0x67(%rsp)
jmp 0x21f2f
movb 0x67(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x21f3e
jmp 0x22236
leaq 0x1d0(%rsp), %rdi
callq 0x25130
movq %rax, 0x58(%rsp)
jmp 0x21f52
movq 0x58(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x168(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x25130
movq %rax, 0x50(%rsp)
jmp 0x21f74
movq 0x50(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x160(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x25140
jmp 0x21f91
movslq 0x160(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0xe790
movq %rdx, 0x40(%rsp)
movq %rax, 0x48(%rsp)
jmp 0x21fb2
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
movq %rcx, 0xe8(%rsp)
movq %rax, 0xf0(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0xeb50
andb $0x1, %al
movzbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0x3f(%rsp)
jne 0x22053
movslq 0x160(%rsp), %rsi
leaq 0x178(%rsp), %rdi
callq 0xeb00
movq 0xa8(%rsp), %rdi
movsd (%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movl 0x160(%rsp), %esi
movl 0x22c(%rsp), %edx
callq 0x1eb70
movq 0xa8(%rsp), %rdi
movss %xmm0, 0x38(%rsp)
addq $0xab8, %rdi            # imm = 0xAB8
movslq 0x168(%rsp), %rsi
callq 0xf1a0
movss 0x38(%rsp), %xmm0
ucomiss (%rax), %xmm0
setae %al
movb %al, 0x3f(%rsp)
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x22060
jmp 0x22231
movslq 0x160(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0xe790
movq %rdx, 0x28(%rsp)
movq %rax, 0x30(%rsp)
jmp 0x22081
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rcx, 0xd8(%rsp)
movq %rax, 0xe0(%rsp)
leaq 0xd8(%rsp), %rdi
movl $0x1, %esi
callq 0xe7f0
movq 0x220(%rsp), %rax
movslq 0x22c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x160(%rsp), %rcx
movss 0xff7b(%rip), %xmm0     # 0x3204c
addss (%rax,%rcx,4), %xmm0
movss %xmm0, (%rax,%rcx,4)
movl $0x0, 0xd4(%rsp)
movq 0xa8(%rsp), %rdi
movl 0xd4(%rsp), %eax
movl %eax, 0x24(%rsp)
addq $0xa20, %rdi            # imm = 0xA20
movslq 0x160(%rsp), %rsi
callq 0xe3b0
movq %rax, %rcx
movl 0x24(%rsp), %eax
cmpl (%rcx), %eax
jge 0x2222f
movq 0xa8(%rsp), %rdi
addq $0x9d8, %rdi            # imm = 0x9D8
movslq 0x160(%rsp), %rsi
callq 0x24850
movq %rax, %rdi
movslq 0xd4(%rsp), %rsi
callq 0xe3b0
movl (%rax), %eax
movl %eax, 0x15c(%rsp)
movslq 0x15c(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0xe790
movq %rdx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
jmp 0x22172
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, 0xc0(%rsp)
movq %rax, 0xc8(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0xeb50
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x22200
movq 0xa8(%rsp), %rdi
addq $0x9f0, %rdi            # imm = 0x9F0
movslq 0x160(%rsp), %rsi
callq 0x24890
movq %rax, %rdi
movslq 0xd4(%rsp), %rsi
callq 0xf1a0
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movslq 0x15c(%rsp), %rsi
leaq 0x178(%rsp), %rdi
callq 0xeb00
movsd 0x8(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
leaq 0x1d0(%rsp), %rdi
leaq 0x15c(%rsp), %rsi
callq 0x250e0
jmp 0x22217
jmp 0x22219
movl 0xd4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd4(%rsp)
jmp 0x220e6
jmp 0x22231
jmp 0x21f1c
leaq 0x178(%rsp), %rdi
callq 0xf030
leaq 0x1a8(%rsp), %rdi
callq 0xe3a0
leaq 0x1d0(%rsp), %rdi
callq 0x25150
addq $0x238, %rsp            # imm = 0x238
retq
leaq 0x1a8(%rsp), %rdi
callq 0xe3a0
leaq 0x1d0(%rsp), %rdi
callq 0x25150
movq 0x198(%rsp), %rdi
callq 0x4690
nopl (%rax)