#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 */
scalar_t__ strchr(char *, char);
int /*<<< orphan*/ strncmp(char *, char *, int);
int CUSFS_IS_USFS_PATH(char *path) {
  int rc = 0;
  if ((strchr(path, ':')) &&
      ((!strncmp(path, "/dev/sd", 7)) || (!strncmp(path, "/dev/sg", 7)))) {
    rc = 1;
  }
  return rc;
}


x86 assembly (clang, -O0):
<CUSFS_IS_USFS_PATH>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     118e <CUSFS_IS_USFS_PATH+0x6e>
mov    -0x8(%rbp),%rdi
lea    0xeaa(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     1187 <CUSFS_IS_USFS_PATH+0x67>
mov    -0x8(%rbp),%rdi
lea    0xe94(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    118e <CUSFS_IS_USFS_PATH+0x6e>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CUSFS_IS_USFS_PATH>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x3a,%esi
call   1040 <strchr@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     116c <CUSFS_IS_USFS_PATH+0x4c>
lea    0xec2(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1167 <CUSFS_IS_USFS_PATH+0x47>
lea    0xeb2(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    116c <CUSFS_IS_USFS_PATH+0x4c>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"/dev/sd\00"
@.str.1 = [8 x i8] c"/dev/sg\00"
define i32 @CUSFS_IS_USFS_PATH(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = call i64 @strchr(i8* %4, i8 signext 58)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @strncmp(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8*, i8** %2
%13 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %11, %7
store i32 1, i32* %3
br label %16
16: ; preds = %15, %11, %1
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [8 x i8] c"/dev/sd\00"
@.str.1 = [8 x i8] c"/dev/sg\00"
define i32 @CUSFS_IS_USFS_PATH(i8* %0) {
%2 = tail call i64 @strchr(i8* %0, i8 signext 58)
%3 = icmp eq i64 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7, %4
br label %11
11: ; preds = %10, %7, %1
%12 = phi i32 [ 0, %7 ], [ 1, %10 ], [ 0, %1 ]
ret i32 %12
}