#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 Graph {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ addToQueue(int /*<<< orphan*/);
int /*<<< orphan*/ bfsGraph(struct Graph *, int *);
int /*<<< orphan*/ creator2(struct Graph *);
struct Graph *initGraph(int);
int /*<<< orphan*/ initQueue();
int *initVisited(struct Graph *);
int /*<<< orphan*/ printGraphAll(struct Graph *);
int /*<<< orphan*/ printf(char *);
int main() {
  struct Graph *graph = initGraph(4);
  creator2(graph);
  printGraphAll(graph);
  initQueue();
  int *visited = initVisited(graph);
  addToQueue(0);
  bfsGraph(graph, visited);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1040 <initGraph@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <creator2@plt>
mov    -0x10(%rbp),%rdi
call   1090 <printGraphAll@plt>
mov    $0x0,%al
call   1080 <initQueue@plt>
mov    -0x10(%rbp),%rdi
call   1030 <initVisited@plt>
mov    %rax,-0x18(%rbp)
xor    %edi,%edi
call   1070 <addToQueue@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <bfsGraph@plt>
lea    0xe22(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x4,%edi
call   1050 <initGraph@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <creator2@plt>
mov    %rbx,%rdi
call   1090 <printGraphAll@plt>
xor    %eax,%eax
call   1080 <initQueue@plt>
mov    %rbx,%rdi
call   1040 <initVisited@plt>
mov    %rax,%r14
xor    %edi,%edi
call   1070 <addToQueue@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10a0 <bfsGraph@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.Graph = type { i32 }
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.Graph*
%3 = alloca i32*
store i32 0, i32* %1
%4 = call %struct.Graph* @initGraph(i32 4)
store %struct.Graph* %4, %struct.Graph** %2
%5 = load %struct.Graph*, %struct.Graph** %2
%6 = call i32 @creator2(%struct.Graph* %5)
%7 = load %struct.Graph*, %struct.Graph** %2
%8 = call i32 @printGraphAll(%struct.Graph* %7)
%9 = call i32 (...) @initQueue()
%10 = load %struct.Graph*, %struct.Graph** %2
%11 = call i32* @initVisited(%struct.Graph* %10)
store i32* %11, i32** %3
%12 = call i32 @addToQueue(i32 0)
%13 = load %struct.Graph*, %struct.Graph** %2
%14 = load i32*, i32** %3
%15 = call i32 @bfsGraph(%struct.Graph* %13, i32* %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.Graph = type { i32 }
define i32 @main() {
%1 = tail call %struct.Graph* @initGraph(i32 4)
%2 = tail call i32 @creator2(%struct.Graph* %1)
%3 = tail call i32 @printGraphAll(%struct.Graph* %1)
%4 = tail call i32 (...) @initQueue()
%5 = tail call i32* @initVisited(%struct.Graph* %1)
%6 = tail call i32 @addToQueue(i32 0)
%7 = tail call i32 @bfsGraph(%struct.Graph* %1, i32* %5)
%8 = tail call i32 @putchar(i32 10)
ret i32 0
}