#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);
const char *get_end_of_slashes_with_end(const char *__attribute__((nonnull))
                                        const path,
                                        const char *__attribute__((nonnull))
                                        const end) {
  const char *iter = path;
  for (; iter != end; ++iter) {
    const char ch = *iter;
    if (!ch_is_slash(ch)) {
      break;
    }
  }
  return iter;
}


x86 assembly (clang, -O0):
<get_end_of_slashes_with_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     116c <get_end_of_slashes_with_end+0x5c>
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%edi
call   1030 <ch_is_slash@plt>
cmp    $0x0,%eax
jne    1156 <get_end_of_slashes_with_end+0x46>
jmp    116c <get_end_of_slashes_with_end+0x5c>
jmp    115b <get_end_of_slashes_with_end+0x4b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <get_end_of_slashes_with_end+0x18>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_end_of_slashes_with_end>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
cmp    %rsi,%rdi
je     1138 <get_end_of_slashes_with_end+0x28>
mov    %rsi,%r14
nop
movsbl (%rbx),%edi
call   1030 <ch_is_slash@plt>
test   %eax,%eax
je     1138 <get_end_of_slashes_with_end+0x28>
add    $0x1,%rbx
cmp    %r14,%rbx
jne    1120 <get_end_of_slashes_with_end+0x10>
mov    %r14,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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