#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_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  long tv_sec;
  long tv_usec;
};
struct rusage {
  long ru_maxrss;
  TYPE_1__ ru_utime;
};
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
int /*<<< orphan*/ SIGKILL;
scalar_t__ clock();
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ kill(int, int /*<<< orphan*/);
int /*<<< orphan*/ malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[], char *envp[]) {
  int pid, i;
  long int memory[10];
  long int memory_total = 0;
  long int ucp[10], ucp_decimal[10];
  double time_spent;
  struct rusage rusage;
  clock_t begin;
  pid = fork();
  if (pid < 0) {
    perror("Erro: ");
    exit(-1);
  } else if (pid > 0) {
    for (i = 0; i < 10; i++) {
      begin = clock();
      while (1) {
        time_spent = (double)(clock() - begin) / CLOCKS_PER_SEC;
        if (time_spent == 1.0) {
          getrusage(0, &rusage);
          memory_total += rusage.ru_maxrss;
          memory[i] = rusage.ru_maxrss;
          ucp[i] = rusage.ru_utime.tv_sec;
          ucp_decimal[i] = rusage.ru_utime.tv_usec;
          break;
        }
      }
    }
    kill(pid, SIGKILL);
  } else {
    if (strcmp(argv[1], "cpu") == 0) {
      for (;;) {
      }
    } else if (strcmp(argv[1], "cpu-mem") == 0) {
      for (;;) {
        malloc(sizeof(10));
      }
    } else {
      printf("\nargv[] digitado incorretamente\n");
    }
  }
  for (i = 0; i < 10; i++) {
    printf("Em %d segundo(s):\nMemoria: %ld Kilobytes | CPU: %ld.%ld%c \n\n",
           i + 1, memory[i], ucp[i] * 10, ucp_decimal[i] / 1000, 37);
  }
  printf(
      "Uso total de:\nMemoria: %ld Kilobytes | Uso total de CPU: %ld.%ld%c\n",
      memory_total, ucp[9] * 10, ucp_decimal[9] / 1000, 37);
  printf("Tchau!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x78(%rbp)
mov    $0x0,%al
call   10b0 <fork@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    11df <main+0x4f>
lea    0xe38(%rip),%rdi
call   1090 <perror@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
cmpl   $0x0,-0x1c(%rbp)
jle    12d4 <main+0x144>
movl   $0x0,-0x20(%rbp)
cmpl   $0xa,-0x20(%rbp)
jge    12be <main+0x12e>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x148(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
sub    -0x148(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2dc6(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x128(%rbp)
ff
movsd  -0x128(%rbp),%xmm0
ff
movsd  0xdc2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    12a6 <main+0x116>
jp     12a6 <main+0x116>
xor    %edi,%edi
lea    -0x140(%rbp),%rsi
call   1080 <getrusage@plt>
mov    -0x140(%rbp),%rax
add    -0x78(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x140(%rbp),%rcx
movslq -0x20(%rbp),%rax
mov    %rcx,-0x70(%rbp,%rax,8)
mov    -0x138(%rbp),%rcx
movslq -0x20(%rbp),%rax
mov    %rcx,-0xd0(%rbp,%rax,8)
ff
mov    -0x130(%rbp),%rcx
movslq -0x20(%rbp),%rax
mov    %rcx,-0x120(%rbp,%rax,8)
ff
jmp    12ab <main+0x11b>
jmp    1208 <main+0x78>
jmp    12b0 <main+0x120>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11f0 <main+0x60>
mov    -0x1c(%rbp),%edi
mov    0x2d10(%rip),%rax
mov    (%rax),%esi
call   1060 <kill@plt>
jmp    1346 <main+0x1b6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd2c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12fc <main+0x16c>
jmp    12f7 <main+0x167>
jmp    12f7 <main+0x167>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd08(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    132e <main+0x19e>
jmp    131f <main+0x18f>
mov    $0x4,%edi
call   1070 <malloc@plt>
jmp    131f <main+0x18f>
lea    0xce6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1341 <main+0x1b1>
jmp    1346 <main+0x1b6>
jmp    134b <main+0x1bb>
movl   $0x0,-0x20(%rbp)
cmpl   $0xa,-0x20(%rbp)
jge    13c1 <main+0x231>
mov    -0x20(%rbp),%esi
add    $0x1,%esi
movslq -0x20(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rax
mov    %rax,-0x150(%rbp)
movslq -0x20(%rbp),%rax
imul   $0xa,-0xd0(%rbp,%rax,8),%rcx
ff 0a
movslq -0x20(%rbp),%rax
mov    -0x120(%rbp,%rax,8),%rax
ff
mov    $0x3e8,%edi
cqto
idiv   %rdi
mov    -0x150(%rbp),%rdx
mov    %rax,%r8
lea    0xc96(%rip),%rdi
mov    $0x25,%r9d
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1352 <main+0x1c2>
mov    -0x78(%rbp),%rsi
imul   $0xa,-0x88(%rbp),%rax
0a
mov    %rax,-0x158(%rbp)
mov    -0xd8(%rbp),%rax
mov    $0x3e8,%ecx
cqto
idiv   %rcx
mov    -0x158(%rbp),%rdx
mov    %rax,%rcx
lea    0xc83(%rip),%rdi
mov    $0x25,%r8d
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xcb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
mov    %rsi,%rbx
xor    %eax,%eax
call   10c0 <fork@plt>
test   %eax,%eax
js     16b2 <main+0x512>
je     1671 <main+0x4d1>
mov    %eax,%r14d
mov    0x2e15(%rip),%rbx
lea    0x98(%rsp),%r15
xor    %r13d,%r13d
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%rbp
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <clock@plt>
sub    %rbp,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%rbx),%xmm0
ucomisd 0xde2(%rip),%xmm0
jne    1200 <main+0x60>
jp     1200 <main+0x60>
xor    %edi,%edi
mov    %r15,%rsi
call   1090 <getrusage@plt>
mov    0x98(%rsp),%rax
mov    0xa0(%rsp),%rcx
add    %rax,%r12
mov    %rax,0x150(%rsp,%r13,8)
mov    %rcx,0x100(%rsp,%r13,8)
mov    0xa8(%rsp),%rax
mov    %rax,0xb0(%rsp,%r13,8)
add    $0x1,%r13
cmp    $0xa,%r13
jne    11f0 <main+0x50>
mov    0x2d68(%rip),%rax
mov    (%rax),%esi
mov    %r14d,%edi
call   1070 <kill@plt>
mov    0x100(%rsp),%r9
mov    0x108(%rsp),%r10
mov    0x110(%rsp),%r11
mov    0x118(%rsp),%r14
mov    0x120(%rsp),%rdi
movabs $0x20c49ba5e353f7cf,%rbx
9b c4 20
mov    %rbx,%rax
imulq  0xb0(%rsp)
mov    %rdx,%rcx
mov    %rdx,%r8
shr    $0x3f,%r8
sar    $0x7,%rcx
mov    %rbx,%rax
imulq  0xb8(%rsp)
add    %rcx,%r8
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x7,%rdx
add    %rdx,%rax
mov    %rax,0x90(%rsp)
mov    %rbx,%rax
imulq  0xc0(%rsp)
mov    %rdx,%rcx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x7,%rcx
mov    %rbx,%rax
imulq  0xc8(%rsp)
add    %rcx,%rsi
mov    %rsi,0x78(%rsp)
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x7,%rdx
add    %rdx,%rax
mov    %rax,0x80(%rsp)
mov    %rbx,%rax
imulq  0xd0(%rsp)
mov    %rdx,%rbp
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x7,%rbp
mov    %rbx,%rax
imulq  0xd8(%rsp)
mov    %rdx,%rsi
add    %rbp,%rcx
mov    %rcx,0x70(%rsp)
mov    %rbx,%rax
imulq  0xe0(%rsp)
mov    %rdx,%rcx
mov    %rbx,%rax
imulq  0xe8(%rsp)
mov    %rsi,%r13
shr    $0x3f,%r13
sar    $0x7,%rsi
add    %rsi,%r13
mov    %rcx,%rbx
shr    $0x3f,%rbx
sar    $0x7,%rcx
add    %rcx,%rbx
mov    %rdx,%r15
shr    $0x3f,%r15
sar    $0x7,%rdx
add    %rdx,%r15
mov    0x128(%rsp),%rax
add    %r9,%r9
lea    (%r9,%r9,4),%rcx
add    %r10,%r10
lea    (%r10,%r10,4),%rdx
mov    %rdx,0x10(%rsp)
add    %r11,%r11
lea    (%r11,%r11,4),%rdx
mov    %rdx,0x18(%rsp)
add    %r14,%r14
lea    (%r14,%r14,4),%rdx
mov    %rdx,0x28(%rsp)
add    %rdi,%rdi
lea    (%rdi,%rdi,4),%rdx
mov    %rdx,0x38(%rsp)
add    %rax,%rax
lea    (%rax,%rax,4),%rax
mov    %rax,0x48(%rsp)
mov    0x130(%rsp),%rax
add    %rax,%rax
lea    (%rax,%rax,4),%rax
mov    %rax,0x58(%rsp)
mov    0x138(%rsp),%rax
add    %rax,%rax
lea    (%rax,%rax,4),%rax
mov    %rax,0x68(%rsp)
mov    0x150(%rsp),%rdx
mov    0x158(%rsp),%rbp
mov    0x160(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    0x168(%rsp),%rax
mov    %rax,0x20(%rsp)
mov    0x170(%rsp),%rax
mov    %rax,0x30(%rsp)
mov    0x178(%rsp),%rax
mov    %rax,0x40(%rsp)
mov    0x180(%rsp),%rax
mov    %rax,0x50(%rsp)
mov    0x188(%rsp),%rax
mov    %rax,0x60(%rsp)
mov    0x190(%rsp),%rax
mov    %rax,0x88(%rsp)
lea    0xb96(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x25,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    %rbp,%rdx
mov    0x10(%rsp),%rcx
mov    0x90(%rsp),%r8
mov    $0x25,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
mov    0x8(%rsp),%rdx
mov    0x18(%rsp),%rcx
mov    0x78(%rsp),%r8
mov    $0x25,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    0x20(%rsp),%rdx
mov    0x28(%rsp),%rcx
mov    0x80(%rsp),%r8
mov    $0x25,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
mov    0x30(%rsp),%rdx
mov    0x38(%rsp),%rcx
mov    0x70(%rsp),%r8
mov    $0x25,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    $0x6,%esi
mov    0x40(%rsp),%rdx
mov    0x48(%rsp),%rcx
mov    %r13,%r8
mov    $0x25,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    $0x7,%esi
mov    0x50(%rsp),%rdx
mov    0x58(%rsp),%rcx
mov    %rbx,%r8
mov    $0x25,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %r14,%r13
mov    $0x8,%esi
mov    0x60(%rsp),%rdx
mov    0x68(%rsp),%rcx
mov    %r15,%r8
mov    $0x25,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x140(%rsp),%rcx
add    %rcx,%rcx
movabs $0x20c49ba5e353f7cf,%rbx
9b c4 20
mov    %rbx,%rax
imulq  0xf0(%rsp)
lea    (%rcx,%rcx,4),%rcx
mov    %rdx,%r8
shr    $0x3f,%r8
sar    $0x7,%rdx
add    %rdx,%r8
mov    %r14,%rdi
mov    $0x9,%esi
mov    0x88(%rsp),%rdx
mov    $0x25,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x198(%rsp),%rcx
mov    0x148(%rsp),%rsi
add    %rsi,%rsi
mov    %rbx,%rax
imulq  0xf8(%rsp)
lea    (%rsi,%rsi,4),%r14
mov    %rdx,%rbp
shr    $0x3f,%rbp
sar    $0x7,%rdx
add    %rdx,%rbp
mov    %r13,%rdi
mov    $0xa,%esi
mov    %rcx,%rdx
mov    %r14,%rcx
mov    %rbp,%r8
mov    $0x25,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xa1d(%rip),%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
mov    $0x25,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xa64(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rbx),%rdi
lea    0x993(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     16b0 <main+0x510>
mov    0x8(%rbx),%rdi
lea    0x982(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    16c8 <main+0x528>
nopl   0x0(%rax,%rax,1)
mov    $0x4,%edi
call   1080 <malloc@plt>
jmp    16a0 <main+0x500>
nopl   0x0(%rax)
jmp    16b0 <main+0x510>
lea    0x94f(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
lea    0x9cd(%rip),%rdi
call   1030 <puts@plt>

LLVM IR (-O0):
%struct.rusage = type { i64, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64, i64 }
@.str = [7 x i8] c"Erro: \00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@SIGKILL = global i32 0
@.str.1 = [4 x i8] c"cpu\00"
@.str.2 = [8 x i8] c"cpu-mem\00"
@.str.3 = [33 x i8] c"\0Aargv[] digitado incorretamente\0A\00"
@.str.4 = [61 x i8] c"Em %d segundo(s):\0AMemoria: %ld Kilobytes | CPU: %ld.%ld%c \0A\0A\00"
@.str.5 = [68 x i8] c"Uso total de:\0AMemoria: %ld Kilobytes | Uso total de CPU: %ld.%ld%c\0A\00"
@.str.6 = [8 x i8] c"Tchau!\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
%10 = alloca [10 x i64]
%11 = alloca i64
%12 = alloca [10 x i64]
%13 = alloca [10 x i64]
%14 = alloca double
%15 = alloca %struct.rusage
%16 = alloca i64
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i64 0, i64* %11
%17 = call i32 (...) @fork()
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %3
%21 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @exit(i32 -1)
unreachable
23: ; preds = %3
%24 = load i32, i32* %8
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %73
26: ; preds = %23
store i32 0, i32* %9
br label %27
27: ; preds = %66, %26
%28 = load i32, i32* %9
%29 = icmp slt i32 %28, 10
br i1 %29, label %30, label %69
30: ; preds = %27
%31 = call i64 (...) @clock()
store i64 %31, i64* %16
br label %32
32: ; preds = %30, %64
%33 = call i64 (...) @clock()
%34 = load i64, i64* %16
%35 = sub nsw i64 %33, %34
%36 = sitofp i64 %35 to double
%37 = load double, double* @CLOCKS_PER_SEC
%38 = fdiv double %36, %37
store double %38, double* %14
%39 = load double, double* %14
%40 = fcmp oeq double %39, 1.000000e+00
br i1 %40, label %41, label %64
41: ; preds = %32
%42 = call i32 @getrusage(i32 0, %struct.rusage* %15)
%43 = getelementptr inbounds %struct.rusage, %struct.rusage* %15, i32 0, i32 0
%44 = load i64, i64* %43
%45 = load i64, i64* %11
%46 = add nsw i64 %45, %44
store i64 %46, i64* %11
%47 = getelementptr inbounds %struct.rusage, %struct.rusage* %15, i32 0, i32 0
%48 = load i64, i64* %47
%49 = load i32, i32* %9
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [10 x i64], [10 x i64]* %10, i64 0, i64 %50
store i64 %48, i64* %51
%52 = getelementptr inbounds %struct.rusage, %struct.rusage* %15, i32 0, i32 1
%53 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %52, i32 0, i32 0
%54 = load i64, i64* %53
%55 = load i32, i32* %9
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [10 x i64], [10 x i64]* %12, i64 0, i64 %56
store i64 %54, i64* %57
%58 = getelementptr inbounds %struct.rusage, %struct.rusage* %15, i32 0, i32 1
%59 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %58, i32 0, i32 1
%60 = load i64, i64* %59
%61 = load i32, i32* %9
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [10 x i64], [10 x i64]* %13, i64 0, i64 %62
store i64 %60, i64* %63
br label %65
64: ; preds = %32
br label %32
65: ; preds = %41
br label %66
66: ; preds = %65
%67 = load i32, i32* %9
%68 = add nsw i32 %67, 1
store i32 %68, i32* %9
br label %27
69: ; preds = %27
%70 = load i32, i32* %8
%71 = load i32, i32* @SIGKILL
%72 = call i32 @kill(i32 %70, i32 %71)
br label %94
73: ; preds = %23
%74 = load i8**, i8*** %6
%75 = getelementptr inbounds i8*, i8** %74, i64 1
%76 = load i8*, i8** %75
%77 = call i64 @strcmp(i8* %76, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %73
br label %80
80: ; preds = %80, %79
br label %80
81: ; preds = %73
%82 = load i8**, i8*** %6
%83 = getelementptr inbounds i8*, i8** %82, i64 1
%84 = load i8*, i8** %83
%85 = call i64 @strcmp(i8* %84, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %90
87: ; preds = %81
br label %88
88: ; preds = %88, %87
%89 = call i32 @malloc(i32 4)
br label %88
90: ; preds = %81
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %92
92: ; preds = %90
br label %93
93: ; preds = %92
br label %94
94: ; preds = %93, %69
br label %95
95: ; preds = %94
store i32 0, i32* %9
br label %96
96: ; preds = %117, %95
%97 = load i32, i32* %9
%98 = icmp slt i32 %97, 10
br i1 %98, label %99, label %120
99: ; preds = %96
%100 = load i32, i32* %9
%101 = add nsw i32 %100, 1
%102 = load i32, i32* %9
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [10 x i64], [10 x i64]* %10, i64 0, i64 %103
%105 = load i64, i64* %104
%106 = load i32, i32* %9
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [10 x i64], [10 x i64]* %12, i64 0, i64 %107
%109 = load i64, i64* %108
%110 = mul nsw i64 %109, 10
%111 = load i32, i32* %9
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [10 x i64], [10 x i64]* %13, i64 0, i64 %112
%114 = load i64, i64* %113
%115 = sdiv i64 %114, 1000
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 %101, i64 %105, i64 %110, i64 %115, i32 37)
br label %117
117: ; preds = %99
%118 = load i32, i32* %9
%119 = add nsw i32 %118, 1
store i32 %119, i32* %9
br label %96
120: ; preds = %96
%121 = load i64, i64* %11
%122 = getelementptr inbounds [10 x i64], [10 x i64]* %12, i64 0, i64 9
%123 = load i64, i64* %122
%124 = mul nsw i64 %123, 10
%125 = getelementptr inbounds [10 x i64], [10 x i64]* %13, i64 0, i64 9
%126 = load i64, i64* %125
%127 = sdiv i64 %126, 1000
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.5, i64 0, i64 0), i64 %121, i64 %124, i64 %127, i32 37)
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.rusage = type { i64, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64, i64 }
@.str = [7 x i8] c"Erro: \00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@SIGKILL = global i32 0
@.str.1 = [4 x i8] c"cpu\00"
@.str.2 = [8 x i8] c"cpu-mem\00"
@.str.4 = [61 x i8] c"Em %d segundo(s):\0AMemoria: %ld Kilobytes | CPU: %ld.%ld%c \0A\0A\00"
@.str.5 = [68 x i8] c"Uso total de:\0AMemoria: %ld Kilobytes | Uso total de CPU: %ld.%ld%c\0A\00"
@str = [32 x i8] c"\0Aargv[] digitado incorretamente\00"
@str.7 = [7 x i8] c"Tchau!\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture readnone %2) {
%4 = alloca [10 x i64]
%5 = alloca [10 x i64]
%6 = alloca [10 x i64]
%7 = alloca %struct.rusage
%8 = bitcast [10 x i64]* %4 to i8*
%9 = bitcast [10 x i64]* %5 to i8*
%10 = bitcast [10 x i64]* %6 to i8*
%11 = bitcast %struct.rusage* %7 to i8*
%12 = tail call i32 (...) @fork()
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%16 = tail call i32 @exit(i32 -1)
unreachable
17: ; preds = %3
%18 = icmp eq i32 %12, 0
br i1 %18, label %140, label %19
19: ; preds = %17
%20 = getelementptr inbounds %struct.rusage, %struct.rusage* %7, i64 0, i32 0
%21 = getelementptr inbounds %struct.rusage, %struct.rusage* %7, i64 0, i32 1, i32 0
%22 = getelementptr inbounds %struct.rusage, %struct.rusage* %7, i64 0, i32 1, i32 1
br label %23
23: ; preds = %19, %34
%24 = phi i64 [ 0, %19 ], [ %43, %34 ]
%25 = phi i64 [ 0, %19 ], [ %37, %34 ]
%26 = call i64 (...) @clock()
br label %27
27: ; preds = %27, %23
%28 = call i64 (...) @clock()
%29 = sub nsw i64 %28, %26
%30 = sitofp i64 %29 to double
%31 = load double, double* @CLOCKS_PER_SEC
%32 = fdiv double %30, %31
%33 = fcmp oeq double %32, 1.000000e+00
br i1 %33, label %34, label %27
34: ; preds = %27
%35 = call i32 @getrusage(i32 0, %struct.rusage* %7)
%36 = load i64, i64* %20
%37 = add nsw i64 %36, %25
%38 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 %24
store i64 %36, i64* %38
%39 = load i64, i64* %21
%40 = getelementptr inbounds [10 x i64], [10 x i64]* %5, i64 0, i64 %24
store i64 %39, i64* %40
%41 = load i64, i64* %22
%42 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 %24
store i64 %41, i64* %42
%43 = add nuw nsw i64 %24, 1
%44 = icmp eq i64 %43, 10
br i1 %44, label %45, label %23
45: ; preds = %34
%46 = load i32, i32* @SIGKILL
%47 = call i32 @kill(i32 %12, i32 %46)
%48 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 0
%49 = load i64, i64* %48
%50 = getelementptr inbounds [10 x i64], [10 x i64]* %5, i64 0, i64 0
%51 = load i64, i64* %50
%52 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 0
%53 = load i64, i64* %52
%54 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 1
%55 = load i64, i64* %54
%56 = getelementptr inbounds [10 x i64], [10 x i64]* %5, i64 0, i64 1
%57 = load i64, i64* %56
%58 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 1
%59 = load i64, i64* %58
%60 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 2
%61 = load i64, i64* %60
%62 = getelementptr inbounds [10 x i64], [10 x i64]* %5, i64 0, i64 2
%63 = load i64, i64* %62
%64 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 2
%65 = load i64, i64* %64
%66 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 3
%67 = load i64, i64* %66
%68 = getelementptr inbounds [10 x i64], [10 x i64]* %5, i64 0, i64 3
%69 = load i64, i64* %68
%70 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 3
%71 = load i64, i64* %70
%72 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 4
%73 = load i64, i64* %72
%74 = getelementptr inbounds [10 x i64], [10 x i64]* %5, i64 0, i64 4
%75 = load i64, i64* %74
%76 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 4
%77 = load i64, i64* %76
%78 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 5
%79 = load i64, i64* %78
%80 = getelementptr inbounds [10 x i64], [10 x i64]* %5, i64 0, i64 5
%81 = load i64, i64* %80
%82 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 5
%83 = load i64, i64* %82
%84 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 6
%85 = load i64, i64* %84
%86 = getelementptr inbounds [10 x i64], [10 x i64]* %5, i64 0, i64 6
%87 = load i64, i64* %86
%88 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 6
%89 = load i64, i64* %88
%90 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 7
%91 = load i64, i64* %90
%92 = getelementptr inbounds [10 x i64], [10 x i64]* %5, i64 0, i64 7
%93 = load i64, i64* %92
%94 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 7
%95 = load i64, i64* %94
%96 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 8
%97 = load i64, i64* %96
%98 = mul i64 %51, 10
%99 = sdiv i64 %53, 1000
%100 = mul i64 %57, 10
%101 = sdiv i64 %59, 1000
%102 = mul i64 %63, 10
%103 = sdiv i64 %65, 1000
%104 = mul i64 %69, 10
%105 = sdiv i64 %71, 1000
%106 = mul i64 %75, 10
%107 = sdiv i64 %77, 1000
%108 = mul i64 %81, 10
%109 = sdiv i64 %83, 1000
%110 = mul i64 %87, 10
%111 = sdiv i64 %89, 1000
%112 = mul i64 %93, 10
%113 = sdiv i64 %95, 1000
%114 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 1, i64 %49, i64 %98, i64 %99, i32 37)
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 2, i64 %55, i64 %100, i64 %101, i32 37)
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 3, i64 %61, i64 %102, i64 %103, i32 37)
%117 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 4, i64 %67, i64 %104, i64 %105, i32 37)
%118 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 5, i64 %73, i64 %106, i64 %107, i32 37)
%119 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 6, i64 %79, i64 %108, i64 %109, i32 37)
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 7, i64 %85, i64 %110, i64 %111, i32 37)
%121 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 8, i64 %91, i64 %112, i64 %113, i32 37)
%122 = getelementptr inbounds [10 x i64], [10 x i64]* %5, i64 0, i64 8
%123 = load i64, i64* %122
%124 = mul nsw i64 %123, 10
%125 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 8
%126 = load i64, i64* %125
%127 = sdiv i64 %126, 1000
%128 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 9, i64 %97, i64 %124, i64 %127, i32 37)
%129 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 9
%130 = load i64, i64* %129
%131 = getelementptr inbounds [10 x i64], [10 x i64]* %5, i64 0, i64 9
%132 = load i64, i64* %131
%133 = mul nsw i64 %132, 10
%134 = getelementptr inbounds [10 x i64], [10 x i64]* %6, i64 0, i64 9
%135 = load i64, i64* %134
%136 = sdiv i64 %135, 1000
%137 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 10, i64 %130, i64 %133, i64 %136, i32 37)
%138 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.5, i64 0, i64 0), i64 %37, i64 %133, i64 %136, i32 37)
%139 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.7, i64 0, i64 0))
ret i32 0
140: ; preds = %17
%141 = getelementptr inbounds i8*, i8** %1, i64 1
%142 = load i8*, i8** %141
%143 = tail call i64 @strcmp(i8* %142, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%144 = icmp eq i64 %143, 0
br i1 %144, label %145, label %146
145: ; preds = %140, %145
br label %145
146: ; preds = %140
%147 = load i8*, i8** %141
%148 = tail call i64 @strcmp(i8* %147, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%149 = icmp eq i64 %148, 0
br i1 %149, label %150, label %152
150: ; preds = %146, %150
%151 = tail call i32 @malloc(i32 4)
br label %150
152: ; preds = %146
%153 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
unreachable
}