// File: /workspace/github_c_makefile_star2_O3/MAGI003769[P]EE450-Socket-Project/serverC.c
// Function: dijkstra
float dijkstra(int V, float graph[V][V], int src, int target, char *path, int *vtx_set) 
{ 
      
    // The output array. dist[i] 
    // will hold the shortest 
    // distance from src to i 
    float dist[V];  
  
    // sptSet[i] will true if vertex 
    // i is included / in shortest 
    // path tree or shortest distance  
    // from src to i is finalized 
    bool sptSet[V]; 
  
    // Parent array to store 
    // shortest path tree 
    int parent[V]; 
  
    // Initialize all distances as  
    // INFINITE and stpSet[] as false 
    for (int i = 0; i < V; i++) 
    { 
        parent[src] = -1; 
        dist[i] = FLT_MAX; 
        sptSet[i] = false; 
    } 
  
    // Distance of source vertex  
    // from itself is always 0 
    dist[src] = 0; 
  
    // Find shortest path 
    // for all vertices 
    for (int count = 0; count < V - 1; count++) 
    { 
        // Pick the minimum distance 
        // vertex from the set of 
        // vertices not yet processed.  
        // u is always equal to src 
        // in first iteration. 
        int u = minDistance(dist, sptSet, V); 
  
        // Mark the picked vertex  
        // as processed 
        sptSet[u] = true; 
  
        // Update dist value of the  
        // adjacent vertices of the 
        // picked vertex. 
        for (int v = 0; v < V; v++) 
  
            // Update dist[v] only if is 
            // not in sptSet, there is 
            // an edge from u to v, and  
            // total weight of path from 
            // src to v through u is smaller 
            // than current value of 
            // dist[v] 
            if (!sptSet[v] && graph[u][v] && 
                dist[u] + graph[u][v] < dist[v]) 
            { 
                parent[v] = u; 
                dist[v] = dist[u] + graph[u][v]; 
            }  
    } 
  
    // print the constructed 
    // distance array 
    //printSolution(src, dist, V, parent); 
    //selectivePrintSolution(target, dist, parent);

    get_path2(path, src, target, parent, vtx_set);

    return dist[target];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movl %ecx, %r13d
movl %edi, %ebx
movq %rsp, %r12
leaq 0xf(,%rbx,4), %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movq %rsp, %r15
leaq 0xf(%rbx), %rcx
andq $-0x10, %rcx
subq %rcx, %r15
movq %r15, %rsp
movq %rsp, %r14
subq %rax, %r14
movq %r14, %rsp
movslq %edx, %r10
testl %edi, %edi
jle 0x1937
movq %r10, -0x38(%rbp)
movl %edi, -0x2c(%rbp)
movq %rsi, -0x40(%rbp)
movl %r13d, -0x30(%rbp)
xorl %r13d, %r13d
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x1080
movl $0x7f7fffff, (%r12,%r13,4) # imm = 0x7F7FFFFF
incq %r13
cmpq %r13, %rbx
jne 0x1864
movq -0x38(%rbp), %r10
movl $0xffffffff, (%r14,%r10,4) # imm = 0xFFFFFFFF
movl $0x0, (%r12,%r10,4)
movl -0x2c(%rbp), %r9d
cmpl $0x1, %r9d
movl -0x30(%rbp), %r13d
movq -0x40(%rbp), %r8
je 0x193f
addl $-0x2, %r9d
xorl %eax, %eax
movss 0x758(%rip), %xmm0      # 0x2004
xorps %xmm1, %xmm1
xorl %ecx, %ecx
movaps %xmm0, %xmm3
cmpb $0x0, (%r15,%rcx)
jne 0x18d0
movss (%r12,%rcx,4), %xmm4
ucomiss %xmm4, %xmm3
jb 0x18d0
xorps %xmm2, %xmm2
cvtsi2ss %ecx, %xmm2
movaps %xmm4, %xmm3
incq %rcx
cmpq %rcx, %rbx
jne 0x18b4
cvttss2si %xmm2, %ecx
movslq %ecx, %rdx
movb $0x1, (%r15,%rdx)
movq %rdx, %rsi
imulq %rbx, %rsi
leaq (%r8,%rsi,4), %rsi
xorl %edi, %edi
cmpb $0x0, (%r15,%rdi)
jne 0x191f
movss (%rsi,%rdi,4), %xmm2
ucomiss %xmm1, %xmm2
jne 0x1904
jnp 0x191f
addss (%r12,%rdx,4), %xmm2
movss (%r12,%rdi,4), %xmm3
ucomiss %xmm2, %xmm3
jbe 0x191f
movl %ecx, (%r14,%rdi,4)
movss %xmm2, (%r12,%rdi,4)
incq %rdi
cmpq %rdi, %rbx
jne 0x18f1
leal 0x1(%rax), %ecx
cmpl %r9d, %eax
movl %ecx, %eax
jne 0x18af
jmp 0x193f
movl $0x0, (%r12,%r10,4)
movq -0x48(%rbp), %r15
movl (%r15,%r10,4), %edx
leaq 0x6ea(%rip), %rsi       # 0x2038
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl %r13d, %edi
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x173f
movslq %r13d, %rax
movss (%r12,%rax,4), %xmm0
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq