#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*/ fwrite(char const *, size_t, int, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdout;
char *strchrnul(char const *, char);
void pretty_print(const char *pathlike, char delimiter) {
  const char *begin;
  const char *end;
  for (begin = pathlike, end = pathlike; '\0' != *end; begin = end + 1) {
    end = strchrnul(begin, delimiter);
    size_t length = (size_t)(end - begin);
    if (length > 0) {
      fwrite(begin, length, 1, stdout);
    }
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<pretty_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     11c4 <pretty_print+0x94>
mov    -0x18(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1040 <strchrnul@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jbe    11a9 <pretty_print+0x79>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x2e43(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
call   1050 <fwrite@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1152 <pretty_print+0x22>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pretty_print>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     118f <pretty_print+0x5f>
mov    %rdi,%rbx
movsbl %sil,%r14d
mov    0x2e96(%rip),%r15
jmp    1167 <pretty_print+0x37>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbp,%rbx
add    $0x1,%rbx
cmpb   $0x0,0x0(%rbp)
je     118f <pretty_print+0x5f>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <strchrnul@plt>
mov    %rax,%rbp
mov    %rax,%rsi
sub    %rbx,%rsi
je     1150 <pretty_print+0x20>
mov    (%r15),%ecx
mov    %rbx,%rdi
mov    $0x1,%edx
call   1050 <fwrite@plt>
jmp    1150 <pretty_print+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
define void @pretty_print(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %3
store i8 %1, i8* %4
%8 = load i8*, i8** %3
store i8* %8, i8** %5
%9 = load i8*, i8** %3
store i8* %9, i8** %6
br label %10
10: ; preds = %33, %2
%11 = load i8*, i8** %6
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 0, %13
br i1 %14, label %15, label %36
15: ; preds = %10
%16 = load i8*, i8** %5
%17 = load i8, i8* %4
%18 = call i8* @strchrnul(i8* %16, i8 signext %17)
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = load i8*, i8** %5
%21 = ptrtoint i8* %19 to i64
%22 = ptrtoint i8* %20 to i64
%23 = sub i64 %21, %22
store i64 %23, i64* %7
%24 = load i64, i64* %7
%25 = icmp ugt i64 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %15
%27 = load i8*, i8** %5
%28 = load i64, i64* %7
%29 = load i32, i32* @stdout
%30 = call i32 @fwrite(i8* %27, i64 %28, i32 1, i32 %29)
br label %31
31: ; preds = %26, %15
%32 = call i32 @putchar(i8 signext 10)
br label %33
33: ; preds = %31
%34 = load i8*, i8** %6
%35 = getelementptr inbounds i8, i8* %34, i64 1
store i8* %35, i8** %5
br label %10
36: ; preds = %10
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @pretty_print(i8* %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %20, label %5
5: ; preds = %2, %15
%6 = phi i8* [ %17, %15 ], [ %0, %2 ]
%7 = tail call i8* @strchrnul(i8* %6, i8 signext %1)
%8 = ptrtoint i8* %7 to i64
%9 = ptrtoint i8* %6 to i64
%10 = sub i64 %8, %9
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %5
%13 = load i32, i32* @stdout
%14 = tail call i32 @fwrite(i8* %6, i64 %10, i32 1, i32 %13)
br label %15
15: ; preds = %12, %5
%16 = tail call i32 @putchar(i8 signext 10)
%17 = getelementptr inbounds i8, i8* %7, i64 1
%18 = load i8, i8* %7
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %5
20: ; preds = %15, %2
ret void
}