#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
char EOF;
char getopt_long(int, char **, char *, struct option *, int *);
int /*<<< orphan*/ help();
int optind;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ rmdir(char *);
int /*<<< orphan*/ version();
int main(int argc, char *argv[]) {
  int cmd_x;
  char optstring[] = "hva";
  int opt_a = 0;
  int i;
  char optch;
  struct option long_opts[] = {{"help", 0, 0, 'h'},
                               {"version", 0, 0, 'v'},
                               {"all", 0, 0, 'a'},
                               {NULL, 0, 0, 0}};
  while ((optch = getopt_long(argc, argv, optstring, long_opts, &cmd_x)) !=
         EOF) {
    switch (optch) {
    case 'h':
      help();
      return 0;
    case 'v':
      version();
      return 0;
    case 'a':
      opt_a = 1;
      break;
    default:
      printf("-%c: unkown option\n", optch);
      break;
    }
  }
  if (argc - optind < 1) {
    printf("Incomplete inputs\n");
    return 0;
  }
  for (i = optind; i < argc; i++) {
    if (rmdir(argv[i]) != 0) {
      perror(argv[i]);
      continue;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe71(%rip),%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x60,%edx
call   1060 <memset@plt>
lea    0xe51(%rip),%rax
mov    %rax,-0x90(%rbp)
movl   $0x68,-0x80(%rbp)
lea    0xe41(%rip),%rax
mov    %rax,-0x78(%rbp)
movl   $0x76,-0x68(%rbp)
lea    0xe37(%rip),%rax
mov    %rax,-0x60(%rbp)
movl   $0x61,-0x50(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x90(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <getopt_long@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%eax
mov    0x2ddb(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     12a1 <main+0x131>
movsbl -0x21(%rbp),%eax
mov    %eax,-0x94(%rbp)
sub    $0x61,%eax
je     127e <main+0x10e>
jmp    1230 <main+0xc0>
mov    -0x94(%rbp),%eax
sub    $0x68,%eax
je     1258 <main+0xe8>
jmp    1244 <main+0xd4>
mov    -0x94(%rbp),%eax
sub    $0x76,%eax
je     126b <main+0xfb>
jmp    128a <main+0x11a>
mov    $0x0,%al
call   1090 <help@plt>
movl   $0x0,-0x4(%rbp)
jmp    1333 <main+0x1c3>
mov    $0x0,%al
call   1070 <version@plt>
movl   $0x0,-0x4(%rbp)
jmp    1333 <main+0x1c3>
movl   $0x1,-0x1c(%rbp)
jmp    129c <main+0x12c>
movsbl -0x21(%rbp),%esi
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11e5 <main+0x75>
mov    -0x8(%rbp),%eax
mov    0x2d35(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x1,%eax
jge    12d0 <main+0x160>
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1333 <main+0x1c3>
mov    0x2d09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    132c <main+0x1bc>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <rmdir@plt>
cmp    $0x0,%rax
je     1319 <main+0x1a9>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1080 <perror@plt>
jmp    131e <main+0x1ae>
jmp    131e <main+0x1ae>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12dc <main+0x16c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%r14
mov    %edi,%r15d
movl   $0x617668,0x8(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
lea    0xe4c(%rip),%rax
mov    %rax,0x10(%rsp)
movl   $0x68,0x20(%rsp)
lea    0xe3d(%rip),%rax
mov    %rax,0x28(%rsp)
movl   $0x76,0x38(%rsp)
lea    0xe31(%rip),%rax
mov    %rax,0x40(%rsp)
movl   $0x61,0x50(%rsp)
lea    0x8(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
call   1050 <getopt_long@plt>
mov    0x2de4(%rip),%rbp
cmp    0x0(%rbp),%al
jne    1258 <main+0xe8>
mov    0x2dd0(%rip),%rax
movslq (%rax),%rax
cmp    %r15d,%eax
jge    12ab <main+0x13b>
lea    (%r14,%rax,8),%rbp
sub    %eax,%r15d
xor    %ebx,%ebx
jmp    123d <main+0xcd>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %ebx,%r15d
je     12c9 <main+0x159>
mov    0x0(%rbp,%rbx,8),%rdi
call   1040 <rmdir@plt>
test   %rax,%rax
je     1230 <main+0xc0>
mov    0x0(%rbp,%rbx,8),%rdi
call   1080 <perror@plt>
jmp    1230 <main+0xc0>
lea    0x8(%rsp),%rbx
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
jmp    1289 <main+0x119>
nopl   0x0(%rax)
mov    %r15d,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r13,%r8
call   1050 <getopt_long@plt>
cmp    0x0(%rbp),%al
je     1209 <main+0x99>
movsbl %al,%esi
cmp    $0x61,%esi
je     1270 <main+0x100>
cmp    $0x76,%esi
je     12b9 <main+0x149>
cmp    $0x68,%esi
je     12c2 <main+0x152>
lea    0xd6f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1270 <main+0x100>
lea    0xd73(%rip),%rdi
call   1030 <puts@plt>
jmp    12c9 <main+0x159>
xor    %eax,%eax
call   1070 <version@plt>
jmp    12c9 <main+0x159>
xor    %eax,%eax
call   1090 <help@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
@__const.main.optstring = [4 x i8] c"hva\00"
@.str = [5 x i8] c"help\00"
@.str.1 = [8 x i8] c"version\00"
@.str.2 = [4 x i8] c"all\00"
@EOF = global i8 0
@.str.3 = [20 x i8] c"-%c: unkown option\0A\00"
@optind = global i32 0
@.str.4 = [19 x i8] c"Incomplete inputs\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [4 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca [4 x %struct.option]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = bitcast [4 x i8]* %7 to i8*
store i32 0, i32* %8
%13 = bitcast [4 x %struct.option]* %11 to i8*
%14 = bitcast i8* %13 to [4 x %struct.option]*
%15 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %14, i32 0, i32 0
%16 = getelementptr inbounds %struct.option, %struct.option* %15, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8** %16
%17 = getelementptr inbounds %struct.option, %struct.option* %15, i32 0, i32 3
store i32 104, i32* %17
%18 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %14, i32 0, i32 1
%19 = getelementptr inbounds %struct.option, %struct.option* %18, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8** %19
%20 = getelementptr inbounds %struct.option, %struct.option* %18, i32 0, i32 3
store i32 118, i32* %20
%21 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %14, i32 0, i32 2
%22 = getelementptr inbounds %struct.option, %struct.option* %21, i32 0, i32 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8** %22
%23 = getelementptr inbounds %struct.option, %struct.option* %21, i32 0, i32 3
store i32 97, i32* %23
br label %24
24: ; preds = %46, %2
%25 = load i32, i32* %4
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%28 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %11, i64 0, i64 0
%29 = call signext i8 @getopt_long(i32 %25, i8** %26, i8* %27, %struct.option* %28, i32* %6)
store i8 %29, i8* %10
%30 = sext i8 %29 to i32
%31 = load i8, i8* @EOF
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %30, %32
br i1 %33, label %34, label %47
34: ; preds = %24
%35 = load i8, i8* %10
%36 = sext i8 %35 to i32
switch i32 %36, label %42 [
i32 104, label %37
i32 118, label %39
i32 97, label %41
]
37: ; preds = %34
%38 = call i32 (...) @help()
store i32 0, i32* %3
br label %80
39: ; preds = %34
%40 = call i32 (...) @version()
store i32 0, i32* %3
br label %80
41: ; preds = %34
store i32 1, i32* %8
br label %46
42: ; preds = %34
%43 = load i8, i8* %10
%44 = sext i8 %43 to i32
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %42, %41
br label %24
47: ; preds = %24
%48 = load i32, i32* %4
%49 = load i32, i32* @optind
%50 = sub nsw i32 %48, %49
%51 = icmp slt i32 %50, 1
br i1 %51, label %52, label %54
52: ; preds = %47
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %80
54: ; preds = %47
%55 = load i32, i32* @optind
store i32 %55, i32* %9
br label %56
56: ; preds = %76, %54
%57 = load i32, i32* %9
%58 = load i32, i32* %4
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %79
60: ; preds = %56
%61 = load i8**, i8*** %5
%62 = load i32, i32* %9
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8*, i8** %61, i64 %63
%65 = load i8*, i8** %64
%66 = call i64 @rmdir(i8* %65)
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %75
68: ; preds = %60
%69 = load i8**, i8*** %5
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %69, i64 %71
%73 = load i8*, i8** %72
%74 = call i32 @perror(i8* %73)
br label %76
75: ; preds = %60
br label %76
76: ; preds = %75, %68
%77 = load i32, i32* %9
%78 = add nsw i32 %77, 1
store i32 %78, i32* %9
br label %56
79: ; preds = %56
store i32 0, i32* %3
br label %80
80: ; preds = %79, %52, %39, %37
%81 = load i32, i32* %3
ret i32 %81
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@.str = [5 x i8] c"help\00"
@.str.1 = [8 x i8] c"version\00"
@.str.2 = [4 x i8] c"all\00"
@EOF = global i8 0
@.str.3 = [20 x i8] c"-%c: unkown option\0A\00"
@optind = global i32 0
@str = [18 x i8] c"Incomplete inputs\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [4 x %struct.option]
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
store i32 6387304, i32* %4
%8 = bitcast [4 x %struct.option]* %5 to i8*
%9 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %5, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %5, i64 0, i64 0, i32 3
store i32 104, i32* %10
%11 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %5, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %11
%12 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %5, i64 0, i64 1, i32 3
store i32 118, i32* %12
%13 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %5, i64 0, i64 2, i32 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %13
%14 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %5, i64 0, i64 2, i32 3
store i32 97, i32* %14
%15 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %5, i64 0, i64 0
%16 = call signext i8 @getopt_long(i32 %0, i8** %1, i8* %7, %struct.option* %15, i32* %3)
%17 = load i8, i8* @EOF
%18 = icmp eq i8 %16, %17
br i1 %18, label %32, label %19
19: ; preds = %2, %28
%20 = phi i8 [ %29, %28 ], [ %16, %2 ]
%21 = sext i8 %20 to i32
switch i32 %21, label %26 [
i32 104, label %22
i32 118, label %24
i32 97, label %28
]
22: ; preds = %19
%23 = call i32 (...) @help()
br label %52
24: ; preds = %19
%25 = call i32 (...) @version()
br label %52
26: ; preds = %19
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %21)
br label %28
28: ; preds = %19, %26
%29 = call signext i8 @getopt_long(i32 %0, i8** %1, i8* %7, %struct.option* %15, i32* %3)
%30 = load i8, i8* @EOF
%31 = icmp eq i8 %29, %30
br i1 %31, label %32, label %19
32: ; preds = %28, %2
%33 = load i32, i32* @optind
%34 = icmp slt i32 %33, %0
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = sext i32 %33 to i64
br label %39
37: ; preds = %32
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %52
39: ; preds = %35, %48
%40 = phi i64 [ %36, %35 ], [ %49, %48 ]
%41 = getelementptr inbounds i8*, i8** %1, i64 %40
%42 = load i8*, i8** %41
%43 = call i64 @rmdir(i8* %42)
%44 = icmp eq i64 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %39
%46 = load i8*, i8** %41
%47 = call i32 @perror(i8* %46)
br label %48
48: ; preds = %39, %45
%49 = add nsw i64 %40, 1
%50 = trunc i64 %49 to i32
%51 = icmp eq i32 %50, %0
br i1 %51, label %52, label %39
52: ; preds = %48, %37, %24, %22
ret i32 0
}