#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*/ X_OK;
int access(char *, int /*<<< orphan*/);
int str_noslash_and_acsok(char *cmd) {
  int i;
  int slash;
  int acs;
  i = 0;
  acs = access(cmd, X_OK);
  slash = 0;
  if (cmd == NULL)
    return (1);
  while (cmd[i] != '\0') {
    if (cmd[i] == '/')
      slash += 1;
    i += 1;
  }
  if (slash == 0 && acs == 0)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<str_noslash_and_acsok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2eba(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1156 <str_noslash_and_acsok+0x46>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <str_noslash_and_acsok+0xb3>
jmp    115b <str_noslash_and_acsok+0x4b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     119c <str_noslash_and_acsok+0x8c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    118e <str_noslash_and_acsok+0x7e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <str_noslash_and_acsok+0x4b>
cmpl   $0x0,-0x18(%rbp)
jne    11bc <str_noslash_and_acsok+0xac>
cmpl   $0x0,-0x1c(%rbp)
jne    11bc <str_noslash_and_acsok+0xac>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <str_noslash_and_acsok+0xb3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_noslash_and_acsok>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ecd(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
test   %rbx,%rbx
je     114c <str_noslash_and_acsok+0x3c>
xor    %edx,%edx
jmp    1137 <str_noslash_and_acsok+0x27>
nopl   0x0(%rax,%rax,1)
add    $0x1,%edx
add    $0x1,%rbx
movzbl (%rbx),%ecx
cmp    $0x2f,%cl
je     1130 <str_noslash_and_acsok+0x20>
test   %cl,%cl
jne    1133 <str_noslash_and_acsok+0x23>
xor    %ecx,%ecx
or     %eax,%edx
sete   %cl
jmp    1151 <str_noslash_and_acsok+0x41>
mov    $0x1,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@X_OK = global i32 0
define i32 @str_noslash_and_acsok(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
%7 = load i8*, i8** %3
%8 = load i32, i32* @X_OK
%9 = call i32 @access(i8* %7, i32 %8)
store i32 %9, i32* %6
store i32 0, i32* %5
%10 = load i8*, i8** %3
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 1, i32* %2
br label %44
13: ; preds = %1
br label %14
14: ; preds = %33, %13
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %36
22: ; preds = %14
%23 = load i8*, i8** %3
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 47
br i1 %29, label %30, label %33
30: ; preds = %22
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %33
33: ; preds = %30, %22
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %14
36: ; preds = %14
%37 = load i32, i32* %5
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i32, i32* %6
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %39
store i32 1, i32* %2
br label %44
43: ; preds = %39, %36
store i32 0, i32* %2
br label %44
44: ; preds = %43, %42, %12
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
@X_OK = global i32 0
define i32 @str_noslash_and_acsok(i8* %0) {
%2 = load i32, i32* @X_OK
%3 = tail call i32 @access(i8* %0, i32 %2)
%4 = icmp eq i8* %0, null
br i1 %4, label %19, label %5
5: ; preds = %1, %12
%6 = phi i64 [ %14, %12 ], [ 0, %1 ]
%7 = phi i32 [ %13, %12 ], [ 0, %1 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
%9 = load i8, i8* %8
switch i8 %9, label %12 [
i8 0, label %15
i8 47, label %10
]
10: ; preds = %5
%11 = add nsw i32 %7, 1
br label %12
12: ; preds = %5, %10
%13 = phi i32 [ %11, %10 ], [ %7, %5 ]
%14 = add nuw i64 %6, 1
br label %5
15: ; preds = %5
%16 = or i32 %7, %3
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %15, %1
%20 = phi i32 [ 1, %1 ], [ %18, %15 ]
ret i32 %20
}