#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 timespec {
  long tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ elapsed_time_hr(struct timespec, struct timespec, char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ mkdir(char *, int);
int /*<<< orphan*/ nanosleep(struct timespec *, struct timespec *);
int omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ rmdir(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, int, int);
int /*<<< orphan*/ stdout;
int mk_rm_dir(unsigned int N) {
  char d[32];
  int i = 0, nanosleepInterval = 0;
  struct timespec start, end;
  struct timespec timeToSleep, timeRemaining;
  timeToSleep.tv_sec = 0;
  timeToSleep.tv_nsec = 250000000L;
  if (N == 2000000)
    N = 100000;
#pragma omp parallel private(i, d)
  for (i = 0; i < 100; i++) {
    sprintf(d, "warmupdir_%d_%d", omp_get_thread_num(), i);
    mkdir(d, 777);
  }
  clock_gettime(CLOCK_MONOTONIC, &start);
#pragma omp parallel private(i, d)
  for (i = 0; i < N; i++) {
    sprintf(d, "testdir_%d_%d", omp_get_thread_num(), i);
    mkdir(d, 777);
    if (i % 10000 == 0) {
      nanosleep(&timeToSleep, &timeRemaining);
      nanosleepInterval++;
    }
  }
  clock_gettime(CLOCK_MONOTONIC, &end);
  elapsed_time_hr(start, end, "mkdir");
  printf("Slept for :%6.3f, ms.\n", 1000 * nanosleepInterval * 0.25);
  nanosleepInterval = 0;
  sleep(5);
#pragma omp parallel private(i, d)
  for (i = 0; i < 100; i++) {
    sprintf(d, "warmupdir_%d_%d", omp_get_thread_num(), i);
    rmdir(d);
  }
  clock_gettime(CLOCK_MONOTONIC, &start);
#pragma omp parallel private(i, d)
  for (i = 0; i < N; i++) {
    sprintf(d, "testdir_%d_%d", omp_get_thread_num(), i);
    rmdir(d);
    if (i % 10000 == 0) {
      nanosleep(&timeToSleep, &timeRemaining);
      nanosleepInterval++;
    }
  }
  clock_gettime(CLOCK_MONOTONIC, &end);
  elapsed_time_hr(start, end, "rmdir");
  printf("Slept for :%6.3f, ms.\n", 1000 * nanosleepInterval * 0.25);
  fflush(stdout);
  return 0;
}


x86 assembly (clang, -O0):
<mk_rm_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movq   $0x0,-0x60(%rbp)
movq   $0xee6b280,-0x68(%rbp)
0e
cmpl   $0x1e8480,-0x4(%rbp)
jne    11e0 <mk_rm_dir+0x40>
movl   $0x186a0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x64,-0x34(%rbp)
jge    1231 <mk_rm_dir+0x91>
lea    -0x30(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    $0x0,%al
call   1050 <omp_get_thread_num@plt>
mov    -0x80(%rbp),%rdi
mov    %eax,%edx
mov    -0x34(%rbp),%ecx
lea    0xdf8(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11e7 <mk_rm_dir+0x47>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1060 <clock_gettime@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    12cb <mk_rm_dir+0x12b>
lea    -0x30(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    $0x0,%al
call   1050 <omp_get_thread_num@plt>
mov    -0x88(%rbp),%rdi
mov    %eax,%edx
mov    -0x34(%rbp),%ecx
lea    0xd9d(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
mov    -0x34(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12b8 <mk_rm_dir+0x118>
lea    -0x68(%rbp),%rdi
lea    -0x78(%rbp),%rsi
call   1090 <nanosleep@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    12bd <mk_rm_dir+0x11d>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    124a <mk_rm_dir+0xaa>
mov    0x2d16(%rip),%rax
mov    (%rax),%edi
lea    -0x58(%rbp),%rsi
call   1060 <clock_gettime@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x50(%rbp),%rcx
lea    0xd32(%rip),%r8
call   1030 <elapsed_time_hr@plt>
imul   $0x3e8,-0x38(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xcf4(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xd11(%rip),%rdi
call   1080 <printf@plt>
movl   $0x0,-0x38(%rbp)
mov    $0x5,%edi
call   10c0 <sleep@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x64,-0x34(%rbp)
jge    1383 <mk_rm_dir+0x1e3>
lea    -0x30(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    $0x0,%al
call   1050 <omp_get_thread_num@plt>
mov    -0x90(%rbp),%rdi
mov    %eax,%edx
mov    -0x34(%rbp),%ecx
lea    0xca1(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x30(%rbp),%rdi
call   1070 <rmdir@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1338 <mk_rm_dir+0x198>
mov    0x2c5e(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1060 <clock_gettime@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1418 <mk_rm_dir+0x278>
lea    -0x30(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    $0x0,%al
call   1050 <omp_get_thread_num@plt>
mov    -0x98(%rbp),%rdi
mov    %eax,%edx
mov    -0x34(%rbp),%ecx
lea    0xc4b(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x30(%rbp),%rdi
call   1070 <rmdir@plt>
mov    -0x34(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1405 <mk_rm_dir+0x265>
lea    -0x68(%rbp),%rdi
lea    -0x78(%rbp),%rsi
call   1090 <nanosleep@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    140a <mk_rm_dir+0x26a>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    139c <mk_rm_dir+0x1fc>
mov    0x2bc9(%rip),%rax
mov    (%rax),%edi
lea    -0x58(%rbp),%rsi
call   1060 <clock_gettime@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x50(%rbp),%rcx
lea    0xc02(%rip),%r8
call   1030 <elapsed_time_hr@plt>
imul   $0x3e8,-0x38(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xba7(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xbc4(%rip),%rdi
call   1080 <printf@plt>
mov    0x2b64(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mk_rm_dir>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %edi,%r14d
movaps 0xe48(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xe54(%rip),%r15
lea    0x30(%rsp),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <omp_get_thread_num@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
mov    %ebp,%ecx
call   10b0 <sprintf@plt>
mov    %rbx,%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
add    $0x1,%ebp
cmp    $0x64,%ebp
jne    11d0 <mk_rm_dir+0x30>
cmp    $0x1e8480,%r14d
mov    $0x186a0,%r13d
cmovne %r14d,%r13d
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rsi
call   1060 <clock_gettime@plt>
mov    $0x0,%r15d
test   %r13d,%r13d
je     129b <mk_rm_dir+0xfb>
lea    0xdf7(%rip),%r14
lea    0x30(%rsp),%rbx
xor    %r15d,%r15d
xor    %ebp,%ebp
jmp    1248 <mk_rm_dir+0xa8>
nopl   (%rax)
add    $0x1,%ebp
cmp    %ebp,%r13d
je     129b <mk_rm_dir+0xfb>
mov    %ebp,%eax
mov    $0xd1b71759,%ecx
imul   %rcx,%rax
shr    $0x2d,%rax
imul   $0x2710,%eax,%r12d
xor    %eax,%eax
call   1050 <omp_get_thread_num@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
mov    %ebp,%ecx
call   10b0 <sprintf@plt>
mov    %rbx,%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
cmp    %ebp,%r12d
jne    1240 <mk_rm_dir+0xa0>
lea    0x20(%rsp),%rdi
lea    0x58(%rsp),%rsi
call   1090 <nanosleep@plt>
add    $0x1,%r15d
jmp    1240 <mk_rm_dir+0xa0>
mov    0x2d46(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1060 <clock_gettime@plt>
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    (%rsp),%rdx
mov    0x8(%rsp),%rcx
lea    0xd70(%rip),%r8
call   1030 <elapsed_time_hr@plt>
imul   $0x3e8,%r15d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd2f(%rip),%xmm0
cvttsd2si %xmm0,%esi
lea    0xd50(%rip),%rdi
call   1080 <printf@plt>
mov    $0x5,%edi
call   10c0 <sleep@plt>
lea    0xd16(%rip),%r14
lea    0x30(%rsp),%rbp
xor    %ebx,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <omp_get_thread_num@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %eax,%edx
mov    %ebx,%ecx
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1070 <rmdir@plt>
add    $0x1,%ebx
cmp    $0x64,%ebx
jne    1310 <mk_rm_dir+0x170>
mov    0x2cab(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rsi
call   1060 <clock_gettime@plt>
test   %r13d,%r13d
je     13c6 <mk_rm_dir+0x226>
lea    0xcd3(%rip),%r14
lea    0x30(%rsp),%rbx
xor    %r15d,%r15d
xor    %ebp,%ebp
jmp    1378 <mk_rm_dir+0x1d8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %ebp,%r13d
je     13c9 <mk_rm_dir+0x229>
mov    %ebp,%eax
mov    $0xd1b71759,%ecx
imul   %rcx,%rax
shr    $0x2d,%rax
imul   $0x2710,%eax,%r12d
xor    %eax,%eax
call   1050 <omp_get_thread_num@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
mov    %ebp,%ecx
call   10b0 <sprintf@plt>
mov    %rbx,%rdi
call   1070 <rmdir@plt>
cmp    %ebp,%r12d
jne    1370 <mk_rm_dir+0x1d0>
lea    0x20(%rsp),%rdi
lea    0x58(%rsp),%rsi
call   1090 <nanosleep@plt>
add    $0x1,%r15d
jmp    1370 <mk_rm_dir+0x1d0>
xor    %r15d,%r15d
mov    0x2c18(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1060 <clock_gettime@plt>
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    (%rsp),%rdx
mov    0x8(%rsp),%rcx
lea    0xc5f(%rip),%r8
call   1030 <elapsed_time_hr@plt>
imul   $0x3e8,%r15d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xc01(%rip),%xmm0
cvttsd2si %xmm0,%esi
lea    0xc22(%rip),%rdi
call   1080 <printf@plt>
mov    0x2bb2(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
@.str = [16 x i8] c"warmupdir_%d_%d\00"
@CLOCK_MONOTONIC = global i32 0
@.str.1 = [14 x i8] c"testdir_%d_%d\00"
@.str.2 = [6 x i8] c"mkdir\00"
@.str.3 = [23 x i8] c"Slept for :%6.3f, ms.\0A\00"
@.str.4 = [6 x i8] c"rmdir\00"
@stdout = global i32 0
define i32 @mk_rm_dir(i32 %0) {
%2 = alloca i32
%3 = alloca [32 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.timespec
%7 = alloca %struct.timespec
%8 = alloca %struct.timespec
%9 = alloca %struct.timespec
store i32 %0, i32* %2
store i32 0, i32* %4
store i32 0, i32* %5
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 1
store i64 0, i64* %10
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
store i64 250000000, i64* %11
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 2000000
br i1 %13, label %14, label %15
14: ; preds = %1
store i32 100000, i32* %2
br label %15
15: ; preds = %14, %1
store i32 0, i32* %4
br label %16
16: ; preds = %26, %15
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 100
br i1 %18, label %19, label %29
19: ; preds = %16
%20 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%21 = call i32 (...) @omp_get_thread_num()
%22 = load i32, i32* %4
%23 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %22)
%24 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%25 = call i32 @mkdir(i8* %24, i32 777)
br label %26
26: ; preds = %19
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %16
29: ; preds = %16
%30 = load i32, i32* @CLOCK_MONOTONIC
%31 = call i32 @clock_gettime(i32 %30, %struct.timespec* %6)
store i32 0, i32* %4
br label %32
32: ; preds = %51, %29
%33 = load i32, i32* %4
%34 = load i32, i32* %2
%35 = icmp ult i32 %33, %34
br i1 %35, label %36, label %54
36: ; preds = %32
%37 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%38 = call i32 (...) @omp_get_thread_num()
%39 = load i32, i32* %4
%40 = call i32 @sprintf(i8* %37, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %38, i32 %39)
%41 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%42 = call i32 @mkdir(i8* %41, i32 777)
%43 = load i32, i32* %4
%44 = srem i32 %43, 10000
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %36
%47 = call i32 @nanosleep(%struct.timespec* %8, %struct.timespec* %9)
%48 = load i32, i32* %5
%49 = add nsw i32 %48, 1
store i32 %49, i32* %5
br label %50
50: ; preds = %46, %36
br label %51
51: ; preds = %50
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
store i32 %53, i32* %4
br label %32
54: ; preds = %32
%55 = load i32, i32* @CLOCK_MONOTONIC
%56 = call i32 @clock_gettime(i32 %55, %struct.timespec* %7)
%57 = bitcast %struct.timespec* %6 to { i64, i64 }*
%58 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %57, i32 0, i32 0
%59 = load i64, i64* %58
%60 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %57, i32 0, i32 1
%61 = load i64, i64* %60
%62 = bitcast %struct.timespec* %7 to { i64, i64 }*
%63 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %62, i32 0, i32 0
%64 = load i64, i64* %63
%65 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %62, i32 0, i32 1
%66 = load i64, i64* %65
%67 = call i32 @elapsed_time_hr(i64 %59, i64 %61, i64 %64, i64 %66, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%68 = load i32, i32* %5
%69 = mul nsw i32 1000, %68
%70 = sitofp i32 %69 to double
%71 = fmul double %70, 2.500000e-01
%72 = fptosi double %71 to i32
%73 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %72)
store i32 0, i32* %5
%74 = call i32 @sleep(i32 5)
store i32 0, i32* %4
br label %75
75: ; preds = %85, %54
%76 = load i32, i32* %4
%77 = icmp slt i32 %76, 100
br i1 %77, label %78, label %88
78: ; preds = %75
%79 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%80 = call i32 (...) @omp_get_thread_num()
%81 = load i32, i32* %4
%82 = call i32 @sprintf(i8* %79, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %80, i32 %81)
%83 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%84 = call i32 @rmdir(i8* %83)
br label %85
85: ; preds = %78
%86 = load i32, i32* %4
%87 = add nsw i32 %86, 1
store i32 %87, i32* %4
br label %75
88: ; preds = %75
%89 = load i32, i32* @CLOCK_MONOTONIC
%90 = call i32 @clock_gettime(i32 %89, %struct.timespec* %6)
store i32 0, i32* %4
br label %91
91: ; preds = %110, %88
%92 = load i32, i32* %4
%93 = load i32, i32* %2
%94 = icmp ult i32 %92, %93
br i1 %94, label %95, label %113
95: ; preds = %91
%96 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%97 = call i32 (...) @omp_get_thread_num()
%98 = load i32, i32* %4
%99 = call i32 @sprintf(i8* %96, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %97, i32 %98)
%100 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%101 = call i32 @rmdir(i8* %100)
%102 = load i32, i32* %4
%103 = srem i32 %102, 10000
%104 = icmp eq i32 %103, 0
br i1 %104, label %105, label %109
105: ; preds = %95
%106 = call i32 @nanosleep(%struct.timespec* %8, %struct.timespec* %9)
%107 = load i32, i32* %5
%108 = add nsw i32 %107, 1
store i32 %108, i32* %5
br label %109
109: ; preds = %105, %95
br label %110
110: ; preds = %109
%111 = load i32, i32* %4
%112 = add nsw i32 %111, 1
store i32 %112, i32* %4
br label %91
113: ; preds = %91
%114 = load i32, i32* @CLOCK_MONOTONIC
%115 = call i32 @clock_gettime(i32 %114, %struct.timespec* %7)
%116 = bitcast %struct.timespec* %6 to { i64, i64 }*
%117 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %116, i32 0, i32 0
%118 = load i64, i64* %117
%119 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %116, i32 0, i32 1
%120 = load i64, i64* %119
%121 = bitcast %struct.timespec* %7 to { i64, i64 }*
%122 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %121, i32 0, i32 0
%123 = load i64, i64* %122
%124 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %121, i32 0, i32 1
%125 = load i64, i64* %124
%126 = call i32 @elapsed_time_hr(i64 %118, i64 %120, i64 %123, i64 %125, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%127 = load i32, i32* %5
%128 = mul nsw i32 1000, %127
%129 = sitofp i32 %128 to double
%130 = fmul double %129, 2.500000e-01
%131 = fptosi double %130 to i32
%132 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %131)
%133 = load i32, i32* @stdout
%134 = call i32 @fflush(i32 %133)
ret i32 0
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
@.str = [16 x i8] c"warmupdir_%d_%d\00"
@CLOCK_MONOTONIC = global i32 0
@.str.1 = [14 x i8] c"testdir_%d_%d\00"
@.str.2 = [6 x i8] c"mkdir\00"
@.str.3 = [23 x i8] c"Slept for :%6.3f, ms.\0A\00"
@.str.4 = [6 x i8] c"rmdir\00"
@stdout = global i32 0
define i32 @mk_rm_dir(i32 %0) {
%2 = alloca [32 x i8]
%3 = alloca %struct.timespec
%4 = alloca %struct.timespec
%5 = alloca <2 x i64>
%6 = bitcast <2 x i64>* %5 to %struct.timespec*
%7 = alloca %struct.timespec
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%9 = bitcast %struct.timespec* %3 to i8*
%10 = bitcast %struct.timespec* %4 to i8*
%11 = bitcast <2 x i64>* %5 to i8*
%12 = bitcast %struct.timespec* %7 to i8*
store <2 x i64> <i64 250000000, i64 0>, <2 x i64>* %5
%13 = icmp eq i32 %0, 2000000
br label %14
14: ; preds = %1, %14
%15 = phi i32 [ 0, %1 ], [ %19, %14 ]
%16 = tail call i32 (...) @omp_get_thread_num()
%17 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %15)
%18 = call i32 @mkdir(i8* %8, i32 777)
%19 = add nuw nsw i32 %15, 1
%20 = icmp eq i32 %19, 100
br i1 %20, label %21, label %14
21: ; preds = %14
%22 = select i1 %13, i32 100000, i32 %0
%23 = load i32, i32* @CLOCK_MONOTONIC
%24 = call i32 @clock_gettime(i32 %23, %struct.timespec* %3)
%25 = icmp eq i32 %22, 0
br i1 %25, label %41, label %26
26: ; preds = %21, %37
%27 = phi i32 [ %38, %37 ], [ 0, %21 ]
%28 = phi i32 [ %39, %37 ], [ 0, %21 ]
%29 = call i32 (...) @omp_get_thread_num()
%30 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %28)
%31 = call i32 @mkdir(i8* %8, i32 777)
%32 = urem i32 %28, 10000
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %26
%35 = call i32 @nanosleep(%struct.timespec* %6, %struct.timespec* %7)
%36 = add nsw i32 %27, 1
br label %37
37: ; preds = %26, %34
%38 = phi i32 [ %36, %34 ], [ %27, %26 ]
%39 = add nuw i32 %28, 1
%40 = icmp eq i32 %39, %22
br i1 %40, label %41, label %26
41: ; preds = %37, %21
%42 = phi i32 [ 0, %21 ], [ %38, %37 ]
%43 = load i32, i32* @CLOCK_MONOTONIC
%44 = call i32 @clock_gettime(i32 %43, %struct.timespec* %4)
%45 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
%46 = load i64, i64* %45
%47 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 1
%48 = load i64, i64* %47
%49 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 0
%50 = load i64, i64* %49
%51 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 1
%52 = load i64, i64* %51
%53 = call i32 @elapsed_time_hr(i64 %46, i64 %48, i64 %50, i64 %52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%54 = mul nsw i32 %42, 1000
%55 = sitofp i32 %54 to double
%56 = fmul double %55, 2.500000e-01
%57 = fptosi double %56 to i32
%58 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %57)
%59 = call i32 @sleep(i32 5)
br label %60
60: ; preds = %41, %60
%61 = phi i32 [ 0, %41 ], [ %65, %60 ]
%62 = call i32 (...) @omp_get_thread_num()
%63 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %62, i32 %61)
%64 = call i32 @rmdir(i8* %8)
%65 = add nuw nsw i32 %61, 1
%66 = icmp eq i32 %65, 100
br i1 %66, label %67, label %60
67: ; preds = %60
%68 = load i32, i32* @CLOCK_MONOTONIC
%69 = call i32 @clock_gettime(i32 %68, %struct.timespec* %3)
br i1 %25, label %85, label %70
70: ; preds = %67, %81
%71 = phi i32 [ %82, %81 ], [ 0, %67 ]
%72 = phi i32 [ %83, %81 ], [ 0, %67 ]
%73 = call i32 (...) @omp_get_thread_num()
%74 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %73, i32 %72)
%75 = call i32 @rmdir(i8* %8)
%76 = urem i32 %72, 10000
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %70
%79 = call i32 @nanosleep(%struct.timespec* %6, %struct.timespec* %7)
%80 = add nsw i32 %71, 1
br label %81
81: ; preds = %70, %78
%82 = phi i32 [ %80, %78 ], [ %71, %70 ]
%83 = add nuw i32 %72, 1
%84 = icmp eq i32 %83, %22
br i1 %84, label %85, label %70
85: ; preds = %81, %67
%86 = phi i32 [ 0, %67 ], [ %82, %81 ]
%87 = load i32, i32* @CLOCK_MONOTONIC
%88 = call i32 @clock_gettime(i32 %87, %struct.timespec* %4)
%89 = load i64, i64* %45
%90 = load i64, i64* %47
%91 = load i64, i64* %49
%92 = load i64, i64* %51
%93 = call i32 @elapsed_time_hr(i64 %89, i64 %90, i64 %91, i64 %92, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%94 = mul nsw i32 %86, 1000
%95 = sitofp i32 %94 to double
%96 = fmul double %95, 2.500000e-01
%97 = fptosi double %96 to i32
%98 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %97)
%99 = load i32, i32* @stdout
%100 = call i32 @fflush(i32 %99)
ret i32 0
}