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

/* Variables and functions */
int /*<<< orphan*/ bfs(struct gnode **, int, int);
int /*<<< orphan*/ createGraph(struct gnode **, int);
int /*<<< orphan*/ inputGraph(struct gnode **, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  struct gnode *adj[20];
  int n;
  printf("\nEnter no. of nodes in the graph: ");
  scanf("%d", &n);
  createGraph(adj, n);
  inputGraph(adj, n);
  bfs(adj, n, 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0xb4(%rbp),%rsi
call   1070 <scanf@plt>
lea    -0xb0(%rbp),%rdi
mov    -0xb4(%rbp),%esi
call   1060 <createGraph@plt>
lea    -0xb0(%rbp),%rdi
mov    -0xb4(%rbp),%esi
call   1050 <inputGraph@plt>
lea    -0xb0(%rbp),%rdi
mov    -0xb4(%rbp),%esi
mov    $0x1,%edx
call   1040 <bfs@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xb0,%rsp
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <createGraph@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1050 <inputGraph@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1040 <bfs@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.gnode = type { i32 }
@.str = [35 x i8] c"\0AEnter no. of nodes in the graph: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x %struct.gnode*]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%6 = getelementptr inbounds [20 x %struct.gnode*], [20 x %struct.gnode*]* %2, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 @createGraph(%struct.gnode** %6, i32 %7)
%9 = getelementptr inbounds [20 x %struct.gnode*], [20 x %struct.gnode*]* %2, i64 0, i64 0
%10 = load i32, i32* %3
%11 = call i32 @inputGraph(%struct.gnode** %9, i32 %10)
%12 = getelementptr inbounds [20 x %struct.gnode*], [20 x %struct.gnode*]* %2, i64 0, i64 0
%13 = load i32, i32* %3
%14 = call i32 @bfs(%struct.gnode** %12, i32 %13, i32 1)
ret i32 0
}

LLVM IR (-O2):
%struct.gnode = type { i32 }
@.str = [35 x i8] c"\0AEnter no. of nodes in the graph: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [20 x %struct.gnode*]
%2 = alloca i32
%3 = bitcast [20 x %struct.gnode*]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = getelementptr inbounds [20 x %struct.gnode*], [20 x %struct.gnode*]* %1, i64 0, i64 0
%8 = load i32, i32* %2
%9 = call i32 @createGraph(%struct.gnode** %7, i32 %8)
%10 = load i32, i32* %2
%11 = call i32 @inputGraph(%struct.gnode** %7, i32 %10)
%12 = load i32, i32* %2
%13 = call i32 @bfs(%struct.gnode** %7, i32 %12, i32 1)
ret i32 0
}