#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *asctime(struct tm *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ *stdout;
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int printLatencyHeader(FILE *fp, char *testName, double UsedMem,
                       double overhead, double threshold_lo) {
  FILE *pipe;
  time_t rawtime;
  struct tm *timeinfo;
  char tmpStr[64];
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  fprintf(stdout, "\n\n PAW v%s\n %s", "1.6",
          "=================================\n");
  fprintf(stdout, " %s", asctime(timeinfo));
  fprintf(stdout, "\n %s test in progress ... \n", testName);
  fprintf(stdout, "\n\tMemory Used Per Node : %6.1f MB", UsedMem / 1.0E6);
  fprintf(stdout, "\n\tTimer Overhead       : %6.1f ns", overhead / 1.0E-9);
  fprintf(stdout, "\n\tTimer Threshold      : %6.1f ns\n",
          threshold_lo / 1.0E-9);
  fflush(stdout);
  fprintf(fp, "%s%s%s%s%s",
          "#=======================================================\n",
          "# PAW - Performance Assessment Workbench v1.6\n#\n",
          "# Carlos Rosales-Fernandez\n",
          "# carlos.rosales.fernandez@gmail.com\n",
          "#=======================================================\n");
  fprintf(fp, "# Date : %s", asctime(timeinfo));
  fprintf(fp, "# Test : %s", testName);
  if (strncmp(testName, "MPI", 3) == 0) {
    fprintf(fp, "\n%s%s",
            "#=======================================================\n",
            "#\n# "
            "SIZE(B)\t\tAVG(us)\t\t\t\tMIN(us)\t\t\t\tMAX(us)\t\t\tstdDev(us)"
            "\t\t\tNLOOP\tNREPS\n");
  } else {
    fprintf(fp, "\n%s%s",
            "#=======================================================\n",
            "#\n# "
            "SIZE\t\tAVG(s)\t\t\t\tMIN(s)\t\t\t\tMAX(s)\t\t\tstdDev(s)"
            "\t\t\tNLOOP\tNREPS\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<printLatencyHeader>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
lea    -0x34(%rbp),%rdi
call   1070 <time@plt>
lea    -0x34(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x40(%rbp)
mov    0x2e41(%rip),%rax
mov    (%rax),%rdi
lea    0xe67(%rip),%rsi
lea    0xe6f(%rip),%rdx
lea    0xf11(%rip),%rcx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x90(%rbp)
mov    -0x40(%rbp),%rdi
call   1050 <asctime@plt>
mov    -0x90(%rbp),%rdi
mov    %rax,%rdx
lea    0xe32(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2de9(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe1e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%rdi
movsd  -0x18(%rbp),%xmm0
movsd  0xde5(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe11(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%rdi
movsd  -0x20(%rbp),%xmm0
movsd  0xdb4(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe0a(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    0x2d7b(%rip),%rax
mov    (%rax),%rdi
movsd  -0x28(%rbp),%xmm0
movsd  0xd8b(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe03(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    0x2d52(%rip),%rax
mov    (%rax),%rdi
call   1080 <fflush@plt>
mov    -0x8(%rbp),%rdi
lea    0xe05(%rip),%rsi
lea    0xe09(%rip),%rax
lea    0xe3c(%rip),%rcx
lea    0xe66(%rip),%r8
lea    0xe7b(%rip),%r9
mov    %rax,%rdx
mov    %rax,(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x40(%rbp),%rdi
call   1050 <asctime@plt>
mov    -0x88(%rbp),%rdi
mov    %rax,%rdx
lea    0xe6e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe64(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe5e(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1351 <printLatencyHeader+0x1f1>
mov    -0x8(%rbp),%rdi
lea    0xe43(%rip),%rsi
lea    0xd73(%rip),%rdx
lea    0xe3b(%rip),%rcx
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1371 <printLatencyHeader+0x211>
mov    -0x8(%rbp),%rdi
lea    0xe1e(%rip),%rsi
lea    0xd4e(%rip),%rdx
lea    0xe5d(%rip),%rcx
mov    $0x0,%al
call   1060 <fprintf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printLatencyHeader>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %rsi,%r14
mov    %rdi,%r13
lea    0x2c(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%r15
mov    0x2e3c(%rip),%r12
mov    (%r12),%rdi
lea    0xe61(%rip),%rsi
lea    0xe69(%rip),%rdx
lea    0xf0b(%rip),%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r12),%rbx
mov    %r15,%rdi
call   1050 <asctime@plt>
lea    0xe44(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r12),%rdi
lea    0xe34(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r12),%rdi
movsd  0x10(%rsp),%xmm0
divsd  0xdf5(%rip),%xmm0
lea    0xe2d(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    (%r12),%rdi
movsd  0x18(%rsp),%xmm0
divsd  0xddd(%rip),%xmm0
lea    0xe2f(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    (%r12),%rdi
movsd  0x20(%rsp),%xmm0
divsd  0xdbd(%rip),%xmm0
lea    0xe31(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    (%r12),%rdi
call   1080 <fflush@plt>
lea    0xe48(%rip),%r12
mov    %r12,(%rsp)
lea    0xe32(%rip),%rsi
lea    0xe70(%rip),%rcx
lea    0xe9a(%rip),%r8
lea    0xeaf(%rip),%r9
mov    %r13,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r15,%rdi
call   1050 <asctime@plt>
lea    0xeb9(%rip),%rsi
mov    %r13,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0xeb1(%rip),%rsi
mov    %r13,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0xea9(%rip),%rsi
mov    %r14,%rdi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
lea    0xe9c(%rip),%rax
lea    0xedc(%rip),%rcx
cmove  %rax,%rcx
lea    0xe84(%rip),%rsi
mov    %r13,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@stdout = global i32* null
@.str = [15 x i8] c"\0A\0A PAW v%s\0A %s\00"
@.str.1 = [4 x i8] c"1.6\00"
@.str.2 = [35 x i8] c"=================================\0A\00"
@.str.3 = [4 x i8] c" %s\00"
@.str.4 = [28 x i8] c"\0A %s test in progress ... \0A\00"
@.str.5 = [34 x i8] c"\0A\09Memory Used Per Node : %6.1f MB\00"
@.str.6 = [34 x i8] c"\0A\09Timer Overhead : %6.1f ns\00"
@.str.7 = [35 x i8] c"\0A\09Timer Threshold : %6.1f ns\0A\00"
@.str.8 = [11 x i8] c"%s%s%s%s%s\00"
@.str.9 = [58 x i8] c"#=======================================================\0A\00"
@.str.10 = [49 x i8] c"# PAW - Performance Assessment Workbench v1.6\0A#\0A\00"
@.str.11 = [28 x i8] c"# Carlos Rosales-Fernandez\0A\00"
@.str.12 = [38 x i8] c"# carlos.rosales.fernandez@gmail.com\0A\00"
@.str.13 = [12 x i8] c"# Date : %s\00"
@.str.14 = [12 x i8] c"# Test : %s\00"
@.str.15 = [4 x i8] c"MPI\00"
@.str.16 = [6 x i8] c"\0A%s%s\00"
@.str.17 = [71 x i8] c"#\0A# SIZE(B)\09\09AVG(us)\09\09\09\09MIN(us)\09\09\09\09MAX(us)\09\09\09stdDev(us)\09\09\09NLOOP\09NREPS\0A\00"
@.str.18 = [64 x i8] c"#\0A# SIZE\09\09AVG(s)\09\09\09\09MIN(s)\09\09\09\09MAX(s)\09\09\09stdDev(s)\09\09\09NLOOP\09NREPS\0A\00"
define i32 @printLatencyHeader(i32* %0, i8* %1, double %2, double %3, double %4) {
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32*
%12 = alloca i32
%13 = alloca %struct.tm*
%14 = alloca [64 x i8]
store i32* %0, i32** %6
store i8* %1, i8** %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%15 = call i32 @time(i32* %12)
%16 = call %struct.tm* @localtime(i32* %12)
store %struct.tm* %16, %struct.tm** %13
%17 = load i32*, i32** @stdout
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32*, i32** @stdout
%20 = load %struct.tm*, %struct.tm** %13
%21 = call i8* @asctime(%struct.tm* %20)
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %21)
%23 = load i32*, i32** @stdout
%24 = load i8*, i8** %7
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %24)
%26 = load i32*, i32** @stdout
%27 = load double, double* %8
%28 = fdiv double %27, 1.000000e+06
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), double %28)
%30 = load i32*, i32** @stdout
%31 = load double, double* %9
%32 = fdiv double %31, 1.000000e-09
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), double %32)
%34 = load i32*, i32** @stdout
%35 = load double, double* %10
%36 = fdiv double %35, 1.000000e-09
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), double %36)
%38 = load i32*, i32** @stdout
%39 = call i32 @fflush(i32* %38)
%40 = load i32*, i32** %6
%41 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.9, i64 0, i64 0))
%42 = load i32*, i32** %6
%43 = load %struct.tm*, %struct.tm** %13
%44 = call i8* @asctime(%struct.tm* %43)
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %42, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i8* %44)
%46 = load i32*, i32** %6
%47 = load i8*, i8** %7
%48 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0), i8* %47)
%49 = load i8*, i8** %7
%50 = call i64 @strncmp(i8* %49, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 3)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %5
%53 = load i32*, i32** %6
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.17, i64 0, i64 0))
br label %58
55: ; preds = %5
%56 = load i32*, i32** %6
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %56, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.18, i64 0, i64 0))
br label %58
58: ; preds = %55, %52
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@stdout = global i32* null
@.str = [15 x i8] c"\0A\0A PAW v%s\0A %s\00"
@.str.1 = [4 x i8] c"1.6\00"
@.str.2 = [35 x i8] c"=================================\0A\00"
@.str.3 = [4 x i8] c" %s\00"
@.str.4 = [28 x i8] c"\0A %s test in progress ... \0A\00"
@.str.5 = [34 x i8] c"\0A\09Memory Used Per Node : %6.1f MB\00"
@.str.6 = [34 x i8] c"\0A\09Timer Overhead : %6.1f ns\00"
@.str.7 = [35 x i8] c"\0A\09Timer Threshold : %6.1f ns\0A\00"
@.str.8 = [11 x i8] c"%s%s%s%s%s\00"
@.str.9 = [58 x i8] c"#=======================================================\0A\00"
@.str.10 = [49 x i8] c"# PAW - Performance Assessment Workbench v1.6\0A#\0A\00"
@.str.11 = [28 x i8] c"# Carlos Rosales-Fernandez\0A\00"
@.str.12 = [38 x i8] c"# carlos.rosales.fernandez@gmail.com\0A\00"
@.str.13 = [12 x i8] c"# Date : %s\00"
@.str.14 = [12 x i8] c"# Test : %s\00"
@.str.15 = [4 x i8] c"MPI\00"
@.str.16 = [6 x i8] c"\0A%s%s\00"
@.str.17 = [71 x i8] c"#\0A# SIZE(B)\09\09AVG(us)\09\09\09\09MIN(us)\09\09\09\09MAX(us)\09\09\09stdDev(us)\09\09\09NLOOP\09NREPS\0A\00"
@.str.18 = [64 x i8] c"#\0A# SIZE\09\09AVG(s)\09\09\09\09MIN(s)\09\09\09\09MAX(s)\09\09\09stdDev(s)\09\09\09NLOOP\09NREPS\0A\00"
define i32 @printLatencyHeader(i32* nocapture %0, i8* %1, double %2, double %3, double %4) {
%6 = alloca i32
%7 = bitcast i32* %6 to i8*
%8 = call i32 @time(i32* %6)
%9 = call %struct.tm* @localtime(i32* %6)
%10 = load i32*, i32** @stdout
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32*, i32** @stdout
%13 = call i8* @asctime(%struct.tm* %9)
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%15 = load i32*, i32** @stdout
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%17 = load i32*, i32** @stdout
%18 = fdiv double %2, 1.000000e+06
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), double %18)
%20 = load i32*, i32** @stdout
%21 = fdiv double %3, 1.000000e-09
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), double %21)
%23 = load i32*, i32** @stdout
%24 = fdiv double %4, 1.000000e-09
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), double %24)
%26 = load i32*, i32** @stdout
%27 = call i32 @fflush(i32* %26)
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.9, i64 0, i64 0))
%29 = call i8* @asctime(%struct.tm* %9)
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i8* %29)
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0), i8* %1)
%32 = call i64 @strncmp(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 3)
%33 = icmp eq i64 %32, 0
%34 = select i1 %33, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.18, i64 0, i64 0)
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.9, i64 0, i64 0), i8* %34)
ret i32 0
}