#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*/ F_OK;
int access(char *, int /*<<< orphan*/);
int getopt(int, char **, char *);
scalar_t__ optind;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ remove_pattern(char *);
int main(int argc, char *argv[]) {
  int o, recur = 0;
  while ((o = getopt(argc, argv, "rRh")) != -1)
    switch (o) {
    case 'r':
      recur = 1;
      continue;
    case 'R':
      recur = 1;
      continue;
    case 'h':
      printf(" rm -rR [TARGET(S)]\n");
      return 0;
    default:
      break;
    }
  argv += optind;
  argc -= optind;
  while (*argv && recur == 1) {
    while (access(*argv, F_OK) != -1) {
      remove_pattern(*argv);
      remove(*argv);
    }
    argv++;
  }
  if (recur == 0)
    while (*argv)
      remove(*argv++);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe85(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11fc <main+0xac>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x52,%eax
je     11ce <main+0x7e>
jmp    11a0 <main+0x50>
mov    -0x1c(%rbp),%eax
sub    $0x68,%eax
je     11da <main+0x8a>
jmp    11b1 <main+0x61>
mov    -0x1c(%rbp),%eax
sub    $0x72,%eax
jne    11f2 <main+0xa2>
jmp    11c2 <main+0x72>
movl   $0x1,-0x18(%rbp)
jmp    116d <main+0x1d>
movl   $0x1,-0x18(%rbp)
jmp    116d <main+0x1d>
lea    0xe23(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12e9 <main+0x199>
jmp    11f7 <main+0xa7>
jmp    116d <main+0x1d>
mov    0x2de5(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2dcf(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x1d(%rbp)
je     1243 <main+0xf3>
cmpl   $0x1,-0x18(%rbp)
sete   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1253 <main+0x103>
jmp    12a4 <main+0x154>
jmp    1258 <main+0x108>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2d6a(%rip),%rax
mov    (%rax),%esi
call   1060 <access@plt>
cmp    $0xffffffff,%eax
je     1293 <main+0x143>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <remove_pattern@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <remove@plt>
jmp    1258 <main+0x108>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1226 <main+0xd6>
cmpl   $0x0,-0x18(%rbp)
jne    12e2 <main+0x192>
jmp    12b3 <main+0x163>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     12dd <main+0x18d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rdi
call   1030 <remove@plt>
jmp    12b3 <main+0x163>
jmp    12e2 <main+0x192>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %r15d,%r15d
lea    0xe9a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <getopt@plt>
cmp    $0x67,%eax
jg     1190 <main+0x40>
cmp    $0xffffffff,%eax
je     11b2 <main+0x62>
cmp    $0x52,%eax
jne    1170 <main+0x20>
jmp    119c <main+0x4c>
xchg   %ax,%ax
cmp    $0x72,%eax
je     119c <main+0x4c>
cmp    $0x68,%eax
jne    1170 <main+0x20>
jmp    11a1 <main+0x51>
mov    $0x1,%r15b
jmp    1170 <main+0x20>
lea    0xe5c(%rip),%rdi
call   1040 <puts@plt>
jmp    1241 <main+0xf1>
mov    0x2e2f(%rip),%rax
mov    (%rax),%rax
mov    (%rbx,%rax,8),%rdi
test   %rdi,%rdi
sete   %cl
mov    %r15d,%edx
not    %dl
or     %cl,%dl
test   $0x1,%dl
jne    120f <main+0xbf>
lea    (%rbx,%rax,8),%rbx
mov    0x2df3(%rip),%rbp
jmp    11f3 <main+0xa3>
nop
mov    (%rbx),%rdi
call   1050 <remove_pattern@plt>
mov    (%rbx),%rdi
call   1030 <remove@plt>
mov    (%rbx),%rdi
mov    0x0(%rbp),%esi
call   1060 <access@plt>
cmp    $0xffffffff,%eax
jne    11e0 <main+0x90>
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    11f3 <main+0xa3>
jmp    1241 <main+0xf1>
test   %rdi,%rdi
sete   %cl
or     %cl,%r15b
test   $0x1,%r15b
jne    1241 <main+0xf1>
lea    (%rbx,%rax,8),%rbx
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
call   1030 <remove@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1230 <main+0xe0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"rRh\00"
@.str.1 = [21 x i8] c" rm -rR [TARGET(S)]\0A\00"
@optind = global i64 0
@F_OK = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %8
8: ; preds = %20, %16, %15, %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %6
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %21
13: ; preds = %8
%14 = load i32, i32* %6
switch i32 %14, label %19 [
i32 114, label %15
i32 82, label %16
i32 104, label %17
]
15: ; preds = %13
store i32 1, i32* %7
br label %8
16: ; preds = %13
store i32 1, i32* %7
br label %8
17: ; preds = %13
%18 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %71
19: ; preds = %13
br label %20
20: ; preds = %19
br label %8
21: ; preds = %8
%22 = load i64, i64* @optind
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 %22
store i8** %24, i8*** %5
%25 = load i64, i64* @optind
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = sub nsw i64 %27, %25
%29 = trunc i64 %28 to i32
store i32 %29, i32* %4
br label %30
30: ; preds = %53, %21
%31 = load i8**, i8*** %5
%32 = load i8*, i8** %31
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i32, i32* %7
%36 = icmp eq i32 %35, 1
br label %37
37: ; preds = %34, %30
%38 = phi i1 [ false, %30 ], [ %36, %34 ]
br i1 %38, label %39, label %56
39: ; preds = %37
br label %40
40: ; preds = %46, %39
%41 = load i8**, i8*** %5
%42 = load i8*, i8** %41
%43 = load i32, i32* @F_OK
%44 = call i32 @access(i8* %42, i32 %43)
%45 = icmp ne i32 %44, -1
br i1 %45, label %46, label %53
46: ; preds = %40
%47 = load i8**, i8*** %5
%48 = load i8*, i8** %47
%49 = call i32 @remove_pattern(i8* %48)
%50 = load i8**, i8*** %5
%51 = load i8*, i8** %50
%52 = call i32 @remove(i8* %51)
br label %40
53: ; preds = %40
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i32 1
store i8** %55, i8*** %5
br label %30
56: ; preds = %37
%57 = load i32, i32* %7
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %70
59: ; preds = %56
br label %60
60: ; preds = %64, %59
%61 = load i8**, i8*** %5
%62 = load i8*, i8** %61
%63 = icmp ne i8* %62, null
br i1 %63, label %64, label %69
64: ; preds = %60
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i32 1
store i8** %66, i8*** %5
%67 = load i8*, i8** %65
%68 = call i32 @remove(i8* %67)
br label %60
69: ; preds = %60
br label %70
70: ; preds = %69, %56
store i32 0, i32* %3
br label %71
71: ; preds = %70, %17
%72 = load i32, i32* %3
ret i32 %72
}

LLVM IR (-O2):
@.str = [4 x i8] c"rRh\00"
@optind = global i64 0
@F_OK = global i32 0
@str = [20 x i8] c" rm -rR [TARGET(S)]\00"
define i32 @main(i32 %0, i8** %1) {
br label %4
3: ; preds = %6, %6
br label %4
4: ; preds = %3, %2
%5 = phi i1 [ false, %2 ], [ true, %3 ]
br label %6
6: ; preds = %4, %6
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
switch i32 %7, label %6 [
i32 -1, label %10
i32 114, label %3
i32 82, label %3
i32 104, label %8
]
8: ; preds = %6
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %45
10: ; preds = %6
%11 = load i64, i64* @optind
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = icmp ne i8* %13, null
%15 = and i1 %14, %5
br i1 %15, label %16, label %35
16: ; preds = %10, %31
%17 = phi i8* [ %33, %31 ], [ %13, %10 ]
%18 = phi i8** [ %32, %31 ], [ %12, %10 ]
%19 = load i32, i32* @F_OK
%20 = tail call i32 @access(i8* %17, i32 %19)
%21 = icmp eq i32 %20, -1
br i1 %21, label %31, label %22
22: ; preds = %16, %22
%23 = load i8*, i8** %18
%24 = tail call i32 @remove_pattern(i8* %23)
%25 = load i8*, i8** %18
%26 = tail call i32 @remove(i8* %25)
%27 = load i8*, i8** %18
%28 = load i32, i32* @F_OK
%29 = tail call i32 @access(i8* %27, i32 %28)
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %22
31: ; preds = %22, %16
%32 = getelementptr inbounds i8*, i8** %18, i64 1
%33 = load i8*, i8** %32
%34 = icmp eq i8* %33, null
br i1 %34, label %45, label %16
35: ; preds = %10
%36 = icmp eq i8* %13, null
%37 = select i1 %5, i1 true, i1 %36
br i1 %37, label %45, label %38
38: ; preds = %35, %38
%39 = phi i8* [ %43, %38 ], [ %13, %35 ]
%40 = phi i8** [ %41, %38 ], [ %12, %35 ]
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = tail call i32 @remove(i8* %39)
%43 = load i8*, i8** %41
%44 = icmp eq i8* %43, null
br i1 %44, label %45, label %38
45: ; preds = %38, %31, %35, %8
ret i32 0
}