#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 *find_next_slash_reverse(char *__attribute__((nonnull)) const path,
                              char *__attribute__((nonnull)) const last_slash) {
  const char *const rev_end = path - 1;
  for (char *iter = (last_slash - 1); iter != rev_end; --iter) {
    const char ch = *iter;
    if (ch == '/') {
      return iter;
    }
  }
  return NULL;
}


x86 assembly (clang, -O0):
<find_next_slash_reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     116b <find_next_slash_reverse+0x6b>
mov    -0x28(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x29(%rbp)
movsbl -0x29(%rbp),%eax
cmp    $0x2f,%eax
jne    1155 <find_next_slash_reverse+0x55>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1173 <find_next_slash_reverse+0x73>
jmp    115a <find_next_slash_reverse+0x5a>
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    1124 <find_next_slash_reverse+0x24>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_next_slash_reverse>:
cmp    %rdi,%rsi
je     1113 <find_next_slash_reverse+0x13>
lea    -0x1(%rsi),%rax
cmpb   $0x2f,-0x1(%rsi)
mov    %rax,%rsi
jne    1100 <find_next_slash_reverse>
ret
xor    %eax,%eax
ret

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

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