#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ DFSExplore(struct node **, int *, int);
void DFS(struct node *adjacencyList[], int length, int parent[]) {
  int i;
  for (i = 1; i <= length; ++i) {
    if (parent[i] == -1) {
      parent[i] = 0;
      DFSExplore(adjacencyList, parent, i);
    }
  }
}


x86 assembly (clang, -O0):
<DFS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     117a <DFS+0x6a>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    1167 <DFS+0x57>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <DFSExplore@plt>
jmp    116c <DFS+0x5c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112a <DFS+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DFS>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <DFS+0x47>
mov    %rdx,%r12
mov    %esi,%r14d
mov    %rdi,%r15
add    $0x1,%r14d
mov    $0x1,%ebx
jmp    1139 <DFS+0x29>
add    $0x1,%rbx
cmp    %rbx,%r14
je     1157 <DFS+0x47>
cmpl   $0xffffffff,(%r12,%rbx,4)
jne    1130 <DFS+0x20>
movl   $0x0,(%r12,%rbx,4)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1030 <DFSExplore@plt>
jmp    1130 <DFS+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
define void @DFS(%struct.node** %0, i32 %1, i32* %2) {
%4 = alloca %struct.node**
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store %struct.node** %0, %struct.node*** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
store i32 1, i32* %7
br label %8
8: ; preds = %29, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %5
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %32
12: ; preds = %8
%13 = load i32*, i32** %6
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %28
19: ; preds = %12
%20 = load i32*, i32** %6
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 0, i32* %23
%24 = load %struct.node**, %struct.node*** %4
%25 = load i32*, i32** %6
%26 = load i32, i32* %7
%27 = call i32 @DFSExplore(%struct.node** %24, i32* %25, i32 %26)
br label %28
28: ; preds = %19, %12
br label %29
29: ; preds = %28
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %8
32: ; preds = %8
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
define void @DFS(%struct.node** %0, i32 %1, i32* %2) {
%4 = icmp slt i32 %1, 1
br i1 %4, label %19, label %5
5: ; preds = %3
%6 = add nuw i32 %1, 1
%7 = zext i32 %6 to i64
br label %8
8: ; preds = %5, %16
%9 = phi i64 [ 1, %5 ], [ %17, %16 ]
%10 = getelementptr inbounds i32, i32* %2, i64 %9
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %16
13: ; preds = %8
store i32 0, i32* %10
%14 = trunc i64 %9 to i32
%15 = tail call i32 @DFSExplore(%struct.node** %0, i32* %2, i32 %14)
br label %16
16: ; preds = %8, %13
%17 = add nuw nsw i64 %9, 1
%18 = icmp eq i64 %17, %7
br i1 %18, label %19, label %8
19: ; preds = %16, %3
ret void
}