// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/datastructure.c
// Function: minimum_spanning_tree_prim
Graphptr minimum_spanning_tree_prim(Graphptr g)
{
 int i, v, w;
 int intree[MAXV];
 double distance[MAXV], weight, dist;
 int parent[MAXV];
 Graphptr mst = graph(g->nvertices);
 for (i = 0; i < g->nvertices; i++)
  {
   intree[i] = BOOLEAN_FALSE;
   distance[i] = +LONG_MAX;
   parent[i] = -1;
  }
 distance[0] = 0;
 v = 0;
 while (!intree[v])
  {
   intree[v] = BOOLEAN_TRUE;
   for (i = 0; i < g->degree[v]; i++)
    {
     w = g->edges[v][i].v;
     weight = g->edges[v][i].weight;
     if (distance[w] > weight && !intree[w])
      {
       distance[w] = weight;
       parent[w] = v;
      }
    }
   v = 0;
   dist = +LONG_MAX;
   for (i = 1; i < g->nvertices; i++)
     if (!intree[i] && dist > distance[i])
      {
       dist = distance[i];
       v = i;
      }
  }
 for (i = 1; i < g->nvertices; i++)
   if (parent[i] != -1)
    {
     graph_insert_edge(mst, parent[i], i, 1);
     graph_insert_edge(mst, i, parent[i], 1);
    }
 return mst;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3e88, %rsp           # imm = 0x3E88
movq %rdi, %rbx
movl 0xf46280(%rdi), %edi
callq 0x1b34c
movq %rax, %r14
movl 0xf46280(%rbx), %r12d
testl %r12d, %r12d
jle 0x1b5f5
leaq (,%r12,4), %r15
movq %rsp, %rdi
xorl %r13d, %r13d
xorl %esi, %esi
movq %r15, %rdx
callq 0x4050
leaq 0x2ee0(%rsp), %rdi
movl $0xff, %esi
movq %r15, %rdx
callq 0x4050
leal 0x1(%r12), %eax
leaq -0x1(%r12), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl %eax
shlq $0x4, %rax
movdqa 0x8aee1(%rip), %xmm1    # 0xa6440
movdqa 0x8aee9(%rip), %xmm2    # 0xa6450
pxor %xmm2, %xmm0
movabsq $0x43e0000000000000, %rcx # imm = 0x43E0000000000000
pcmpeqd %xmm3, %xmm3
movdqa 0x8af0f(%rip), %xmm4    # 0xa6490
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %edx
notl %edx
testb $0x1, %dl
je 0x1b5ba
movq %rcx, 0xfa0(%rsp,%r13)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %edx
testb $0x1, %dl
je 0x1b5d0
movq %rcx, 0xfa8(%rsp,%r13)
paddq %xmm4, %xmm1
addq $0x10, %r13
cmpq %r13, %rax
jne 0x1b581
cmpl $0x0, (%rsp)
movq $0x0, 0xfa0(%rsp)
jne 0x1b6b4
jmp 0x1b601
movq $0x0, 0xfa0(%rsp)
leaq 0x8(%rbx), %rax
xorl %esi, %esi
movsd 0x8ad21(%rip), %xmm0    # 0xa6330
xorl %ecx, %ecx
movl $0x1, (%rsp,%rsi,4)
movslq 0xf42400(%rbx,%rsi,4), %rdx
testq %rdx, %rdx
jle 0x1b671
imulq $0x3e80, %rsi, %rsi     # imm = 0x3E80
addq %rax, %rsi
shlq $0x4, %rdx
xorl %edi, %edi
movslq -0x8(%rsi,%rdi), %r8
movsd (%rsi,%rdi), %xmm1
movsd 0xfa0(%rsp,%r8,8), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x1b668
cmpl $0x0, (%rsp,%r8,4)
jne 0x1b668
movsd %xmm1, 0xfa0(%rsp,%r8,8)
movl %ecx, 0x2ee0(%rsp,%r8,4)
addq $0x10, %rdi
cmpq %rdi, %rdx
jne 0x1b635
xorl %ecx, %ecx
cmpl $0x2, %r12d
jl 0x1b6a7
xorl %ecx, %ecx
movl $0x1, %edx
movapd %xmm0, %xmm1
cmpl $0x0, (%rsp,%rdx,4)
jne 0x1b69f
movsd 0xfa0(%rsp,%rdx,8), %xmm2
ucomisd %xmm2, %xmm1
jbe 0x1b69f
movl %edx, %ecx
movapd %xmm2, %xmm1
incq %rdx
cmpq %rdx, %r12
jne 0x1b684
movslq %ecx, %rsi
cmpl $0x0, (%rsp,%rsi,4)
je 0x1b611
cmpl $0x2, %r12d
jl 0x1b709
movl $0x1, %r15d
movl 0x2ee0(%rsp,%r15,4), %ebp
cmpl $-0x1, %ebp
je 0x1b6fe
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
movsd 0x89e43(%rip), %xmm0    # 0xa5520
callq 0x1b41a
movq %r14, %rdi
movl %r15d, %esi
movl %ebp, %edx
movq 0x89e2e(%rip), %xmm0    # 0xa5520
callq 0x1b41a
movl 0xf46280(%rbx), %r12d
incq %r15
movslq %r12d, %rax
cmpq %rax, %r15
jl 0x1b6c0
movq %r14, %rax
addq $0x3e88, %rsp           # imm = 0x3E88
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq