#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__ pow(double, int);
double sqrt(double);
double errorEstimation(double *x_gauss, double *x_analytical, int N) {
  double sum = 0;
  for (int i = 0; i < N; i++) {
    sum += pow(*(x_gauss + i) - *(x_analytical + i), 2);
  }
  return sqrt(sum / N);
}


x86 assembly (clang, -O0):
<errorEstimation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    118f <errorEstimation+0x6f>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1142 <errorEstimation+0x22>
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errorEstimation>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
test   %edx,%edx
jle    1204 <errorEstimation+0xe4>
mov    %rsi,%r12
mov    %rdi,%rbp
mov    %r14d,%r15d
cmp    $0x1,%r14d
jne    1155 <errorEstimation+0x35>
xorpd  %xmm2,%xmm2
xor    %ebx,%ebx
jmp    11ca <errorEstimation+0xaa>
mov    %r15d,%r13d
and    $0xfffffffe,%r13d
xorpd  %xmm2,%xmm2
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm2,(%rsp)
movsd  0x0(%rbp,%rbx,8),%xmm0
subsd  (%r12,%rbx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rbp,%rbx,8),%xmm0
subsd  0x8(%r12,%rbx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
xorps  %xmm2,%xmm2
cvtsi2sd %rax,%xmm2
addsd  (%rsp),%xmm2
add    $0x2,%rbx
cmp    %rbx,%r13
jne    1170 <errorEstimation+0x50>
test   $0x1,%r15b
xorpd  %xmm1,%xmm1
je     1204 <errorEstimation+0xe4>
movsd  0x0(%rbp,%rbx,8),%xmm0
subsd  (%r12,%rbx,8),%xmm0
mov    $0x2,%edi
movsd  %xmm2,(%rsp)
call   1030 <pow@plt>
movsd  (%rsp),%xmm2
xorpd  %xmm1,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
divsd  %xmm0,%xmm2
ucomisd %xmm1,%xmm2
jb     122c <errorEstimation+0x10c>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movapd %xmm2,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define double @errorEstimation(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
store double 0.000000e+00, double* %7
store i32 0, i32* %8
br label %9
9: ; preds = %29, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %32
13: ; preds = %9
%14 = load double*, double** %4
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %14, i64 %16
%18 = load double, double* %17
%19 = load double*, double** %5
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load double, double* %22
%24 = fsub double %18, %23
%25 = call i64 @pow(double %24, i32 2)
%26 = sitofp i64 %25 to double
%27 = load double, double* %7
%28 = fadd double %27, %26
store double %28, double* %7
br label %29
29: ; preds = %13
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
br label %9
32: ; preds = %9
%33 = load double, double* %7
%34 = load i32, i32* %6
%35 = sitofp i32 %34 to double
%36 = fdiv double %33, %35
%37 = call double @sqrt(double %36)
ret double %37
}

LLVM IR (-O2):
define double @errorEstimation(double* nocapture %0, double* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %25
5: ; preds = %3
%6 = zext i32 %2 to i64
%7 = and i64 %6, 1
%8 = icmp eq i32 %2, 1
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = and i64 %6, 4294967294
br label %30
11: ; preds = %30, %5
%12 = phi double [ undef, %5 ], [ %50, %30 ]
%13 = phi i64 [ 0, %5 ], [ %51, %30 ]
%14 = phi double [ 0.000000e+00, %5 ], [ %50, %30 ]
%15 = icmp eq i64 %7, 0
br i1 %15, label %25, label %16
16: ; preds = %11
%17 = getelementptr inbounds double, double* %0, i64 %13
%18 = load double, double* %17
%19 = getelementptr inbounds double, double* %1, i64 %13
%20 = load double, double* %19
%21 = fsub double %18, %20
%22 = tail call i64 @pow(double %21, i32 2)
%23 = sitofp i64 %22 to double
%24 = fadd double %14, %23
br label %25
25: ; preds = %16, %11, %3
%26 = phi double [ 0.000000e+00, %3 ], [ %12, %11 ], [ %24, %16 ]
%27 = sitofp i32 %2 to double
%28 = fdiv double %26, %27
%29 = tail call double @sqrt(double %28)
ret double %29
30: ; preds = %30, %9
%31 = phi i64 [ 0, %9 ], [ %51, %30 ]
%32 = phi double [ 0.000000e+00, %9 ], [ %50, %30 ]
%33 = phi i64 [ 0, %9 ], [ %52, %30 ]
%34 = getelementptr inbounds double, double* %0, i64 %31
%35 = load double, double* %34
%36 = getelementptr inbounds double, double* %1, i64 %31
%37 = load double, double* %36
%38 = fsub double %35, %37
%39 = tail call i64 @pow(double %38, i32 2)
%40 = sitofp i64 %39 to double
%41 = fadd double %32, %40
%42 = or i64 %31, 1
%43 = getelementptr inbounds double, double* %0, i64 %42
%44 = load double, double* %43
%45 = getelementptr inbounds double, double* %1, i64 %42
%46 = load double, double* %45
%47 = fsub double %44, %46
%48 = tail call i64 @pow(double %47, i32 2)
%49 = sitofp i64 %48 to double
%50 = fadd double %41, %49
%51 = add nuw nsw i64 %31, 2
%52 = add i64 %33, 2
%53 = icmp eq i64 %52, %10
br i1 %53, label %11, label %30
}