void rm_rf_dir(test_nr) int test_nr;
{
  char buf[128];
  sprintf(buf, "chmod 777 DIR_%02d DIR_%02d/* DIR_%02d/*/* >/dev/null 2>&1",
          test_nr, test_nr, test_nr);
  (void)system(buf);
  sprintf(buf, "rm -rf DIR_%02d >/dev/null 2>&1", test_nr);
  if (system(buf) != 0)
    printf("Warning: system(\"%s\") failed\n", buf);
}


x86 assembly (clang, -O0):
<rm_rf_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%ecx
mov    -0x4(%rbp),%r8d
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x90(%rbp),%rdi
mov    $0x0,%al
call   1030 <system@plt>
lea    -0x90(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x90(%rbp),%rdi
mov    $0x0,%al
call   1030 <system@plt>
cmp    $0x0,%eax
je     11af <rm_rf_dir+0x7f>
lea    -0x90(%rbp),%rsi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rm_rf_dir>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %edi,%ebx
lea    0xebd(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebx,%edx
mov    %ebx,%ecx
mov    %ebx,%r8d
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <system@plt>
lea    0xed3(%rip),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <system@plt>
test   %eax,%eax
je     1193 <rm_rf_dir+0x63>
lea    0xed2(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [59 x i8] c"chmod 777 DIR_%02d DIR_%02d/* DIR_%02d/*/* >/dev/null 2>&1\00"
@.str.1 = [32 x i8] c"rm -rf DIR_%02d >/dev/null 2>&1\00"
@.str.2 = [30 x i8] c"Warning: system(\22%s\22) failed\0A\00"
define void @rm_rf_dir(i32 %0) {
%2 = alloca i32
%3 = alloca [128 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6, i32 %7)
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %9)
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%12 = load i32, i32* %2
%13 = call i32 (i8*, i8*, ...) @sprintf(i8* %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %1
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %17, %1
ret void
}

LLVM IR (-O2):
@.str = [59 x i8] c"chmod 777 DIR_%02d DIR_%02d/* DIR_%02d/*/* >/dev/null 2>&1\00"
@.str.1 = [32 x i8] c"rm -rf DIR_%02d >/dev/null 2>&1\00"
@.str.2 = [30 x i8] c"Warning: system(\22%s\22) failed\0A\00"
define void @rm_rf_dir(i32 %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = call i32 (i8*, i8*, ...) @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %0, i32 %0)
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %3)
%6 = call i32 (i8*, i8*, ...) @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br label %11
11: ; preds = %9, %1
ret void
}