removedir(dir) {
  register int i, j;
  int status;
  if ((i = fork()) == 0) {
    m_update();
    flush();
    execl("/bin/rmdir", "rmdir", dir, 0);
    printf("Can't exec rmdir!!?\n");
    flush();
    return (0);
  }
  if (i == -1) {
    printf("Can't fork\n");
    flush();
    return (0);
  }
  while ((j = waita(&status)) != i && j != -1)
    ;
  if (status) {
    printf("Bad exit status (%o) from rmdir.\n", status);
    flush();
  }
  return (1);
}


x86 assembly (clang, -O0):
<removedir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1080 <fork@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jne    11c7 <removedir+0x67>
mov    $0x0,%al
call   1060 <m_update@plt>
mov    $0x0,%al
call   1030 <flush@plt>
mov    -0x8(%rbp),%edx
lea    0xe6a(%rip),%rdi
lea    0xe68(%rip),%rsi
xor    %ecx,%ecx
mov    $0x0,%al
call   1070 <execl@plt>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <flush@plt>
movl   $0x0,-0x4(%rbp)
jmp    125d <removedir+0xfd>
cmpl   $0xffffffff,-0xc(%rbp)
jne    11f2 <removedir+0x92>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <flush@plt>
movl   $0x0,-0x4(%rbp)
jmp    125d <removedir+0xfd>
jmp    11f7 <removedir+0x97>
lea    -0x14(%rbp),%rdi
mov    $0x0,%al
call   1050 <waita@plt>
mov    %eax,%ecx
mov    %ecx,-0x10(%rbp)
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x15(%rbp)
je     121f <removedir+0xbf>
cmpl   $0xffffffff,-0x10(%rbp)
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    122f <removedir+0xcf>
jmp    1234 <removedir+0xd4>
jmp    11f7 <removedir+0x97>
cmpl   $0x0,-0x14(%rbp)
je     1256 <removedir+0xf6>
mov    -0x14(%rbp),%esi
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <flush@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removedir>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%r14d
xor    %ebx,%ebx
xor    %eax,%eax
call   1090 <fork@plt>
cmp    $0xffffffff,%eax
je     11c2 <removedir+0x52>
mov    %eax,%ebp
test   %eax,%eax
jne    11d0 <removedir+0x60>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <m_update@plt>
xor    %eax,%eax
call   1030 <flush@plt>
lea    0xe5a(%rip),%rdi
lea    0xe58(%rip),%rsi
mov    %r14d,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1080 <execl@plt>
lea    0xe78(%rip),%rdi
jmp    11c9 <removedir+0x59>
lea    0xe64(%rip),%rdi
call   1040 <puts@plt>
jmp    120e <removedir+0x9e>
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <waita@plt>
cmp    %ebp,%eax
je     11f3 <removedir+0x83>
cmp    $0xffffffff,%eax
jne    11e0 <removedir+0x70>
mov    0xc(%rsp),%esi
mov    $0x1,%ebx
test   %esi,%esi
je     1215 <removedir+0xa5>
lea    0xe04(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <flush@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"/bin/rmdir\00"
@.str.1 = [6 x i8] c"rmdir\00"
@.str.2 = [21 x i8] c"Can't exec rmdir!!?\0A\00"
@.str.3 = [12 x i8] c"Can't fork\0A\00"
@.str.4 = [34 x i8] c"Bad exit status (%o) from rmdir.\0A\00"
define i32 @removedir(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
%7 = call i32 (...) @fork()
store i32 %7, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = call i32 (...) @m_update()
%11 = call i32 (...) @flush()
%12 = load i32, i32* %3
%13 = call i32 (i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @execl to i32 (i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 0)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (...) @flush()
store i32 0, i32* %2
br label %41
16: ; preds = %1
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 (...) @flush()
store i32 0, i32* %2
br label %41
22: ; preds = %16
br label %23
23: ; preds = %32, %22
%24 = call i32 (i32*, ...) bitcast (i32 (...)* @waita to i32 (i32*, ...)*)(i32* %6)
store i32 %24, i32* %5
%25 = load i32, i32* %4
%26 = icmp ne i32 %24, %25
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i32, i32* %5
%29 = icmp ne i32 %28, -1
br label %30
30: ; preds = %27, %23
%31 = phi i1 [ false, %23 ], [ %29, %27 ]
br i1 %31, label %32, label %33
32: ; preds = %30
br label %23
33: ; preds = %30
%34 = load i32, i32* %6
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %33
%37 = load i32, i32* %6
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %37)
%39 = call i32 (...) @flush()
br label %40
40: ; preds = %36, %33
store i32 1, i32* %2
br label %41
41: ; preds = %40, %19, %9
%42 = load i32, i32* %2
ret i32 %42
}

LLVM IR (-O2):
@.str = [11 x i8] c"/bin/rmdir\00"
@.str.1 = [6 x i8] c"rmdir\00"
@.str.4 = [34 x i8] c"Bad exit status (%o) from rmdir.\0A\00"
@str = [11 x i8] c"Can't fork\00"
@str.5 = [20 x i8] c"Can't exec rmdir!!?\00"
define i32 @removedir(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 (...) @fork()
switch i32 %4, label %14 [
i32 0, label %5
i32 -1, label %11
]
5: ; preds = %1
%6 = tail call i32 (...) @m_update()
%7 = tail call i32 (...) @flush()
%8 = tail call i32 (i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @execl to i32 (i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 0)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.5, i64 0, i64 0))
%10 = tail call i32 (...) @flush()
br label %25
11: ; preds = %1
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 (...) @flush()
br label %25
14: ; preds = %1, %14
%15 = call i32 (i32*, ...) bitcast (i32 (...)* @waita to i32 (i32*, ...)*)(i32* %2)
%16 = icmp ne i32 %15, %4
%17 = icmp ne i32 %15, -1
%18 = and i1 %16, %17
br i1 %18, label %14, label %19
19: ; preds = %14
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %20)
%24 = call i32 (...) @flush()
br label %25
25: ; preds = %19, %22, %11, %5
%26 = phi i32 [ 0, %5 ], [ 0, %11 ], [ 1, %22 ], [ 1, %19 ]
ret i32 %26
}