#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*/ ch_is_slash(char);
const char *get_end_of_slashes(const char *__attribute__((nonnull))
                               const path) {
  const char *iter = path;
  for (char ch = *(++iter); ch != '\0'; ch = *(++iter)) {
    if (!ch_is_slash(ch)) {
      return iter;
    }
  }
  return NULL;
}


x86 assembly (clang, -O0):
<get_end_of_slashes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    0x1(%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x0,%eax
je     1184 <get_end_of_slashes+0x74>
movsbl -0x19(%rbp),%edi
call   1030 <ch_is_slash@plt>
cmp    $0x0,%eax
jne    1165 <get_end_of_slashes+0x55>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    118c <get_end_of_slashes+0x7c>
jmp    116a <get_end_of_slashes+0x5a>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    0x1(%rax),%al
mov    %al,-0x19(%rbp)
jmp    1139 <get_end_of_slashes+0x29>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_end_of_slashes>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x1(%rbx),%eax
test   %al,%al
je     113a <get_end_of_slashes+0x2a>
add    $0x1,%rbx
movsbl %al,%edi
call   1030 <ch_is_slash@plt>
test   %eax,%eax
jne    1120 <get_end_of_slashes+0x10>
jmp    113c <get_end_of_slashes+0x2c>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

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

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