#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*/ LC_ALL;
int /*<<< orphan*/ exit(int);
int getopt(int, char **, char *);
scalar_t__ optind;
int rm_path(char *);
scalar_t__ rmdir(char *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ setprogname(char *);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ warn(char *, char *);
int main(int argc, char *argv[]) {
  int ch, errors, pflag;
  setprogname(argv[0]);
  (void)setlocale(LC_ALL, "");
  pflag = 0;
  while ((ch = getopt(argc, argv, "p")) != -1)
    switch (ch) {
    case 'p':
      pflag = 1;
      break;
    case '?':
    default:
      usage();
    }
  argc -= optind;
  argv += optind;
  if (argc == 0)
    usage();
  for (errors = 0; *argv; argv++) {
    if (rmdir(*argv) < 0) {
      warn("%s", *argv);
      errors = 1;
    } else if (pflag)
      errors |= rm_path(*argv);
  }
  exit(errors);
}


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)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10a0 <setprogname@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    0xe4f(%rip),%rsi
call   1060 <setlocale@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe34(%rip),%rdx
call   1080 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     121f <main+0x9f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x3f,%eax
je     120e <main+0x8e>
jmp    11f1 <main+0x71>
mov    -0x20(%rbp),%eax
sub    $0x70,%eax
jne    1213 <main+0x93>
jmp    1202 <main+0x82>
movl   $0x1,-0x1c(%rbp)
jmp    121a <main+0x9a>
jmp    1213 <main+0x93>
mov    $0x0,%al
call   1070 <usage@plt>
jmp    11be <main+0x3e>
mov    0x2dc2(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2dae(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    125a <main+0xda>
mov    $0x0,%al
call   1070 <usage@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     12db <main+0x15b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <rmdir@plt>
cmp    $0x0,%rax
jge    12a4 <main+0x124>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd6f(%rip),%rdi
call   1030 <warn@plt>
movl   $0x1,-0x18(%rbp)
jmp    12c5 <main+0x145>
cmpl   $0x0,-0x1c(%rbp)
je     12c0 <main+0x140>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <rm_path@plt>
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    12c5 <main+0x145>
jmp    12ca <main+0x14a>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1261 <main+0xe1>
mov    -0x18(%rbp),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    (%rsi),%rdi
call   10a0 <setprogname@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
call   1060 <setlocale@plt>
mov    $0x1,%r15b
lea    0xe4d(%rip),%r14
jmp    11c0 <main+0x40>
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1080 <getopt@plt>
cmp    $0x70,%eax
je     11b5 <main+0x35>
cmp    $0xffffffff,%eax
je     11e0 <main+0x60>
xor    %eax,%eax
call   1070 <usage@plt>
jmp    11c0 <main+0x40>
mov    0x2e01(%rip),%rax
mov    (%rax),%rax
lea    (%rbx,%rax,8),%rbx
cmp    %ebp,%eax
jne    11f9 <main+0x79>
xor    %eax,%eax
call   1070 <usage@plt>
mov    (%rbx),%rdi
xor    %ebp,%ebp
test   %rdi,%rdi
jne    120a <main+0x8a>
mov    %ebp,%edi
call   1090 <exit@plt>
xor    %ebp,%ebp
lea    0xdef(%rip),%r14
jmp    123d <main+0xbd>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx),%rsi
mov    %r14,%rdi
call   1030 <warn@plt>
mov    $0x1,%ebp
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     1203 <main+0x83>
call   1040 <rmdir@plt>
test   %rax,%rax
js     1220 <main+0xa0>
test   $0x1,%r15b
jne    1230 <main+0xb0>
mov    (%rbx),%rdi
call   1050 <rm_path@plt>
or     %eax,%ebp
jmp    1230 <main+0xb0>

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"p\00"
@optind = global i64 0
@.str.2 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @setprogname(i8* %11)
%13 = load i32, i32* @LC_ALL
%14 = call i32 @setlocale(i32 %13, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %8
br label %15
15: ; preds = %26, %2
%16 = load i32, i32* %4
%17 = load i8**, i8*** %5
%18 = call i32 @getopt(i32 %16, i8** %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 %18, i32* %6
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %27
20: ; preds = %15
%21 = load i32, i32* %6
switch i32 %21, label %24 [
i32 112, label %22
i32 63, label %23
]
22: ; preds = %20
store i32 1, i32* %8
br label %26
23: ; preds = %20
br label %24
24: ; preds = %20, %23
%25 = call i32 (...) @usage()
br label %26
26: ; preds = %24, %22
br label %15
27: ; preds = %15
%28 = load i64, i64* @optind
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = sub nsw i64 %30, %28
%32 = trunc i64 %31 to i32
store i32 %32, i32* %4
%33 = load i64, i64* @optind
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 %33
store i8** %35, i8*** %5
%36 = load i32, i32* %4
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %27
%39 = call i32 (...) @usage()
br label %40
40: ; preds = %38, %27
store i32 0, i32* %7
br label %41
41: ; preds = %65, %40
%42 = load i8**, i8*** %5
%43 = load i8*, i8** %42
%44 = icmp ne i8* %43, null
br i1 %44, label %45, label %68
45: ; preds = %41
%46 = load i8**, i8*** %5
%47 = load i8*, i8** %46
%48 = call i64 @rmdir(i8* %47)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %45
%51 = load i8**, i8*** %5
%52 = load i8*, i8** %51
%53 = call i32 @warn(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %52)
store i32 1, i32* %7
br label %64
54: ; preds = %45
%55 = load i32, i32* %8
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %63
57: ; preds = %54
%58 = load i8**, i8*** %5
%59 = load i8*, i8** %58
%60 = call i32 @rm_path(i8* %59)
%61 = load i32, i32* %7
%62 = or i32 %61, %60
store i32 %62, i32* %7
br label %63
63: ; preds = %57, %54
br label %64
64: ; preds = %63, %50
br label %65
65: ; preds = %64
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i32 1
store i8** %67, i8*** %5
br label %41
68: ; preds = %41
%69 = load i32, i32* %7
%70 = call i32 @exit(i32 %69)
unreachable
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [2 x i8] c"p\00"
@optind = global i64 0
@.str.2 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @setprogname(i8* %3)
%5 = load i32, i32* @LC_ALL
%6 = tail call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %9, %2
%8 = phi i1 [ true, %2 ], [ false, %9 ]
br label %9
9: ; preds = %7, %11
%10 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
switch i32 %10, label %11 [
i32 -1, label %13
i32 112, label %7
]
11: ; preds = %9
%12 = tail call i32 (...) @usage()
br label %9
13: ; preds = %9
%14 = load i64, i64* @optind
%15 = trunc i64 %14 to i32
%16 = getelementptr inbounds i8*, i8** %1, i64 %14
%17 = icmp eq i32 %15, %0
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = tail call i32 (...) @usage()
br label %20
20: ; preds = %18, %13
%21 = load i8*, i8** %16
%22 = icmp eq i8* %21, null
br i1 %22, label %42, label %23
23: ; preds = %20, %37
%24 = phi i8* [ %40, %37 ], [ %21, %20 ]
%25 = phi i32 [ %38, %37 ], [ 0, %20 ]
%26 = phi i8** [ %39, %37 ], [ %16, %20 ]
%27 = tail call i64 @rmdir(i8* %24)
%28 = icmp slt i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %23
%30 = load i8*, i8** %26
%31 = tail call i32 @warn(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %30)
br label %37
32: ; preds = %23
br i1 %8, label %37, label %33
33: ; preds = %32
%34 = load i8*, i8** %26
%35 = tail call i32 @rm_path(i8* %34)
%36 = or i32 %35, %25
br label %37
37: ; preds = %29, %33, %32
%38 = phi i32 [ 1, %29 ], [ %36, %33 ], [ %25, %32 ]
%39 = getelementptr inbounds i8*, i8** %26, i64 1
%40 = load i8*, i8** %39
%41 = icmp eq i8* %40, null
br i1 %41, label %42, label %23
42: ; preds = %37, %20
%43 = phi i32 [ 0, %20 ], [ %38, %37 ]
%44 = tail call i32 @exit(i32 %43)
unreachable
}