#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct TYPE_4__ {
  long tv_sec;
};
struct TYPE_3__ {
  long tv_sec;
};
struct rusage {
  long ru_maxrss;
  long ru_inblock;
  long ru_oublock;
  int /*<<< orphan*/ ru_isrss;
  int /*<<< orphan*/ ru_idrss;
  int /*<<< orphan*/ ru_ixrss;
  TYPE_2__ ru_stime;
  TYPE_1__ ru_utime;
};
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_CHILDREN;
double difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int execvp(char *, char **);
long findMemTickSize(long, int /*<<< orphan*/);
int /*<<< orphan*/ fork();
int getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ waitpid(int /*<<< orphan*/, int *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  struct rusage rusage;
  pid_t child;
  int status;
  time_t startTime;
  time_t endTime;
  switch (child = fork()) {
  case -1:
    perror("Fork failed: ");
    return -1;
  case 0:
    if (execvp(argv[1], argv + 1) == -1) {
      perror("Exec failed: ");
      return -1;
    }
    break;
  default:
    break;
  };
  if ((startTime = time(NULL)) == ((time_t)(-1))) {
    perror("Failed to get start time: ");
    return -1;
  }
  waitpid(child, &status, 0);
  if ((endTime = time(NULL)) == ((time_t)(-1))) {
    perror("Failed to get end time: ");
    return -1;
  }
  if ((getrusage(RUSAGE_CHILDREN, &rusage)) == -1) {
    perror("Getrusage failed: ");
    return -1;
  }
  printf("User CPU time (s): %ld\n", rusage.ru_utime.tv_sec);
  printf("System CPU time (s): %ld\n", rusage.ru_stime.tv_sec);
  printf("Total CPU time (s): %ld\n",
         rusage.ru_utime.tv_sec + rusage.ru_stime.tv_sec);
  printf("Total Wall time (s): %6.2f\n", difftime(endTime, startTime));
  printf("\n");
  printf("Maximum memory (KB): %ld\n", rusage.ru_maxrss);
  printf("Maximum memory (MB): %ld\n", rusage.ru_maxrss / 1024);
  printf("Maximum memory (GB): %ld\n", rusage.ru_maxrss / 1024 / 1024);
  printf("\n");
  long totalTime = rusage.ru_utime.tv_sec - rusage.ru_stime.tv_sec;
  if (totalTime < 1)
    totalTime = 1;
  long codeSize = findMemTickSize(totalTime, rusage.ru_ixrss);
  printf("Maximum code (KB): %ld\n", codeSize);
  printf("Maximum code (MB): %ld\n", codeSize / 1024);
  printf("\n");
  long dataSize = findMemTickSize(totalTime, rusage.ru_idrss);
  printf("Maximum data (KB): %ld\n", dataSize);
  printf("Maximum data (MB): %ld\n", dataSize / 1024);
  printf("\n");
  long stackSize = findMemTickSize(totalTime, rusage.ru_isrss);
  printf("Maximum stack (KB): %ld\n", stackSize);
  printf("Maximum stack (MB): %ld\n", stackSize / 1024);
  printf("\n");
  printf("Number of FS Reads : %ld\n", rusage.ru_inblock);
  printf("Number of FS Writes: %ld\n", rusage.ru_oublock);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
call   10b0 <fork@plt>
mov    %eax,-0x4c(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x7c(%rbp)
sub    $0xffffffff,%eax
je     11d6 <main+0x46>
jmp    11c6 <main+0x36>
mov    -0x7c(%rbp),%eax
test   %eax,%eax
je     11ee <main+0x5e>
jmp    1229 <main+0x99>
lea    0xe23(%rip),%rdi
call   1080 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c9 <main+0x339>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1090 <execvp@plt>
cmp    $0xffffffff,%eax
jne    1224 <main+0x94>
lea    0xdfb(%rip),%rdi
call   1080 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c9 <main+0x339>
jmp    122e <main+0x9e>
jmp    122e <main+0x9e>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x54(%rbp)
cmp    $0xffffffff,%eax
jne    125b <main+0xcb>
lea    0xdd2(%rip),%rdi
call   1080 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c9 <main+0x339>
mov    -0x4c(%rbp),%edi
lea    -0x50(%rbp),%rsi
xor    %edx,%edx
call   1060 <waitpid@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x58(%rbp)
cmp    $0xffffffff,%eax
jne    1296 <main+0x106>
lea    0xdb2(%rip),%rdi
call   1080 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c9 <main+0x339>
mov    0x2d43(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1070 <getrusage@plt>
cmp    $0xffffffff,%eax
jne    12c9 <main+0x139>
lea    0xd98(%rip),%rdi
call   1080 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c9 <main+0x339>
mov    -0x18(%rbp),%rsi
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
add    -0x20(%rbp),%rsi
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%edi
mov    -0x54(%rbp),%esi
call   1040 <difftime@plt>
lea    0xd99(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rsi
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rax
mov    $0x400,%ecx
cqto
idiv   %rcx
mov    %rax,%rsi
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rax
mov    $0x400,%ecx
cqto
idiv   %rcx
mov    $0x400,%ecx
cqto
idiv   %rcx
mov    %rax,%rsi
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
sub    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
cmpq   $0x1,-0x60(%rbp)
jge    13b1 <main+0x221>
movq   $0x1,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   10a0 <findMemTickSize@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rsi
lea    0xd4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x68(%rbp),%rax
mov    $0x400,%ecx
cqto
idiv   %rcx
mov    %rax,%rsi
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x60(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   10a0 <findMemTickSize@plt>
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rsi
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x70(%rbp),%rax
mov    $0x400,%ecx
cqto
idiv   %rcx
mov    %rax,%rsi
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x60(%rbp),%rdi
mov    -0x30(%rbp),%esi
call   10a0 <findMemTickSize@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rsi
lea    0xd0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%rax
mov    $0x400,%ecx
cqto
idiv   %rcx
mov    %rax,%rsi
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    0xd09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%rbp
xor    %eax,%eax
call   10c0 <fork@plt>
mov    %eax,%ebx
test   %eax,%eax
je     11c9 <main+0x29>
cmp    $0xffffffff,%ebx
jne    11e2 <main+0x42>
lea    0xe3c(%rip),%rdi
jmp    1432 <main+0x292>
mov    0x8(%rbp),%rdi
add    $0x8,%rbp
mov    %rbp,%rsi
call   10a0 <execvp@plt>
cmp    $0xffffffff,%eax
je     142b <main+0x28b>
xor    %edi,%edi
call   1060 <time@plt>
cmp    $0xffffffff,%eax
je     1410 <main+0x270>
mov    %eax,%ebp
lea    0x3c(%rsp),%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   1070 <waitpid@plt>
xor    %edi,%edi
call   1060 <time@plt>
cmp    $0xffffffff,%eax
je     1419 <main+0x279>
mov    %eax,%ebx
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1080 <getrusage@plt>
cmp    $0xffffffff,%eax
je     1422 <main+0x282>
mov    0x30(%rsp),%rsi
lea    0xe29(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rsp),%rsi
lea    0xe2b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rsp),%rsi
add    0x30(%rsp),%rsi
lea    0xe2d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1050 <difftime@plt>
lea    0xe2f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rsp),%rsi
lea    0xe2f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rax
lea    0x3ff(%rax),%rsi
test   %rax,%rax
cmovns %rax,%rsi
sar    $0xa,%rsi
lea    0xe25(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rax
lea    0xfffff(%rax),%rsi
test   %rax,%rax
cmovns %rax,%rsi
sar    $0x14,%rsi
lea    0xe1b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x30(%rsp),%rax
sub    0x28(%rsp),%rax
test   %rax,%rax
mov    $0x1,%ebp
cmovg  %rax,%rbp
mov    0x20(%rsp),%esi
mov    %rbp,%rdi
call   10b0 <findMemTickSize@plt>
mov    %rax,%rbx
lea    0xdf8(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x3ff(%rbx),%rsi
test   %rbx,%rbx
cmovns %rbx,%rsi
sar    $0xa,%rsi
lea    0xded(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x1c(%rsp),%esi
mov    %rbp,%rdi
call   10b0 <findMemTickSize@plt>
mov    %rax,%rbx
lea    0xdde(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x3ff(%rbx),%rsi
test   %rbx,%rbx
cmovns %rbx,%rsi
sar    $0xa,%rsi
lea    0xdd3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x18(%rsp),%esi
mov    %rbp,%rdi
call   10b0 <findMemTickSize@plt>
mov    %rax,%rbx
lea    0xdc4(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x3ff(%rbx),%rsi
test   %rbx,%rbx
cmovns %rbx,%rsi
sar    $0xa,%rsi
lea    0xdba(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%rsi
lea    0xdb6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%rsi
lea    0xdbd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    143d <main+0x29d>
lea    0xc05(%rip),%rdi
jmp    1432 <main+0x292>
lea    0xc17(%rip),%rdi
jmp    1432 <main+0x292>
lea    0xc27(%rip),%rdi
jmp    1432 <main+0x292>
lea    0xbdc(%rip),%rdi
call   1090 <perror@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.rusage = type { i64, i64, i64, i32, i32, i32, %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64 }
%struct.TYPE_3__ = type { i64 }
@.str = [14 x i8] c"Fork failed: \00"
@.str.1 = [14 x i8] c"Exec failed: \00"
@.str.2 = [27 x i8] c"Failed to get start time: \00"
@.str.3 = [25 x i8] c"Failed to get end time: \00"
@RUSAGE_CHILDREN = global i32 0
@.str.4 = [19 x i8] c"Getrusage failed: \00"
@.str.5 = [24 x i8] c"User CPU time (s): %ld\0A\00"
@.str.6 = [26 x i8] c"System CPU time (s): %ld\0A\00"
@.str.7 = [25 x i8] c"Total CPU time (s): %ld\0A\00"
@.str.8 = [28 x i8] c"Total Wall time (s): %6.2f\0A\00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [26 x i8] c"Maximum memory (KB): %ld\0A\00"
@.str.11 = [26 x i8] c"Maximum memory (MB): %ld\0A\00"
@.str.12 = [26 x i8] c"Maximum memory (GB): %ld\0A\00"
@.str.13 = [24 x i8] c"Maximum code (KB): %ld\0A\00"
@.str.14 = [24 x i8] c"Maximum code (MB): %ld\0A\00"
@.str.15 = [24 x i8] c"Maximum data (KB): %ld\0A\00"
@.str.16 = [24 x i8] c"Maximum data (MB): %ld\0A\00"
@.str.17 = [25 x i8] c"Maximum stack (KB): %ld\0A\00"
@.str.18 = [25 x i8] c"Maximum stack (MB): %ld\0A\00"
@.str.19 = [26 x i8] c"Number of FS Reads : %ld\0A\00"
@.str.20 = [26 x i8] c"Number of FS Writes: %ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.rusage
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = call i32 (...) @fork()
store i32 %15, i32* %7
switch i32 %15, label %29 [
i32 -1, label %16
i32 0, label %18
]
16: ; preds = %2
%17 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %130
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = call i32 @execvp(i8* %21, i8** %23)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %28
26: ; preds = %18
%27 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %130
28: ; preds = %18
br label %30
29: ; preds = %2
br label %30
30: ; preds = %29, %28
%31 = call i32 @time(i32* null)
store i32 %31, i32* %9
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %130
35: ; preds = %30
%36 = load i32, i32* %7
%37 = call i32 @waitpid(i32 %36, i32* %8, i32 0)
%38 = call i32 @time(i32* null)
store i32 %38, i32* %10
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %42
40: ; preds = %35
%41 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %130
42: ; preds = %35
%43 = load i32, i32* @RUSAGE_CHILDREN
%44 = call i32 @getrusage(i32 %43, %struct.rusage* %6)
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %130
48: ; preds = %42
%49 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 7
%50 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %49, i32 0, i32 0
%51 = load i64, i64* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i64 %51)
%53 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 6
%54 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %53, i32 0, i32 0
%55 = load i64, i64* %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i64 %55)
%57 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 7
%58 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %57, i32 0, i32 0
%59 = load i64, i64* %58
%60 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 6
%61 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %60, i32 0, i32 0
%62 = load i64, i64* %61
%63 = add nsw i64 %59, %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i64 %63)
%65 = load i32, i32* %10
%66 = load i32, i32* %9
%67 = call double @difftime(i32 %65, i32 %66)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), double %67)
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%70 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 0
%71 = load i64, i64* %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i64 %71)
%73 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 0
%74 = load i64, i64* %73
%75 = sdiv i64 %74, 1024
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i64 %75)
%77 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 0
%78 = load i64, i64* %77
%79 = sdiv i64 %78, 1024
%80 = sdiv i64 %79, 1024
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i64 %80)
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%83 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 7
%84 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %83, i32 0, i32 0
%85 = load i64, i64* %84
%86 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 6
%87 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %86, i32 0, i32 0
%88 = load i64, i64* %87
%89 = sub nsw i64 %85, %88
store i64 %89, i64* %11
%90 = load i64, i64* %11
%91 = icmp slt i64 %90, 1
br i1 %91, label %92, label %93
92: ; preds = %48
store i64 1, i64* %11
br label %93
93: ; preds = %92, %48
%94 = load i64, i64* %11
%95 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 5
%96 = load i32, i32* %95
%97 = call i64 @findMemTickSize(i64 %94, i32 %96)
store i64 %97, i64* %12
%98 = load i64, i64* %12
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), i64 %98)
%100 = load i64, i64* %12
%101 = sdiv i64 %100, 1024
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), i64 %101)
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%104 = load i64, i64* %11
%105 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 4
%106 = load i32, i32* %105
%107 = call i64 @findMemTickSize(i64 %104, i32 %106)
store i64 %107, i64* %13
%108 = load i64, i64* %13
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), i64 %108)
%110 = load i64, i64* %13
%111 = sdiv i64 %110, 1024
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), i64 %111)
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%114 = load i64, i64* %11
%115 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 3
%116 = load i32, i32* %115
%117 = call i64 @findMemTickSize(i64 %114, i32 %116)
store i64 %117, i64* %14
%118 = load i64, i64* %14
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.17, i64 0, i64 0), i64 %118)
%120 = load i64, i64* %14
%121 = sdiv i64 %120, 1024
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.18, i64 0, i64 0), i64 %121)
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%124 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 1
%125 = load i64, i64* %124
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0), i64 %125)
%127 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 2
%128 = load i64, i64* %127
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.20, i64 0, i64 0), i64 %128)
store i32 0, i32* %3
br label %130
130: ; preds = %93, %46, %40, %33, %26, %16
%131 = load i32, i32* %3
ret i32 %131
}

LLVM IR (-O2):
%struct.rusage = type { i64, i64, i64, i32, i32, i32, %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64 }
%struct.TYPE_3__ = type { i64 }
@.str = [14 x i8] c"Fork failed: \00"
@.str.1 = [14 x i8] c"Exec failed: \00"
@.str.2 = [27 x i8] c"Failed to get start time: \00"
@.str.3 = [25 x i8] c"Failed to get end time: \00"
@RUSAGE_CHILDREN = global i32 0
@.str.4 = [19 x i8] c"Getrusage failed: \00"
@.str.5 = [24 x i8] c"User CPU time (s): %ld\0A\00"
@.str.6 = [26 x i8] c"System CPU time (s): %ld\0A\00"
@.str.7 = [25 x i8] c"Total CPU time (s): %ld\0A\00"
@.str.8 = [28 x i8] c"Total Wall time (s): %6.2f\0A\00"
@.str.10 = [26 x i8] c"Maximum memory (KB): %ld\0A\00"
@.str.11 = [26 x i8] c"Maximum memory (MB): %ld\0A\00"
@.str.12 = [26 x i8] c"Maximum memory (GB): %ld\0A\00"
@.str.13 = [24 x i8] c"Maximum code (KB): %ld\0A\00"
@.str.14 = [24 x i8] c"Maximum code (MB): %ld\0A\00"
@.str.15 = [24 x i8] c"Maximum data (KB): %ld\0A\00"
@.str.16 = [24 x i8] c"Maximum data (MB): %ld\0A\00"
@.str.17 = [25 x i8] c"Maximum stack (KB): %ld\0A\00"
@.str.18 = [25 x i8] c"Maximum stack (MB): %ld\0A\00"
@.str.19 = [26 x i8] c"Number of FS Reads : %ld\0A\00"
@.str.20 = [26 x i8] c"Number of FS Writes: %ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.rusage
%4 = alloca i32
%5 = bitcast %struct.rusage* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 (...) @fork()
switch i32 %7, label %17 [
i32 -1, label %8
i32 0, label %10
]
8: ; preds = %2
%9 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %90
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @execvp(i8* %12, i8** %11)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %90
17: ; preds = %2, %10
%18 = tail call i32 @time(i32* null)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %90
22: ; preds = %17
%23 = call i32 @waitpid(i32 %7, i32* %4, i32 0)
%24 = call i32 @time(i32* null)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %90
28: ; preds = %22
%29 = load i32, i32* @RUSAGE_CHILDREN
%30 = call i32 @getrusage(i32 %29, %struct.rusage* %3)
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %90
34: ; preds = %28
%35 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 7, i32 0
%36 = load i64, i64* %35
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i64 %36)
%38 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 6, i32 0
%39 = load i64, i64* %38
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i64 %39)
%41 = load i64, i64* %35
%42 = load i64, i64* %38
%43 = add nsw i64 %42, %41
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i64 %43)
%45 = call double @difftime(i32 %24, i32 %18)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), double %45)
%47 = call i32 @putchar(i32 10)
%48 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 0
%49 = load i64, i64* %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i64 %49)
%51 = load i64, i64* %48
%52 = sdiv i64 %51, 1024
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i64 %52)
%54 = load i64, i64* %48
%55 = sdiv i64 %54, 1048576
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i64 %55)
%57 = call i32 @putchar(i32 10)
%58 = load i64, i64* %35
%59 = load i64, i64* %38
%60 = sub nsw i64 %58, %59
%61 = icmp sgt i64 %60, 1
%62 = select i1 %61, i64 %60, i64 1
%63 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 5
%64 = load i32, i32* %63
%65 = call i64 @findMemTickSize(i64 %62, i32 %64)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), i64 %65)
%67 = sdiv i64 %65, 1024
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), i64 %67)
%69 = call i32 @putchar(i32 10)
%70 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 4
%71 = load i32, i32* %70
%72 = call i64 @findMemTickSize(i64 %62, i32 %71)
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), i64 %72)
%74 = sdiv i64 %72, 1024
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), i64 %74)
%76 = call i32 @putchar(i32 10)
%77 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 3
%78 = load i32, i32* %77
%79 = call i64 @findMemTickSize(i64 %62, i32 %78)
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.17, i64 0, i64 0), i64 %79)
%81 = sdiv i64 %79, 1024
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.18, i64 0, i64 0), i64 %81)
%83 = call i32 @putchar(i32 10)
%84 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 1
%85 = load i64, i64* %84
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0), i64 %85)
%87 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 2
%88 = load i64, i64* %87
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.20, i64 0, i64 0), i64 %88)
br label %90
90: ; preds = %34, %32, %26, %20, %15, %8
%91 = phi i32 [ -1, %20 ], [ -1, %26 ], [ -1, %32 ], [ 0, %34 ], [ -1, %15 ], [ -1, %8 ]
ret i32 %91
}