#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 */

/* Variables and functions */
float clock_pid();
float clock_ppid();
float clock_time_of_day();
float *malloc(int);
int /*<<< orphan*/ printf(char *, float);
float *simple_time() {
  float *retArray = malloc(sizeof(float) * 3);
  int i;
  float sum = 0;
  for (i = 0; i < 10; i++) {
    float res;
    res = clock_ppid();
    printf("microseconds for the call clockppid %f\n", res);
    sum += res;
  }
  float avg1 = sum / 10;
  retArray[0] = avg1;
  sum = 0;
  for (i = 0; i < 10; i++) {
    float res;
    res = clock_pid();
    printf("microseconds for the call clockpid %f\n", res);
    sum += res;
  }
  float avg2 = sum / 10;
  retArray[1] = avg2;
  sum = 0;
  for (i = 0; i < 10; i++) {
    float res;
    res = clock_time_of_day();
    printf("microseconds for the call clocktimeofday%f\n", res);
    sum += res;
  }
  float avg3 = sum / 10;
  retArray[2] = avg2;
  return retArray;
}


x86 assembly (clang, -O0):
<simple_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0xc,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    11b9 <simple_time+0x69>
mov    $0x0,%al
call   1030 <clock_ppid@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
movss  -0x14(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1175 <simple_time+0x25>
movss  -0x10(%rbp),%xmm0
movss  0xe3a(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    122f <simple_time+0xdf>
mov    $0x0,%al
call   1070 <clock_pid@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
lea    0xe1f(%rip),%rdi
call   1040 <printf@plt>
movss  -0x1c(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11eb <simple_time+0x9b>
movss  -0x10(%rbp),%xmm0
movss  0xdc4(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    12a6 <simple_time+0x156>
mov    $0x0,%al
call   1060 <clock_time_of_day@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
lea    0xdcf(%rip),%rdi
call   1040 <printf@plt>
movss  -0x24(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1262 <simple_time+0x112>
movss  -0x10(%rbp),%xmm0
movss  0xd4d(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_time>:
push   %r14
push   %rbx
push   %rax
mov    $0xc,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1030 <clock_ppid@plt>
movss  %xmm0,(%rsp)
lea    0xe94(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movss  (%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,(%rsp)
xor    %eax,%eax
call   1030 <clock_ppid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <clock_ppid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <clock_ppid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <clock_ppid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <clock_ppid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <clock_ppid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <clock_ppid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <clock_ppid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <clock_ppid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
divss  0xd23(%rip),%xmm0
movss  %xmm0,(%r14)
xor    %eax,%eax
call   1070 <clock_pid@plt>
movss  %xmm0,(%rsp)
lea    0xd3b(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0xcfa(%rip),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <clock_pid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <clock_pid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <clock_pid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <clock_pid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <clock_pid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <clock_pid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <clock_pid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <clock_pid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <clock_pid@plt>
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
divss  0xba1(%rip),%xmm0
movss  %xmm0,(%rsp)
movss  %xmm0,0x4(%r14)
xor    %eax,%eax
call   1060 <clock_time_of_day@plt>
lea    0xbdf(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <clock_time_of_day@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <clock_time_of_day@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <clock_time_of_day@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <clock_time_of_day@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <clock_time_of_day@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <clock_time_of_day@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <clock_time_of_day@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <clock_time_of_day@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <clock_time_of_day@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  (%rsp),%xmm0
movss  %xmm0,0x8(%r14)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [40 x i8] c"microseconds for the call clockppid %f\0A\00"
@.str.1 = [39 x i8] c"microseconds for the call clockpid %f\0A\00"
@.str.2 = [44 x i8] c"microseconds for the call clocktimeofday%f\0A\00"
define float* @simple_time() {
%1 = alloca float*
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = call float* @malloc(i32 12)
store float* %10, float** %1
store float 0.000000e+00, float* %3
store i32 0, i32* %2
br label %11
11: ; preds = %21, %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = call float (...) @clock_ppid()
store float %15, float* %4
%16 = load float, float* %4
%17 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), float %16)
%18 = load float, float* %4
%19 = load float, float* %3
%20 = fadd float %19, %18
store float %20, float* %3
br label %21
21: ; preds = %14
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %11
24: ; preds = %11
%25 = load float, float* %3
%26 = fdiv float %25, 1.000000e+01
store float %26, float* %5
%27 = load float, float* %5
%28 = load float*, float** %1
%29 = getelementptr inbounds float, float* %28, i64 0
store float %27, float* %29
store float 0.000000e+00, float* %3
store i32 0, i32* %2
br label %30
30: ; preds = %40, %24
%31 = load i32, i32* %2
%32 = icmp slt i32 %31, 10
br i1 %32, label %33, label %43
33: ; preds = %30
%34 = call float (...) @clock_pid()
store float %34, float* %6
%35 = load float, float* %6
%36 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), float %35)
%37 = load float, float* %6
%38 = load float, float* %3
%39 = fadd float %38, %37
store float %39, float* %3
br label %40
40: ; preds = %33
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
br label %30
43: ; preds = %30
%44 = load float, float* %3
%45 = fdiv float %44, 1.000000e+01
store float %45, float* %7
%46 = load float, float* %7
%47 = load float*, float** %1
%48 = getelementptr inbounds float, float* %47, i64 1
store float %46, float* %48
store float 0.000000e+00, float* %3
store i32 0, i32* %2
br label %49
49: ; preds = %59, %43
%50 = load i32, i32* %2
%51 = icmp slt i32 %50, 10
br i1 %51, label %52, label %62
52: ; preds = %49
%53 = call float (...) @clock_time_of_day()
store float %53, float* %8
%54 = load float, float* %8
%55 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), float %54)
%56 = load float, float* %8
%57 = load float, float* %3
%58 = fadd float %57, %56
store float %58, float* %3
br label %59
59: ; preds = %52
%60 = load i32, i32* %2
%61 = add nsw i32 %60, 1
store i32 %61, i32* %2
br label %49
62: ; preds = %49
%63 = load float, float* %3
%64 = fdiv float %63, 1.000000e+01
store float %64, float* %9
%65 = load float, float* %7
%66 = load float*, float** %1
%67 = getelementptr inbounds float, float* %66, i64 2
store float %65, float* %67
%68 = load float*, float** %1
ret float* %68
}

LLVM IR (-O2):
@.str = [40 x i8] c"microseconds for the call clockppid %f\0A\00"
@.str.1 = [39 x i8] c"microseconds for the call clockpid %f\0A\00"
@.str.2 = [44 x i8] c"microseconds for the call clocktimeofday%f\0A\00"
define noalias float* @simple_time() {
%1 = tail call float* @malloc(i32 12)
%2 = tail call float (...) @clock_ppid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), float %2)
%4 = fadd float %2, 0.000000e+00
%5 = tail call float (...) @clock_ppid()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), float %5)
%7 = fadd float %4, %5
%8 = tail call float (...) @clock_ppid()
%9 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), float %8)
%10 = fadd float %7, %8
%11 = tail call float (...) @clock_ppid()
%12 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), float %11)
%13 = fadd float %10, %11
%14 = tail call float (...) @clock_ppid()
%15 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), float %14)
%16 = fadd float %13, %14
%17 = tail call float (...) @clock_ppid()
%18 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), float %17)
%19 = fadd float %16, %17
%20 = tail call float (...) @clock_ppid()
%21 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), float %20)
%22 = fadd float %19, %20
%23 = tail call float (...) @clock_ppid()
%24 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), float %23)
%25 = fadd float %22, %23
%26 = tail call float (...) @clock_ppid()
%27 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), float %26)
%28 = fadd float %25, %26
%29 = tail call float (...) @clock_ppid()
%30 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), float %29)
%31 = fadd float %28, %29
%32 = fdiv float %31, 1.000000e+01
store float %32, float* %1
%33 = tail call float (...) @clock_pid()
%34 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), float %33)
%35 = fadd float %33, 0.000000e+00
%36 = tail call float (...) @clock_pid()
%37 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), float %36)
%38 = fadd float %35, %36
%39 = tail call float (...) @clock_pid()
%40 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), float %39)
%41 = fadd float %38, %39
%42 = tail call float (...) @clock_pid()
%43 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), float %42)
%44 = fadd float %41, %42
%45 = tail call float (...) @clock_pid()
%46 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), float %45)
%47 = fadd float %44, %45
%48 = tail call float (...) @clock_pid()
%49 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), float %48)
%50 = fadd float %47, %48
%51 = tail call float (...) @clock_pid()
%52 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), float %51)
%53 = fadd float %50, %51
%54 = tail call float (...) @clock_pid()
%55 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), float %54)
%56 = fadd float %53, %54
%57 = tail call float (...) @clock_pid()
%58 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), float %57)
%59 = fadd float %56, %57
%60 = tail call float (...) @clock_pid()
%61 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), float %60)
%62 = fadd float %59, %60
%63 = fdiv float %62, 1.000000e+01
%64 = getelementptr inbounds float, float* %1, i64 1
store float %63, float* %64
%65 = tail call float (...) @clock_time_of_day()
%66 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), float %65)
%67 = tail call float (...) @clock_time_of_day()
%68 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), float %67)
%69 = tail call float (...) @clock_time_of_day()
%70 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), float %69)
%71 = tail call float (...) @clock_time_of_day()
%72 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), float %71)
%73 = tail call float (...) @clock_time_of_day()
%74 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), float %73)
%75 = tail call float (...) @clock_time_of_day()
%76 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), float %75)
%77 = tail call float (...) @clock_time_of_day()
%78 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), float %77)
%79 = tail call float (...) @clock_time_of_day()
%80 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), float %79)
%81 = tail call float (...) @clock_time_of_day()
%82 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), float %81)
%83 = tail call float (...) @clock_time_of_day()
%84 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), float %83)
%85 = getelementptr inbounds float, float* %1, i64 2
store float %63, float* %85
ret float* %1
}