#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);
void printPath(int parent[], int vertex, int startVertex) {
  if (vertex == startVertex) {
    printf("%d ", startVertex);
    return;
  } else if (parent[vertex] == 0) {
    printf("%d ", vertex);
    return;
  } else {
    printPath(parent, parent[vertex], startVertex);
    printf("%d ", vertex);
  }
}


x86 assembly (clang, -O0):
<printPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1152 <printPath+0x32>
mov    -0x10(%rbp),%esi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <printPath+0x83>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1178 <printPath+0x58>
mov    -0xc(%rbp),%esi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <printPath+0x83>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x10(%rbp),%edx
call   1040 <printPath@plt>
mov    -0xc(%rbp),%esi
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <printPath+0x83>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPath>:
push   %rbx
mov    %esi,%ebx
cmp    %edx,%esi
je     1136 <printPath+0x16>
movslq %ebx,%rax
mov    (%rdi,%rax,4),%esi
test   %esi,%esi
je     1136 <printPath+0x16>
call   1040 <printPath@plt>
lea    0xec3(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @printPath(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %6
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i32, i32* %6
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %34
13: ; preds = %3
%14 = load i32*, i32** %4
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %13
%21 = load i32, i32* %5
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %34
23: ; preds = %13
%24 = load i32*, i32** %4
%25 = load i32*, i32** %4
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
%30 = load i32, i32* %6
%31 = load i32, i32* %5
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %23
br label %34
34: ; preds = %10, %20, %33
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @printPath(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, %2
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %5, %3, %12
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
12: ; preds = %5
tail call void @printPath(i32* %0, i32 %8, i32 %2)
br label %10
}