#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 *, ...);
void printAllShortestPath(int checkedVertex[], int vertexWeight[],
                          int vertexParent[], int size) {
  int i;
  printf("Vertex: revert path (weight)\n");
  for (i = size - 1; i >= 0; i--) {
    printf("%6d", i);
    int current = i;
    while (vertexParent[current] != -1) {
      current = vertexParent[current];
      printf(" -> %2d", current);
    }
    if (vertexWeight[i] == 32768) {
      printf(" (%s)", "MAX");
    } else {
      printf(" (%2d)", vertexWeight[i]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printAllShortestPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     11f9 <printAllShortestPath+0xe9>
mov    -0x20(%rbp),%esi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     1195 <printAllShortestPath+0x85>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115f <printAllShortestPath+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x8000,(%rax,%rcx,4)
jne    11c4 <printAllShortestPath+0xb4>
lea    0xe79(%rip),%rdi
lea    0xe78(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dd <printAllShortestPath+0xcd>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    113e <printAllShortestPath+0x2e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printAllShortestPath>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %rsi,%r14
lea    0xed3(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
jle    11ea <printAllShortestPath+0xba>
mov    %ebp,%r13d
lea    0xea3(%rip),%r12
jmp    1191 <printAllShortestPath+0x61>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x1,%r13
mov    %r15,%r13
jle    11ea <printAllShortestPath+0xba>
lea    -0x1(%r13),%r15
lea    0xe64(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x4(%rbx,%r13,4),%ebp
cmp    $0xffffffff,%ebp
je     11c7 <printAllShortestPath+0x97>
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movslq %ebp,%rax
mov    (%rbx,%rax,4),%ebp
cmp    $0xffffffff,%ebp
jne    11b0 <printAllShortestPath+0x80>
mov    (%r14,%r15,4),%esi
cmp    $0x8000,%esi
jne    1170 <printAllShortestPath+0x40>
lea    0xe32(%rip),%rdi
lea    0xe31(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    117e <printAllShortestPath+0x4e>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Vertex: revert path (weight)\0A\00"
@.str.1 = [4 x i8] c"%6d\00"
@.str.2 = [8 x i8] c" -> %2d\00"
@.str.3 = [6 x i8] c" (%s)\00"
@.str.4 = [4 x i8] c"MAX\00"
@.str.5 = [7 x i8] c" (%2d)\00"
@.str.6 = [2 x i8] c"\0A\00"
define void @printAllShortestPath(i32* %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %8
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %9
br label %14
14: ; preds = %54, %4
%15 = load i32, i32* %9
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %57
17: ; preds = %14
%18 = load i32, i32* %9
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %9
store i32 %20, i32* %10
br label %21
21: ; preds = %28, %17
%22 = load i32*, i32** %7
%23 = load i32, i32* %10
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = load i32, i32* %25
%27 = icmp ne i32 %26, -1
br i1 %27, label %28, label %36
28: ; preds = %21
%29 = load i32*, i32** %7
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = load i32, i32* %32
store i32 %33, i32* %10
%34 = load i32, i32* %10
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %34)
br label %21
36: ; preds = %21
%37 = load i32*, i32** %6
%38 = load i32, i32* %9
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
%41 = load i32, i32* %40
%42 = icmp eq i32 %41, 32768
br i1 %42, label %43, label %45
43: ; preds = %36
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %52
45: ; preds = %36
%46 = load i32*, i32** %6
%47 = load i32, i32* %9
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32, i32* %46, i64 %48
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %45, %43
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %54
54: ; preds = %52
%55 = load i32, i32* %9
%56 = add nsw i32 %55, -1
store i32 %56, i32* %9
br label %14
57: ; preds = %14
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%6d\00"
@.str.2 = [8 x i8] c" -> %2d\00"
@.str.3 = [6 x i8] c" (%s)\00"
@.str.4 = [4 x i8] c"MAX\00"
@.str.5 = [7 x i8] c" (%2d)\00"
@str = [29 x i8] c"Vertex: revert path (weight)\00"
define void @printAllShortestPath(i32* nocapture readnone %0, i32* nocapture %1, i32* nocapture %2, i32 %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %35
7: ; preds = %4
%8 = zext i32 %3 to i64
br label %9
9: ; preds = %7, %32
%10 = phi i64 [ %8, %7 ], [ %11, %32 ]
%11 = add nsw i64 %10, -1
%12 = trunc i64 %11 to i32
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds i32, i32* %2, i64 %11
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, -1
br i1 %16, label %24, label %17
17: ; preds = %9, %17
%18 = phi i32 [ %22, %17 ], [ %15, %9 ]
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = sext i32 %18 to i64
%21 = getelementptr inbounds i32, i32* %2, i64 %20
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %17
24: ; preds = %17, %9
%25 = getelementptr inbounds i32, i32* %1, i64 %11
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 32768
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %32
30: ; preds = %24
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %26)
br label %32
32: ; preds = %30, %28
%33 = tail call i32 @putchar(i32 10)
%34 = icmp sgt i64 %10, 1
br i1 %34, label %9, label %35
35: ; preds = %32, %4
ret void
}