#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 strlen(char const *);
char *_synctex_last_path_component(const char *name) {
  const char *c = name + strlen(name);
  if (c > name) {
    if (!('/' == *c)) {
      do {
        --c;
        if (('/' == *c)) {
          return (char *)c + 1;
        }
      } while (c > name);
    }
    return (char *)c;
  }
  return (char *)c;
}


x86 assembly (clang, -O0):
<_synctex_last_path_component>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    11ba <_synctex_last_path_component+0xaa>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x2f,%eax
cmp    %ecx,%eax
je     11ad <_synctex_last_path_component+0x9d>
jmp    1164 <_synctex_last_path_component+0x54>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x2f,%eax
cmp    %ecx,%eax
jne    1195 <_synctex_last_path_component+0x85>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11c2 <_synctex_last_path_component+0xb2>
jmp    119a <_synctex_last_path_component+0x8a>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     1164 <_synctex_last_path_component+0x54>
jmp    11ad <_synctex_last_path_component+0x9d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11c2 <_synctex_last_path_component+0xb2>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_synctex_last_path_component>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
movslq %eax,%rcx
lea    (%rbx,%rcx,1),%rax
test   %ecx,%ecx
jle    113f <_synctex_last_path_component+0x2f>
cmpb   $0x2f,(%rax)
je     113f <_synctex_last_path_component+0x2f>
nopl   0x0(%rax)
cmpb   $0x2f,-0x1(%rax)
je     113f <_synctex_last_path_component+0x2f>
add    $0xffffffffffffffff,%rax
cmp    %rbx,%rax
ja     1130 <_synctex_last_path_component+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @_synctex_last_path_component(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = load i8, i8* %4
%8 = icmp eq i8 %7, 47
br i1 %8, label %16, label %9
9: ; preds = %6, %14
%10 = phi i8* [ %11, %14 ], [ %4, %6 ]
%11 = getelementptr inbounds i8, i8* %10, i64 -1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 47
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = icmp ugt i8* %11, %0
br i1 %15, label %9, label %16
16: ; preds = %14, %9, %1, %6
%17 = phi i8* [ %4, %6 ], [ %4, %1 ], [ %11, %14 ], [ %10, %9 ]
ret i8* %17
}