#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 exp(int);
int pow(double, int);
int sqrt(double);
double exponential(double *x, double *y, int n, double sigma) {
  int i;
  double d = 0.0;
  for (i = 0; i < n; i++)
    d += pow(x[i] - y[i], 2);
  return exp(-sqrt(d) / (2 * pow(sigma, 2)));
}


x86 assembly (clang, -O0):
<exponential>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a3 <exponential+0x73>
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   1040 <pow@plt>
cvtsi2sd %eax,%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1157 <exponential+0x27>
movsd  -0x30(%rbp),%xmm0
call   1050 <sqrt@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x34(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
shl    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <exp@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exponential>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %edx,%edx
movsd  %xmm0,0x8(%rsp)
jle    115d <exponential+0x2d>
mov    %rsi,%r14
mov    %rdi,%r12
mov    %edx,%r15d
cmp    $0x1,%edx
jne    1166 <exponential+0x36>
xorpd  %xmm0,%xmm0
xor    %ebx,%ebx
jmp    11d9 <exponential+0xa9>
xorpd  %xmm0,%xmm0
jmp    1214 <exponential+0xe4>
mov    %r15d,%r13d
and    $0xfffffffe,%r13d
xorpd  %xmm0,%xmm0
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm0,(%rsp)
movsd  (%r12,%rbx,8),%xmm0
subsd  (%r14,%rbx,8),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%r12,%rbx,8),%xmm0
subsd  0x8(%r14,%rbx,8),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  (%rsp),%xmm0
add    $0x2,%rbx
cmp    %rbx,%r13
jne    1180 <exponential+0x50>
test   $0x1,%r15b
je     1214 <exponential+0xe4>
movsd  %xmm0,(%rsp)
movsd  (%r12,%rbx,8),%xmm0
subsd  (%r14,%rbx,8),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
call   1050 <sqrt@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
add    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
neg    %eax
mov    %eax,%edi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <exp@plt>

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

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