#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*/ op_chdir(unsigned int);
int /*<<< orphan*/ op_chdirup();
int /*<<< orphan*/ op_rmdir(unsigned int);
int /*<<< orphan*/ op_unlink(unsigned int);
void wl_rmtree_sub(unsigned depth) {
  unsigned i, numthings = 4;
  for (i = 0; i < numthings; i++) {
    if (i < depth) {
      op_unlink(i);
    } else {
      if (depth < numthings) {
        op_chdir(i);
        wl_rmtree_sub(depth + 1);
        op_chdirup();
      }
      op_rmdir(i);
    }
  }
}


x86 assembly (clang, -O0):
<wl_rmtree_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x4,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11cf <wl_rmtree_sub+0x7f>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    118e <wl_rmtree_sub+0x3e>
mov    -0x8(%rbp),%edi
call   1040 <op_unlink@plt>
jmp    11bc <wl_rmtree_sub+0x6c>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11b4 <wl_rmtree_sub+0x64>
mov    -0x8(%rbp),%edi
call   1070 <op_chdir@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1060 <wl_rmtree_sub@plt>
mov    $0x0,%al
call   1050 <op_chdirup@plt>
mov    -0x8(%rbp),%edi
call   1030 <op_rmdir@plt>
jmp    11c1 <wl_rmtree_sub+0x71>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1169 <wl_rmtree_sub+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_rmtree_sub>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x1(%rbx),%ebp
test   %edi,%edi
je     1196 <wl_rmtree_sub+0x46>
xor    %edi,%edi
call   1040 <op_unlink@plt>
cmp    $0x1,%ebx
je     11b2 <wl_rmtree_sub+0x62>
mov    $0x1,%edi
call   1040 <op_unlink@plt>
cmp    $0x2,%ebx
jbe    11d4 <wl_rmtree_sub+0x84>
mov    $0x2,%edi
call   1040 <op_unlink@plt>
cmp    $0x3,%ebx
je     11f6 <wl_rmtree_sub+0xa6>
mov    $0x3,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <op_unlink@plt>
xor    %edi,%edi
call   1070 <op_chdir@plt>
mov    %ebp,%edi
call   1060 <wl_rmtree_sub@plt>
xor    %eax,%eax
call   1050 <op_chdirup@plt>
xor    %edi,%edi
call   1030 <op_rmdir@plt>
mov    $0x1,%edi
call   1070 <op_chdir@plt>
mov    %ebp,%edi
call   1060 <wl_rmtree_sub@plt>
xor    %eax,%eax
call   1050 <op_chdirup@plt>
mov    $0x1,%edi
call   1030 <op_rmdir@plt>
mov    $0x2,%edi
call   1070 <op_chdir@plt>
mov    %ebp,%edi
call   1060 <wl_rmtree_sub@plt>
xor    %eax,%eax
call   1050 <op_chdirup@plt>
mov    $0x2,%edi
call   1030 <op_rmdir@plt>
mov    $0x3,%edi
call   1070 <op_chdir@plt>
mov    %ebp,%edi
call   1060 <wl_rmtree_sub@plt>
xor    %eax,%eax
call   1050 <op_chdirup@plt>
mov    $0x3,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <op_rmdir@plt>

LLVM IR (-O0):
define void @wl_rmtree_sub(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 4, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %30, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = icmp ult i32 %6, %7
br i1 %8, label %9, label %33
9: ; preds = %5
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp ult i32 %10, %11
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %3
%15 = call i32 @op_unlink(i32 %14)
br label %29
16: ; preds = %9
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = icmp ult i32 %17, %18
br i1 %19, label %20, label %26
20: ; preds = %16
%21 = load i32, i32* %3
%22 = call i32 @op_chdir(i32 %21)
%23 = load i32, i32* %2
%24 = add i32 %23, 1
%25 = call i32 (...) @op_chdirup()
br label %26
26: ; preds = %20, %16
%27 = load i32, i32* %3
%28 = call i32 @op_rmdir(i32 %27)
br label %29
29: ; preds = %26, %13
br label %30
30: ; preds = %29
%31 = load i32, i32* %3
%32 = add i32 %31, 1
store i32 %32, i32* %3
br label %5
33: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @wl_rmtree_sub(i32 %0) {
%2 = add i32 %0, 1
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @op_chdir(i32 0)
tail call void @wl_rmtree_sub(i32 %2)
%6 = tail call i32 (...) @op_chdirup()
%7 = tail call i32 @op_rmdir(i32 0)
br label %11
8: ; preds = %1
%9 = tail call i32 @op_unlink(i32 0)
%10 = icmp eq i32 %0, 1
br i1 %10, label %11, label %15
11: ; preds = %8, %4
%12 = tail call i32 @op_chdir(i32 1)
tail call void @wl_rmtree_sub(i32 %2)
%13 = tail call i32 (...) @op_chdirup()
%14 = tail call i32 @op_rmdir(i32 1)
br label %18
15: ; preds = %8
%16 = tail call i32 @op_unlink(i32 1)
%17 = icmp ugt i32 %0, 2
br i1 %17, label %22, label %18
18: ; preds = %15, %11
%19 = tail call i32 @op_chdir(i32 2)
tail call void @wl_rmtree_sub(i32 %2)
%20 = tail call i32 (...) @op_chdirup()
%21 = tail call i32 @op_rmdir(i32 2)
br label %25
22: ; preds = %15
%23 = tail call i32 @op_unlink(i32 2)
%24 = icmp eq i32 %0, 3
br i1 %24, label %25, label %29
25: ; preds = %18, %22
%26 = tail call i32 @op_chdir(i32 3)
tail call void @wl_rmtree_sub(i32 %2)
%27 = tail call i32 (...) @op_chdirup()
%28 = tail call i32 @op_rmdir(i32 3)
br label %31
29: ; preds = %22
%30 = tail call i32 @op_unlink(i32 3)
br label %31
31: ; preds = %29, %25
ret void
}