#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*/ add_edge(struct graph *, int, int, int);
struct graph *create_graph(int);
int /*<<< orphan*/ print_graph(struct graph *, int);
int main() {
  int V = 10;
  struct graph *g = NULL;
  g = create_graph(V);
  if (g == NULL) {
    return -1;
  }
  add_edge(g, 0, 1, 5);
  add_edge(g, 0, 4, 9);
  add_edge(g, 0, 7, 8);
  add_edge(g, 1, 2, 12);
  add_edge(g, 1, 3, 15);
  add_edge(g, 1, 7, 4);
  add_edge(g, 2, 3, 3);
  add_edge(g, 2, 6, 11);
  add_edge(g, 3, 6, 9);
  add_edge(g, 4, 5, 4);
  add_edge(g, 4, 6, 20);
  add_edge(g, 4, 7, 5);
  add_edge(g, 5, 2, 1);
  add_edge(g, 5, 6, 13);
  add_edge(g, 7, 5, 6);
  add_edge(g, 7, 2, 7);
  print_graph(g, V);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <create_graph@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1171 <main+0x41>
movl   $0xffffffff,-0x4(%rbp)
jmp    12f2 <main+0x1c2>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x5,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0x9,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
mov    $0x8,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0xc,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0xf,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x7,%edx
mov    $0x4,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
mov    $0x3,%ecx
mov    %ecx,%edx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
mov    $0x6,%edx
mov    $0xb,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
mov    $0x6,%edx
mov    $0x9,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%ecx
mov    $0x5,%edx
mov    %ecx,%esi
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
mov    $0x6,%edx
mov    $0x14,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
mov    $0x7,%edx
mov    $0x5,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
mov    $0x6,%edx
mov    $0xd,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x7,%esi
mov    $0x5,%edx
mov    $0x6,%ecx
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x7,%ecx
mov    $0x2,%edx
mov    %ecx,%esi
call   1040 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <print_graph@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0xa,%edi
call   1050 <create_graph@plt>
test   %rax,%rax
je     12c1 <main+0x191>
mov    %rax,%rbx
xor    %ebp,%ebp
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x5,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0x9,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x7,%edx
mov    $0x8,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0xc,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0xf,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x7,%edx
mov    $0x4,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x3,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x6,%edx
mov    $0xb,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x6,%edx
mov    $0x9,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x5,%edx
mov    $0x4,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x6,%edx
mov    $0x14,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x7,%edx
mov    $0x5,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x6,%edx
mov    $0xd,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x5,%edx
mov    $0x6,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x2,%edx
mov    $0x7,%ecx
call   1040 <add_edge@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <print_graph@plt>
jmp    12c6 <main+0x196>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.graph = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.graph*
store i32 0, i32* %1
store i32 10, i32* %2
store %struct.graph* null, %struct.graph** %3
%4 = load i32, i32* %2
%5 = call %struct.graph* @create_graph(i32 %4)
store %struct.graph* %5, %struct.graph** %3
%6 = load %struct.graph*, %struct.graph** %3
%7 = icmp eq %struct.graph* %6, null
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 -1, i32* %1
br label %45
9: ; preds = %0
%10 = load %struct.graph*, %struct.graph** %3
%11 = call i32 @add_edge(%struct.graph* %10, i32 0, i32 1, i32 5)
%12 = load %struct.graph*, %struct.graph** %3
%13 = call i32 @add_edge(%struct.graph* %12, i32 0, i32 4, i32 9)
%14 = load %struct.graph*, %struct.graph** %3
%15 = call i32 @add_edge(%struct.graph* %14, i32 0, i32 7, i32 8)
%16 = load %struct.graph*, %struct.graph** %3
%17 = call i32 @add_edge(%struct.graph* %16, i32 1, i32 2, i32 12)
%18 = load %struct.graph*, %struct.graph** %3
%19 = call i32 @add_edge(%struct.graph* %18, i32 1, i32 3, i32 15)
%20 = load %struct.graph*, %struct.graph** %3
%21 = call i32 @add_edge(%struct.graph* %20, i32 1, i32 7, i32 4)
%22 = load %struct.graph*, %struct.graph** %3
%23 = call i32 @add_edge(%struct.graph* %22, i32 2, i32 3, i32 3)
%24 = load %struct.graph*, %struct.graph** %3
%25 = call i32 @add_edge(%struct.graph* %24, i32 2, i32 6, i32 11)
%26 = load %struct.graph*, %struct.graph** %3
%27 = call i32 @add_edge(%struct.graph* %26, i32 3, i32 6, i32 9)
%28 = load %struct.graph*, %struct.graph** %3
%29 = call i32 @add_edge(%struct.graph* %28, i32 4, i32 5, i32 4)
%30 = load %struct.graph*, %struct.graph** %3
%31 = call i32 @add_edge(%struct.graph* %30, i32 4, i32 6, i32 20)
%32 = load %struct.graph*, %struct.graph** %3
%33 = call i32 @add_edge(%struct.graph* %32, i32 4, i32 7, i32 5)
%34 = load %struct.graph*, %struct.graph** %3
%35 = call i32 @add_edge(%struct.graph* %34, i32 5, i32 2, i32 1)
%36 = load %struct.graph*, %struct.graph** %3
%37 = call i32 @add_edge(%struct.graph* %36, i32 5, i32 6, i32 13)
%38 = load %struct.graph*, %struct.graph** %3
%39 = call i32 @add_edge(%struct.graph* %38, i32 7, i32 5, i32 6)
%40 = load %struct.graph*, %struct.graph** %3
%41 = call i32 @add_edge(%struct.graph* %40, i32 7, i32 2, i32 7)
%42 = load %struct.graph*, %struct.graph** %3
%43 = load i32, i32* %2
%44 = call i32 @print_graph(%struct.graph* %42, i32 %43)
store i32 0, i32* %1
br label %45
45: ; preds = %9, %8
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
%struct.graph = type { i32 }
define i32 @main() {
%1 = tail call %struct.graph* @create_graph(i32 10)
%2 = icmp eq %struct.graph* %1, null
br i1 %2, label %21, label %3
3: ; preds = %0
%4 = tail call i32 @add_edge(%struct.graph* %1, i32 0, i32 1, i32 5)
%5 = tail call i32 @add_edge(%struct.graph* %1, i32 0, i32 4, i32 9)
%6 = tail call i32 @add_edge(%struct.graph* %1, i32 0, i32 7, i32 8)
%7 = tail call i32 @add_edge(%struct.graph* %1, i32 1, i32 2, i32 12)
%8 = tail call i32 @add_edge(%struct.graph* %1, i32 1, i32 3, i32 15)
%9 = tail call i32 @add_edge(%struct.graph* %1, i32 1, i32 7, i32 4)
%10 = tail call i32 @add_edge(%struct.graph* %1, i32 2, i32 3, i32 3)
%11 = tail call i32 @add_edge(%struct.graph* %1, i32 2, i32 6, i32 11)
%12 = tail call i32 @add_edge(%struct.graph* %1, i32 3, i32 6, i32 9)
%13 = tail call i32 @add_edge(%struct.graph* %1, i32 4, i32 5, i32 4)
%14 = tail call i32 @add_edge(%struct.graph* %1, i32 4, i32 6, i32 20)
%15 = tail call i32 @add_edge(%struct.graph* %1, i32 4, i32 7, i32 5)
%16 = tail call i32 @add_edge(%struct.graph* %1, i32 5, i32 2, i32 1)
%17 = tail call i32 @add_edge(%struct.graph* %1, i32 5, i32 6, i32 13)
%18 = tail call i32 @add_edge(%struct.graph* %1, i32 7, i32 5, i32 6)
%19 = tail call i32 @add_edge(%struct.graph* %1, i32 7, i32 2, i32 7)
%20 = tail call i32 @print_graph(%struct.graph* %1, i32 10)
br label %21
21: ; preds = %0, %3
%22 = phi i32 [ 0, %3 ], [ -1, %0 ]
ret i32 %22
}