#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 mean(double *, int);
int /*<<< orphan*/ printf(char *, ...);
void test_mean() {
  printf("\n---- Test mean ----\n");
  int ret_code = 0;
  double arr_in[6] = {1.12, 1.13, 1.14, 2.15, 1.16, 1.17};
  double m;
  m = mean(arr_in, 6);
  printf("Mean: %f\n", m);
  printf("ret_code: %d\n---- #### ----\n", ret_code);
}


x86 assembly (clang, -O0):
<test_mean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
movsd  0xec3(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xeae(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe99(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe84(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe6f(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe5a(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x6,%esi
call   1050 <mean@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
lea    0xe7c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mean>:
sub    $0x38,%rsp
lea    0xf1c(%rip),%rdi
call   1030 <puts@plt>
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xebe(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec2(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rsp,%rdi
mov    $0x6,%esi
call   1050 <mean@plt>
lea    0xeb9(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"\0A---- Test mean ----\0A\00"
@.str.1 = [10 x i8] c"Mean: %f\0A\00"
@.str.2 = [29 x i8] c"ret_code: %d\0A---- #### ----\0A\00"
define void @test_mean() {
%1 = alloca i32
%2 = alloca [6 x double]
%3 = alloca double
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
%5 = bitcast [6 x double]* %2 to i8*
%6 = bitcast i8* %5 to [6 x double]*
%7 = getelementptr inbounds [6 x double], [6 x double]* %6, i32 0, i32 0
store double 1.120000e+00, double* %7
%8 = getelementptr inbounds [6 x double], [6 x double]* %6, i32 0, i32 1
store double 1.130000e+00, double* %8
%9 = getelementptr inbounds [6 x double], [6 x double]* %6, i32 0, i32 2
store double 1.140000e+00, double* %9
%10 = getelementptr inbounds [6 x double], [6 x double]* %6, i32 0, i32 3
store double 2.150000e+00, double* %10
%11 = getelementptr inbounds [6 x double], [6 x double]* %6, i32 0, i32 4
store double 1.160000e+00, double* %11
%12 = getelementptr inbounds [6 x double], [6 x double]* %6, i32 0, i32 5
store double 1.170000e+00, double* %12
%13 = getelementptr inbounds [6 x double], [6 x double]* %2, i64 0, i64 0
%14 = call double @mean(double* %13, i32 6)
store double %14, double* %3
%15 = load double, double* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %15)
%17 = load i32, i32* %1
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %17)
ret void
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"Mean: %f\0A\00"
@.str.2 = [29 x i8] c"ret_code: %d\0A---- #### ----\0A\00"
@str = [21 x i8] c"\0A---- Test mean ----\00"
define void @test_mean() {
%1 = alloca [6 x double]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%3 = bitcast [6 x double]* %1 to i8*
%4 = getelementptr inbounds [6 x double], [6 x double]* %1, i64 0, i64 0
%5 = bitcast [6 x double]* %1 to <2 x double>*
store <2 x double> <double 1.120000e+00, double 1.130000e+00>, <2 x double>* %5
%6 = getelementptr inbounds [6 x double], [6 x double]* %1, i64 0, i64 2
%7 = bitcast double* %6 to <2 x double>*
store <2 x double> <double 1.140000e+00, double 2.150000e+00>, <2 x double>* %7
%8 = getelementptr inbounds [6 x double], [6 x double]* %1, i64 0, i64 4
%9 = bitcast double* %8 to <2 x double>*
store <2 x double> <double 1.160000e+00, double 1.170000e+00>, <2 x double>* %9
%10 = call double @mean(double* %4, i32 6)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 0)
ret void
}