#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 */
char *scout_any_segment(char const *, int /*<<< orphan*/);
char *scout_path_abempty(char const *);
const char *scout_path_rootless(const char *c) {
  const char *p = NULL;
  c = scout_any_segment(c, 0);
  if (c != NULL) {
    p = c++;
    do {
      c = scout_path_abempty(c);
      if (c != NULL)
        p = c++;
    } while (c != NULL);
  }
  return p;
}


x86 assembly (clang, -O0):
<scout_path_rootless>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <scout_any_segment@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11a1 <scout_path_rootless+0x81>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <scout_path_abempty@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118c <scout_path_rootless+0x6c>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
jmp    1191 <scout_path_rootless+0x71>
cmpq   $0x0,-0x8(%rbp)
jne    1161 <scout_path_rootless+0x41>
jmp    11a1 <scout_path_rootless+0x81>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scout_path_rootless>:
push   %rbx
xor    %ebx,%ebx
xor    %esi,%esi
call   1030 <scout_any_segment@plt>
test   %rax,%rax
je     1141 <scout_path_rootless+0x21>
nop
mov    %rax,%rbx
lea    0x1(%rax),%rdi
call   1040 <scout_path_abempty@plt>
test   %rax,%rax
jne    1130 <scout_path_rootless+0x10>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @scout_path_rootless(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* null, i8** %3
%4 = load i8*, i8** %2
%5 = call i8* @scout_any_segment(i8* %4, i32 0)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %24
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
store i8* %9, i8** %3
br label %11
11: ; preds = %20, %8
%12 = load i8*, i8** %2
%13 = call i8* @scout_path_abempty(i8* %12)
store i8* %13, i8** %2
%14 = load i8*, i8** %2
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %2
store i8* %17, i8** %3
br label %19
19: ; preds = %16, %11
br label %20
20: ; preds = %19
%21 = load i8*, i8** %2
%22 = icmp ne i8* %21, null
br i1 %22, label %11, label %23
23: ; preds = %20
br label %24
24: ; preds = %23, %1
%25 = load i8*, i8** %3
ret i8* %25
}

LLVM IR (-O2):
define i8* @scout_path_rootless(i8* %0) {
%2 = tail call i8* @scout_any_segment(i8* %0, i32 0)
%3 = icmp eq i8* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %7, %4 ], [ %2, %1 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = tail call i8* @scout_path_abempty(i8* %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %4
9: ; preds = %4, %1
%10 = phi i8* [ null, %1 ], [ %5, %4 ]
ret i8* %10
}