#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 StatCovMomentDouble(double *, double *, int, int, int, int);
int StatMomentDouble(double *, int, int, int);
double sqrt(int);
double StatCorrcoefDouble(double a[], double b[], int n, int s) {
  return StatCovMomentDouble(a, b, n, s, 1, 1) /
         sqrt(StatMomentDouble(a, n, 1, 2) * StatMomentDouble(b, n, 1, 2));
}


x86 assembly (clang, -O0):
<StatCorrcoefDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    $0x1,%r9d
mov    %r9d,%r8d
call   1040 <StatCovMomentDouble@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1030 <StatMomentDouble@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1030 <StatMomentDouble@plt>
mov    -0x24(%rbp),%edi
imul   %eax,%edi
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StatCorrcoefDouble>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x1,%r8d
mov    $0x1,%r9d
call   1040 <StatCovMomentDouble@plt>
movsd  %xmm0,(%rsp)
mov    %r15,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1030 <StatMomentDouble@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1030 <StatMomentDouble@plt>
imul   %eax,%ebp
mov    %ebp,%edi
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @StatCorrcoefDouble(double* %0, double* %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load double*, double** %5
%10 = load double*, double** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call double @StatCovMomentDouble(double* %9, double* %10, i32 %11, i32 %12, i32 1, i32 1)
%14 = load double*, double** %5
%15 = load i32, i32* %7
%16 = call i32 @StatMomentDouble(double* %14, i32 %15, i32 1, i32 2)
%17 = load double*, double** %6
%18 = load i32, i32* %7
%19 = call i32 @StatMomentDouble(double* %17, i32 %18, i32 1, i32 2)
%20 = mul nsw i32 %16, %19
%21 = call double @sqrt(i32 %20)
%22 = fdiv double %13, %21
ret double %22
}

LLVM IR (-O2):
define double @StatCorrcoefDouble(double* %0, double* %1, i32 %2, i32 %3) {
%5 = tail call double @StatCovMomentDouble(double* %0, double* %1, i32 %2, i32 %3, i32 1, i32 1)
%6 = tail call i32 @StatMomentDouble(double* %0, i32 %2, i32 1, i32 2)
%7 = tail call i32 @StatMomentDouble(double* %1, i32 %2, i32 1, i32 2)
%8 = mul nsw i32 %7, %6
%9 = tail call double @sqrt(i32 %8)
%10 = fdiv double %5, %9
ret double %10
}