#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 */
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int /*<<< orphan*/);
scalar_t__ strstr(char *, char *);
int cbus_check_name(char *name) {
  if (strstr(name, "/_")) {
    if (strncmp(name, "/_unnamed/", strlen("/_unnamed/"))) {
      return 1;
    }
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<cbus_check_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     119e <cbus_check_name+0x6e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe9e(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
lea    0xe8c(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1192 <cbus_check_name+0x62>
movl   $0x1,-0x4(%rbp)
jmp    11a5 <cbus_check_name+0x75>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <cbus_check_name+0x75>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbus_check_name>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xec2(%rip),%rsi
call   1050 <strstr@plt>
test   %rax,%rax
je     1171 <cbus_check_name+0x41>
lea    0xeb4(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
jmp    1176 <cbus_check_name+0x46>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"/_\00"
@.str.1 = [11 x i8] c"/_unnamed/\00"
define i32 @cbus_check_name(i8* %0) {
%2 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %1, %4
%10 = phi i32 [ %8, %4 ], [ 1, %1 ]
ret i32 %10
}