#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*/ SIT_landmarks();
int destinationval(char *);
int dijkstra(int, int, int **);
int /*<<< orphan*/ exitservice(char *);
int /*<<< orphan*/ function_handling(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int sourceval(char *);
int main() {
  int dist, source, dest, adj[17][17];
  char s[30], d[30], ans[5];
  printf("\n\n\tROUTING SERVICE FOR SYMBIOSIS INSTITUTE OF TECHNOLOGY, PUNE "
         "(SIT)\n");
  do {
    SIT_landmarks();
    printf("\nEnter the source node: ");
    scanf(" %99[^\n]", s);
    source = sourceval(s);
    if (source != 0)
      function_handling(source);
    else
      continue;
    printf("Enter the destination node: ");
    scanf(" %99[^\n]", d);
    dest = destinationval(d);
    if (dest >= 1 && dest <= 16)
      function_handling(dest);
    if (source != 0 && dest != 0) {
      dist = dijkstra(source, dest, adj);
      printf("\nThe Shortest Distance between the nodes: %d metres (approx)\n",
             dist);
    }
    exitservice(ans);
  } while (1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <SIT_landmarks@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x4c0(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x4c0(%rbp),%rdi
call   1030 <sourceval@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11ee <main+0x6e>
mov    -0xc(%rbp),%edi
call   1050 <function_handling@plt>
jmp    11f3 <main+0x73>
jmp    1285 <main+0x105>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x4e0(%rbp),%rsi
lea    0xe50(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x4e0(%rbp),%rdi
call   10a0 <destinationval@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jl     123f <main+0xbf>
cmpl   $0x10,-0x10(%rbp)
jg     123f <main+0xbf>
mov    -0x10(%rbp),%edi
call   1050 <function_handling@plt>
cmpl   $0x0,-0xc(%rbp)
je     1279 <main+0xf9>
cmpl   $0x0,-0x10(%rbp)
je     1279 <main+0xf9>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
lea    -0x4a0(%rbp),%rdx
call   1080 <dijkstra@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x4e5(%rbp),%rdi
call   1090 <exitservice@plt>
mov    $0x1,%al
test   $0x1,%al
jne    11a0 <main+0x20>
jmp    1294 <main+0x114>
xor    %eax,%eax
add    $0x4f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4d8,%rsp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xe4c(%rip),%r14
lea    0xe5e(%rip),%r15
lea    0x30(%rsp),%rbx
lea    0x10(%rsp),%r13
jmp    1200 <main+0x70>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1060 <function_handling@plt>
mov    %r12d,%edi
mov    %ebp,%esi
lea    0x50(%rsp),%rdx
call   1090 <dijkstra@plt>
lea    0xe52(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xb(%rsp),%rdi
call   10a0 <exitservice@plt>
xor    %eax,%eax
call   1070 <SIT_landmarks@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    %rbx,%rdi
call   1040 <sourceval@plt>
test   %eax,%eax
je     1200 <main+0x70>
mov    %eax,%r12d
mov    %eax,%edi
call   1060 <function_handling@plt>
lea    0xde9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1080 <scanf@plt>
mov    %r13,%rdi
call   10b0 <destinationval@plt>
mov    %eax,%ebp
lea    -0x1(%rbp),%eax
cmp    $0xf,%eax
jbe    11d0 <main+0x40>
test   %ebp,%ebp
jne    11d7 <main+0x47>
jmp    11f6 <main+0x66>

LLVM IR (-O0):
@.str = [70 x i8] c"\0A\0A\09ROUTING SERVICE FOR SYMBIOSIS INSTITUTE OF TECHNOLOGY, PUNE (SIT)\0A\00"
@.str.1 = [25 x i8] c"\0AEnter the source node: \00"
@.str.2 = [9 x i8] c" %99[^\0A]\00"
@.str.3 = [29 x i8] c"Enter the destination node: \00"
@.str.4 = [62 x i8] c"\0AThe Shortest Distance between the nodes: %d metres (approx)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [17 x [17 x i32]]
%6 = alloca [30 x i8]
%7 = alloca [30 x i8]
%8 = alloca [5 x i8]
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %54, %0
%11 = call i32 (...) @SIT_landmarks()
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%14 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%16 = call i32 @sourceval(i8* %15)
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %10
%20 = load i32, i32* %3
%21 = call i32 @function_handling(i32 %20)
br label %23
22: ; preds = %10
br label %54
23: ; preds = %19
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%25 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%26 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%28 = call i32 @destinationval(i8* %27)
store i32 %28, i32* %4
%29 = load i32, i32* %4
%30 = icmp sge i32 %29, 1
br i1 %30, label %31, label %37
31: ; preds = %23
%32 = load i32, i32* %4
%33 = icmp sle i32 %32, 16
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* %4
%36 = call i32 @function_handling(i32 %35)
br label %37
37: ; preds = %34, %31, %23
%38 = load i32, i32* %3
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %51
40: ; preds = %37
%41 = load i32, i32* %4
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %51
43: ; preds = %40
%44 = load i32, i32* %3
%45 = load i32, i32* %4
%46 = getelementptr inbounds [17 x [17 x i32]], [17 x [17 x i32]]* %5, i64 0, i64 0
%47 = bitcast [17 x i32]* %46 to i32**
%48 = call i32 @dijkstra(i32 %44, i32 %45, i32** %47)
store i32 %48, i32* %2
%49 = load i32, i32* %2
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %43, %40, %37
%52 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%53 = call i32 @exitservice(i8* %52)
br label %54
54: ; preds = %51, %22
br i1 true, label %10, label %55
55: ; preds = %54
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [25 x i8] c"\0AEnter the source node: \00"
@.str.2 = [9 x i8] c" %99[^\0A]\00"
@.str.3 = [29 x i8] c"Enter the destination node: \00"
@.str.4 = [62 x i8] c"\0AThe Shortest Distance between the nodes: %d metres (approx)\0A\00"
@str = [69 x i8] c"\0A\0A\09ROUTING SERVICE FOR SYMBIOSIS INSTITUTE OF TECHNOLOGY, PUNE (SIT)\00"
define i32 @main() {
%1 = alloca [17 x [17 x i32]]
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
%4 = alloca [5 x i8]
%5 = bitcast [17 x [17 x i32]]* %1 to i8*
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str, i64 0, i64 0))
%10 = bitcast [17 x [17 x i32]]* %1 to i32**
br label %11
11: ; preds = %17, %0
%12 = call i32 (...) @SIT_landmarks()
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%15 = call i32 @sourceval(i8* %6)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11, %32
br label %11
18: ; preds = %11
%19 = call i32 @function_handling(i32 %15)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%22 = call i32 @destinationval(i8* %7)
%23 = add i32 %22, -1
%24 = icmp ult i32 %23, 16
br i1 %24, label %25, label %27
25: ; preds = %18
%26 = call i32 @function_handling(i32 %22)
br label %29
27: ; preds = %18
%28 = icmp eq i32 %22, 0
br i1 %28, label %32, label %29
29: ; preds = %25, %27
%30 = call i32 @dijkstra(i32 %15, i32 %22, i32** %10)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29, %27
%33 = call i32 @exitservice(i8* %8)
br label %17
}