#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);
int /*<<< orphan*/ bellman_ford(struct Graph *, int /*<<< orphan*/);
struct Graph *create_graph(int);
void main() {
  int V = 5;
  struct Graph *graph = create_graph(V);
  add_edge(graph, 0, 1, -1);
  add_edge(graph, 0, 2, 4);
  add_edge(graph, 1, 2, 3);
  add_edge(graph, 1, 3, 2);
  add_edge(graph, 1, 4, 2);
  add_edge(graph, 3, 2, 5);
  add_edge(graph, 3, 1, 1);
  add_edge(graph, 4, 3, -3);
  bellman_ford(graph, 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <create_graph@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
call   1030 <add_edge@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x4,%ecx
call   1030 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1030 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0x2,%ecx
call   1030 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
call   1030 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
mov    $0x5,%ecx
call   1030 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
mov    $0x1,%ecx
mov    %ecx,%edx
call   1030 <add_edge@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
mov    $0x3,%edx
mov    $0xfffffffd,%ecx
call   1030 <add_edge@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1040 <bellman_ford@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x5,%edi
call   1050 <create_graph@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
call   1030 <add_edge@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x4,%ecx
call   1030 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1030 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0x2,%ecx
call   1030 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
call   1030 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x2,%edx
mov    $0x5,%ecx
call   1030 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1030 <add_edge@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x3,%edx
mov    $0xfffffffd,%ecx
call   1030 <add_edge@plt>
mov    %rbx,%rdi
xor    %esi,%esi
pop    %rbx
jmp    1040 <bellman_ford@plt>

LLVM IR (-O0):
%struct.Graph = type { i32 }
define void @main() {
%1 = alloca i32
%2 = alloca %struct.Graph*
store i32 5, i32* %1
%3 = load i32, i32* %1
%4 = call %struct.Graph* @create_graph(i32 %3)
store %struct.Graph* %4, %struct.Graph** %2
%5 = load %struct.Graph*, %struct.Graph** %2
%6 = call i32 @add_edge(%struct.Graph* %5, i32 0, i32 1, i32 -1)
%7 = load %struct.Graph*, %struct.Graph** %2
%8 = call i32 @add_edge(%struct.Graph* %7, i32 0, i32 2, i32 4)
%9 = load %struct.Graph*, %struct.Graph** %2
%10 = call i32 @add_edge(%struct.Graph* %9, i32 1, i32 2, i32 3)
%11 = load %struct.Graph*, %struct.Graph** %2
%12 = call i32 @add_edge(%struct.Graph* %11, i32 1, i32 3, i32 2)
%13 = load %struct.Graph*, %struct.Graph** %2
%14 = call i32 @add_edge(%struct.Graph* %13, i32 1, i32 4, i32 2)
%15 = load %struct.Graph*, %struct.Graph** %2
%16 = call i32 @add_edge(%struct.Graph* %15, i32 3, i32 2, i32 5)
%17 = load %struct.Graph*, %struct.Graph** %2
%18 = call i32 @add_edge(%struct.Graph* %17, i32 3, i32 1, i32 1)
%19 = load %struct.Graph*, %struct.Graph** %2
%20 = call i32 @add_edge(%struct.Graph* %19, i32 4, i32 3, i32 -3)
%21 = load %struct.Graph*, %struct.Graph** %2
%22 = call i32 @bellman_ford(%struct.Graph* %21, i32 0)
ret void
}

LLVM IR (-O2):
%struct.Graph = type { i32 }
define void @main() {
%1 = tail call %struct.Graph* @create_graph(i32 5)
%2 = tail call i32 @add_edge(%struct.Graph* %1, i32 0, i32 1, i32 -1)
%3 = tail call i32 @add_edge(%struct.Graph* %1, i32 0, i32 2, i32 4)
%4 = tail call i32 @add_edge(%struct.Graph* %1, i32 1, i32 2, i32 3)
%5 = tail call i32 @add_edge(%struct.Graph* %1, i32 1, i32 3, i32 2)
%6 = tail call i32 @add_edge(%struct.Graph* %1, i32 1, i32 4, i32 2)
%7 = tail call i32 @add_edge(%struct.Graph* %1, i32 3, i32 2, i32 5)
%8 = tail call i32 @add_edge(%struct.Graph* %1, i32 3, i32 1, i32 1)
%9 = tail call i32 @add_edge(%struct.Graph* %1, i32 4, i32 3, i32 -3)
%10 = tail call i32 @bellman_ford(%struct.Graph* %1, i32 0)
ret void
}