#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*/ dijkstra(int **, int, int *);
int distance(int **, int /*<<< orphan*/, int);
int /*<<< orphan*/ inputWGraph(int **);
int /*<<< orphan*/ printArray(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int g[10][10];
  int dist[10];
  inputWGraph(g);
  printf("Starting Node: ");
  int startinNode;
  scanf("%d", &startinNode);
  dijkstra(g, startinNode, dist);
  printArray(dist);
  printf("Distance: %d", distance(g, 0, 2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rdi
call   1040 <inputWGraph@plt>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe87(%rip),%rdi
lea    -0x1d4(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x1d4(%rbp),%esi
lea    -0x1d0(%rbp),%rdx
call   1060 <dijkstra@plt>
lea    -0x1d0(%rbp),%rdi
call   1070 <printArray@plt>
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1080 <distance@plt>
mov    %eax,%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1d8,%rsp
lea    0x40(%rsp),%r14
mov    %r14,%rdi
call   1040 <inputWGraph@plt>
lea    0xe82(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe8e(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0x10(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rdx
call   1060 <dijkstra@plt>
mov    %rbx,%rdi
call   1070 <printArray@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1080 <distance@plt>
lea    0xe48(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1d8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Starting Node: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"Distance: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [10 x i32]]
%3 = alloca [10 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 0
%6 = bitcast [10 x i32]* %5 to i32**
%7 = call i32 @inputWGraph(i32** %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%10 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 0
%11 = bitcast [10 x i32]* %10 to i32**
%12 = load i32, i32* %4
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%14 = call i32 @dijkstra(i32** %11, i32 %12, i32* %13)
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%16 = call i32 @printArray(i32* %15)
%17 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 0
%18 = bitcast [10 x i32]* %17 to i32**
%19 = call i32 @distance(i32** %18, i32 0, i32 2)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Starting Node: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"Distance: %d\00"
define i32 @main() {
%1 = alloca [10 x [10 x i32]]
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = bitcast [10 x [10 x i32]]* %1 to i8*
%5 = bitcast [10 x i32]* %2 to i8*
%6 = bitcast [10 x [10 x i32]]* %1 to i32**
%7 = call i32 @inputWGraph(i32** %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = bitcast i32* %3 to i8*
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %3
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%13 = call i32 @dijkstra(i32** %6, i32 %11, i32* %12)
%14 = call i32 @printArray(i32* %12)
%15 = call i32 @distance(i32** %6, i32 0, i32 2)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %15)
ret i32 0
}