#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 /*<<< orphan*/ create_directed_graph(int **, int);
int /*<<< orphan*/ dijkstra(int **, int, int);
int /*<<< orphan*/ print_all_shortest_paths(int **, int);
int /*<<< orphan*/ print_graph(int **, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int G[20][20], no_of_nodes, source_vertex;
  printf("\n enter the no of nodes:");
  scanf("%d", &no_of_nodes);
  create_directed_graph(G, no_of_nodes);
  printf("\n..ORIGINAL GRAPH...\n");
  print_graph(G, no_of_nodes);
  printf("\n enter the source vertex:");
  scanf("%d", &source_vertex);
  dijkstra(G, no_of_nodes, source_vertex);
  print_all_shortest_paths(G, no_of_nodes);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x650,%rsp
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    -0x644(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x640(%rbp),%rdi
mov    -0x644(%rbp),%esi
call   1080 <create_directed_graph@plt>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
lea    -0x640(%rbp),%rdi
mov    -0x644(%rbp),%esi
call   1030 <print_graph@plt>
lea    0xe71(%rip),%rdi
call   1040 <printf@plt>
lea    0xe4c(%rip),%rdi
lea    -0x648(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x640(%rbp),%rdi
mov    -0x644(%rbp),%esi
mov    -0x648(%rbp),%edx
call   1070 <dijkstra@plt>
lea    -0x640(%rbp),%rdi
mov    -0x644(%rbp),%esi
call   1050 <print_all_shortest_paths@plt>
xor    %eax,%eax
add    $0x650,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x658,%rsp
lea    0xe7f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8c(%rip),%r14
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1070 <scanf@plt>
mov    0x8(%rsp),%esi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <create_directed_graph@plt>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1040 <print_graph@plt>
lea    0xe52(%rip),%rdi
call   1050 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1070 <scanf@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
call   1080 <dijkstra@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1060 <print_all_shortest_paths@plt>
xor    %eax,%eax
add    $0x658,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0A enter the no of nodes:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"\0A..ORIGINAL GRAPH...\0A\00"
@.str.3 = [27 x i8] c"\0A enter the source vertex:\00"
define i32 @main() {
%1 = alloca [20 x [20 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 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* %2)
%6 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* %1, i64 0, i64 0
%7 = bitcast [20 x i32]* %6 to i32**
%8 = load i32, i32* %2
%9 = call i32 @create_directed_graph(i32** %7, i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* %1, i64 0, i64 0
%12 = bitcast [20 x i32]* %11 to i32**
%13 = load i32, i32* %2
%14 = call i32 @print_graph(i32** %12, i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* %1, i64 0, i64 0
%18 = bitcast [20 x i32]* %17 to i32**
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @dijkstra(i32** %18, i32 %19, i32 %20)
%22 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* %1, i64 0, i64 0
%23 = bitcast [20 x i32]* %22 to i32**
%24 = load i32, i32* %2
%25 = call i32 @print_all_shortest_paths(i32** %23, i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0A enter the no of nodes:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [27 x i8] c"\0A enter the source vertex:\00"
@str = [21 x i8] c"\0A..ORIGINAL GRAPH...\00"
define i32 @main() {
%1 = alloca [20 x [20 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [20 x [20 x i32]]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = bitcast [20 x [20 x i32]]* %1 to i32**
%10 = load i32, i32* %2
%11 = call i32 @create_directed_graph(i32** %9, i32 %10)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%13 = load i32, i32* %2
%14 = call i32 @print_graph(i32** %9, i32 %13)
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = call i32 @dijkstra(i32** %9, i32 %17, i32 %18)
%20 = load i32, i32* %2
%21 = call i32 @print_all_shortest_paths(i32** %9, i32 %20)
ret i32 0
}