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


x86 assembly (clang, -O0):
<condMu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
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    11bb <condMu+0x9b>
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    114d <condMu+0x2d>
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
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<condMu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8,%r15
mov    %rcx,%r12
test   %edi,%edi
jle    1160 <condMu+0x40>
mov    %rdx,%rbx
mov    %r15,0x20(%rsp)
mov    %edi,%eax
movslq %esi,%r13
cmp    $0x1,%edi
mov    %r13,0x18(%rsp)
mov    %rax,0x10(%rsp)
jne    116c <condMu+0x4c>
xorpd  %xmm0,%xmm0
xor    %r14d,%r14d
jmp    1205 <condMu+0xe5>
movslq %esi,%rbp
xorpd  %xmm0,%xmm0
jmp    125a <condMu+0x13a>
mov    %eax,%ebp
and    $0xfffffffe,%ebp
lea    (%r9,%rax,8),%rcx
mov    %rcx,0x30(%rsp)
add    %rax,%rax
mov    %rax,0x28(%rsp)
xorpd  %xmm0,%xmm0
xor    %r14d,%r14d
nopl   0x0(%rax)
movsd  %xmm0,(%rsp)
movsd  (%r9,%r13,8),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rbx,%r14,8),%xmm0
subsd  (%r12,%r14,8),%xmm0
mov    %r9,%r15
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    0x30(%rsp),%rax
movsd  (%rax,%r13,8),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rbx,%r14,8),%xmm0
subsd  0x8(%r12,%r14,8),%xmm0
call   1030 <sin@plt>
mov    %r15,%r9
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
add    $0x2,%r14
add    0x28(%rsp),%r13
cmp    %r14,%rbp
jne    1190 <condMu+0x70>
mov    0x10(%rsp),%rax
test   $0x1,%al
mov    0x20(%rsp),%r15
mov    0x18(%rsp),%rbp
je     125a <condMu+0x13a>
imul   %r14,%rax
add    %rbp,%rax
movsd  (%r9,%rax,8),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
movsd  (%rbx,%r14,8),%xmm0
subsd  (%r12,%r14,8),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
movsd  (%r12,%rbp,8),%xmm1
movsd  %xmm1,(%rsp)
divsd  (%r15,%rbp,8),%xmm0
call   1040 <atan@plt>
addsd  (%rsp),%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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