#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 {
  int tv_sec;
  scalar_t__ tv_nsec;
};
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/ *);
int /*<<< orphan*/ node_require_test(char *, char *, struct stat *);
int /*<<< orphan*/ printf(char *);
int main() {
  struct stat file_stat;
  struct timespec ts;
  int i;
  ts.tv_sec = 1;
  ts.tv_nsec = 0;
  printf("init stat() ver.\n");
  for (i = 0; i < 100; i++) {
    node_require_test("/", "./hello", &file_stat);
    node_require_test("/static/foo/bar/", "./hello", &file_stat);
    node_require_test("/static/home/test/", "./hello", &file_stat);
    node_require_test("/static/foo/", "hello", &file_stat);
    node_require_test("/static/foo/", "world", &file_stat);
    node_require_test("/static/foo/", "asdf", &file_stat);
    nanosleep(&ts, NULL);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jge    1210 <main+0xe0>
lea    0xed7(%rip),%rdi
lea    0xe99(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <node_require_test@plt>
lea    0xe91(%rip),%rdi
lea    0xe82(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <node_require_test@plt>
lea    0xe8b(%rip),%rdi
lea    0xe6b(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <node_require_test@plt>
lea    0xe87(%rip),%rdi
lea    0xe56(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <node_require_test@plt>
lea    0xe70(%rip),%rdi
lea    0xe76(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <node_require_test@plt>
lea    0xe59(%rip),%rdi
lea    0xe65(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <node_require_test@plt>
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <nanosleep@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1161 <main+0x31>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x1,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xeee(%rip),%rdi
call   1030 <puts@plt>
mov    $0x64,%r12d
lea    0xe98(%rip),%r15
mov    %rsp,%rbx
lea    0xeba(%rip),%rbp
lea    0xec6(%rip),%r13
lea    0x8(%rsp),%r14
xchg   %ax,%ax
lea    0xeb0(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <node_require_test@plt>
lea    0xe6f(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <node_require_test@plt>
lea    0xe6e(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <node_require_test@plt>
mov    %rbp,%rdi
lea    0xe42(%rip),%rsi
mov    %rbx,%rdx
call   1050 <node_require_test@plt>
mov    %rbp,%rdi
lea    0xe67(%rip),%rsi
mov    %rbx,%rdx
call   1050 <node_require_test@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1050 <node_require_test@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <nanosleep@plt>
add    $0xffffffff,%r12d
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.timespec = type { i32, i64 }
@.str = [18 x i8] c"init stat() ver.\0A\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [8 x i8] c"./hello\00"
@.str.3 = [17 x i8] c"/static/foo/bar/\00"
@.str.4 = [19 x i8] c"/static/home/test/\00"
@.str.5 = [13 x i8] c"/static/foo/\00"
@.str.6 = [6 x i8] c"hello\00"
@.str.7 = [6 x i8] c"world\00"
@.str.8 = [5 x i8] c"asdf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.stat
%3 = alloca %struct.timespec
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i32 1, i32* %5
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i64 0, i64* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %8
8: ; preds = %19, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 100
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = call i32 @node_require_test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %2)
%13 = call i32 @node_require_test(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %2)
%14 = call i32 @node_require_test(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %2)
%15 = call i32 @node_require_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), %struct.stat* %2)
%16 = call i32 @node_require_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), %struct.stat* %2)
%17 = call i32 @node_require_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), %struct.stat* %2)
%18 = call i32 @nanosleep(%struct.timespec* %3, i32* null)
br label %19
19: ; preds = %11
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %8
22: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.timespec = type { i32, i64 }
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [8 x i8] c"./hello\00"
@.str.3 = [17 x i8] c"/static/foo/bar/\00"
@.str.4 = [19 x i8] c"/static/home/test/\00"
@.str.5 = [13 x i8] c"/static/foo/\00"
@.str.6 = [6 x i8] c"hello\00"
@.str.7 = [6 x i8] c"world\00"
@.str.8 = [5 x i8] c"asdf\00"
@str = [17 x i8] c"init stat() ver.\00"
define i32 @main() {
%1 = alloca %struct.stat
%2 = alloca %struct.timespec
%3 = bitcast %struct.stat* %1 to i8*
%4 = bitcast %struct.timespec* %2 to i8*
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i32 1, i32* %5
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i64 0, i64* %6
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %0, %8
%9 = phi i32 [ 0, %0 ], [ %17, %8 ]
%10 = call i32 @node_require_test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %1)
%11 = call i32 @node_require_test(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %1)
%12 = call i32 @node_require_test(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %struct.stat* %1)
%13 = call i32 @node_require_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), %struct.stat* %1)
%14 = call i32 @node_require_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), %struct.stat* %1)
%15 = call i32 @node_require_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), %struct.stat* %1)
%16 = call i32 @nanosleep(%struct.timespec* %2, i32* null)
%17 = add nuw nsw i32 %9, 1
%18 = icmp eq i32 %17, 100
br i1 %18, label %19, label %8
19: ; preds = %8
ret i32 0
}