#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*/ printf(char *);
int strlen(char *);
void shortest_path(char str[]) {
  int i = strlen(str) - 1, j = 0, k = 0;
  char ch;
  while (i > j) {
    ch = str[i];
    str[i] = str[j];
    str[j] = ch;
    i--;
    j++;
  }
  printf("\nShortest Path:\n\n");
  printf("\tStart-> ");
  while (str[k] != '\0') {
    switch (str[k]) {
    case 'A':
      printf("Hostel A-> ");
      break;
    case 'B':
      printf("Hostel B-> ");
      break;
    case 'C':
      printf("Hostel C-> ");
      break;
    case 'D':
      printf("Hostel D-> ");
      break;
    case 'E':
      printf("Hostel E-> ");
      break;
    case 'F':
      printf("Hostel F-> ");
      break;
    case 'G':
      printf("Hostel G-> ");
      break;
    case 'H':
      printf("Hostel H-> ");
      break;
    case 'I':
      printf("Hostel S-> ");
      break;
    case 'J':
      printf("CCD-> ");
      break;
    case 'K':
      printf("Symbus-> ");
      break;
    case 'L':
      printf("Mess-> ");
      break;
    case 'M':
      printf("Rangoli-> ");
      break;
    case 'N':
      printf("Coffee Stop-> ");
      break;
    case 'O':
      printf("Academic Block-> ");
      break;
    case 'P':
      printf("Main Gate-> ");
      break;
    }
    k++;
  }
  printf("End\n");
}


x86 assembly (clang, -O0):
<shortest_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    119e <shortest_path+0x7e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x15(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x15(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1149 <shortest_path+0x29>
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1316 <shortest_path+0x1f6>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0xf,%eax
ja     1308 <shortest_path+0x1e8>
mov    -0x20(%rbp),%rax
lea    0xe0c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe58(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe49(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe44(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe3f(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe3a(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe2b(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe1a(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe11(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe0b(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe09(%rip),%rdi
call   1040 <printf@plt>
jmp    1308 <shortest_path+0x1e8>
lea    0xe0a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b6 <shortest_path+0x96>
lea    0xdfd(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shortest_path>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     1171 <shortest_path+0x41>
mov    %eax,%eax
add    $0xfffffffffffffffe,%rax
xor    %ecx,%ecx
nopl   0x0(%rax)
movzbl 0x1(%rbx,%rax,1),%esi
movzbl (%rbx,%rcx,1),%edx
mov    %dl,0x1(%rbx,%rax,1)
mov    %sil,(%rbx,%rcx,1)
add    $0x1,%rcx
lea    -0x1(%rax),%rdx
cmp    %rcx,%rax
mov    %rdx,%rax
jg     1150 <shortest_path+0x20>
lea    0xf50(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7c(%rip),%rdi
call   1050 <printf@plt>
mov    (%rbx),%al
test   %al,%al
je     11c6 <shortest_path+0x96>
add    $0x1,%rbx
lea    0xf46(%rip),%r14
jmp    11ab <shortest_path+0x7b>
nopl   0x0(%rax)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11c6 <shortest_path+0x96>
movsbl %al,%eax
add    $0xffffffbf,%eax
cmp    $0xf,%eax
ja     11a0 <shortest_path+0x70>
cltq
movslq (%r14,%rax,4),%rdi
add    %r14,%rdi
call   1050 <printf@plt>
jmp    11a0 <shortest_path+0x70>
lea    0xf0c(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"\0AShortest Path:\0A\0A\00"
@.str.1 = [10 x i8] c"\09Start-> \00"
@.str.2 = [12 x i8] c"Hostel A-> \00"
@.str.3 = [12 x i8] c"Hostel B-> \00"
@.str.4 = [12 x i8] c"Hostel C-> \00"
@.str.5 = [12 x i8] c"Hostel D-> \00"
@.str.6 = [12 x i8] c"Hostel E-> \00"
@.str.7 = [12 x i8] c"Hostel F-> \00"
@.str.8 = [12 x i8] c"Hostel G-> \00"
@.str.9 = [12 x i8] c"Hostel H-> \00"
@.str.10 = [12 x i8] c"Hostel S-> \00"
@.str.11 = [7 x i8] c"CCD-> \00"
@.str.12 = [10 x i8] c"Symbus-> \00"
@.str.13 = [8 x i8] c"Mess-> \00"
@.str.14 = [11 x i8] c"Rangoli-> \00"
@.str.15 = [15 x i8] c"Coffee Stop-> \00"
@.str.16 = [18 x i8] c"Academic Block-> \00"
@.str.17 = [13 x i8] c"Main Gate-> \00"
@.str.18 = [5 x i8] c"End\0A\00"
define void @shortest_path(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %10
10: ; preds = %14, %1
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = icmp sgt i32 %11, %12
br i1 %13, label %14, label %38
14: ; preds = %10
%15 = load i8*, i8** %2
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
store i8 %19, i8* %6
%20 = load i8*, i8** %2
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = load i8*, i8** %2
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 %24, i8* %28
%29 = load i8, i8* %6
%30 = load i8*, i8** %2
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
store i8 %29, i8* %33
%34 = load i32, i32* %3
%35 = add nsw i32 %34, -1
store i32 %35, i32* %3
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %10
38: ; preds = %10
%39 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%40 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %41
41: ; preds = %88, %38
%42 = load i8*, i8** %2
%43 = load i32, i32* %5
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %91
49: ; preds = %41
%50 = load i8*, i8** %2
%51 = load i32, i32* %5
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8, i8* %50, i64 %52
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
switch i32 %55, label %88 [
i32 65, label %56
i32 66, label %58
i32 67, label %60
i32 68, label %62
i32 69, label %64
i32 70, label %66
i32 71, label %68
i32 72, label %70
i32 73, label %72
i32 74, label %74
i32 75, label %76
i32 76, label %78
i32 77, label %80
i32 78, label %82
i32 79, label %84
i32 80, label %86
]
56: ; preds = %49
%57 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %88
58: ; preds = %49
%59 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %88
60: ; preds = %49
%61 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %88
62: ; preds = %49
%63 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %88
64: ; preds = %49
%65 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %88
66: ; preds = %49
%67 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
br label %88
68: ; preds = %49
%69 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
br label %88
70: ; preds = %49
%71 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
br label %88
72: ; preds = %49
%73 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
br label %88
74: ; preds = %49
%75 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %88
76: ; preds = %49
%77 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
br label %88
78: ; preds = %49
%79 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
br label %88
80: ; preds = %49
%81 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0))
br label %88
82: ; preds = %49
%83 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0))
br label %88
84: ; preds = %49
%85 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0))
br label %88
86: ; preds = %49
%87 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0))
br label %88
88: ; preds = %49, %86, %84, %82, %80, %78, %76, %74, %72, %70, %68, %66, %64, %62, %60, %58, %56
%89 = load i32, i32* %5
%90 = add nsw i32 %89, 1
store i32 %90, i32* %5
br label %41
91: ; preds = %41
%92 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"\09Start-> \00"
@.str.2 = [12 x i8] c"Hostel A-> \00"
@.str.3 = [12 x i8] c"Hostel B-> \00"
@.str.4 = [12 x i8] c"Hostel C-> \00"
@.str.5 = [12 x i8] c"Hostel D-> \00"
@.str.6 = [12 x i8] c"Hostel E-> \00"
@.str.7 = [12 x i8] c"Hostel F-> \00"
@.str.8 = [12 x i8] c"Hostel G-> \00"
@.str.9 = [12 x i8] c"Hostel H-> \00"
@.str.10 = [12 x i8] c"Hostel S-> \00"
@.str.11 = [7 x i8] c"CCD-> \00"
@.str.12 = [10 x i8] c"Symbus-> \00"
@.str.13 = [8 x i8] c"Mess-> \00"
@.str.14 = [11 x i8] c"Rangoli-> \00"
@.str.15 = [15 x i8] c"Coffee Stop-> \00"
@.str.16 = [18 x i8] c"Academic Block-> \00"
@.str.17 = [13 x i8] c"Main Gate-> \00"
@str = [17 x i8] c"\0AShortest Path:\0A\00"
@str.19 = [4 x i8] c"End\00"
@reltable.shortest_path = [16 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.2 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.3 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.4 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.5 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.7 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.8 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.9 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.11 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.12 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.13 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.14 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.15 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.16 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.17 to i64), i64 ptrtoint ([16 x i32]* @reltable.shortest_path to i64)) to i32)]
define void @shortest_path(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 1
br i1 %3, label %4, label %17
4: ; preds = %1
%5 = zext i32 %2 to i64
%6 = add nsw i64 %5, -1
br label %7
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %14, %7 ]
%9 = phi i64 [ %6, %4 ], [ %15, %7 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = getelementptr inbounds i8, i8* %0, i64 %8
%13 = load i8, i8* %12
store i8 %13, i8* %10
store i8 %11, i8* %12
%14 = add nuw nsw i64 %8, 1
%15 = add nsw i64 %9, -1
%16 = icmp sgt i64 %15, %14
br i1 %16, label %7, label %17
17: ; preds = %7, %1
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%20 = load i8, i8* %0
%21 = icmp eq i8 %20, 0
br i1 %21, label %38, label %22
22: ; preds = %17, %33
%23 = phi i64 [ %34, %33 ], [ 0, %17 ]
%24 = phi i8 [ %36, %33 ], [ %20, %17 ]
%25 = sext i8 %24 to i32
%26 = add nsw i32 %25, -65
%27 = icmp ult i32 %26, 16
br i1 %27, label %28, label %33
28: ; preds = %22
%29 = sext i32 %26 to i64
%30 = shl i64 %29, 2
%31 = call i8* @llvm.load.relative.i64(i8* bitcast ([16 x i32]* @reltable.shortest_path to i8*), i64 %30)
%32 = tail call i32 @printf(i8* dereferenceable(1) %31)
br label %33
33: ; preds = %22, %28
%34 = add nuw i64 %23, 1
%35 = getelementptr inbounds i8, i8* %0, i64 %34
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 0
br i1 %37, label %38, label %22
38: ; preds = %33, %17
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.19, i64 0, i64 0))
ret void
}