#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 dir {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ op_closedir(struct dir *);
int /*<<< orphan*/ op_mkdir(unsigned int);
struct dir *op_opendir(unsigned int);
int /*<<< orphan*/ op_rmdir(unsigned int);
int /*<<< orphan*/ op_sync();
int /*<<< orphan*/ writeemptyfile(unsigned int);
void wl_rmmanydirdelayed(void) {
  unsigned numdirs = 27;
  struct dir *dirs[27];
  unsigned i;
  for (i = 0; i < numdirs; i++) {
    op_mkdir(i);
  }
  writeemptyfile(numdirs);
  op_sync();
  for (i = 0; i < numdirs; i++) {
    dirs[i] = op_opendir(i);
  }
  for (i = 0; i < numdirs; i++) {
    op_rmdir(i);
  }
  for (i = 0; i < numdirs; i++) {
    op_closedir(dirs[i]);
  }
}


x86 assembly (clang, -O0):
<wl_rmmanydirdelayed>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x1b,-0x4(%rbp)
movl   $0x0,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    11aa <wl_rmmanydirdelayed+0x4a>
mov    -0xe4(%rbp),%edi
call   1040 <op_mkdir@plt>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    117c <wl_rmmanydirdelayed+0x1c>
mov    -0x4(%rbp),%edi
call   1030 <writeemptyfile@plt>
mov    $0x0,%al
call   1080 <op_sync@plt>
movl   $0x0,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1202 <wl_rmmanydirdelayed+0xa2>
mov    -0xe4(%rbp),%edi
call   1060 <op_opendir@plt>
mov    %rax,%rcx
mov    -0xe4(%rbp),%eax
mov    %rcx,-0xe0(%rbp,%rax,8)
ff
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    11c3 <wl_rmmanydirdelayed+0x63>
movl   $0x0,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    123a <wl_rmmanydirdelayed+0xda>
mov    -0xe4(%rbp),%edi
call   1050 <op_rmdir@plt>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    120c <wl_rmmanydirdelayed+0xac>
movl   $0x0,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    127a <wl_rmmanydirdelayed+0x11a>
mov    -0xe4(%rbp),%eax
mov    -0xe0(%rbp,%rax,8),%rdi
ff
call   1070 <op_closedir@plt>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1244 <wl_rmmanydirdelayed+0xe4>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_rmmanydirdelayed>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
xor    %edi,%edi
call   1040 <op_mkdir@plt>
mov    $0x1,%edi
call   1040 <op_mkdir@plt>
mov    $0x2,%edi
call   1040 <op_mkdir@plt>
mov    $0x3,%edi
call   1040 <op_mkdir@plt>
mov    $0x4,%edi
call   1040 <op_mkdir@plt>
mov    $0x5,%edi
call   1040 <op_mkdir@plt>
mov    $0x6,%edi
call   1040 <op_mkdir@plt>
mov    $0x7,%edi
call   1040 <op_mkdir@plt>
mov    $0x8,%edi
call   1040 <op_mkdir@plt>
mov    $0x9,%edi
call   1040 <op_mkdir@plt>
mov    $0xa,%edi
call   1040 <op_mkdir@plt>
mov    $0xb,%edi
call   1040 <op_mkdir@plt>
mov    $0xc,%edi
call   1040 <op_mkdir@plt>
mov    $0xd,%edi
call   1040 <op_mkdir@plt>
mov    $0xe,%edi
call   1040 <op_mkdir@plt>
mov    $0xf,%edi
call   1040 <op_mkdir@plt>
mov    $0x10,%edi
call   1040 <op_mkdir@plt>
mov    $0x11,%edi
call   1040 <op_mkdir@plt>
mov    $0x12,%edi
call   1040 <op_mkdir@plt>
mov    $0x13,%edi
call   1040 <op_mkdir@plt>
mov    $0x14,%edi
call   1040 <op_mkdir@plt>
mov    $0x15,%edi
call   1040 <op_mkdir@plt>
mov    $0x16,%edi
call   1040 <op_mkdir@plt>
mov    $0x17,%edi
call   1040 <op_mkdir@plt>
mov    $0x18,%edi
call   1040 <op_mkdir@plt>
mov    $0x19,%edi
call   1040 <op_mkdir@plt>
mov    $0x1a,%edi
call   1040 <op_mkdir@plt>
mov    $0x1b,%edi
call   1030 <writeemptyfile@plt>
xor    %eax,%eax
call   1080 <op_sync@plt>
xor    %edi,%edi
call   1060 <op_opendir@plt>
mov    %rax,0xa0(%rsp)
mov    $0x1,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x98(%rsp)
mov    $0x2,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x90(%rsp)
mov    $0x3,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x88(%rsp)
mov    $0x4,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x80(%rsp)
mov    $0x5,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x78(%rsp)
mov    $0x6,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x70(%rsp)
mov    $0x7,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x68(%rsp)
mov    $0x8,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x60(%rsp)
mov    $0x9,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x58(%rsp)
mov    $0xa,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x50(%rsp)
mov    $0xb,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x48(%rsp)
mov    $0xc,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x40(%rsp)
mov    $0xd,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x38(%rsp)
mov    $0xe,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x30(%rsp)
mov    $0xf,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x28(%rsp)
mov    $0x10,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x20(%rsp)
mov    $0x11,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x18(%rsp)
mov    $0x12,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x10(%rsp)
mov    $0x13,%edi
call   1060 <op_opendir@plt>
mov    %rax,0x8(%rsp)
mov    $0x14,%edi
call   1060 <op_opendir@plt>
mov    %rax,(%rsp)
mov    $0x15,%edi
call   1060 <op_opendir@plt>
mov    %rax,%r13
mov    $0x16,%edi
call   1060 <op_opendir@plt>
mov    %rax,%rbx
mov    $0x17,%edi
call   1060 <op_opendir@plt>
mov    %rax,%rbp
mov    $0x18,%edi
call   1060 <op_opendir@plt>
mov    %rax,%r14
mov    $0x19,%edi
call   1060 <op_opendir@plt>
mov    %rax,%r15
mov    $0x1a,%edi
call   1060 <op_opendir@plt>
mov    %rax,%r12
xor    %edi,%edi
call   1050 <op_rmdir@plt>
mov    $0x1,%edi
call   1050 <op_rmdir@plt>
mov    $0x2,%edi
call   1050 <op_rmdir@plt>
mov    $0x3,%edi
call   1050 <op_rmdir@plt>
mov    $0x4,%edi
call   1050 <op_rmdir@plt>
mov    $0x5,%edi
call   1050 <op_rmdir@plt>
mov    $0x6,%edi
call   1050 <op_rmdir@plt>
mov    $0x7,%edi
call   1050 <op_rmdir@plt>
mov    $0x8,%edi
call   1050 <op_rmdir@plt>
mov    $0x9,%edi
call   1050 <op_rmdir@plt>
mov    $0xa,%edi
call   1050 <op_rmdir@plt>
mov    $0xb,%edi
call   1050 <op_rmdir@plt>
mov    $0xc,%edi
call   1050 <op_rmdir@plt>
mov    $0xd,%edi
call   1050 <op_rmdir@plt>
mov    $0xe,%edi
call   1050 <op_rmdir@plt>
mov    $0xf,%edi
call   1050 <op_rmdir@plt>
mov    $0x10,%edi
call   1050 <op_rmdir@plt>
mov    $0x11,%edi
call   1050 <op_rmdir@plt>
mov    $0x12,%edi
call   1050 <op_rmdir@plt>
mov    $0x13,%edi
call   1050 <op_rmdir@plt>
mov    $0x14,%edi
call   1050 <op_rmdir@plt>
mov    $0x15,%edi
call   1050 <op_rmdir@plt>
mov    $0x16,%edi
call   1050 <op_rmdir@plt>
mov    $0x17,%edi
call   1050 <op_rmdir@plt>
mov    $0x18,%edi
call   1050 <op_rmdir@plt>
mov    $0x19,%edi
call   1050 <op_rmdir@plt>
mov    $0x1a,%edi
call   1050 <op_rmdir@plt>
mov    0xa0(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x98(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x90(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x88(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x80(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x78(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x70(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x68(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x60(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x58(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x50(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x48(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x40(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x38(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x30(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x28(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x20(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x18(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x10(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    0x8(%rsp),%rdi
call   1070 <op_closedir@plt>
mov    (%rsp),%rdi
call   1070 <op_closedir@plt>
mov    %r13,%rdi
call   1070 <op_closedir@plt>
mov    %rbx,%rdi
call   1070 <op_closedir@plt>
mov    %rbp,%rdi
call   1070 <op_closedir@plt>
mov    %r14,%rdi
call   1070 <op_closedir@plt>
mov    %r15,%rdi
call   1070 <op_closedir@plt>
mov    %r12,%rdi
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <op_closedir@plt>

LLVM IR (-O0):
%struct.dir = type { i32 }
define void @wl_rmmanydirdelayed() {
%1 = alloca i32
%2 = alloca [27 x %struct.dir*]
%3 = alloca i32
store i32 27, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %3
%6 = load i32, i32* %1
%7 = icmp ult i32 %5, %6
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = load i32, i32* %3
%10 = call i32 @op_mkdir(i32 %9)
br label %11
11: ; preds = %8
%12 = load i32, i32* %3
%13 = add i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i32, i32* %1
%16 = call i32 @writeemptyfile(i32 %15)
%17 = call i32 (...) @op_sync()
store i32 0, i32* %3
br label %18
18: ; preds = %28, %14
%19 = load i32, i32* %3
%20 = load i32, i32* %1
%21 = icmp ult i32 %19, %20
br i1 %21, label %22, label %31
22: ; preds = %18
%23 = load i32, i32* %3
%24 = call %struct.dir* @op_opendir(i32 %23)
%25 = load i32, i32* %3
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds [27 x %struct.dir*], [27 x %struct.dir*]* %2, i64 0, i64 %26
store %struct.dir* %24, %struct.dir** %27
br label %28
28: ; preds = %22
%29 = load i32, i32* %3
%30 = add i32 %29, 1
store i32 %30, i32* %3
br label %18
31: ; preds = %18
store i32 0, i32* %3
br label %32
32: ; preds = %39, %31
%33 = load i32, i32* %3
%34 = load i32, i32* %1
%35 = icmp ult i32 %33, %34
br i1 %35, label %36, label %42
36: ; preds = %32
%37 = load i32, i32* %3
%38 = call i32 @op_rmdir(i32 %37)
br label %39
39: ; preds = %36
%40 = load i32, i32* %3
%41 = add i32 %40, 1
store i32 %41, i32* %3
br label %32
42: ; preds = %32
store i32 0, i32* %3
br label %43
43: ; preds = %53, %42
%44 = load i32, i32* %3
%45 = load i32, i32* %1
%46 = icmp ult i32 %44, %45
br i1 %46, label %47, label %56
47: ; preds = %43
%48 = load i32, i32* %3
%49 = zext i32 %48 to i64
%50 = getelementptr inbounds [27 x %struct.dir*], [27 x %struct.dir*]* %2, i64 0, i64 %49
%51 = load %struct.dir*, %struct.dir** %50
%52 = call i32 @op_closedir(%struct.dir* %51)
br label %53
53: ; preds = %47
%54 = load i32, i32* %3
%55 = add i32 %54, 1
store i32 %55, i32* %3
br label %43
56: ; preds = %43
ret void
}

LLVM IR (-O2):
%struct.dir = type { i32 }
define void @wl_rmmanydirdelayed() {
%1 = tail call i32 @op_mkdir(i32 0)
%2 = tail call i32 @op_mkdir(i32 1)
%3 = tail call i32 @op_mkdir(i32 2)
%4 = tail call i32 @op_mkdir(i32 3)
%5 = tail call i32 @op_mkdir(i32 4)
%6 = tail call i32 @op_mkdir(i32 5)
%7 = tail call i32 @op_mkdir(i32 6)
%8 = tail call i32 @op_mkdir(i32 7)
%9 = tail call i32 @op_mkdir(i32 8)
%10 = tail call i32 @op_mkdir(i32 9)
%11 = tail call i32 @op_mkdir(i32 10)
%12 = tail call i32 @op_mkdir(i32 11)
%13 = tail call i32 @op_mkdir(i32 12)
%14 = tail call i32 @op_mkdir(i32 13)
%15 = tail call i32 @op_mkdir(i32 14)
%16 = tail call i32 @op_mkdir(i32 15)
%17 = tail call i32 @op_mkdir(i32 16)
%18 = tail call i32 @op_mkdir(i32 17)
%19 = tail call i32 @op_mkdir(i32 18)
%20 = tail call i32 @op_mkdir(i32 19)
%21 = tail call i32 @op_mkdir(i32 20)
%22 = tail call i32 @op_mkdir(i32 21)
%23 = tail call i32 @op_mkdir(i32 22)
%24 = tail call i32 @op_mkdir(i32 23)
%25 = tail call i32 @op_mkdir(i32 24)
%26 = tail call i32 @op_mkdir(i32 25)
%27 = tail call i32 @op_mkdir(i32 26)
%28 = tail call i32 @writeemptyfile(i32 27)
%29 = tail call i32 (...) @op_sync()
%30 = tail call %struct.dir* @op_opendir(i32 0)
%31 = tail call %struct.dir* @op_opendir(i32 1)
%32 = tail call %struct.dir* @op_opendir(i32 2)
%33 = tail call %struct.dir* @op_opendir(i32 3)
%34 = tail call %struct.dir* @op_opendir(i32 4)
%35 = tail call %struct.dir* @op_opendir(i32 5)
%36 = tail call %struct.dir* @op_opendir(i32 6)
%37 = tail call %struct.dir* @op_opendir(i32 7)
%38 = tail call %struct.dir* @op_opendir(i32 8)
%39 = tail call %struct.dir* @op_opendir(i32 9)
%40 = tail call %struct.dir* @op_opendir(i32 10)
%41 = tail call %struct.dir* @op_opendir(i32 11)
%42 = tail call %struct.dir* @op_opendir(i32 12)
%43 = tail call %struct.dir* @op_opendir(i32 13)
%44 = tail call %struct.dir* @op_opendir(i32 14)
%45 = tail call %struct.dir* @op_opendir(i32 15)
%46 = tail call %struct.dir* @op_opendir(i32 16)
%47 = tail call %struct.dir* @op_opendir(i32 17)
%48 = tail call %struct.dir* @op_opendir(i32 18)
%49 = tail call %struct.dir* @op_opendir(i32 19)
%50 = tail call %struct.dir* @op_opendir(i32 20)
%51 = tail call %struct.dir* @op_opendir(i32 21)
%52 = tail call %struct.dir* @op_opendir(i32 22)
%53 = tail call %struct.dir* @op_opendir(i32 23)
%54 = tail call %struct.dir* @op_opendir(i32 24)
%55 = tail call %struct.dir* @op_opendir(i32 25)
%56 = tail call %struct.dir* @op_opendir(i32 26)
%57 = tail call i32 @op_rmdir(i32 0)
%58 = tail call i32 @op_rmdir(i32 1)
%59 = tail call i32 @op_rmdir(i32 2)
%60 = tail call i32 @op_rmdir(i32 3)
%61 = tail call i32 @op_rmdir(i32 4)
%62 = tail call i32 @op_rmdir(i32 5)
%63 = tail call i32 @op_rmdir(i32 6)
%64 = tail call i32 @op_rmdir(i32 7)
%65 = tail call i32 @op_rmdir(i32 8)
%66 = tail call i32 @op_rmdir(i32 9)
%67 = tail call i32 @op_rmdir(i32 10)
%68 = tail call i32 @op_rmdir(i32 11)
%69 = tail call i32 @op_rmdir(i32 12)
%70 = tail call i32 @op_rmdir(i32 13)
%71 = tail call i32 @op_rmdir(i32 14)
%72 = tail call i32 @op_rmdir(i32 15)
%73 = tail call i32 @op_rmdir(i32 16)
%74 = tail call i32 @op_rmdir(i32 17)
%75 = tail call i32 @op_rmdir(i32 18)
%76 = tail call i32 @op_rmdir(i32 19)
%77 = tail call i32 @op_rmdir(i32 20)
%78 = tail call i32 @op_rmdir(i32 21)
%79 = tail call i32 @op_rmdir(i32 22)
%80 = tail call i32 @op_rmdir(i32 23)
%81 = tail call i32 @op_rmdir(i32 24)
%82 = tail call i32 @op_rmdir(i32 25)
%83 = tail call i32 @op_rmdir(i32 26)
%84 = tail call i32 @op_closedir(%struct.dir* %30)
%85 = tail call i32 @op_closedir(%struct.dir* %31)
%86 = tail call i32 @op_closedir(%struct.dir* %32)
%87 = tail call i32 @op_closedir(%struct.dir* %33)
%88 = tail call i32 @op_closedir(%struct.dir* %34)
%89 = tail call i32 @op_closedir(%struct.dir* %35)
%90 = tail call i32 @op_closedir(%struct.dir* %36)
%91 = tail call i32 @op_closedir(%struct.dir* %37)
%92 = tail call i32 @op_closedir(%struct.dir* %38)
%93 = tail call i32 @op_closedir(%struct.dir* %39)
%94 = tail call i32 @op_closedir(%struct.dir* %40)
%95 = tail call i32 @op_closedir(%struct.dir* %41)
%96 = tail call i32 @op_closedir(%struct.dir* %42)
%97 = tail call i32 @op_closedir(%struct.dir* %43)
%98 = tail call i32 @op_closedir(%struct.dir* %44)
%99 = tail call i32 @op_closedir(%struct.dir* %45)
%100 = tail call i32 @op_closedir(%struct.dir* %46)
%101 = tail call i32 @op_closedir(%struct.dir* %47)
%102 = tail call i32 @op_closedir(%struct.dir* %48)
%103 = tail call i32 @op_closedir(%struct.dir* %49)
%104 = tail call i32 @op_closedir(%struct.dir* %50)
%105 = tail call i32 @op_closedir(%struct.dir* %51)
%106 = tail call i32 @op_closedir(%struct.dir* %52)
%107 = tail call i32 @op_closedir(%struct.dir* %53)
%108 = tail call i32 @op_closedir(%struct.dir* %54)
%109 = tail call i32 @op_closedir(%struct.dir* %55)
%110 = tail call i32 @op_closedir(%struct.dir* %56)
ret void
}