#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);
double pow(double, int);
double sqrt(double);
double var(double *, double *, int, double, double);
double SE_intercept(double *x, double *y, int n, double slope,
                    double intercept) {
  double sumXmeanX = 0;
  double meanX = mean(x, n);
  for (int j = 0; j < n; j++)
    sumXmeanX += pow(x[j] - meanX, 2);
  return var(x, y, n, slope, intercept) *
         sqrt((pow(meanX, 2) / sumXmeanX) + (1 / n));
}


x86 assembly (clang, -O0):
<SE_intercept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <mean@plt>
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11bd <SE_intercept+0x7d>
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    117d <SE_intercept+0x3d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1030 <var@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
divsd  -0x30(%rbp),%xmm0
mov    $0x1,%eax
cltd
idivl  -0x14(%rbp)
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SE_intercept>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x20(%rsp)
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %edx,%esi
call   1050 <mean@plt>
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
test   %r15d,%r15d
jle    128c <SE_intercept+0x14c>
mov    %r15d,%r13d
lea    -0x1(%r13),%rax
mov    %r13d,%r12d
and    $0x3,%r12d
cmp    $0x3,%rax
jae    119c <SE_intercept+0x5c>
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
jmp    1244 <SE_intercept+0x104>
and    $0xfffffffc,%r13d
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
movsd  (%rbx,%rbp,8),%xmm0
subsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rbx,%rbp,8),%xmm0
subsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rbx,%rbp,8),%xmm0
subsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rbx,%rbp,8),%xmm0
subsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
addsd  0x8(%rsp),%xmm0
add    $0x4,%rbp
cmp    %rbp,%r13
jne    11b0 <SE_intercept+0x70>
test   %r12,%r12
je     128c <SE_intercept+0x14c>
lea    (%rbx,%rbp,8),%r13
xor    %ebp,%ebp
nop
movsd  %xmm0,0x8(%rsp)
movsd  0x0(%r13,%rbp,8),%xmm0
subsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1250 <SE_intercept+0x110>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1030 <var@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movapd %xmm0,%xmm1
lea    0x1(%r15),%eax
xor    %ecx,%ecx
cmp    $0x3,%eax
cmovb  %r15d,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
divsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm0
ucomisd 0xd14(%rip),%xmm0
jb     12f4 <SE_intercept+0x1b4>
sqrtsd %xmm0,%xmm0
jmp    12f9 <SE_intercept+0x1b9>
call   1060 <sqrt@plt>
movsd  0x18(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define double @SE_intercept(double* %0, double* %1, i32 %2, double %3, double %4) {
%6 = tail call double @mean(double* %0, i32 %2)
%7 = icmp sgt i32 %2, 0
br i1 %7, label %8, label %32
8: ; preds = %5
%9 = zext i32 %2 to i64
%10 = add nsw i64 %9, -1
%11 = and i64 %9, 3
%12 = icmp ult i64 %10, 3
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = and i64 %9, 4294967292
br label %44
15: ; preds = %44, %8
%16 = phi double [ undef, %8 ], [ %70, %44 ]
%17 = phi i64 [ 0, %8 ], [ %71, %44 ]
%18 = phi double [ 0.000000e+00, %8 ], [ %70, %44 ]
%19 = icmp eq i64 %11, 0
br i1 %19, label %32, label %20
20: ; preds = %15, %20
%21 = phi i64 [ %29, %20 ], [ %17, %15 ]
%22 = phi double [ %28, %20 ], [ %18, %15 ]
%23 = phi i64 [ %30, %20 ], [ 0, %15 ]
%24 = getelementptr inbounds double, double* %0, i64 %21
%25 = load double, double* %24
%26 = fsub double %25, %6
%27 = tail call double @pow(double %26, i32 2)
%28 = fadd double %22, %27
%29 = add nuw nsw i64 %21, 1
%30 = add i64 %23, 1
%31 = icmp eq i64 %30, %11
br i1 %31, label %32, label %20
32: ; preds = %15, %20, %5
%33 = phi double [ 0.000000e+00, %5 ], [ %16, %15 ], [ %28, %20 ]
%34 = tail call double @var(double* %0, double* %1, i32 %2, double %3, double %4)
%35 = tail call double @pow(double %6, i32 2)
%36 = fdiv double %35, %33
%37 = add i32 %2, 1
%38 = icmp ult i32 %37, 3
%39 = select i1 %38, i32 %2, i32 0
%40 = sitofp i32 %39 to double
%41 = fadd double %36, %40
%42 = tail call double @sqrt(double %41)
%43 = fmul double %34, %42
ret double %43
44: ; preds = %44, %13
%45 = phi i64 [ 0, %13 ], [ %71, %44 ]
%46 = phi double [ 0.000000e+00, %13 ], [ %70, %44 ]
%47 = phi i64 [ 0, %13 ], [ %72, %44 ]
%48 = getelementptr inbounds double, double* %0, i64 %45
%49 = load double, double* %48
%50 = fsub double %49, %6
%51 = tail call double @pow(double %50, i32 2)
%52 = fadd double %46, %51
%53 = or i64 %45, 1
%54 = getelementptr inbounds double, double* %0, i64 %53
%55 = load double, double* %54
%56 = fsub double %55, %6
%57 = tail call double @pow(double %56, i32 2)
%58 = fadd double %52, %57
%59 = or i64 %45, 2
%60 = getelementptr inbounds double, double* %0, i64 %59
%61 = load double, double* %60
%62 = fsub double %61, %6
%63 = tail call double @pow(double %62, i32 2)
%64 = fadd double %58, %63
%65 = or i64 %45, 3
%66 = getelementptr inbounds double, double* %0, i64 %65
%67 = load double, double* %66
%68 = fsub double %67, %6
%69 = tail call double @pow(double %68, i32 2)
%70 = fadd double %64, %69
%71 = add nuw nsw i64 %45, 4
%72 = add i64 %47, 4
%73 = icmp eq i64 %72, %14
br i1 %73, label %15, label %44
}