#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 */

/* Variables and functions */
int *bfs(int /*<<< orphan*/, int /*<<< orphan*/);
int *dfs(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ getGraph();
char *getVertexName(int);
int /*<<< orphan*/ initGraphFromFile(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char const *argv[]) {
  unsigned int i;
  initGraphFromFile("dummy_path.txt");
  int *path = dfs(getGraph(), 0);
  printf("Depth First Search\n");
  printf("Path of vertex A: ");
  i = 0;
  while (path[i] != -1) {
    printf("-%s ", getVertexName(path[i]));
    i++;
  }
  printf("\n");
  int *path1 = bfs(getGraph(), 0);
  printf("Breath First Search\n");
  printf("Path of vertex A: ");
  i = 0;
  while (path1[i] != -1) {
    printf("-%s ", getVertexName(path1[i]));
    i++;
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rdi
call   1070 <initGraphFromFile@plt>
mov    $0x0,%al
call   1060 <getGraph@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1080 <dfs@plt>
mov    %rax,-0x20(%rbp)
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     11f8 <main+0x98>
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,4),%edi
call   1040 <getVertexName@plt>
mov    %rax,%rsi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b9 <main+0x59>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <getGraph@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1050 <bfs@plt>
mov    %rax,-0x28(%rbp)
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     127c <main+0x11c>
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,4),%edi
call   1040 <getVertexName@plt>
mov    %rax,%rsi
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    123d <main+0xdd>
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xe75(%rip),%rdi
call   1090 <initGraphFromFile@plt>
xor    %eax,%eax
call   1080 <getGraph@plt>
mov    %eax,%edi
xor    %esi,%esi
call   10a0 <dfs@plt>
mov    %rax,%rbx
lea    0xe7d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe59(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%edi
cmp    $0xffffffff,%edi
je     11ef <main+0x6f>
mov    $0x1,%ebp
lea    0xe52(%rip),%r14
call   1060 <getVertexName@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%eax
mov    (%rbx,%rax,4),%edi
add    $0x1,%ebp
cmp    $0xffffffff,%edi
jne    11d0 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1080 <getGraph@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1070 <bfs@plt>
mov    %rax,%rbx
lea    0xe27(%rip),%rdi
call   1040 <puts@plt>
lea    0xdf0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%edi
cmp    $0xffffffff,%edi
je     125f <main+0xdf>
mov    $0x1,%ebp
lea    0xde9(%rip),%r14
nopl   0x0(%rax)
call   1060 <getVertexName@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%eax
mov    (%rbx,%rax,4),%edi
add    $0x1,%ebp
cmp    $0xffffffff,%edi
jne    1240 <main+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"dummy_path.txt\00"
@.str.1 = [20 x i8] c"Depth First Search\0A\00"
@.str.2 = [19 x i8] c"Path of vertex A: \00"
@.str.3 = [5 x i8] c"-%s \00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [21 x i8] c"Breath First Search\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @initGraphFromFile(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @getGraph()
%11 = call i32* @dfs(i32 %10, i32 0)
store i32* %11, i32** %7
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %14
14: ; preds = %21, %2
%15 = load i32*, i32** %7
%16 = load i32, i32* %6
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = load i32, i32* %18
%20 = icmp ne i32 %19, -1
br i1 %20, label %21, label %31
21: ; preds = %14
%22 = load i32*, i32** %7
%23 = load i32, i32* %6
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = load i32, i32* %25
%27 = call i8* @getVertexName(i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %27)
%29 = load i32, i32* %6
%30 = add i32 %29, 1
store i32 %30, i32* %6
br label %14
31: ; preds = %14
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%33 = call i32 (...) @getGraph()
%34 = call i32* @bfs(i32 %33, i32 0)
store i32* %34, i32** %8
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %37
37: ; preds = %44, %31
%38 = load i32*, i32** %8
%39 = load i32, i32* %6
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %38, i64 %40
%42 = load i32, i32* %41
%43 = icmp ne i32 %42, -1
br i1 %43, label %44, label %54
44: ; preds = %37
%45 = load i32*, i32** %8
%46 = load i32, i32* %6
%47 = zext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %45, i64 %47
%49 = load i32, i32* %48
%50 = call i8* @getVertexName(i32 %49)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %50)
%52 = load i32, i32* %6
%53 = add i32 %52, 1
store i32 %53, i32* %6
br label %37
54: ; preds = %37
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"dummy_path.txt\00"
@.str.2 = [19 x i8] c"Path of vertex A: \00"
@.str.3 = [5 x i8] c"-%s \00"
@str = [19 x i8] c"Depth First Search\00"
@str.6 = [20 x i8] c"Breath First Search\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @initGraphFromFile(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @getGraph()
%5 = tail call i32* @dfs(i32 %4, i32 0)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, -1
br i1 %9, label %20, label %10
10: ; preds = %2, %10
%11 = phi i32 [ %18, %10 ], [ %8, %2 ]
%12 = phi i32 [ %15, %10 ], [ 0, %2 ]
%13 = tail call i8* @getVertexName(i32 %11)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%15 = add i32 %12, 1
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %5, i64 %16
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %10
20: ; preds = %10, %2
%21 = tail call i32 @putchar(i32 10)
%22 = tail call i32 (...) @getGraph()
%23 = tail call i32* @bfs(i32 %22, i32 0)
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.6, i64 0, i64 0))
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32, i32* %23
%27 = icmp eq i32 %26, -1
br i1 %27, label %38, label %28
28: ; preds = %20, %28
%29 = phi i32 [ %36, %28 ], [ %26, %20 ]
%30 = phi i32 [ %33, %28 ], [ 0, %20 ]
%31 = tail call i8* @getVertexName(i32 %29)
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %31)
%33 = add i32 %30, 1
%34 = zext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %23, i64 %34
%36 = load i32, i32* %35
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %28
38: ; preds = %28, %20
%39 = tail call i32 @putchar(i32 10)
ret i32 0
}