#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);
scalar_t__ pow(double, int);
double sqrt(int);
double var(double *, double *, int, double, double);
double SE_slope(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((1 / sumXmeanX));
}


x86 assembly (clang, -O0):
<SE_slope>:
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    11c2 <SE_slope+0x82>
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    117d <SE_slope+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  0xe17(%rip),%xmm0
divsd  -0x30(%rbp),%xmm0
cvttsd2si %xmm0,%edi
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_slope>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %edx,%esi
call   1050 <mean@plt>
test   %r15d,%r15d
jle    1198 <SE_slope+0x58>
mov    %r15d,%r13d
lea    -0x1(%r13),%rax
mov    %r13d,%r12d
and    $0x3,%r12d
cmp    $0x3,%rax
movsd  %xmm0,0x10(%rsp)
jae    11a7 <SE_slope+0x67>
xorpd  %xmm2,%xmm2
xor    %ebp,%ebp
movapd %xmm0,%xmm1
jmp    1278 <SE_slope+0x138>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
jmp    12cc <SE_slope+0x18c>
and    $0xfffffffc,%r13d
xorpd  %xmm2,%xmm2
xor    %ebp,%ebp
movapd %xmm0,%xmm1
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm2,0x8(%rsp)
movsd  (%rbx,%rbp,8),%xmm0
subsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
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>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
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>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
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>
movsd  0x10(%rsp),%xmm1
xorps  %xmm2,%xmm2
cvtsi2sd %rax,%xmm2
addsd  0x8(%rsp),%xmm2
add    $0x4,%rbp
cmp    %rbp,%r13
jne    11c0 <SE_slope+0x80>
movsd  %xmm2,0x8(%rsp)
test   %r12,%r12
je     12cc <SE_slope+0x18c>
lea    (%rbx,%rbp,8),%r13
xor    %ebp,%ebp
nopl   0x0(%rax)
movsd  0x0(%r13,%rbp,8),%xmm0
subsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1290 <SE_slope+0x150>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1030 <var@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xd0c(%rip),%xmm0
divsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @SE_slope(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 = %33, %5
%18 = load i32, i32* %13
%19 = load i32, i32* %8
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %36
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 i64 @pow(double %28, i32 2)
%30 = sitofp i64 %29 to double
%31 = load double, double* %11
%32 = fadd double %31, %30
store double %32, double* %11
br label %33
33: ; preds = %21
%34 = load i32, i32* %13
%35 = add nsw i32 %34, 1
store i32 %35, i32* %13
br label %17
36: ; preds = %17
%37 = load double*, double** %6
%38 = load double*, double** %7
%39 = load i32, i32* %8
%40 = load double, double* %9
%41 = load double, double* %10
%42 = call double @var(double* %37, double* %38, i32 %39, double %40, double %41)
%43 = load double, double* %11
%44 = fdiv double 1.000000e+00, %43
%45 = fptosi double %44 to i32
%46 = call double @sqrt(i32 %45)
%47 = fmul double %42, %46
ret double %47
}

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