// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/datastructure.c
// Function: topological_sort
int* topological_sort(Graphptr g)
{
 int x, y, i, j;
 int *node;
 int* sorted = safemalloc(sizeof(int) * g->nvertices, "topological_sort", 1);
 int indegree[MAXV];
 Queueptr zeroin = queue();
 compute_indegrees(g, indegree);
 for (i = 0; i < g->nvertices; i++)
   if (indegree[i] == 0)
    {
     node = safemalloc(sizeof(int), "topological_sort", 11);
     node[0] = i;
     enqueue(zeroin, node);
    }
 j = 0;
 while (!queue_empty(zeroin))
  {
   node = dequeue(zeroin);
   x = node[0];
   safe_free(node);
   sorted[j] = x;
   j++;
   for (i = 0; i < g->degree[x]; i++)
    {
     y = g->edges[x][i].v;
     indegree[y]--;
     if (indegree[y] == 0)
      {
       node = safemalloc(sizeof(int), "topological_sort", 29);
       node[0] = y;
       enqueue(zeroin, node);
      }
    }
  }
 free_queue(zeroin);
 return sorted;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xfe0, %rsp            # imm = 0xFE0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movslq 0xf46280(%rax), %rdi
shlq $0x2, %rdi
leaq 0xbd621(%rip), %rsi     # 0xe4416
movl $0x1, %edx
callq 0x52d70
movq %rax, -0x28(%rbp)
callq 0x27710
movq %rax, -0xfd8(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xfd0(%rbp), %rsi
callq 0x267b0
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xf46280(%rcx), %eax
jge 0x26e83
movslq -0x14(%rbp), %rax
cmpl $0x0, -0xfd0(%rbp,%rax,4)
jne 0x26e76
movl $0x4, %edi
leaq 0xbd5c7(%rip), %rsi     # 0xe4416
movl $0xb, %edx
callq 0x52d70
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0xfd8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x26fb0
jmp 0x26e78
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x26e26
movl $0x0, -0x18(%rbp)
movq -0xfd8(%rbp), %rdi
callq 0x27040
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x26ea7
jmp 0x26f8c
movq -0xfd8(%rbp), %rdi
callq 0x27070
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xc(%rbp)
movq -0x20(%rbp), %rdi
callq 0x52e80
movl -0xc(%rbp), %edx
movq -0x28(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rdx
cmpl 0xf42400(%rcx,%rdx,4), %eax
jge 0x26f87
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
imulq $0x3e80, %rcx, %rcx     # imm = 0x3E80
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x10(%rbp)
movslq -0x10(%rbp), %rax
movl -0xfd0(%rbp,%rax,4), %ecx
addl $-0x1, %ecx
movl %ecx, -0xfd0(%rbp,%rax,4)
movslq -0x10(%rbp), %rax
cmpl $0x0, -0xfd0(%rbp,%rax,4)
jne 0x26f77
movl $0x4, %edi
leaq 0xbd4c6(%rip), %rsi     # 0xe4416
movl $0x1d, %edx
callq 0x52d70
movq %rax, -0x20(%rbp)
movl -0x10(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0xfd8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x26fb0
jmp 0x26f79
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x26ee7
jmp 0x26e8a
movq -0xfd8(%rbp), %rdi
callq 0x27100
movq -0x28(%rbp), %rax
addq $0xfe0, %rsp            # imm = 0xFE0
popq %rbp
retq
nopw %cs:(%rax,%rax)