#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 *PathFindFileNameA(char *);
int /*<<< orphan*/ PathRemoveBackslashA(char *);
void PathStripPathA(char *path) {
  PathRemoveBackslashA(path);
  char *filename = PathFindFileNameA(path);
  if (filename && filename > path) {
    while (*filename) {
      *path++ = *filename++;
    }
    *path = *filename;
  }
}


x86 assembly (clang, -O0):
<PathStripPathA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <PathRemoveBackslashA@plt>
mov    -0x8(%rbp),%rdi
call   1030 <PathFindFileNameA@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a0 <PathStripPathA+0x80>
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jbe    11a0 <PathStripPathA+0x80>
jmp    1160 <PathStripPathA+0x40>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1194 <PathStripPathA+0x74>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1160 <PathStripPathA+0x40>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PathStripPathA>:
push   %rbx
mov    %rdi,%rbx
call   1040 <PathRemoveBackslashA@plt>
mov    %rbx,%rdi
call   1030 <PathFindFileNameA@plt>
cmp    %rbx,%rax
jbe    1154 <PathStripPathA+0x34>
mov    (%rax),%cl
test   %cl,%cl
je     1151 <PathStripPathA+0x31>
add    $0x1,%rax
mov    %cl,(%rbx)
add    $0x1,%rbx
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1140 <PathStripPathA+0x20>
movb   $0x0,(%rbx)
pop    %rbx
ret

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

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