int path_is_devfd(path) const char *path;
{
  if (path[0] == '/' && path[1] == 'd' && strncmp(path, "/dev/fd/", 8) == 0)
    return 1;
  else if (STREQN(path, "/dev/std", 8)) {
    if (STREQ(path + 8, "in") || STREQ(path + 8, "out") ||
        STREQ(path + 8, "err"))
      return 1;
    else
      return 0;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<path_is_devfd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1187 <path_is_devfd+0x57>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x64,%eax
jne    1187 <path_is_devfd+0x57>
mov    -0x10(%rbp),%rdi
lea    0xe98(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1187 <path_is_devfd+0x57>
movl   $0x1,-0x4(%rbp)
jmp    1223 <path_is_devfd+0xf3>
mov    -0x10(%rbp),%rdi
lea    0xe77(%rip),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1050 <STREQN@plt>
cmp    $0x0,%eax
je     121c <path_is_devfd+0xec>
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1040 <STREQ@plt>
cmp    $0x0,%eax
jne    1204 <path_is_devfd+0xd4>
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
lea    0xe40(%rip),%rsi
mov    $0x0,%al
call   1040 <STREQ@plt>
cmp    $0x0,%eax
jne    1204 <path_is_devfd+0xd4>
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
lea    0xe25(%rip),%rsi
mov    $0x0,%al
call   1040 <STREQ@plt>
cmp    $0x0,%eax
je     1210 <path_is_devfd+0xe0>
movl   $0x1,-0x4(%rbp)
jmp    1223 <path_is_devfd+0xf3>
movl   $0x0,-0x4(%rbp)
jmp    1223 <path_is_devfd+0xf3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<path_is_devfd>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
cmpb   $0x2f,(%rdi)
jne    1159 <path_is_devfd+0x29>
cmpb   $0x64,0x1(%rbx)
jne    1159 <path_is_devfd+0x29>
lea    0xeb8(%rip),%rsi
mov    $0x8,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     11c3 <path_is_devfd+0x93>
lea    0xea9(%rip),%rsi
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    $0x8,%edx
xor    %eax,%eax
call   1050 <STREQN@plt>
test   %eax,%eax
je     11c8 <path_is_devfd+0x98>
add    $0x8,%rbx
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <STREQ@plt>
mov    $0x1,%ebp
test   %eax,%eax
jne    11c8 <path_is_devfd+0x98>
lea    0xe7b(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <STREQ@plt>
test   %eax,%eax
jne    11c8 <path_is_devfd+0x98>
lea    0xe6a(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <STREQ@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
jmp    11c8 <path_is_devfd+0x98>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"/dev/fd/\00"
@.str.1 = [9 x i8] c"/dev/std\00"
@.str.2 = [3 x i8] c"in\00"
@.str.3 = [4 x i8] c"out\00"
@.str.4 = [4 x i8] c"err\00"
define i32 @path_is_devfd(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 47
br i1 %8, label %9, label %20
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 100
br i1 %14, label %15, label %20
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = call i32 @strncmp(i8* %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 8)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 1, i32* %2
br label %42
20: ; preds = %15, %9, %1
%21 = load i8*, i8** %3
%22 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @STREQN to i32 (i8*, i8*, i32, ...)*)(i8* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %41
24: ; preds = %20
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 8
%27 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @STREQ to i32 (i8*, i8*, ...)*)(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %39, label %29
29: ; preds = %24
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i64 8
%32 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @STREQ to i32 (i8*, i8*, ...)*)(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%33 = icmp ne i32 %32, 0
br i1 %33, label %39, label %34
34: ; preds = %29
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i64 8
%37 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @STREQ to i32 (i8*, i8*, ...)*)(i8* %36, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %34, %29, %24
store i32 1, i32* %2
br label %42
40: ; preds = %34
store i32 0, i32* %2
br label %42
41: ; preds = %20
store i32 0, i32* %2
br label %42
42: ; preds = %41, %40, %39, %19
%43 = load i32, i32* %2
ret i32 %43
}

LLVM IR (-O2):
@.str = [9 x i8] c"/dev/fd/\00"
@.str.1 = [9 x i8] c"/dev/std\00"
@.str.2 = [3 x i8] c"in\00"
@.str.3 = [4 x i8] c"out\00"
@.str.4 = [4 x i8] c"err\00"
define i32 @path_is_devfd(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 47
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 100
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = tail call i32 @strncmp(i8* %0, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %25, label %11
11: ; preds = %8, %4, %1
%12 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @STREQN to i32 (i8*, i8*, i32, ...)*)(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
%13 = icmp eq i32 %12, 0
br i1 %13, label %25, label %14
14: ; preds = %11
%15 = getelementptr inbounds i8, i8* %0, i64 8
%16 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @STREQ to i32 (i8*, i8*, ...)*)(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %14
%19 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @STREQ to i32 (i8*, i8*, ...)*)(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @STREQ to i32 (i8*, i8*, ...)*)(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
%24 = zext i1 %23 to i32
br label %25
25: ; preds = %21, %11, %14, %18, %8
%26 = phi i32 [ 1, %8 ], [ 1, %18 ], [ 1, %14 ], [ 0, %11 ], [ %24, %21 ]
ret i32 %26
}