#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 *lib_strchr(char *, char);
void splitpath(char *path, char **devname, char **filename) {
  char *x;
  *devname = 0;
  *filename = 0;
  x = lib_strchr(path, ':');
  if (!x) {
    *devname = 0;
    *filename = path;
  } else {
    *x++ = '\0';
    *filename = x;
    *devname = path;
  }
}


x86 assembly (clang, -O0):
<splitpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <lib_strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1172 <splitpath+0x62>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    119a <splitpath+0x8a>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<splitpath>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
movq   $0x0,(%rsi)
movq   $0x0,(%rdx)
mov    $0x3a,%esi
call   1030 <lib_strchr@plt>
test   %rax,%rax
je     114d <splitpath+0x3d>
mov    %rax,%rcx
add    $0x1,%rcx
movb   $0x0,(%rax)
mov    %rcx,(%rbx)
mov    %r15,%rbx
jmp    1154 <splitpath+0x44>
movq   $0x0,(%r15)
mov    %r14,(%rbx)
pop    %rbx
pop    %r14
pop    %r15
ret

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

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