#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 */
scalar_t__ atof(char *);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, double);
double rmse(double, int, double *);
int main(int argc, char *argv[]) {
  int len = argc - 1;
  double RMSE;
  double *intake;
  intake = (double *)malloc(len * sizeof(double));
  for (int i = 1; i < argc; i++) {
    intake[i - 1] = (double)atof(argv[i]);
  }
  RMSE = rmse(RMSE, len, intake);
  printf("RMSE %G\n", RMSE);
  free(intake);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11cb <main+0x7b>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atof@plt>
cvtsi2sd %rax,%xmm0
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1189 <main+0x39>
movsd  -0x20(%rbp),%xmm0
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1040 <rmse@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe13(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
lea    -0x1(%rbp),%r15d
lea    -0x8(,%rbp,8),%edi
call   1070 <malloc@plt>
mov    %rax,%r12
cmp    $0x2,%ebp
jl     11a1 <main+0x51>
mov    %ebp,%ebp
add    $0xffffffffffffffff,%rbp
xor    %ebx,%ebx
nopl   (%rax)
mov    0x8(%r14,%rbx,8),%rdi
call   1050 <atof@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1180 <main+0x30>
mov    %r15d,%edi
mov    %r12,%rsi
call   1040 <rmse@plt>
lea    0xe4d(%rip),%rdi
call   1060 <printf@plt>
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"RMSE %G\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca double*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 8
%15 = trunc i64 %14 to i32
%16 = call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to double*
store double* %17, double** %8
store i32 1, i32* %9
br label %18
18: ; preds = %35, %2
%19 = load i32, i32* %9
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %38
22: ; preds = %18
%23 = load i8**, i8*** %5
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i64 @atof(i8* %27)
%29 = sitofp i64 %28 to double
%30 = load double*, double** %8
%31 = load i32, i32* %9
%32 = sub nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %30, i64 %33
store double %29, double* %34
br label %35
35: ; preds = %22
%36 = load i32, i32* %9
%37 = add nsw i32 %36, 1
store i32 %37, i32* %9
br label %18
38: ; preds = %18
%39 = load double, double* %7
%40 = load i32, i32* %6
%41 = load double*, double** %8
%42 = call double @rmse(double %39, i32 %40, double* %41)
store double %42, double* %7
%43 = load double, double* %7
%44 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double %43)
%45 = load double*, double** %8
%46 = call i32 @free(double* %45)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"RMSE %G\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add nsw i32 %0, -1
%4 = shl i32 %3, 3
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to double*
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = zext i32 %0 to i64
br label %14
10: ; preds = %14, %2
%11 = tail call double @rmse(double undef, i32 %3, double* %6)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double %11)
%13 = tail call i32 @free(double* %6)
ret i32 0
14: ; preds = %8, %14
%15 = phi i64 [ 1, %8 ], [ %22, %14 ]
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = tail call i64 @atof(i8* %17)
%19 = sitofp i64 %18 to double
%20 = add nsw i64 %15, -1
%21 = getelementptr inbounds double, double* %6, i64 %20
store double %19, double* %21
%22 = add nuw nsw i64 %15, 1
%23 = icmp eq i64 %22, %9
br i1 %23, label %10, label %14
}