#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*/ newAvg(double *, int, int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main() {
  double arr1[7] = {14.0, 30.0, 5.0, 7.0, 9.0, 11.0, 16.0};
  printf("%lld\n", newAvg(arr1, 7, 90));
  double arr2[8] = {10000.0, 10000.0, 10000.0, 1000.0, 500.0, 60.0, 4.0, 3.0};
  printf("%lld\n", newAvg(arr2, 8, 10000));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0x7,%esi
mov    $0x5a,%edx
call   1050 <newAvg@plt>
mov    %eax,%esi
lea    0xf0d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x80(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
lea    -0x80(%rbp),%rdi
mov    $0x8,%esi
mov    $0x2710,%edx
call   1050 <newAvg@plt>
mov    %eax,%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
mov    0xf01(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xead(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
mov    $0x5a,%edx
call   1040 <newAvg@plt>
lea    0xf10(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
movaps 0xeef(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xed3(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xeb7(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe9b(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0x40(%rsp),%rdi
mov    $0x8,%esi
mov    $0x2710,%edx
call   1040 <newAvg@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr1 = [7 x double] [double 1.400000e+01, double 3.000000e+01, double 5.000000e+00, double 7.000000e+00, double 9.000000e+00, double 1.100000e+01, double 1.600000e+01]
@.str = [6 x i8] c"%lld\0A\00"
@__const.main.arr2 = [8 x double] [double 1.000000e+04, double 1.000000e+04, double 1.000000e+04, double 1.000000e+03, double 5.000000e+02, double 6.000000e+01, double 4.000000e+00, double 3.000000e+00]
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x double]
%3 = alloca [8 x double]
store i32 0, i32* %1
%4 = bitcast [7 x double]* %2 to i8*
%5 = getelementptr inbounds [7 x double], [7 x double]* %2, i64 0, i64 0
%6 = call i32 @newAvg(double* %5, i32 7, i32 90)
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = bitcast [8 x double]* %3 to i8*
%9 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 0
%10 = call i32 @newAvg(double* %9, i32 8, i32 10000)
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr1 = [7 x double] [double 1.400000e+01, double 3.000000e+01, double 5.000000e+00, double 7.000000e+00, double 9.000000e+00, double 1.100000e+01, double 1.600000e+01]
@.str = [6 x i8] c"%lld\0A\00"
@__const.main.arr2 = [8 x double] [double 1.000000e+04, double 1.000000e+04, double 1.000000e+04, double 1.000000e+03, double 5.000000e+02, double 6.000000e+01, double 4.000000e+00, double 3.000000e+00]
define i32 @main() {
%1 = alloca [7 x double]
%2 = alloca [8 x double]
%3 = bitcast [7 x double]* %1 to i8*
%4 = getelementptr inbounds [7 x double], [7 x double]* %1, i64 0, i64 0
%5 = call i32 @newAvg(double* %4, i32 7, i32 90)
%6 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = bitcast [8 x double]* %2 to i8*
%8 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%9 = call i32 @newAvg(double* %8, i32 8, i32 10000)
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}