#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 */
double fabs(double);
int /*<<< orphan*/ printf(char *, ...);
void dump_hash_results(char *name, int counts[8][8]) {
  int srv, nsrv;
  double err, total_err, max_err;
  printf("%s:\n", name);
  for (nsrv = 0; nsrv < 8; nsrv++) {
    total_err = 0.0;
    max_err = 0.0;
    printf("%02d srv: ", nsrv + 1);
    for (srv = 0; srv <= nsrv; srv++) {
      err = 100.0 * (counts[nsrv][srv] - (double)counts[0][0] / (nsrv + 1)) /
            (double)counts[0][0];
      printf("% 3.1f%%%c ", err, counts[nsrv][srv] ? ' ' : '*');
      err = fabs(err);
      total_err += err;
      if (err > max_err)
        max_err = err;
    }
    total_err /= (double)(nsrv + 1);
    for (srv = nsrv + 1; srv < 8; srv++)
      printf("       ");
    printf("  avg_err=%3.1f, max_err=%3.1f\n", total_err, max_err);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dump_hash_results>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x8,-0x18(%rbp)
jge    12c0 <dump_hash_results+0x1b0>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%esi
add    $0x1,%esi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1253 <dump_hash_results+0x143>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm1
mov    -0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm0
subsd  %xmm0,%xmm1
movsd  0xe5c(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    $0x2a,%esi
mov    $0x20,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xe2d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
movaps 0xdf2(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    1240 <dump_hash_results+0x130>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1245 <dump_hash_results+0x135>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116e <dump_hash_results+0x5e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    129a <dump_hash_results+0x18a>
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1274 <dump_hash_results+0x164>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0xd91(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1139 <dump_hash_results+0x29>
lea    0xd54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_hash_results>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%r13
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%r14d
mov    $0x7,%ecx
lea    0xedc(%rip),%r15
mov    %r13,%rbx
xor    %eax,%eax
jmp    119e <dump_hash_results+0x7e>
nopl   0x0(%rax,%rax,1)
movapd 0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
lea    0xed1(%rip),%rdi
movapd 0x20(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
add    $0x1,%r14
add    $0x20,%rbx
mov    0x4(%rsp),%ecx
add    $0xffffffff,%ecx
mov    0x38(%rsp),%rax
cmp    $0x8,%rax
je     1294 <dump_hash_results+0x174>
mov    %ecx,0x4(%rsp)
mov    %rax,0x30(%rsp)
lea    0x1(%rax),%rbp
lea    0xe73(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,0x38(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  %xmm0,0x8(%rsp)
xorps  %xmm1,%xmm1
xor    %r12d,%r12d
xorps  %xmm2,%xmm2
mov    $0x2a,%ebp
nopl   0x0(%rax,%rax,1)
movaps %xmm2,0x10(%rsp)
movsd  %xmm1,0x40(%rsp)
mov    (%rbx,%r12,4),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
xorps  %xmm2,%xmm2
cvtsi2sdl 0x0(%r13),%xmm2
movapd %xmm2,%xmm1
divsd  0x8(%rsp),%xmm1
subsd  %xmm1,%xmm0
mulsd  0xdeb(%rip),%xmm0
divsd  %xmm2,%xmm0
movapd %xmm0,0x20(%rsp)
test   %eax,%eax
mov    $0x20,%esi
cmove  %ebp,%esi
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movapd 0x10(%rsp),%xmm2
movapd 0x20(%rsp),%xmm1
andpd  0xdc9(%rip),%xmm1
addsd  %xmm1,%xmm2
maxsd  0x40(%rsp),%xmm1
add    $0x1,%r12
cmp    %r12,%r14
jne    11e0 <dump_hash_results+0xc0>
movapd %xmm2,0x10(%rsp)
movapd %xmm1,0x20(%rsp)
cmpq   $0x6,0x30(%rsp)
lea    0xdc9(%rip),%r12
ja     1160 <dump_hash_results+0x40>
mov    0x4(%rsp),%ebp
nopl   (%rax)
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1280 <dump_hash_results+0x160>
jmp    1160 <dump_hash_results+0x40>
mov    $0xa,%edi
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s:\0A\00"
@.str.1 = [11 x i8] c"%02d srv: \00"
@.str.2 = [12 x i8] c"% 3.1f%%%c \00"
@.str.3 = [8 x i8] c" \00"
@.str.4 = [32 x i8] c" avg_err=%3.1f, max_err=%3.1f\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @dump_hash_results(i8* %0, [8 x i32]* %1) {
%3 = alloca i8*
%4 = alloca [8 x i32]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i8* %0, i8** %3
store [8 x i32]* %1, [8 x i32]** %4
%10 = load i8*, i8** %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10)
store i32 0, i32* %6
br label %12
12: ; preds = %97, %2
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 8
br i1 %14, label %15, label %100
15: ; preds = %12
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %17)
store i32 0, i32* %5
br label %19
19: ; preds = %74, %15
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %77
23: ; preds = %19
%24 = load [8 x i32]*, [8 x i32]** %4
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [8 x i32], [8 x i32]* %24, i64 %26
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [8 x i32], [8 x i32]* %27, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = sitofp i32 %31 to double
%33 = load [8 x i32]*, [8 x i32]** %4
%34 = getelementptr inbounds [8 x i32], [8 x i32]* %33, i64 0
%35 = getelementptr inbounds [8 x i32], [8 x i32]* %34, i64 0, i64 0
%36 = load i32, i32* %35
%37 = sitofp i32 %36 to double
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
%40 = sitofp i32 %39 to double
%41 = fdiv double %37, %40
%42 = fsub double %32, %41
%43 = fmul double 1.000000e+02, %42
%44 = load [8 x i32]*, [8 x i32]** %4
%45 = getelementptr inbounds [8 x i32], [8 x i32]* %44, i64 0
%46 = getelementptr inbounds [8 x i32], [8 x i32]* %45, i64 0, i64 0
%47 = load i32, i32* %46
%48 = sitofp i32 %47 to double
%49 = fdiv double %43, %48
store double %49, double* %7
%50 = load double, double* %7
%51 = load [8 x i32]*, [8 x i32]** %4
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [8 x i32], [8 x i32]* %51, i64 %53
%55 = load i32, i32* %5
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [8 x i32], [8 x i32]* %54, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = icmp ne i32 %58, 0
%60 = zext i1 %59 to i64
%61 = select i1 %59, i32 32, i32 42
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %50, i32 %61)
%63 = load double, double* %7
%64 = call double @llvm.fabs.f64(double %63)
store double %64, double* %7
%65 = load double, double* %7
%66 = load double, double* %8
%67 = fadd double %66, %65
store double %67, double* %8
%68 = load double, double* %7
%69 = load double, double* %9
%70 = fcmp ogt double %68, %69
br i1 %70, label %71, label %73
71: ; preds = %23
%72 = load double, double* %7
store double %72, double* %9
br label %73
73: ; preds = %71, %23
br label %74
74: ; preds = %73
%75 = load i32, i32* %5
%76 = add nsw i32 %75, 1
store i32 %76, i32* %5
br label %19
77: ; preds = %19
%78 = load i32, i32* %6
%79 = add nsw i32 %78, 1
%80 = sitofp i32 %79 to double
%81 = load double, double* %8
%82 = fdiv double %81, %80
store double %82, double* %8
%83 = load i32, i32* %6
%84 = add nsw i32 %83, 1
store i32 %84, i32* %5
br label %85
85: ; preds = %90, %77
%86 = load i32, i32* %5
%87 = icmp slt i32 %86, 8
br i1 %87, label %88, label %93
88: ; preds = %85
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %90
90: ; preds = %88
%91 = load i32, i32* %5
%92 = add nsw i32 %91, 1
store i32 %92, i32* %5
br label %85
93: ; preds = %85
%94 = load double, double* %8
%95 = load double, double* %9
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), double %94, double %95)
br label %97
97: ; preds = %93
%98 = load i32, i32* %6
%99 = add nsw i32 %98, 1
store i32 %99, i32* %6
br label %12
100: ; preds = %12
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s:\0A\00"
@.str.1 = [11 x i8] c"%02d srv: \00"
@.str.2 = [12 x i8] c"% 3.1f%%%c \00"
@.str.3 = [8 x i8] c" \00"
@.str.4 = [32 x i8] c" avg_err=%3.1f, max_err=%3.1f\0A\00"
define void @dump_hash_results(i8* %0, [8 x i32]* nocapture %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
br label %5
5: ; preds = %2, %42
%6 = phi i64 [ 0, %2 ], [ %8, %42 ]
%7 = phi i64 [ 1, %2 ], [ %44, %42 ]
%8 = add nuw nsw i64 %6, 1
%9 = trunc i64 %8 to i32
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = sitofp i32 %9 to double
br label %12
12: ; preds = %5, %12
%13 = phi i64 [ 0, %5 ], [ %32, %12 ]
%14 = phi double [ 0.000000e+00, %5 ], [ %31, %12 ]
%15 = phi double [ 0.000000e+00, %5 ], [ %29, %12 ]
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 %6, i64 %13
%17 = load i32, i32* %16
%18 = sitofp i32 %17 to double
%19 = load i32, i32* %4
%20 = sitofp i32 %19 to double
%21 = fdiv double %20, %11
%22 = fsub double %18, %21
%23 = fmul double %22, 1.000000e+02
%24 = fdiv double %23, %20
%25 = icmp eq i32 %17, 0
%26 = select i1 %25, i32 42, i32 32
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %24, i32 %26)
%28 = tail call double @llvm.fabs.f64(double %24)
%29 = fadd double %15, %28
%30 = fcmp ogt double %28, %14
%31 = select i1 %30, double %28, double %14
%32 = add nuw nsw i64 %13, 1
%33 = icmp eq i64 %32, %7
br i1 %33, label %34, label %12
34: ; preds = %12
%35 = fdiv double %29, %11
%36 = icmp ult i64 %6, 7
br i1 %36, label %37, label %42
37: ; preds = %34, %37
%38 = phi i32 [ %40, %37 ], [ %9, %34 ]
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%40 = add nuw nsw i32 %38, 1
%41 = icmp eq i32 %40, 8
br i1 %41, label %42, label %37
42: ; preds = %37, %34
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), double %35, double %31)
%44 = add nuw nsw i64 %7, 1
%45 = icmp eq i64 %8, 8
br i1 %45, label %46, label %5
46: ; preds = %42
%47 = tail call i32 @putchar(i32 10)
ret void
}