#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 my_access(char *);
int /*<<< orphan*/ my_do(char *, char **, char **);
int /*<<< orphan*/ my_putstr(char *);
int slash(char **env, char **save) {
  if (save[0] == NULL || save == NULL)
    return (1);
  if (save[0][0] == '/') {
    if ((my_access(save[0])) == 2) {
      my_do(save[0], env, save);
      return (0);
    } else
      my_putstr("42sh : Command not found\n");
    return (1);
  } else if (save[0][0] == '.' && save[0][1] == '/') {
    if ((my_access(save[0])) == 2) {
      my_do(save[0], env, save);
      return (0);
    }
    my_putstr("42sh : Command not found\n");
  } else
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<slash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1159 <slash+0x29>
cmpq   $0x0,-0x18(%rbp)
jne    1165 <slash+0x35>
movl   $0x1,-0x4(%rbp)
jmp    124a <slash+0x11a>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    11c5 <slash+0x95>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <my_access@plt>
cmp    $0x2,%eax
jne    11ad <slash+0x7d>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <my_do@plt>
movl   $0x0,-0x4(%rbp)
jmp    124a <slash+0x11a>
lea    0xe4c(%rip),%rdi
call   1040 <my_putstr@plt>
movl   $0x1,-0x4(%rbp)
jmp    124a <slash+0x11a>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    1232 <slash+0x102>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
jne    1232 <slash+0x102>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <my_access@plt>
cmp    $0x2,%eax
jne    1221 <slash+0xf1>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <my_do@plt>
movl   $0x0,-0x4(%rbp)
jmp    124a <slash+0x11a>
lea    0xdd8(%rip),%rdi
call   1040 <my_putstr@plt>
jmp    123e <slash+0x10e>
movl   $0x1,-0x4(%rbp)
jmp    124a <slash+0x11a>
jmp    1243 <slash+0x113>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slash>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    (%rsi),%rdi
mov    $0x1,%ebp
test   %rdi,%rdi
je     1197 <slash+0x67>
mov    %rsi,%rbx
mov    (%rdi),%al
cmp    $0x2e,%al
je     1169 <slash+0x39>
cmp    $0x2f,%al
jne    1197 <slash+0x67>
call   1030 <my_access@plt>
cmp    $0x2,%eax
je     1179 <slash+0x49>
lea    0xe9e(%rip),%rdi
call   1040 <my_putstr@plt>
jmp    1197 <slash+0x67>
cmpb   $0x2f,0x1(%rdi)
jne    1197 <slash+0x67>
call   1030 <my_access@plt>
cmp    $0x2,%eax
jne    1189 <slash+0x59>
mov    (%rbx),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <my_do@plt>
jmp    1195 <slash+0x65>
lea    0xe70(%rip),%rdi
call   1040 <my_putstr@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"42sh : Command not found\0A\00"
define i32 @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*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = icmp eq i8** %11, null
br i1 %12, label %13, label %14
13: ; preds = %10, %2
store i32 1, i32* %3
br label %72
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 47
br i1 %21, label %22, label %38
22: ; preds = %14
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @my_access(i8* %25)
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %35
28: ; preds = %22
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = load i8**, i8*** %4
%33 = load i8**, i8*** %5
%34 = call i32 @my_do(i8* %31, i8** %32, i8** %33)
store i32 0, i32* %3
br label %72
35: ; preds = %22
%36 = call i32 @my_putstr(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %37
37: ; preds = %35
store i32 1, i32* %3
br label %72
38: ; preds = %14
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = getelementptr inbounds i8, i8* %41, i64 0
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 46
br i1 %45, label %46, label %69
46: ; preds = %38
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 0
%49 = load i8*, i8** %48
%50 = getelementptr inbounds i8, i8* %49, i64 1
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 47
br i1 %53, label %54, label %69
54: ; preds = %46
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 0
%57 = load i8*, i8** %56
%58 = call i32 @my_access(i8* %57)
%59 = icmp eq i32 %58, 2
br i1 %59, label %60, label %67
60: ; preds = %54
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 0
%63 = load i8*, i8** %62
%64 = load i8**, i8*** %4
%65 = load i8**, i8*** %5
%66 = call i32 @my_do(i8* %63, i8** %64, i8** %65)
store i32 0, i32* %3
br label %72
67: ; preds = %54
%68 = call i32 @my_putstr(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %70
69: ; preds = %46, %38
store i32 1, i32* %3
br label %72
70: ; preds = %67
br label %71
71: ; preds = %70
store i32 0, i32* %3
br label %72
72: ; preds = %71, %69, %60, %37, %28, %13
%73 = load i32, i32* %3
ret i32 %73
}

LLVM IR (-O2):
@.str = [26 x i8] c"42sh : Command not found\0A\00"
define i32 @slash(i8** %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %27, label %5
5: ; preds = %2
%6 = load i8, i8* %3
switch i8 %6, label %27 [
i8 47, label %7
i8 46, label %15
]
7: ; preds = %5
%8 = tail call i32 @my_access(i8* %3)
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i8*, i8** %1
%12 = tail call i32 @my_do(i8* %11, i8** %0, i8** %1)
br label %27
13: ; preds = %7
%14 = tail call i32 @my_putstr(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %27
15: ; preds = %5
%16 = getelementptr inbounds i8, i8* %3, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 47
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = tail call i32 @my_access(i8* %3)
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i8*, i8** %1
%24 = tail call i32 @my_do(i8* %23, i8** %0, i8** %1)
br label %27
25: ; preds = %19
%26 = tail call i32 @my_putstr(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %15, %5, %2, %25, %22, %13, %10
%28 = phi i32 [ 0, %10 ], [ 1, %13 ], [ 0, %22 ], [ 0, %25 ], [ 1, %2 ], [ 1, %5 ], [ 1, %15 ]
ret i32 %28
}