#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
scalar_t__ rmdir_recursive(char *);
int main(int argc, char **argv) {
  int exitval = EXIT_SUCCESS;
  int i;
  for (i = 1; i < argc; i++)
    if (rmdir_recursive(argv[i])) {
      perror(argv[i]);
      exitval = EXIT_FAILURE;
    }
  exit(exitval);
}


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    0x2e8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b0 <main+0x80>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <rmdir_recursive@plt>
cmp    $0x0,%rax
je     119d <main+0x6d>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <perror@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    11a2 <main+0x72>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1159 <main+0x29>
mov    -0x14(%rbp),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2e99(%rip),%rax
mov    (%rax),%r14d
cmp    $0x2,%edi
jl     1186 <main+0x56>
mov    %rsi,%r15
mov    %edi,%ebp
mov    $0x1,%ebx
mov    0x2e88(%rip),%r12
jmp    1169 <main+0x39>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1186 <main+0x56>
mov    (%r15,%rbx,8),%rdi
call   1030 <rmdir_recursive@plt>
test   %rax,%rax
je     1160 <main+0x30>
mov    (%r15,%rbx,8),%rdi
call   1040 <perror@plt>
mov    (%r12),%r14d
jmp    1160 <main+0x30>
mov    %r14d,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = 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
%8 = load i32, i32* @EXIT_SUCCESS
store i32 %8, i32* %6
store i32 1, i32* %7
br label %9
9: ; preds = %30, %2
%10 = load i32, i32* %7
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %33
13: ; preds = %9
%14 = load i8**, i8*** %5
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
%18 = load i8*, i8** %17
%19 = call i64 @rmdir_recursive(i8* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %13
%22 = load i8**, i8*** %5
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @perror(i8* %26)
%28 = load i32, i32* @EXIT_FAILURE
store i32 %28, i32* %6
br label %29
29: ; preds = %21, %13
br label %30
30: ; preds = %29
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %9
33: ; preds = %9
%34 = load i32, i32* %6
%35 = call i32 @exit(i32 %34)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @EXIT_SUCCESS
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %22
5: ; preds = %2
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %5, %18
%8 = phi i64 [ 1, %5 ], [ %20, %18 ]
%9 = phi i32 [ %3, %5 ], [ %19, %18 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %8
%11 = load i8*, i8** %10
%12 = tail call i64 @rmdir_recursive(i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %7
%15 = load i8*, i8** %10
%16 = tail call i32 @perror(i8* %15)
%17 = load i32, i32* @EXIT_FAILURE
br label %18
18: ; preds = %7, %14
%19 = phi i32 [ %17, %14 ], [ %9, %7 ]
%20 = add nuw nsw i64 %8, 1
%21 = icmp eq i64 %20, %6
br i1 %21, label %22, label %7
22: ; preds = %18, %2
%23 = phi i32 [ %3, %2 ], [ %19, %18 ]
%24 = tail call i32 @exit(i32 %23)
unreachable
}