#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 atan(double);
double sin(double);
double sqrt(double);
void condKappaMu(int size, int j, double *instance, double *mu, double *kappa,
                 double *lambda, double *muCond, double *kappaCond) {
  double sum = 0.0;
  int l;
  for (l = 0; l < size; l++) {
    sum += lambda[l * size + j] * sin(instance[l] - mu[l]);
  }
  *kappaCond = sqrt((kappa[j] * kappa[j]) + (sum * sum));
  *muCond = mu[j] + atan(sum / kappa[j]);
}


x86 assembly (clang, -O0):
<condKappaMu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d3 <condKappaMu+0xa3>
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x8(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1165 <condKappaMu+0x35>
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
call   1040 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
addsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<condKappaMu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8,%r12
mov    %rcx,%r15
test   %edi,%edi
jle    1173 <condKappaMu+0x43>
mov    %r9,%r13
mov    %rdx,%rbx
mov    %r12,0x20(%rsp)
mov    %edi,%eax
movslq %esi,%r12
cmp    $0x1,%edi
mov    %r12,0x18(%rsp)
mov    %rax,0x10(%rsp)
jne    117f <condKappaMu+0x4f>
xorpd  %xmm2,%xmm2
xor    %r14d,%r14d
jmp    1224 <condKappaMu+0xf4>
movslq %esi,%rbp
xorpd  %xmm2,%xmm2
jmp    1270 <condKappaMu+0x140>
mov    %eax,%ebp
and    $0xfffffffe,%ebp
lea    0x0(,%rax,8),%rcx
add    %r13,%rcx
mov    %rcx,0x30(%rsp)
add    %rax,%rax
mov    %rax,0x28(%rsp)
xorpd  %xmm2,%xmm2
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm2,(%rsp)
movsd  0x0(%r13,%r12,8),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rbx,%r14,8),%xmm0
subsd  (%r15,%r14,8),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    0x30(%rsp),%rax
movsd  (%rax,%r12,8),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rbx,%r14,8),%xmm0
subsd  0x8(%r15,%r14,8),%xmm0
call   1030 <sin@plt>
movapd %xmm0,%xmm2
mulsd  0x8(%rsp),%xmm2
addsd  (%rsp),%xmm2
add    $0x2,%r14
add    0x28(%rsp),%r12
cmp    %r14,%rbp
jne    11b0 <condKappaMu+0x80>
mov    0x10(%rsp),%rax
test   $0x1,%al
mov    0x20(%rsp),%r12
mov    0x18(%rsp),%rbp
je     1270 <condKappaMu+0x140>
imul   %r14,%rax
add    %rbp,%rax
movsd  0x0(%r13,%rax,8),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rbx,%r14,8),%xmm0
subsd  (%r15,%r14,8),%xmm0
movsd  %xmm2,(%rsp)
call   1030 <sin@plt>
movsd  (%rsp),%xmm2
mulsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm2
mov    0x78(%rsp),%rbx
mov    0x70(%rsp),%r14
movsd  (%r12,%rbp,8),%xmm0
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12a0 <condKappaMu+0x170>
sqrtsd %xmm0,%xmm0
jmp    12af <condKappaMu+0x17f>
movsd  %xmm2,(%rsp)
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm2
movsd  %xmm0,(%rbx)
movsd  (%r15,%rbp,8),%xmm0
movsd  %xmm0,(%rsp)
divsd  (%r12,%rbp,8),%xmm2
movapd %xmm2,%xmm0
call   1040 <atan@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @condKappaMu(i32 %0, i32 %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double
%18 = alloca i32
store i32 %0, i32* %9
store i32 %1, i32* %10
store double* %2, double** %11
store double* %3, double** %12
store double* %4, double** %13
store double* %5, double** %14
store double* %6, double** %15
store double* %7, double** %16
store double 0.000000e+00, double* %17
store i32 0, i32* %18
br label %19
19: ; preds = %47, %8
%20 = load i32, i32* %18
%21 = load i32, i32* %9
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %50
23: ; preds = %19
%24 = load double*, double** %14
%25 = load i32, i32* %18
%26 = load i32, i32* %9
%27 = mul nsw i32 %25, %26
%28 = load i32, i32* %10
%29 = add nsw i32 %27, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %24, i64 %30
%32 = load double, double* %31
%33 = load double*, double** %11
%34 = load i32, i32* %18
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = load double*, double** %12
%39 = load i32, i32* %18
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
%43 = fsub double %37, %42
%44 = call double @sin(double %43)
%45 = load double, double* %17
%46 = call double @llvm.fmuladd.f64(double %32, double %44, double %45)
store double %46, double* %17
br label %47
47: ; preds = %23
%48 = load i32, i32* %18
%49 = add nsw i32 %48, 1
store i32 %49, i32* %18
br label %19
50: ; preds = %19
%51 = load double*, double** %13
%52 = load i32, i32* %10
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %51, i64 %53
%55 = load double, double* %54
%56 = load double*, double** %13
%57 = load i32, i32* %10
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
%60 = load double, double* %59
%61 = load double, double* %17
%62 = load double, double* %17
%63 = fmul double %61, %62
%64 = call double @llvm.fmuladd.f64(double %55, double %60, double %63)
%65 = call double @sqrt(double %64)
%66 = load double*, double** %16
store double %65, double* %66
%67 = load double*, double** %12
%68 = load i32, i32* %10
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double, double* %67, i64 %69
%71 = load double, double* %70
%72 = load double, double* %17
%73 = load double*, double** %13
%74 = load i32, i32* %10
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %73, i64 %75
%77 = load double, double* %76
%78 = fdiv double %72, %77
%79 = call double @atan(double %78)
%80 = fadd double %71, %79
%81 = load double*, double** %15
store double %80, double* %81
ret void
}

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