#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*/ execve(char *, char **, char **);
int my_access(char *);
int check_slash(char **tab, char **env) {
  if ((tab == NULL))
    return (1);
  if (tab[0][0] == '/') {
    if ((my_access(tab[0])) == 2) {
      execve(tab[0], tab, env);
      return (0);
    }
  }
  return (1);
}


x86 assembly (clang, -O0):
<check_slash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1147 <check_slash+0x27>
movl   $0x1,-0x4(%rbp)
jmp    119b <check_slash+0x7b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1194 <check_slash+0x74>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <my_access@plt>
cmp    $0x2,%eax
jne    118f <check_slash+0x6f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <execve@plt>
movl   $0x0,-0x4(%rbp)
jmp    119b <check_slash+0x7b>
jmp    1194 <check_slash+0x74>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_slash>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%ebp
test   %rdi,%rdi
je     1156 <check_slash+0x36>
mov    %rdi,%rbx
mov    (%rdi),%rdi
cmpb   $0x2f,(%rdi)
jne    1156 <check_slash+0x36>
mov    %rsi,%r14
call   1030 <my_access@plt>
cmp    $0x2,%eax
jne    1156 <check_slash+0x36>
mov    (%rbx),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <execve@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @check_slash(i8** %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8**
store i8** %0, i8*** %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %4
%7 = icmp eq i8** %6, null
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 1, i32* %3
br label %32
9: ; preds = %2
%10 = load i8**, i8*** %4
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 47
br i1 %16, label %17, label %31
17: ; preds = %9
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @my_access(i8* %20)
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %30
23: ; preds = %17
%24 = load i8**, i8*** %4
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = load i8**, i8*** %4
%28 = load i8**, i8*** %5
%29 = call i32 @execve(i8* %26, i8** %27, i8** %28)
store i32 0, i32* %3
br label %32
30: ; preds = %17
br label %31
31: ; preds = %30, %9
store i32 1, i32* %3
br label %32
32: ; preds = %31, %23, %8
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @check_slash(i8** %0, i8** %1) {
%3 = icmp eq i8** %0, null
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = load i8*, i8** %0
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 47
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = tail call i32 @my_access(i8* %5)
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i8*, i8** %0
%13 = tail call i32 @execve(i8* %12, i8** %0, i8** %1)
br label %14
14: ; preds = %4, %8, %2, %11
%15 = phi i32 [ 0, %11 ], [ 1, %2 ], [ 1, %8 ], [ 1, %4 ]
ret i32 %15
}