#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 */
int /*<<< orphan*/ CalcDevBins(char *, int, float, float, int *);
int /*<<< orphan*/ addaline(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
float sqrt(float);
printstats(float themeans[], float thessds[], float thecounts[],
           char *basename) {
  char thefile[256];
  char theline[256];
  int readback, devbins[5];
  float var;
  float stdev;
  for (readback = 0; readback < 200; readback++) {
    if (thecounts[readback] > 0) {
      var = thessds[readback] / (thecounts[readback] - 1);
      stdev = sqrt(var);
      CalcDevBins(basename, readback, themeans[readback], stdev, devbins);
      sprintf(theline, "%f %f %f %d %d %d %d %d", thecounts[readback],
              themeans[readback], stdev, devbins[0], devbins[1], devbins[2],
              devbins[3], devbins[4]);
      sprintf(thefile, "%s/%d/stats", basename, readback);
      addaline(thefile, theline);
    }
  }
}


x86 assembly (clang, -O0):
<printstats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x234(%rbp)
cmpl   $0xc8,-0x234(%rbp)
jge    12c3 <printstats+0x183>
mov    -0x20(%rbp),%rax
movslq -0x234(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    12aa <printstats+0x16a>
mov    -0x18(%rbp),%rax
movslq -0x234(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x234(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
movss  0xe47(%rip),%xmm2
subss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x254(%rbp)
ff
movss  -0x254(%rbp),%xmm0
ff
call   1050 <sqrt@plt>
movss  %xmm0,-0x258(%rbp)
ff
mov    -0x28(%rbp),%rdi
mov    -0x234(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x234(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  -0x258(%rbp),%xmm1
ff
lea    -0x250(%rbp),%rdx
call   1040 <CalcDevBins@plt>
lea    -0x230(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x234(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x234(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x258(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
mov    -0x250(%rbp),%edx
mov    -0x24c(%rbp),%ecx
mov    -0x248(%rbp),%r8d
mov    -0x244(%rbp),%r9d
mov    -0x240(%rbp),%eax
lea    0xd96(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x3,%al
call   1060 <sprintf@plt>
lea    -0x130(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x234(%rbp),%ecx
lea    0xd8c(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
lea    -0x130(%rbp),%rdi
lea    -0x230(%rbp),%rsi
call   1030 <addaline@plt>
jmp    12af <printstats+0x16f>
mov    -0x234(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x234(%rbp)
jmp    1165 <printstats+0x25>
mov    -0x4(%rbp),%eax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printstats>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,0x28(%rsp)
mov    %rdi,%r12
xorps  %xmm2,%xmm2
lea    0x30(%rsp),%r13
lea    0x130(%rsp),%rbp
xor    %r15d,%r15d
jmp    121e <printstats+0xde>
nopw   0x0(%rax,%rax,1)
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  (%r12,%r15,4),%xmm0
mov    %r14,%rdi
mov    %r15d,%esi
movss  %xmm1,0xc(%rsp)
lea    0x10(%rsp),%rdx
call   1040 <CalcDevBins@plt>
movss  (%rbx,%r15,4),%xmm0
cvtss2sd %xmm0,%xmm0
movss  (%r12,%r15,4),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0xc(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    0x18(%rsp),%r8d
mov    0x1c(%rsp),%r9d
mov    0x20(%rsp),%eax
mov    %eax,(%rsp)
mov    %r13,%rdi
lea    0xe1f(%rip),%rsi
mov    $0x3,%al
call   1060 <sprintf@plt>
mov    %rbp,%rdi
lea    0xe26(%rip),%rsi
mov    %r14,%rdx
mov    %r15d,%ecx
xor    %eax,%eax
call   1060 <sprintf@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
call   1030 <addaline@plt>
xorps  %xmm2,%xmm2
add    $0x1,%r15
cmp    $0xc8,%r15
je     1255 <printstats+0x115>
movss  (%rbx,%r15,4),%xmm1
ucomiss %xmm2,%xmm1
jbe    1211 <printstats+0xd1>
mov    0x28(%rsp),%rax
movss  (%rax,%r15,4),%xmm0
addss  0xdc4(%rip),%xmm1
divss  %xmm1,%xmm0
ucomiss %xmm2,%xmm0
jb     1180 <printstats+0x40>
xorps  %xmm1,%xmm1
sqrtss %xmm0,%xmm1
jmp    1188 <printstats+0x48>
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"%f %f %f %d %d %d %d %d\00"
@.str.1 = [12 x i8] c"%s/%d/stats\00"
define i32 @printstats(float* %0, float* %1, float* %2, i8* %3) {
%5 = alloca i32
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca i8*
%10 = alloca [256 x i8]
%11 = alloca [256 x i8]
%12 = alloca i32
%13 = alloca [5 x i32]
%14 = alloca float
%15 = alloca float
store float* %0, float** %6
store float* %1, float** %7
store float* %2, float** %8
store i8* %3, i8** %9
store i32 0, i32* %12
br label %16
16: ; preds = %85, %4
%17 = load i32, i32* %12
%18 = icmp slt i32 %17, 200
br i1 %18, label %19, label %88
19: ; preds = %16
%20 = load float*, float** %8
%21 = load i32, i32* %12
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds float, float* %20, i64 %22
%24 = load float, float* %23
%25 = fcmp ogt float %24, 0.000000e+00
br i1 %25, label %26, label %84
26: ; preds = %19
%27 = load float*, float** %7
%28 = load i32, i32* %12
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds float, float* %27, i64 %29
%31 = load float, float* %30
%32 = load float*, float** %8
%33 = load i32, i32* %12
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds float, float* %32, i64 %34
%36 = load float, float* %35
%37 = fsub float %36, 1.000000e+00
%38 = fdiv float %31, %37
store float %38, float* %14
%39 = load float, float* %14
%40 = call float @sqrt(float %39)
store float %40, float* %15
%41 = load i8*, i8** %9
%42 = load i32, i32* %12
%43 = load float*, float** %6
%44 = load i32, i32* %12
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds float, float* %43, i64 %45
%47 = load float, float* %46
%48 = load float, float* %15
%49 = getelementptr inbounds [5 x i32], [5 x i32]* %13, i64 0, i64 0
%50 = call i32 @CalcDevBins(i8* %41, i32 %42, float %47, float %48, i32* %49)
%51 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%52 = load float*, float** %8
%53 = load i32, i32* %12
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds float, float* %52, i64 %54
%56 = load float, float* %55
%57 = fpext float %56 to double
%58 = load float*, float** %6
%59 = load i32, i32* %12
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds float, float* %58, i64 %60
%62 = load float, float* %61
%63 = fpext float %62 to double
%64 = load float, float* %15
%65 = fpext float %64 to double
%66 = getelementptr inbounds [5 x i32], [5 x i32]* %13, i64 0, i64 0
%67 = load i32, i32* %66
%68 = getelementptr inbounds [5 x i32], [5 x i32]* %13, i64 0, i64 1
%69 = load i32, i32* %68
%70 = getelementptr inbounds [5 x i32], [5 x i32]* %13, i64 0, i64 2
%71 = load i32, i32* %70
%72 = getelementptr inbounds [5 x i32], [5 x i32]* %13, i64 0, i64 3
%73 = load i32, i32* %72
%74 = getelementptr inbounds [5 x i32], [5 x i32]* %13, i64 0, i64 4
%75 = load i32, i32* %74
%76 = call i32 (i8*, i8*, ...) @sprintf(i8* %51, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double %57, double %63, double %65, i32 %67, i32 %69, i32 %71, i32 %73, i32 %75)
%77 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%78 = load i8*, i8** %9
%79 = load i32, i32* %12
%80 = call i32 (i8*, i8*, ...) @sprintf(i8* %77, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %78, i32 %79)
%81 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%82 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%83 = call i32 @addaline(i8* %81, i8* %82)
br label %84
84: ; preds = %26, %19
br label %85
85: ; preds = %84
%86 = load i32, i32* %12
%87 = add nsw i32 %86, 1
store i32 %87, i32* %12
br label %16
88: ; preds = %16
%89 = load i32, i32* %5
ret i32 %89
}

LLVM IR (-O2):
@.str = [24 x i8] c"%f %f %f %d %d %d %d %d\00"
@.str.1 = [12 x i8] c"%s/%d/stats\00"
define i32 @printstats(float* nocapture %0, float* nocapture %1, float* nocapture %2, i8* %3) {
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = alloca [5 x i32]
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%10 = bitcast [5 x i32]* %7 to i8*
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 0
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 1
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 2
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 3
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 4
br label %16
16: ; preds = %4, %44
%17 = phi i64 [ 0, %4 ], [ %45, %44 ]
%18 = getelementptr inbounds float, float* %2, i64 %17
%19 = load float, float* %18
%20 = fcmp ogt float %19, 0.000000e+00
br i1 %20, label %21, label %44
21: ; preds = %16
%22 = getelementptr inbounds float, float* %1, i64 %17
%23 = load float, float* %22
%24 = fadd float %19, -1.000000e+00
%25 = fdiv float %23, %24
%26 = call float @sqrt(float %25)
%27 = getelementptr inbounds float, float* %0, i64 %17
%28 = load float, float* %27
%29 = trunc i64 %17 to i32
%30 = call i32 @CalcDevBins(i8* %3, i32 %29, float %28, float %26, i32* %11)
%31 = load float, float* %18
%32 = fpext float %31 to double
%33 = load float, float* %27
%34 = fpext float %33 to double
%35 = fpext float %26 to double
%36 = load i32, i32* %11
%37 = load i32, i32* %12
%38 = load i32, i32* %13
%39 = load i32, i32* %14
%40 = load i32, i32* %15
%41 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double %32, double %34, double %35, i32 %36, i32 %37, i32 %38, i32 %39, i32 %40)
%42 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %3, i32 %29)
%43 = call i32 @addaline(i8* %8, i8* %9)
br label %44
44: ; preds = %16, %21
%45 = add nuw nsw i64 %17, 1
%46 = icmp eq i64 %45, 200
br i1 %46, label %47, label %16
47: ; preds = %44
ret i32 undef
}