// File: /workspace/github_c_makefile_star2_O1/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 0x1887
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 0x1860
movq -0x38(%rbp), %r10
movl $0xffffffff, (%r14,%r10,4) # imm = 0xFFFFFFFF
movl -0x30(%rbp), %r13d
movq -0x40(%rbp), %rsi
movl -0x2c(%rbp), %edi
movl $0x0, (%r12,%r10,4)
cmpl $0x2, %edi
jl 0x192f
addl $-0x2, %edi
xorl %eax, %eax
movss 0x75f(%rip), %xmm0      # 0x2004
xorps %xmm1, %xmm1
xorl %ecx, %ecx
movaps %xmm0, %xmm3
cmpb $0x0, (%r15,%rcx)
jne 0x18c9
movss (%r12,%rcx,4), %xmm4
ucomiss %xmm4, %xmm3
jb 0x18c9
xorps %xmm2, %xmm2
cvtsi2ss %ecx, %xmm2
movaps %xmm4, %xmm3
incq %rcx
cmpq %rcx, %rbx
jne 0x18ad
cvttss2si %xmm2, %ecx
movslq %ecx, %rdx
movb $0x1, (%r15,%rdx)
movq %rdx, %r8
imulq %rbx, %r8
leaq (%rsi,%r8,4), %r8
xorl %r9d, %r9d
cmpb $0x0, (%r15,%r9)
jne 0x191a
movss (%r8,%r9,4), %xmm2
ucomiss %xmm1, %xmm2
jne 0x18ff
jnp 0x191a
addss (%r12,%rdx,4), %xmm2
movss (%r12,%r9,4), %xmm3
ucomiss %xmm2, %xmm3
jbe 0x191a
movl %ecx, (%r14,%r9,4)
movss %xmm2, (%r12,%r9,4)
incq %r9
cmpq %r9, %rbx
jne 0x18eb
leal 0x1(%rax), %ecx
cmpl %edi, %eax
movl %ecx, %eax
jne 0x18a8
movq -0x48(%rbp), %r15
movl (%r15,%r10,4), %edx
leaq 0x6fa(%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