#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 printPath(int *path) {
  if (path == NULL) {
    printf("Invalid path!");
  } else {
    while (*path != '\0')
      printf("%d ", *path--);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113a <printPath+0x2a>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1175 <printPath+0x65>
jmp    113f <printPath+0x2f>
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
je     1170 <printPath+0x60>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113f <printPath+0x2f>
jmp    1175 <printPath+0x65>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPath>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1156 <printPath+0x36>
mov    %rdi,%rbx
mov    (%rdi),%esi
test   %esi,%esi
je     1164 <printPath+0x44>
add    $0xfffffffffffffffc,%rbx
lea    0xed1(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%esi
add    $0xfffffffffffffffc,%rbx
test   %esi,%esi
jne    1140 <printPath+0x20>
jmp    1164 <printPath+0x44>
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Invalid path!\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @printPath(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %18
7: ; preds = %1
br label %8
8: ; preds = %12, %7
%9 = load i32*, i32** %2
%10 = load i32, i32* %9
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load i32*, i32** %2
%14 = getelementptr inbounds i32, i32* %13, i32 -1
store i32* %14, i32** %2
%15 = load i32, i32* %13
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %8
17: ; preds = %8
br label %18
18: ; preds = %17, %5
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

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