#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 */
char *durations2string(double const *, int);
int /*<<< orphan*/ free(char *);
double mean(double const *, int);
double median(double const *, int);
int /*<<< orphan*/ printf(char *, double const, ...);
void show_summary(const double *durations, int repetitions) {
  if (repetitions == 1) {
    printf("%f s\n", durations[0]);
  } else {
    char *s = durations2string(durations, repetitions);
    printf("mean: %f s, median: %f s (repetitions=%d) %s\n",
           mean(durations, repetitions), median(durations, repetitions),
           repetitions, s);
    free(s);
  }
}


x86 assembly (clang, -O0):
<show_summary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1184 <show_summary+0x34>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xe88(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    11d7 <show_summary+0x87>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1070 <durations2string@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <mean@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <median@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xe3f(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_summary>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
cmp    $0x1,%esi
jne    117d <show_summary+0x2d>
movsd  (%r14),%xmm0
lea    0xe93(%rip),%rdi
mov    $0x1,%al
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <printf@plt>
mov    %esi,%ebx
mov    %r14,%rdi
call   1070 <durations2string@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <mean@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <median@plt>
movaps %xmm0,%xmm1
lea    0xe58(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    %ebx,%esi
mov    %r15,%rdx
mov    $0x2,%al
call   1050 <printf@plt>
mov    %r15,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%f s\0A\00"
@.str.1 = [46 x i8] c"mean: %f s, median: %f s (repetitions=%d) %s\0A\00"
define void @show_summary(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i8*
store double* %0, double** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %11)
br label %28
13: ; preds = %2
%14 = load double*, double** %3
%15 = load i32, i32* %4
%16 = call i8* @durations2string(double* %14, i32 %15)
store i8* %16, i8** %5
%17 = load double*, double** %3
%18 = load i32, i32* %4
%19 = call double @mean(double* %17, i32 %18)
%20 = load double*, double** %3
%21 = load i32, i32* %4
%22 = call double @median(double* %20, i32 %21)
%23 = load i32, i32* %4
%24 = load i8*, i8** %5
%25 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), double %19, double %22, i32 %23, i8* %24)
%26 = load i8*, i8** %5
%27 = call i32 @free(i8* %26)
br label %28
28: ; preds = %13, %8
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%f s\0A\00"
@.str.1 = [46 x i8] c"mean: %f s, median: %f s (repetitions=%d) %s\0A\00"
define void @show_summary(double* %0, i32 %1) {
%3 = icmp eq i32 %1, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load double, double* %0
%6 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %5)
br label %13
7: ; preds = %2
%8 = tail call i8* @durations2string(double* %0, i32 %1)
%9 = tail call double @mean(double* %0, i32 %1)
%10 = tail call double @median(double* %0, i32 %1)
%11 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), double %9, double %10, i32 %1, i8* %8)
%12 = tail call i32 @free(i8* %8)
br label %13
13: ; preds = %7, %4
ret void
}