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

/* Variables and functions */
int /*<<< orphan*/ saveData(int /*<<< orphan*/ *, double, int, double, double,
                            double, double);
int /*<<< orphan*/ setLoopIters(double, double, double, int *);
int /*<<< orphan*/ stats(int, double *, double *, double *, double *, double *,
                         double);
int post_process(FILE *fp, FILE *fp2, double threshold_hi, double *tElapsed,
                 double tScale, double wScale, unsigned int size,
                 double sizeBytes, double work, int *NLOOP, double *localMax,
                 unsigned int *localSize) {
  int i;
  double tMin, tMax, tAvg, tDev, wMax, wMin, wAvg, wDev;
  double tMsg[10], wMsg[10];
  for (i = 0; i < 10; i++) {
    tMsg[i] = tElapsed[i] / ((double)(*NLOOP));
    wMsg[i] = work / tMsg[i];
  }
  stats(10, tMsg, &tAvg, &tMax, &tMin, &tDev, tScale);
  stats(10, wMsg, &wAvg, &wMax, &wMin, &wDev, wScale);
  saveData(fp, sizeBytes, *NLOOP, tAvg, tMax, tMin, tDev);
  saveData(fp2, sizeBytes, *NLOOP, wAvg, wMax, wMin, wDev);
  if (wMax > *localMax) {
    *localMax = wMax;
    *localSize = size;
  }
  setLoopIters(tMin, tScale, threshold_hi, NLOOP);
  return 0;
}


x86 assembly (clang, -O0):
<post_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
mov    %ecx,-0x34(%rbp)
movsd  %xmm3,-0x40(%rbp)
movsd  %xmm4,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
mov    %r9,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
cmpl   $0xa,-0x5c(%rbp)
jge    11d3 <post_process+0xa3>
mov    -0x20(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x50(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
divsd  %xmm1,%xmm0
movslq -0x5c(%rbp),%rax
movsd  %xmm0,-0xf0(%rbp,%rax,8)
ff ff
movsd  -0x48(%rbp),%xmm0
movslq -0x5c(%rbp),%rax
divsd  -0xf0(%rbp,%rax,8),%xmm0
ff ff
movslq -0x5c(%rbp),%rax
movsd  %xmm0,-0x140(%rbp,%rax,8)
ff ff
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1176 <post_process+0x46>
lea    -0xf0(%rbp),%rsi
movsd  -0x28(%rbp),%xmm0
mov    $0xa,%edi
lea    -0x78(%rbp),%rdx
lea    -0x70(%rbp),%rcx
lea    -0x68(%rbp),%r8
lea    -0x80(%rbp),%r9
call   1030 <stats@plt>
lea    -0x140(%rbp),%rsi
movsd  -0x30(%rbp),%xmm0
mov    $0xa,%edi
lea    -0x98(%rbp),%rdx
lea    -0x88(%rbp),%rcx
lea    -0x90(%rbp),%r8
lea    -0xa0(%rbp),%r9
call   1030 <stats@plt>
mov    -0x8(%rbp),%rdi
movsd  -0x40(%rbp),%xmm0
mov    -0x50(%rbp),%rax
mov    (%rax),%esi
movsd  -0x78(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm3
movsd  -0x80(%rbp),%xmm4
call   1050 <saveData@plt>
mov    -0x10(%rbp),%rdi
movsd  -0x40(%rbp),%xmm0
mov    -0x50(%rbp),%rax
mov    (%rax),%esi
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x88(%rbp),%xmm2
ff
movsd  -0x90(%rbp),%xmm3
ff
movsd  -0xa0(%rbp),%xmm4
ff
call   1050 <saveData@plt>
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x58(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    12b6 <post_process+0x186>
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x58(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x34(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x68(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
mov    -0x50(%rbp),%rdi
call   1040 <setLoopIters@plt>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<post_process>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %r8,%rbx
cvtsi2sdl (%r8),%xmm5
mov    %r9,%r14
movsd  %xmm3,(%rsp)
mov    %ecx,%r15d
movsd  %xmm2,0x18(%rsp)
movaps %xmm1,%xmm2
movsd  %xmm0,0x28(%rsp)
mov    %rsi,%r12
mov    %rdi,%rbp
movupd (%rdx),%xmm0
unpcklpd %xmm5,%xmm5
divpd  %xmm5,%xmm0
movapd %xmm0,0xb0(%rsp)
unpcklpd %xmm4,%xmm4
movapd %xmm4,%xmm1
divpd  %xmm0,%xmm1
movapd %xmm1,0x60(%rsp)
movupd 0x10(%rdx),%xmm0
divpd  %xmm5,%xmm0
movapd %xmm0,0xc0(%rsp)
movapd %xmm4,%xmm1
divpd  %xmm0,%xmm1
movapd %xmm1,0x70(%rsp)
movupd 0x20(%rdx),%xmm0
divpd  %xmm5,%xmm0
movapd %xmm0,0xd0(%rsp)
movapd %xmm4,%xmm1
divpd  %xmm0,%xmm1
movapd %xmm1,0x80(%rsp)
movupd 0x30(%rdx),%xmm0
divpd  %xmm5,%xmm0
movapd %xmm0,0xe0(%rsp)
movapd %xmm4,%xmm1
divpd  %xmm0,%xmm1
movapd %xmm1,0x90(%rsp)
movupd 0x40(%rdx),%xmm0
divpd  %xmm5,%xmm0
movapd %xmm0,0xf0(%rsp)
divpd  %xmm0,%xmm4
movapd %xmm4,0xa0(%rsp)
lea    0xb0(%rsp),%rsi
lea    0x50(%rsp),%rdx
lea    0x58(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0x48(%rsp),%r9
mov    $0xa,%edi
movsd  %xmm2,0x20(%rsp)
movaps %xmm2,%xmm0
call   1030 <stats@plt>
lea    0x60(%rsp),%rsi
lea    0x38(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x40(%rsp),%r8
lea    0x30(%rsp),%r9
mov    $0xa,%edi
movsd  0x18(%rsp),%xmm0
call   1030 <stats@plt>
mov    (%rbx),%esi
movsd  0x50(%rsp),%xmm1
movsd  0x58(%rsp),%xmm2
movsd  0x10(%rsp),%xmm3
movsd  0x48(%rsp),%xmm4
mov    %rbp,%rdi
movsd  (%rsp),%xmm0
call   1050 <saveData@plt>
mov    (%rbx),%esi
movsd  0x38(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
movsd  0x40(%rsp),%xmm3
movsd  0x30(%rsp),%xmm4
mov    %r12,%rdi
movsd  (%rsp),%xmm0
call   1050 <saveData@plt>
movsd  0x8(%rsp),%xmm0
ucomisd (%r14),%xmm0
jbe    12d6 <post_process+0x1a6>
mov    0x130(%rsp),%rax
movsd  %xmm0,(%r14)
mov    %r15d,(%rax)
movsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
mov    %rbx,%rdi
call   1040 <setLoopIters@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @post_process(i32* %0, i32* %1, double %2, double* %3, double %4, double %5, i32 %6, double %7, double %8, i32* %9, double* %10, i32* %11) {
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca double
%16 = alloca double*
%17 = alloca double
%18 = alloca double
%19 = alloca i32
%20 = alloca double
%21 = alloca double
%22 = alloca i32*
%23 = alloca double*
%24 = alloca i32*
%25 = alloca i32
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
%33 = alloca double
%34 = alloca [10 x double]
%35 = alloca [10 x double]
store i32* %0, i32** %13
store i32* %1, i32** %14
store double %2, double* %15
store double* %3, double** %16
store double %4, double* %17
store double %5, double* %18
store i32 %6, i32* %19
store double %7, double* %20
store double %8, double* %21
store i32* %9, i32** %22
store double* %10, double** %23
store i32* %11, i32** %24
store i32 0, i32* %25
br label %36
36: ; preds = %61, %12
%37 = load i32, i32* %25
%38 = icmp slt i32 %37, 10
br i1 %38, label %39, label %64
39: ; preds = %36
%40 = load double*, double** %16
%41 = load i32, i32* %25
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
%44 = load double, double* %43
%45 = load i32*, i32** %22
%46 = load i32, i32* %45
%47 = sitofp i32 %46 to double
%48 = fdiv double %44, %47
%49 = load i32, i32* %25
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [10 x double], [10 x double]* %34, i64 0, i64 %50
store double %48, double* %51
%52 = load double, double* %21
%53 = load i32, i32* %25
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [10 x double], [10 x double]* %34, i64 0, i64 %54
%56 = load double, double* %55
%57 = fdiv double %52, %56
%58 = load i32, i32* %25
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [10 x double], [10 x double]* %35, i64 0, i64 %59
store double %57, double* %60
br label %61
61: ; preds = %39
%62 = load i32, i32* %25
%63 = add nsw i32 %62, 1
store i32 %63, i32* %25
br label %36
64: ; preds = %36
%65 = getelementptr inbounds [10 x double], [10 x double]* %34, i64 0, i64 0
%66 = load double, double* %17
%67 = call i32 @stats(i32 10, double* %65, double* %28, double* %27, double* %26, double* %29, double %66)
%68 = getelementptr inbounds [10 x double], [10 x double]* %35, i64 0, i64 0
%69 = load double, double* %18
%70 = call i32 @stats(i32 10, double* %68, double* %32, double* %30, double* %31, double* %33, double %69)
%71 = load i32*, i32** %13
%72 = load double, double* %20
%73 = load i32*, i32** %22
%74 = load i32, i32* %73
%75 = load double, double* %28
%76 = load double, double* %27
%77 = load double, double* %26
%78 = load double, double* %29
%79 = call i32 @saveData(i32* %71, double %72, i32 %74, double %75, double %76, double %77, double %78)
%80 = load i32*, i32** %14
%81 = load double, double* %20
%82 = load i32*, i32** %22
%83 = load i32, i32* %82
%84 = load double, double* %32
%85 = load double, double* %30
%86 = load double, double* %31
%87 = load double, double* %33
%88 = call i32 @saveData(i32* %80, double %81, i32 %83, double %84, double %85, double %86, double %87)
%89 = load double, double* %30
%90 = load double*, double** %23
%91 = load double, double* %90
%92 = fcmp ogt double %89, %91
br i1 %92, label %93, label %98
93: ; preds = %64
%94 = load double, double* %30
%95 = load double*, double** %23
store double %94, double* %95
%96 = load i32, i32* %19
%97 = load i32*, i32** %24
store i32 %96, i32* %97
br label %98
98: ; preds = %93, %64
%99 = load double, double* %26
%100 = load double, double* %17
%101 = load double, double* %15
%102 = load i32*, i32** %22
%103 = call i32 @setLoopIters(double %99, double %100, double %101, i32* %102)
ret i32 0
}

LLVM IR (-O2):
define i32 @post_process(i32* %0, i32* %1, double %2, double* nocapture %3, double %4, double %5, i32 %6, double %7, double %8, i32* %9, double* nocapture %10, i32* nocapture writeonly %11) {
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca [10 x double]
%22 = alloca [10 x double]
%23 = bitcast double* %13 to i8*
%24 = bitcast double* %14 to i8*
%25 = bitcast double* %15 to i8*
%26 = bitcast double* %16 to i8*
%27 = bitcast double* %17 to i8*
%28 = bitcast double* %18 to i8*
%29 = bitcast double* %19 to i8*
%30 = bitcast double* %20 to i8*
%31 = bitcast [10 x double]* %21 to i8*
%32 = bitcast [10 x double]* %22 to i8*
%33 = load i32, i32* %9
%34 = sitofp i32 %33 to double
%35 = getelementptr inbounds [10 x double], [10 x double]* %21, i64 0, i64 0
%36 = bitcast double* %3 to <2 x double>*
%37 = load <2 x double>, <2 x double>* %36
%38 = insertelement <2 x double> poison, double %34, i64 0
%39 = shufflevector <2 x double> %38, <2 x double> poison, <2 x i32> zeroinitializer
%40 = fdiv <2 x double> %37, %39
%41 = getelementptr inbounds [10 x double], [10 x double]* %22, i64 0, i64 0
%42 = bitcast [10 x double]* %21 to <2 x double>*
store <2 x double> %40, <2 x double>* %42
%43 = insertelement <2 x double> poison, double %8, i64 0
%44 = shufflevector <2 x double> %43, <2 x double> poison, <2 x i32> zeroinitializer
%45 = fdiv <2 x double> %44, %40
%46 = bitcast [10 x double]* %22 to <2 x double>*
store <2 x double> %45, <2 x double>* %46
%47 = getelementptr inbounds double, double* %3, i64 2
%48 = getelementptr inbounds [10 x double], [10 x double]* %21, i64 0, i64 2
%49 = bitcast double* %47 to <2 x double>*
%50 = load <2 x double>, <2 x double>* %49
%51 = fdiv <2 x double> %50, %39
%52 = getelementptr inbounds [10 x double], [10 x double]* %22, i64 0, i64 2
%53 = bitcast double* %48 to <2 x double>*
store <2 x double> %51, <2 x double>* %53
%54 = fdiv <2 x double> %44, %51
%55 = bitcast double* %52 to <2 x double>*
store <2 x double> %54, <2 x double>* %55
%56 = getelementptr inbounds double, double* %3, i64 4
%57 = getelementptr inbounds [10 x double], [10 x double]* %21, i64 0, i64 4
%58 = bitcast double* %56 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = fdiv <2 x double> %59, %39
%61 = getelementptr inbounds [10 x double], [10 x double]* %22, i64 0, i64 4
%62 = bitcast double* %57 to <2 x double>*
store <2 x double> %60, <2 x double>* %62
%63 = fdiv <2 x double> %44, %60
%64 = bitcast double* %61 to <2 x double>*
store <2 x double> %63, <2 x double>* %64
%65 = getelementptr inbounds double, double* %3, i64 6
%66 = getelementptr inbounds [10 x double], [10 x double]* %21, i64 0, i64 6
%67 = bitcast double* %65 to <2 x double>*
%68 = load <2 x double>, <2 x double>* %67
%69 = fdiv <2 x double> %68, %39
%70 = getelementptr inbounds [10 x double], [10 x double]* %22, i64 0, i64 6
%71 = bitcast double* %66 to <2 x double>*
store <2 x double> %69, <2 x double>* %71
%72 = fdiv <2 x double> %44, %69
%73 = bitcast double* %70 to <2 x double>*
store <2 x double> %72, <2 x double>* %73
%74 = getelementptr inbounds double, double* %3, i64 8
%75 = getelementptr inbounds [10 x double], [10 x double]* %21, i64 0, i64 8
%76 = bitcast double* %74 to <2 x double>*
%77 = load <2 x double>, <2 x double>* %76
%78 = fdiv <2 x double> %77, %39
%79 = getelementptr inbounds [10 x double], [10 x double]* %22, i64 0, i64 8
%80 = bitcast double* %75 to <2 x double>*
store <2 x double> %78, <2 x double>* %80
%81 = fdiv <2 x double> %44, %78
%82 = bitcast double* %79 to <2 x double>*
store <2 x double> %81, <2 x double>* %82
%83 = call i32 @stats(i32 10, double* %35, double* %15, double* %14, double* %13, double* %16, double %4)
%84 = call i32 @stats(i32 10, double* %41, double* %19, double* %17, double* %18, double* %20, double %5)
%85 = load i32, i32* %9
%86 = load double, double* %15
%87 = load double, double* %14
%88 = load double, double* %13
%89 = load double, double* %16
%90 = call i32 @saveData(i32* %0, double %7, i32 %85, double %86, double %87, double %88, double %89)
%91 = load i32, i32* %9
%92 = load double, double* %19
%93 = load double, double* %17
%94 = load double, double* %18
%95 = load double, double* %20
%96 = call i32 @saveData(i32* %1, double %7, i32 %91, double %92, double %93, double %94, double %95)
%97 = load double, double* %17
%98 = load double, double* %10
%99 = fcmp ogt double %97, %98
br i1 %99, label %100, label %101
100: ; preds = %12
store double %97, double* %10
store i32 %6, i32* %11
br label %101
101: ; preds = %100, %12
%102 = load double, double* %13
%103 = call i32 @setLoopIters(double %102, double %4, double %2, i32* %9)
ret i32 0
}