// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movq %r9, -0x48(%rbp)
movq %r8, -0x40(%rbp)
movl %ecx, -0x34(%rbp)
movq %rsi, -0x58(%rbp)
movl %edi, %ecx
movq %rsp, %r13
leaq 0xf(,%rcx,4), %rax
andq $-0x10, %rax
subq %rax, %r13
movq %r13, %rsp
movq %rsp, %rbx
movq %rcx, -0x50(%rbp)
addq $0xf, %rcx
andq $-0x10, %rcx
subq %rcx, %rbx
movq %rbx, %rsp
movq %rsp, %r12
subq %rax, %r12
movq %r12, %rsp
movl %edx, -0x30(%rbp)
movslq %edx, %rax
xorl %ecx, %ecx
testl %edi, %edi
movl $0x0, %r14d
movl %edi, -0x2c(%rbp)
cmovgl %edi, %r14d
cmpq %rcx, %r14
je 0x17af
orl $-0x1, (%r12,%rax,4)
movl $0x7f7fffff, (%r13,%rcx,4) # imm = 0x7F7FFFFF
movb $0x0, (%rbx,%rcx)
incq %rcx
jmp 0x1793
andl $0x0, (%r13,%rax,4)
movl -0x2c(%rbp), %eax
cmpl $0x2, %eax
pushq $0x1
popq %rcx
cmovgel %eax, %ecx
decl %ecx
movl %ecx, -0x38(%rbp)
xorl %r15d, %r15d
cmpl -0x38(%rbp), %r15d
je 0x1838
movq %r13, %rdi
movq %rbx, %rsi
movl -0x2c(%rbp), %edx
callq 0x1598
xorps %xmm2, %xmm2
movslq %eax, %rcx
movb $0x1, (%rbx,%rcx)
movq %rcx, %rdx
imulq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rsi
leaq (%rsi,%rdx,4), %rdx
xorl %esi, %esi
cmpq %rsi, %r14
je 0x1833
cmpb $0x0, (%rbx,%rsi)
jne 0x182e
movss (%rdx,%rsi,4), %xmm0
ucomiss %xmm2, %xmm0
jne 0x1810
jnp 0x182e
addss (%r13,%rcx,4), %xmm0
movss (%r13,%rsi,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x182e
movl %eax, (%r12,%rsi,4)
movss %xmm0, (%r13,%rsi,4)
incq %rsi
jmp 0x17f9
incl %r15d
jmp 0x17c9
movq -0x40(%rbp), %rdi
movl -0x30(%rbp), %esi
movl -0x34(%rbp), %ebx
movl %ebx, %edx
movq %r12, %rcx
movq -0x48(%rbp), %r8
callq 0x16df
movslq %ebx, %rax
movss (%r13,%rax,4), %xmm0
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq