#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 */
char *cpy_str(char *, char *);
int /*<<< orphan*/ free(char *);
char **init_tab_rm();
int my_access(char *);
int /*<<< orphan*/ my_do(char *, char **, char **);
int exec_rm(char **env) {
  char **tab5;
  char *str;
  tab5 = init_tab_rm();
  str = cpy_str("/bin", tab5[0]);
  if ((my_access(str)) == 2) {
    my_do(str, env, tab5);
    return (0);
  }
  free(str);
  return (0);
}


x86 assembly (clang, -O0):
<exec_rm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <init_tab_rm@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
lea    0xe8b(%rip),%rdi
call   1040 <cpy_str@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <my_access@plt>
cmp    $0x2,%eax
jne    11ad <exec_rm+0x5d>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1070 <my_do@plt>
movl   $0x0,-0x4(%rbp)
jmp    11bd <exec_rm+0x6d>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exec_rm>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1060 <init_tab_rm@plt>
mov    %rax,%r15
mov    (%rax),%rsi
lea    0xe94(%rip),%rdi
call   1040 <cpy_str@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <my_access@plt>
mov    %rbx,%rdi
cmp    $0x2,%eax
jne    1191 <exec_rm+0x41>
mov    %r14,%rsi
mov    %r15,%rdx
call   1070 <my_do@plt>
jmp    1196 <exec_rm+0x46>
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"/bin\00"
define i32 @exec_rm(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i8**
%5 = alloca i8*
store i8** %0, i8*** %3
%6 = call i8** (...) @init_tab_rm()
store i8** %6, i8*** %4
%7 = load i8**, i8*** %4
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i8* @cpy_str(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %9)
store i8* %10, i8** %5
%11 = load i8*, i8** %5
%12 = call i32 @my_access(i8* %11)
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %19
14: ; preds = %1
%15 = load i8*, i8** %5
%16 = load i8**, i8*** %3
%17 = load i8**, i8*** %4
%18 = call i32 @my_do(i8* %15, i8** %16, i8** %17)
store i32 0, i32* %2
br label %22
19: ; preds = %1
%20 = load i8*, i8** %5
%21 = call i32 @free(i8* %20)
store i32 0, i32* %2
br label %22
22: ; preds = %19, %14
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@.str = [5 x i8] c"/bin\00"
define i32 @exec_rm(i8** %0) {
%2 = tail call i8** (...) @init_tab_rm()
%3 = load i8*, i8** %2
%4 = tail call i8* @cpy_str(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call i32 @my_access(i8* %4)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @my_do(i8* %4, i8** %0, i8** %2)
br label %11
9: ; preds = %1
%10 = tail call i32 @free(i8* %4)
br label %11
11: ; preds = %9, %7
ret i32 0
}