#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 *strchr(char const *, char);
char index_stc_split_path(const char *path, const char **name) {
  char *tmp;
  if (!path)
    return 0;
  *name = NULL;
  if (!(tmp = strchr(path, '$')))
    return 0;
  *name = tmp + 1;
  if (tmp > path)
    *(tmp - 1) = 0;
  return 1;
}


x86 assembly (clang, -O0):
<index_stc_split_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <index_stc_split_path+0x24>
movb   $0x0,-0x1(%rbp)
jmp    118d <index_stc_split_path+0x7d>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    $0x24,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1164 <index_stc_split_path+0x54>
movb   $0x0,-0x1(%rbp)
jmp    118d <index_stc_split_path+0x7d>
mov    -0x20(%rbp),%rcx
add    $0x1,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    1189 <index_stc_split_path+0x79>
mov    -0x20(%rbp),%rax
movb   $0x0,-0x1(%rax)
movb   $0x1,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<index_stc_split_path>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     114c <index_stc_split_path+0x3c>
mov    %rsi,%r14
mov    %rdi,%rbx
movq   $0x0,(%rsi)
mov    $0x24,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     114c <index_stc_split_path+0x3c>
mov    %rax,%rcx
add    $0x1,%rax
mov    %rax,(%r14)
mov    $0x1,%al
cmp    %rbx,%rcx
jbe    114e <index_stc_split_path+0x3e>
movb   $0x0,-0x1(%rcx)
jmp    114e <index_stc_split_path+0x3e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define signext i8 @index_stc_split_path(i8* %0, i8** nocapture writeonly %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %12, label %4
4: ; preds = %2
store i8* null, i8** %1
%5 = tail call i8* @strchr(i8* %0, i8 signext 36)
%6 = icmp eq i8* %5, null
br i1 %6, label %12, label %7
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8* %8, i8** %1
%9 = icmp ugt i8* %5, %0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %5, i64 -1
store i8 0, i8* %11
br label %12
12: ; preds = %7, %10, %4, %2
%13 = phi i8 [ 0, %2 ], [ 0, %4 ], [ 1, %10 ], [ 1, %7 ]
ret i8 %13
}