#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 */
long double bessi0_salahat_exponScaled(long double);
long double bessi0_spd_exponScaled(long double);
long double bessi1_salahat_exponScaled(long double);
long double bessi1_spd_exponScaled(long double);
int /*<<< orphan*/ generalMatrixMatrix(int, int, int, int, char, char,
                                       long double *, double *, long double *);
long double logl(long double);
int /*<<< orphan*/ memset(double *, int /*<<< orphan*/, int);
long double sqrtl(double);
long double mv_vonmises_lossFunction(int n, int p, double *kappa,
                                     double *lambda, long double *S,
                                     long double *C, long double *ro,
                                     double *d_kappa, double *d_lambda) {
  int i, j, s;
  long double fx;
  long double k_i_j;
  long double bes_kij;
  long double bes1_kij;
  long double a_kij;
  generalMatrixMatrix(n, p, p, p, 'n', 'n', S, lambda, ro);
  fx = 0;
  if (d_lambda != NULL && d_kappa != NULL) {
    memset(d_lambda, 0, sizeof(double) * p * p);
    memset(d_kappa, 0, sizeof(double) * p);
    for (j = 0; j < p; j++) {
      for (i = 0; i < n; i++) {
        k_i_j = sqrtl((kappa[j] * kappa[j]) + (ro[i * p + j] * ro[i * p + j]));
        bes_kij = (k_i_j) < (1E31) ? (bessi0_spd_exponScaled(k_i_j))
                                   : (bessi0_salahat_exponScaled(k_i_j));
        a_kij = (((k_i_j) < (1E31) ? (bessi1_spd_exponScaled(k_i_j))
                                   : (bessi1_salahat_exponScaled(k_i_j))) /
                 (bes_kij * k_i_j));
        fx += (k_i_j + logl(bes_kij)) - (C[i * p + j] * kappa[j]) -
              (S[i * p + j] * ro[i * p + j]);
        d_kappa[j] += a_kij * kappa[j] - C[i * p + j];
        for (s = 0; s < j; s++)
          d_lambda[s * p + j] +=
              S[i * p + s] * (a_kij * ro[i * p + j] - S[i * p + j]);
        for (s = j + 1; s < p; s++)
          d_lambda[j * p + s] +=
              S[i * p + s] * (a_kij * ro[i * p + j] - S[i * p + j]);
      }
      for (s = j + 1; s < p; s++) {
        d_lambda[s * p + j] = d_lambda[j * p + s];
      }
    }
  } else {
    for (j = 0; j < p; j++) {
      for (i = 0; i < n; i++) {
        k_i_j = sqrtl((kappa[j] * kappa[j]) + (ro[i * p + j] * ro[i * p + j]));
        bes_kij = (k_i_j) < (1E31) ? (bessi0_spd_exponScaled(k_i_j))
                                   : (bessi0_salahat_exponScaled(k_i_j));
        fx += (k_i_j + logl(bes_kij)) - (C[i * p + j] * kappa[j]) -
              (S[i * p + j] * ro[i * p + j]);
      }
    }
  }
  return (fx);
}


x86 assembly (clang, -O0):
<mv_vonmises_lossFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    0x20(%rbp),%rax
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)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%ecx
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rsi
mov    0x10(%rbp),%r8
mov    %rsp,%rax
mov    %r8,0x10(%rax)
mov    %rsi,0x8(%rax)
mov    %rdx,(%rax)
mov    $0x6e,%r9d
mov    %ecx,%esi
mov    %ecx,%edx
mov    %r9d,%r8d
call   1090 <generalMatrixMatrix@plt>
fldz
fstpt  -0x50(%rbp)
cmpq   $0x0,0x20(%rbp)
je     1594 <mv_vonmises_lossFunction+0x414>
cmpq   $0x0,0x18(%rbp)
je     1594 <mv_vonmises_lossFunction+0x414>
mov    0x20(%rbp),%rdi
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
movslq -0x8(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    0x18(%rbp),%rdi
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1050 <memset@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    158f <mv_vonmises_lossFunction+0x40f>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    152d <mv_vonmises_lossFunction+0x3ad>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %ecx,%edx
movsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
fldl   -0xa8(%rbp)
mov    0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    -0x8(%rbp),%esi
imul   %esi,%ecx
add    %edx,%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fmul   %st,%st(0)
faddp  %st,%st(1)
fstpl  -0xb0(%rbp)
movsd  -0xb0(%rbp),%xmm0
ff
call   1070 <sqrtl@plt>
fstpt  -0x60(%rbp)
fldt   -0x60(%rbp)
fldl   0xd51(%rip)
fucomip %st(1),%st
fstp   %st(0)
jbe    12d6 <mv_vonmises_lossFunction+0x156>
jmp    12be <mv_vonmises_lossFunction+0x13e>
fldt   -0x60(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   10a0 <bessi0_spd_exponScaled@plt>
fstpt  -0xd4(%rbp)
jmp    12e9 <mv_vonmises_lossFunction+0x169>
fldt   -0x60(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <bessi0_salahat_exponScaled@plt>
fstpt  -0xd4(%rbp)
fldt   -0xd4(%rbp)
fstpt  -0x70(%rbp)
fldt   -0x60(%rbp)
fldl   0xd05(%rip)
fucomip %st(1),%st
fstp   %st(0)
jbe    1322 <mv_vonmises_lossFunction+0x1a2>
jmp    130a <mv_vonmises_lossFunction+0x18a>
fldt   -0x60(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1080 <bessi1_spd_exponScaled@plt>
fstpt  -0xe0(%rbp)
jmp    1335 <mv_vonmises_lossFunction+0x1b5>
fldt   -0x60(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1060 <bessi1_salahat_exponScaled@plt>
fstpt  -0xe0(%rbp)
fldt   -0xe0(%rbp)
fldt   -0x70(%rbp)
fldt   -0x60(%rbp)
fmulp  %st,%st(1)
fdivrp %st,%st(1)
fstpt  -0x90(%rbp)
fldt   -0x60(%rbp)
fstpt  -0xec(%rbp)
fldt   -0x70(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <logl@plt>
fldt   -0xec(%rbp)
faddp  %st,%st(1)
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    -0x8(%rbp),%edx
imul   %edx,%ecx
movslq -0x30(%rbp),%rdx
mov    %edx,%esi
add    %esi,%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
mov    -0x10(%rbp),%rax
fldl   (%rax,%rdx,8)
fmulp  %st,%st(1)
fsubrp %st,%st(1)
mov    -0x20(%rbp),%rax
fldt   (%rax,%rcx,1)
mov    0x10(%rbp),%rax
fldt   (%rax,%rcx,1)
fmulp  %st,%st(1)
fsubrp %st,%st(1)
fldt   -0x50(%rbp)
faddp  %st,%st(1)
fstpt  -0x50(%rbp)
fldt   -0x90(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rdx
mov    %edx,%esi
fldl   (%rax,%rdx,8)
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    -0x8(%rbp),%edi
imul   %edi,%ecx
add    %esi,%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fxch   %st(2)
fmulp  %st,%st(1)
fsubp  %st,%st(1)
mov    0x18(%rbp),%rax
mov    %rdx,%rcx
fldl   (%rax,%rdx,8)
faddp  %st,%st(1)
fstpl  -0xb8(%rbp)
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    148b <mv_vonmises_lossFunction+0x30b>
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
imul   %esi,%edi
mov    -0x34(%rbp),%ecx
mov    %edi,%edx
add    %ecx,%edx
movslq %edx,%rdx
shl    $0x4,%rdx
fldt   (%rax,%rdx,1)
fldt   -0x90(%rbp)
mov    0x10(%rbp),%r8
mov    -0x30(%rbp),%edx
add    %edx,%edi
movslq %edi,%rdi
shl    $0x4,%rdi
fldt   (%r8,%rdi,1)
fldt   (%rax,%rdi,1)
fxch   %st(2)
fmulp  %st,%st(1)
fsubp  %st,%st(1)
mov    0x20(%rbp),%rax
imul   %esi,%ecx
add    %edx,%ecx
movslq %ecx,%rdx
mov    %rdx,%rcx
fldl   (%rax,%rdx,8)
fxch   %st(2)
fmulp  %st,%st(1)
faddp  %st,%st(1)
fstpl  -0xc8(%rbp)
movsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1405 <mv_vonmises_lossFunction+0x285>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    151a <mv_vonmises_lossFunction+0x39a>
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%edi
mov    -0x8(%rbp),%esi
imul   %esi,%edi
mov    -0x34(%rbp),%edx
mov    %edi,%ecx
add    %edx,%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fldt   -0x90(%rbp)
mov    0x10(%rbp),%r8
mov    -0x30(%rbp),%ecx
add    %ecx,%edi
movslq %edi,%rdi
shl    $0x4,%rdi
fldt   (%r8,%rdi,1)
fldt   (%rax,%rdi,1)
fxch   %st(2)
fmulp  %st,%st(1)
fsubp  %st,%st(1)
mov    0x20(%rbp),%rax
imul   %esi,%ecx
add    %edx,%ecx
movslq %ecx,%rdx
mov    %rdx,%rcx
fldl   (%rax,%rdx,8)
fxch   %st(2)
fmulp  %st,%st(1)
faddp  %st,%st(1)
fstpl  -0xc0(%rbp)
movsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1494 <mv_vonmises_lossFunction+0x314>
jmp    151f <mv_vonmises_lossFunction+0x39f>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1246 <mv_vonmises_lossFunction+0xc6>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    157c <mv_vonmises_lossFunction+0x3fc>
mov    0x20(%rbp),%rax
mov    -0x30(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1536 <mv_vonmises_lossFunction+0x3b6>
jmp    1581 <mv_vonmises_lossFunction+0x401>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1233 <mv_vonmises_lossFunction+0xb3>
jmp    16e2 <mv_vonmises_lossFunction+0x562>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    16dd <mv_vonmises_lossFunction+0x55d>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    16ca <mv_vonmises_lossFunction+0x54a>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %ecx,%edx
movsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
fldl   -0x98(%rbp)
mov    0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    -0x8(%rbp),%esi
imul   %esi,%ecx
add    %edx,%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fmul   %st,%st(0)
faddp  %st,%st(1)
fstpl  -0xa0(%rbp)
movsd  -0xa0(%rbp),%xmm0
ff
call   1070 <sqrtl@plt>
fstpt  -0x60(%rbp)
fldt   -0x60(%rbp)
fldl   0x9e9(%rip)
fucomip %st(1),%st
fstp   %st(0)
jbe    163e <mv_vonmises_lossFunction+0x4be>
jmp    1626 <mv_vonmises_lossFunction+0x4a6>
fldt   -0x60(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   10a0 <bessi0_spd_exponScaled@plt>
fstpt  -0xf8(%rbp)
jmp    1651 <mv_vonmises_lossFunction+0x4d1>
fldt   -0x60(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <bessi0_salahat_exponScaled@plt>
fstpt  -0xf8(%rbp)
fldt   -0xf8(%rbp)
fstpt  -0x70(%rbp)
fldt   -0x60(%rbp)
fstpt  -0x104(%rbp)
fldt   -0x70(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <logl@plt>
fldt   -0x104(%rbp)
faddp  %st,%st(1)
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    -0x8(%rbp),%edx
imul   %edx,%ecx
movslq -0x30(%rbp),%rdx
mov    %edx,%esi
add    %esi,%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
mov    -0x10(%rbp),%rax
fldl   (%rax,%rdx,8)
fmulp  %st,%st(1)
fsubrp %st,%st(1)
mov    -0x20(%rbp),%rax
fldt   (%rax,%rcx,1)
mov    0x10(%rbp),%rax
fldt   (%rax,%rcx,1)
fmulp  %st,%st(1)
fsubrp %st,%st(1)
fldt   -0x50(%rbp)
faddp  %st,%st(1)
fstpt  -0x50(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    15ae <mv_vonmises_lossFunction+0x42e>
jmp    16cf <mv_vonmises_lossFunction+0x54f>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    159b <mv_vonmises_lossFunction+0x41b>
jmp    16e2 <mv_vonmises_lossFunction+0x562>
fldt   -0x50(%rbp)
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mv_vonmises_lossFunction>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %r9,0x58(%rsp)
mov    %rdx,0x38(%rsp)
mov    %esi,%ebx
mov    0x150(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    %rcx,0x8(%rsp)
mov    %r8,0x20(%rsp)
mov    %r8,(%rsp)
mov    %edi,0x1c(%rsp)
mov    %esi,%edx
mov    %esi,%ecx
mov    $0x6e,%r8d
mov    $0x6e,%r9d
call   1090 <generalMatrixMatrix@plt>
cmpq   $0x0,0x158(%rsp)
je     15fa <mv_vonmises_lossFunction+0x47a>
mov    0x160(%rsp),%rdi
test   %rdi,%rdi
je     15fa <mv_vonmises_lossFunction+0x47a>
lea    0x0(,%rbx,8),%ebp
mov    %ebp,%edx
imul   %ebx,%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    0x158(%rsp),%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1050 <memset@plt>
fldz
test   %ebx,%ebx
mov    0x150(%rsp),%r8
jle    1735 <mv_vonmises_lossFunction+0x5b5>
fstp   %st(0)
mov    %ebx,%r13d
mov    0x1c(%rsp),%eax
mov    %rax,0xa8(%rsp)
mov    0x20(%rsp),%rax
lea    0x10(%rax),%rcx
mov    %r13,%rdi
shl    $0x4,%rdi
lea    0x0(,%r13,8),%rbx
fldz
xor    %r11d,%r11d
fldl   0xda5(%rip)
fstpt  0x10c(%rsp)
mov    %r13,%r9
mov    %r13,%rbp
mov    0x160(%rsp),%r10
mov    %rcx,0x80(%rsp)
mov    %r13,0xb0(%rsp)
mov    %rdi,0xa0(%rsp)
mov    %rbx,0x78(%rsp)
jmp    12b0 <mv_vonmises_lossFunction+0x130>
nop
mov    0x98(%rsp),%rcx
add    $0x10,%rcx
add    $0x8,%r10
add    $0xffffffffffffffff,%rbp
add    %r13,%r9
cmp    %r13,%r11
je     1735 <mv_vonmises_lossFunction+0x5b5>
mov    %r11,%r15
cmpl   $0x0,0x1c(%rsp)
mov    %rcx,0x98(%rsp)
jle    15b0 <mv_vonmises_lossFunction+0x430>
mov    %r9,0x90(%rsp)
lea    0x1(%r15),%r11
mov    %r15,%rax
imul   %r13,%rax
mov    %r15,%rbx
and    $0xfffffffffffffffe,%rbx
lea    (%r15,%r13,1),%r14
mov    %r10,0x88(%rsp)
lea    (%r10,%rax,8),%r12
mov    %rcx,%rdx
mov    0x80(%rsp),%rsi
xor    %ecx,%ecx
mov    %r11,0xb8(%rsp)
jmp    1336 <mv_vonmises_lossFunction+0x1b6>
nopw   0x0(%rax,%rax,1)
fstp   %st(1)
fstp   %st(1)
fstp   %st(0)
mov    0xd0(%rsp),%rcx
add    $0x1,%rcx
add    %rdi,%rsi
add    %rdi,%rdx
cmp    0xa8(%rsp),%rcx
je     1590 <mv_vonmises_lossFunction+0x410>
mov    %rsi,0xd8(%rsp)
mov    %rdx,0x50(%rsp)
fstpt  0x60(%rsp)
mov    0x38(%rsp),%rax
movsd  (%rax,%r15,8),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,0xe8(%rsp)
mov    %rcx,0xd0(%rsp)
imul   %r13,%rcx
mov    %rcx,0xc0(%rsp)
lea    (%rcx,%r15,1),%r13
shl    $0x4,%r13
lea    (%r8,%r13,1),%rax
mov    %rax,0xc8(%rsp)
fldt   (%r8,%r13,1)
fmul   %st,%st(0)
faddl  0xe8(%rsp)
fstpl  0xe0(%rsp)
movsd  0xe0(%rsp),%xmm0
call   1070 <sqrtl@plt>
fldt   0x10c(%rsp)
fucomip %st(1),%st
fld    %st(0)
fstpt  0x44(%rsp)
jbe    13e0 <mv_vonmises_lossFunction+0x260>
fstpt  (%rsp)
call   10a0 <bessi0_spd_exponScaled@plt>
fstpt  0x2c(%rsp)
fldt   0x44(%rsp)
fstpt  (%rsp)
call   1080 <bessi1_spd_exponScaled@plt>
jmp    13f8 <mv_vonmises_lossFunction+0x278>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
fstpt  (%rsp)
call   1040 <bessi0_salahat_exponScaled@plt>
fstpt  0x2c(%rsp)
fldt   0x44(%rsp)
fstpt  (%rsp)
call   1060 <bessi1_salahat_exponScaled@plt>
fstpt  0x6c(%rsp)
fldt   0x2c(%rsp)
fld    %st(0)
fstpt  0x2c(%rsp)
fstpt  (%rsp)
call   1030 <logl@plt>
fldt   0x44(%rsp)
fldt   0x2c(%rsp)
fmul   %st(1),%st
fldt   0x6c(%rsp)
fdivp  %st,%st(1)
fxch   %st(1)
faddp  %st,%st(2)
mov    0x58(%rsp),%rax
fldt   (%rax,%r13,1)
mov    0x38(%rsp),%rax
fldl   (%rax,%r15,8)
fld    %st(1)
fmul   %st(1),%st
fsubrp %st,%st(4)
mov    0x20(%rsp),%rax
fldt   (%rax,%r13,1)
mov    0xc8(%rsp),%rax
fldt   (%rax)
fld    %st(1)
fmul   %st(1),%st
fsubrp %st,%st(6)
fxch   %st(2)
fmul   %st(4),%st
fsubp  %st,%st(3)
mov    0x158(%rsp),%rax
fxch   %st(2)
faddl  (%rax,%r15,8)
fldt   0x60(%rsp)
faddp  %st,%st(5)
fstpl  (%rax,%r15,8)
fxch   %st(1)
fchs
test   %r15,%r15
mov    0x150(%rsp),%r8
mov    0xb0(%rsp),%r13
mov    0xa0(%rsp),%rdi
mov    0xb8(%rsp),%r11
mov    0xd8(%rsp),%rsi
fldz
je     152f <mv_vonmises_lossFunction+0x3af>
fstp   %st(0)
fld    %st(2)
fmul   %st(2),%st
fadd   %st(1),%st
cmp    $0x1,%r15
jne    14c0 <mv_vonmises_lossFunction+0x340>
xor    %eax,%eax
jmp    14f9 <mv_vonmises_lossFunction+0x379>
nopw   0x0(%rax,%rax,1)
mov    0x160(%rsp),%rcx
mov    %rsi,%rdx
xor    %eax,%eax
nopl   (%rax)
fldt   -0x10(%rdx)
fmul   %st(1),%st
faddl  (%rcx,%r15,8)
fstpl  (%rcx,%r15,8)
fldt   (%rdx)
fmul   %st(1),%st
faddl  (%rcx,%r14,8)
fstpl  (%rcx,%r14,8)
add    $0x2,%rax
add    $0x20,%rdx
add    %rdi,%rcx
cmp    %rax,%rbx
jne    14d0 <mv_vonmises_lossFunction+0x350>
test   $0x1,%r15b
je     152f <mv_vonmises_lossFunction+0x3af>
mov    0xc0(%rsp),%rdx
add    %rax,%rdx
shl    $0x4,%rdx
mov    0x20(%rsp),%rcx
fldt   (%rcx,%rdx,1)
imul   %r13,%rax
add    %r15,%rax
fmulp  %st,%st(1)
mov    0x160(%rsp),%rcx
faddl  (%rcx,%rax,8)
fstpl  (%rcx,%rax,8)
fldz
fstp   %st(0)
cmp    %r13,%r11
mov    0x50(%rsp),%rdx
jge    1310 <mv_vonmises_lossFunction+0x190>
fxch   %st(2)
fmulp  %st,%st(1)
faddp  %st,%st(1)
mov    $0x1,%eax
mov    %rdx,%rcx
fldz
fldz
fxch   %st(1)
fxch   %st(2)
fxch   %st(1)
nopw   0x0(%rax,%rax,1)
fstp   %st(2)
fstp   %st(1)
fldt   (%rcx)
fmul   %st(1),%st
faddl  (%r12,%rax,8)
fstpl  (%r12,%rax,8)
add    $0x10,%rcx
add    $0x1,%rax
cmp    %rax,%rbp
fldz
fldz
fxch   %st(1)
fxch   %st(2)
fxch   %st(1)
jne    1560 <mv_vonmises_lossFunction+0x3e0>
jmp    1310 <mv_vonmises_lossFunction+0x190>
nopl   0x0(%rax)
mov    0x78(%rsp),%rbx
mov    0x90(%rsp),%r9
mov    0x88(%rsp),%r10
cmp    %r13,%r11
jge    1290 <mv_vonmises_lossFunction+0x110>
jmp    15bd <mv_vonmises_lossFunction+0x43d>
lea    0x1(%r15),%r11
cmp    %r13,%r11
jge    1290 <mv_vonmises_lossFunction+0x110>
mov    %r15,%rcx
imul   %r13,%rcx
add    %r9,%r15
mov    0x160(%rsp),%rax
lea    (%rax,%r15,8),%rax
lea    (%r10,%rcx,8),%rcx
mov    $0x1,%edx
nopl   0x0(%rax)
movsd  (%rcx,%rdx,8),%xmm0
movsd  %xmm0,(%rax)
add    %rbx,%rax
add    $0x1,%rdx
cmp    %rdx,%rbp
jne    15e0 <mv_vonmises_lossFunction+0x460>
jmp    1290 <mv_vonmises_lossFunction+0x110>
fldz
test   %ebx,%ebx
mov    0x150(%rsp),%rcx
jle    1735 <mv_vonmises_lossFunction+0x5b5>
fstp   %st(0)
mov    %ebx,%r15d
mov    0x1c(%rsp),%eax
mov    %rax,0x50(%rsp)
mov    %r15,%r12
shl    $0x4,%r12
fldz
xor    %r13d,%r13d
fldl   0x9d4(%rip)
fstpt  0x44(%rsp)
jmp    165d <mv_vonmises_lossFunction+0x4dd>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r13
add    $0x10,%rcx
addq   $0x10,0x58(%rsp)
addq   $0x10,0x20(%rsp)
cmp    %r15,%r13
je     1735 <mv_vonmises_lossFunction+0x5b5>
cmpl   $0x0,0x1c(%rsp)
jle    1640 <mv_vonmises_lossFunction+0x4c0>
mov    0x38(%rsp),%rax
movsd  (%rax,%r13,8),%xmm0
mov    0x50(%rsp),%rbx
xor    %ebp,%ebp
jmp    16e1 <mv_vonmises_lossFunction+0x561>
nopl   0x0(%rax,%rax,1)
fstpt  (%rsp)
call   1040 <bessi0_salahat_exponScaled@plt>
fstpt  (%rsp)
call   1030 <logl@plt>
fldt   0x2c(%rsp)
faddp  %st,%st(1)
mov    0x58(%rsp),%rax
fldt   (%rax,%rbp,1)
mov    0x38(%rsp),%rax
movsd  (%rax,%r13,8),%xmm0
movsd  %xmm0,0xf0(%rsp)
fmull  0xf0(%rsp)
fsubrp %st,%st(1)
mov    0x20(%rsp),%rax
fldt   (%rax,%rbp,1)
mov    %r14,%rcx
fldt   (%r14,%rbp,1)
fmulp  %st,%st(1)
fsubrp %st,%st(1)
fldt   0x60(%rsp)
faddp  %st,%st(1)
add    %r12,%rbp
add    $0xffffffffffffffff,%rbx
je     1640 <mv_vonmises_lossFunction+0x4c0>
fstpt  0x60(%rsp)
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x100(%rsp)
mov    %rcx,%r14
fldt   (%rcx,%rbp,1)
fmul   %st,%st(0)
faddl  0x100(%rsp)
fstpl  0xf8(%rsp)
movsd  0xf8(%rsp),%xmm0
call   1070 <sqrtl@plt>
fldt   0x44(%rsp)
fucomip %st(1),%st
fld    %st(0)
fstpt  0x2c(%rsp)
jbe    1680 <mv_vonmises_lossFunction+0x500>
fstpt  (%rsp)
call   10a0 <bessi0_spd_exponScaled@plt>
jmp    1688 <mv_vonmises_lossFunction+0x508>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define x86_fp80 @mv_vonmises_lossFunction(i32 %0, i32 %1, double* %2, double* %3, x86_fp80* %4, x86_fp80* %5, x86_fp80* %6, double* %7, double* %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
%14 = alloca x86_fp80*
%15 = alloca x86_fp80*
%16 = alloca x86_fp80*
%17 = alloca double*
%18 = alloca double*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca x86_fp80
%23 = alloca x86_fp80
%24 = alloca x86_fp80
%25 = alloca x86_fp80
%26 = alloca x86_fp80
store i32 %0, i32* %10
store i32 %1, i32* %11
store double* %2, double** %12
store double* %3, double** %13
store x86_fp80* %4, x86_fp80** %14
store x86_fp80* %5, x86_fp80** %15
store x86_fp80* %6, x86_fp80** %16
store double* %7, double** %17
store double* %8, double** %18
%27 = load i32, i32* %10
%28 = load i32, i32* %11
%29 = load i32, i32* %11
%30 = load i32, i32* %11
%31 = load x86_fp80*, x86_fp80** %14
%32 = load double*, double** %13
%33 = load x86_fp80*, x86_fp80** %16
%34 = call i32 @generalMatrixMatrix(i32 %27, i32 %28, i32 %29, i32 %30, i8 signext 110, i8 signext 110, x86_fp80* %31, double* %32, x86_fp80* %33)
store x86_fp80 0xK00000000000000000000, x86_fp80* %22
%35 = load double*, double** %18
%36 = icmp ne double* %35, null
br i1 %36, label %37, label %332
37: ; preds = %9
%38 = load double*, double** %17
%39 = icmp ne double* %38, null
br i1 %39, label %40, label %332
40: ; preds = %37
%41 = load double*, double** %18
%42 = load i32, i32* %11
%43 = sext i32 %42 to i64
%44 = mul i64 8, %43
%45 = load i32, i32* %11
%46 = sext i32 %45 to i64
%47 = mul i64 %44, %46
%48 = trunc i64 %47 to i32
%49 = call i32 @memset(double* %41, i32 0, i32 %48)
%50 = load double*, double** %17
%51 = load i32, i32* %11
%52 = sext i32 %51 to i64
%53 = mul i64 8, %52
%54 = trunc i64 %53 to i32
%55 = call i32 @memset(double* %50, i32 0, i32 %54)
store i32 0, i32* %20
br label %56
56: ; preds = %328, %40
%57 = load i32, i32* %20
%58 = load i32, i32* %11
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %331
60: ; preds = %56
store i32 0, i32* %19
br label %61
61: ; preds = %296, %60
%62 = load i32, i32* %19
%63 = load i32, i32* %10
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %299
65: ; preds = %61
%66 = load double*, double** %12
%67 = load i32, i32* %20
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
%70 = load double, double* %69
%71 = load double*, double** %12
%72 = load i32, i32* %20
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %71, i64 %73
%75 = load double, double* %74
%76 = fmul double %70, %75
%77 = fpext double %76 to x86_fp80
%78 = load x86_fp80*, x86_fp80** %16
%79 = load i32, i32* %19
%80 = load i32, i32* %11
%81 = mul nsw i32 %79, %80
%82 = load i32, i32* %20
%83 = add nsw i32 %81, %82
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds x86_fp80, x86_fp80* %78, i64 %84
%86 = load x86_fp80, x86_fp80* %85
%87 = load x86_fp80*, x86_fp80** %16
%88 = load i32, i32* %19
%89 = load i32, i32* %11
%90 = mul nsw i32 %88, %89
%91 = load i32, i32* %20
%92 = add nsw i32 %90, %91
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds x86_fp80, x86_fp80* %87, i64 %93
%95 = load x86_fp80, x86_fp80* %94
%96 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %86, x86_fp80 %95, x86_fp80 %77)
%97 = fptrunc x86_fp80 %96 to double
%98 = call x86_fp80 @sqrtl(double %97)
store x86_fp80 %98, x86_fp80* %23
%99 = load x86_fp80, x86_fp80* %23
%100 = fcmp olt x86_fp80 %99, 0xK4065FC6F7C4045812000
br i1 %100, label %101, label %104
101: ; preds = %65
%102 = load x86_fp80, x86_fp80* %23
%103 = call x86_fp80 @bessi0_spd_exponScaled(x86_fp80 %102)
br label %107
104: ; preds = %65
%105 = load x86_fp80, x86_fp80* %23
%106 = call x86_fp80 @bessi0_salahat_exponScaled(x86_fp80 %105)
br label %107
107: ; preds = %104, %101
%108 = phi x86_fp80 [ %103, %101 ], [ %106, %104 ]
store x86_fp80 %108, x86_fp80* %24
%109 = load x86_fp80, x86_fp80* %23
%110 = fcmp olt x86_fp80 %109, 0xK4065FC6F7C4045812000
br i1 %110, label %111, label %114
111: ; preds = %107
%112 = load x86_fp80, x86_fp80* %23
%113 = call x86_fp80 @bessi1_spd_exponScaled(x86_fp80 %112)
br label %117
114: ; preds = %107
%115 = load x86_fp80, x86_fp80* %23
%116 = call x86_fp80 @bessi1_salahat_exponScaled(x86_fp80 %115)
br label %117
117: ; preds = %114, %111
%118 = phi x86_fp80 [ %113, %111 ], [ %116, %114 ]
%119 = load x86_fp80, x86_fp80* %24
%120 = load x86_fp80, x86_fp80* %23
%121 = fmul x86_fp80 %119, %120
%122 = fdiv x86_fp80 %118, %121
store x86_fp80 %122, x86_fp80* %26
%123 = load x86_fp80, x86_fp80* %23
%124 = load x86_fp80, x86_fp80* %24
%125 = call x86_fp80 @logl(x86_fp80 %124)
%126 = fadd x86_fp80 %123, %125
%127 = load x86_fp80*, x86_fp80** %15
%128 = load i32, i32* %19
%129 = load i32, i32* %11
%130 = mul nsw i32 %128, %129
%131 = load i32, i32* %20
%132 = add nsw i32 %130, %131
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds x86_fp80, x86_fp80* %127, i64 %133
%135 = load x86_fp80, x86_fp80* %134
%136 = load double*, double** %12
%137 = load i32, i32* %20
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %136, i64 %138
%140 = load double, double* %139
%141 = fpext double %140 to x86_fp80
%142 = fneg x86_fp80 %135
%143 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %142, x86_fp80 %141, x86_fp80 %126)
%144 = load x86_fp80*, x86_fp80** %14
%145 = load i32, i32* %19
%146 = load i32, i32* %11
%147 = mul nsw i32 %145, %146
%148 = load i32, i32* %20
%149 = add nsw i32 %147, %148
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds x86_fp80, x86_fp80* %144, i64 %150
%152 = load x86_fp80, x86_fp80* %151
%153 = load x86_fp80*, x86_fp80** %16
%154 = load i32, i32* %19
%155 = load i32, i32* %11
%156 = mul nsw i32 %154, %155
%157 = load i32, i32* %20
%158 = add nsw i32 %156, %157
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds x86_fp80, x86_fp80* %153, i64 %159
%161 = load x86_fp80, x86_fp80* %160
%162 = fneg x86_fp80 %152
%163 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %162, x86_fp80 %161, x86_fp80 %143)
%164 = load x86_fp80, x86_fp80* %22
%165 = fadd x86_fp80 %164, %163
store x86_fp80 %165, x86_fp80* %22
%166 = load x86_fp80, x86_fp80* %26
%167 = load double*, double** %12
%168 = load i32, i32* %20
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds double, double* %167, i64 %169
%171 = load double, double* %170
%172 = fpext double %171 to x86_fp80
%173 = load x86_fp80*, x86_fp80** %15
%174 = load i32, i32* %19
%175 = load i32, i32* %11
%176 = mul nsw i32 %174, %175
%177 = load i32, i32* %20
%178 = add nsw i32 %176, %177
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds x86_fp80, x86_fp80* %173, i64 %179
%181 = load x86_fp80, x86_fp80* %180
%182 = fneg x86_fp80 %181
%183 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %166, x86_fp80 %172, x86_fp80 %182)
%184 = load double*, double** %17
%185 = load i32, i32* %20
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds double, double* %184, i64 %186
%188 = load double, double* %187
%189 = fpext double %188 to x86_fp80
%190 = fadd x86_fp80 %189, %183
%191 = fptrunc x86_fp80 %190 to double
store double %191, double* %187
store i32 0, i32* %21
br label %192
192: ; preds = %239, %117
%193 = load i32, i32* %21
%194 = load i32, i32* %20
%195 = icmp slt i32 %193, %194
br i1 %195, label %196, label %242
196: ; preds = %192
%197 = load x86_fp80*, x86_fp80** %14
%198 = load i32, i32* %19
%199 = load i32, i32* %11
%200 = mul nsw i32 %198, %199
%201 = load i32, i32* %21
%202 = add nsw i32 %200, %201
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds x86_fp80, x86_fp80* %197, i64 %203
%205 = load x86_fp80, x86_fp80* %204
%206 = load x86_fp80, x86_fp80* %26
%207 = load x86_fp80*, x86_fp80** %16
%208 = load i32, i32* %19
%209 = load i32, i32* %11
%210 = mul nsw i32 %208, %209
%211 = load i32, i32* %20
%212 = add nsw i32 %210, %211
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds x86_fp80, x86_fp80* %207, i64 %213
%215 = load x86_fp80, x86_fp80* %214
%216 = load x86_fp80*, x86_fp80** %14
%217 = load i32, i32* %19
%218 = load i32, i32* %11
%219 = mul nsw i32 %217, %218
%220 = load i32, i32* %20
%221 = add nsw i32 %219, %220
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds x86_fp80, x86_fp80* %216, i64 %222
%224 = load x86_fp80, x86_fp80* %223
%225 = fneg x86_fp80 %224
%226 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %206, x86_fp80 %215, x86_fp80 %225)
%227 = load double*, double** %18
%228 = load i32, i32* %21
%229 = load i32, i32* %11
%230 = mul nsw i32 %228, %229
%231 = load i32, i32* %20
%232 = add nsw i32 %230, %231
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds double, double* %227, i64 %233
%235 = load double, double* %234
%236 = fpext double %235 to x86_fp80
%237 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %205, x86_fp80 %226, x86_fp80 %236)
%238 = fptrunc x86_fp80 %237 to double
store double %238, double* %234
br label %239
239: ; preds = %196
%240 = load i32, i32* %21
%241 = add nsw i32 %240, 1
store i32 %241, i32* %21
br label %192
242: ; preds = %192
%243 = load i32, i32* %20
%244 = add nsw i32 %243, 1
store i32 %244, i32* %21
br label %245
245: ; preds = %292, %242
%246 = load i32, i32* %21
%247 = load i32, i32* %11
%248 = icmp slt i32 %246, %247
br i1 %248, label %249, label %295
249: ; preds = %245
%250 = load x86_fp80*, x86_fp80** %14
%251 = load i32, i32* %19
%252 = load i32, i32* %11
%253 = mul nsw i32 %251, %252
%254 = load i32, i32* %21
%255 = add nsw i32 %253, %254
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds x86_fp80, x86_fp80* %250, i64 %256
%258 = load x86_fp80, x86_fp80* %257
%259 = load x86_fp80, x86_fp80* %26
%260 = load x86_fp80*, x86_fp80** %16
%261 = load i32, i32* %19
%262 = load i32, i32* %11
%263 = mul nsw i32 %261, %262
%264 = load i32, i32* %20
%265 = add nsw i32 %263, %264
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds x86_fp80, x86_fp80* %260, i64 %266
%268 = load x86_fp80, x86_fp80* %267
%269 = load x86_fp80*, x86_fp80** %14
%270 = load i32, i32* %19
%271 = load i32, i32* %11
%272 = mul nsw i32 %270, %271
%273 = load i32, i32* %20
%274 = add nsw i32 %272, %273
%275 = sext i32 %274 to i64
%276 = getelementptr inbounds x86_fp80, x86_fp80* %269, i64 %275
%277 = load x86_fp80, x86_fp80* %276
%278 = fneg x86_fp80 %277
%279 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %259, x86_fp80 %268, x86_fp80 %278)
%280 = load double*, double** %18
%281 = load i32, i32* %20
%282 = load i32, i32* %11
%283 = mul nsw i32 %281, %282
%284 = load i32, i32* %21
%285 = add nsw i32 %283, %284
%286 = sext i32 %285 to i64
%287 = getelementptr inbounds double, double* %280, i64 %286
%288 = load double, double* %287
%289 = fpext double %288 to x86_fp80
%290 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %258, x86_fp80 %279, x86_fp80 %289)
%291 = fptrunc x86_fp80 %290 to double
store double %291, double* %287
br label %292
292: ; preds = %249
%293 = load i32, i32* %21
%294 = add nsw i32 %293, 1
store i32 %294, i32* %21
br label %245
295: ; preds = %245
br label %296
296: ; preds = %295
%297 = load i32, i32* %19
%298 = add nsw i32 %297, 1
store i32 %298, i32* %19
br label %61
299: ; preds = %61
%300 = load i32, i32* %20
%301 = add nsw i32 %300, 1
store i32 %301, i32* %21
br label %302
302: ; preds = %324, %299
%303 = load i32, i32* %21
%304 = load i32, i32* %11
%305 = icmp slt i32 %303, %304
br i1 %305, label %306, label %327
306: ; preds = %302
%307 = load double*, double** %18
%308 = load i32, i32* %20
%309 = load i32, i32* %11
%310 = mul nsw i32 %308, %309
%311 = load i32, i32* %21
%312 = add nsw i32 %310, %311
%313 = sext i32 %312 to i64
%314 = getelementptr inbounds double, double* %307, i64 %313
%315 = load double, double* %314
%316 = load double*, double** %18
%317 = load i32, i32* %21
%318 = load i32, i32* %11
%319 = mul nsw i32 %317, %318
%320 = load i32, i32* %20
%321 = add nsw i32 %319, %320
%322 = sext i32 %321 to i64
%323 = getelementptr inbounds double, double* %316, i64 %322
store double %315, double* %323
br label %324
324: ; preds = %306
%325 = load i32, i32* %21
%326 = add nsw i32 %325, 1
store i32 %326, i32* %21
br label %302
327: ; preds = %302
br label %328
328: ; preds = %327
%329 = load i32, i32* %20
%330 = add nsw i32 %329, 1
store i32 %330, i32* %20
br label %56
331: ; preds = %56
br label %437
332: ; preds = %37, %9
store i32 0, i32* %20
br label %333
333: ; preds = %433, %332
%334 = load i32, i32* %20
%335 = load i32, i32* %11
%336 = icmp slt i32 %334, %335
br i1 %336, label %337, label %436
337: ; preds = %333
store i32 0, i32* %19
br label %338
338: ; preds = %429, %337
%339 = load i32, i32* %19
%340 = load i32, i32* %10
%341 = icmp slt i32 %339, %340
br i1 %341, label %342, label %432
342: ; preds = %338
%343 = load double*, double** %12
%344 = load i32, i32* %20
%345 = sext i32 %344 to i64
%346 = getelementptr inbounds double, double* %343, i64 %345
%347 = load double, double* %346
%348 = load double*, double** %12
%349 = load i32, i32* %20
%350 = sext i32 %349 to i64
%351 = getelementptr inbounds double, double* %348, i64 %350
%352 = load double, double* %351
%353 = fmul double %347, %352
%354 = fpext double %353 to x86_fp80
%355 = load x86_fp80*, x86_fp80** %16
%356 = load i32, i32* %19
%357 = load i32, i32* %11
%358 = mul nsw i32 %356, %357
%359 = load i32, i32* %20
%360 = add nsw i32 %358, %359
%361 = sext i32 %360 to i64
%362 = getelementptr inbounds x86_fp80, x86_fp80* %355, i64 %361
%363 = load x86_fp80, x86_fp80* %362
%364 = load x86_fp80*, x86_fp80** %16
%365 = load i32, i32* %19
%366 = load i32, i32* %11
%367 = mul nsw i32 %365, %366
%368 = load i32, i32* %20
%369 = add nsw i32 %367, %368
%370 = sext i32 %369 to i64
%371 = getelementptr inbounds x86_fp80, x86_fp80* %364, i64 %370
%372 = load x86_fp80, x86_fp80* %371
%373 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %363, x86_fp80 %372, x86_fp80 %354)
%374 = fptrunc x86_fp80 %373 to double
%375 = call x86_fp80 @sqrtl(double %374)
store x86_fp80 %375, x86_fp80* %23
%376 = load x86_fp80, x86_fp80* %23
%377 = fcmp olt x86_fp80 %376, 0xK4065FC6F7C4045812000
br i1 %377, label %378, label %381
378: ; preds = %342
%379 = load x86_fp80, x86_fp80* %23
%380 = call x86_fp80 @bessi0_spd_exponScaled(x86_fp80 %379)
br label %384
381: ; preds = %342
%382 = load x86_fp80, x86_fp80* %23
%383 = call x86_fp80 @bessi0_salahat_exponScaled(x86_fp80 %382)
br label %384
384: ; preds = %381, %378
%385 = phi x86_fp80 [ %380, %378 ], [ %383, %381 ]
store x86_fp80 %385, x86_fp80* %24
%386 = load x86_fp80, x86_fp80* %23
%387 = load x86_fp80, x86_fp80* %24
%388 = call x86_fp80 @logl(x86_fp80 %387)
%389 = fadd x86_fp80 %386, %388
%390 = load x86_fp80*, x86_fp80** %15
%391 = load i32, i32* %19
%392 = load i32, i32* %11
%393 = mul nsw i32 %391, %392
%394 = load i32, i32* %20
%395 = add nsw i32 %393, %394
%396 = sext i32 %395 to i64
%397 = getelementptr inbounds x86_fp80, x86_fp80* %390, i64 %396
%398 = load x86_fp80, x86_fp80* %397
%399 = load double*, double** %12
%400 = load i32, i32* %20
%401 = sext i32 %400 to i64
%402 = getelementptr inbounds double, double* %399, i64 %401
%403 = load double, double* %402
%404 = fpext double %403 to x86_fp80
%405 = fneg x86_fp80 %398
%406 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %405, x86_fp80 %404, x86_fp80 %389)
%407 = load x86_fp80*, x86_fp80** %14
%408 = load i32, i32* %19
%409 = load i32, i32* %11
%410 = mul nsw i32 %408, %409
%411 = load i32, i32* %20
%412 = add nsw i32 %410, %411
%413 = sext i32 %412 to i64
%414 = getelementptr inbounds x86_fp80, x86_fp80* %407, i64 %413
%415 = load x86_fp80, x86_fp80* %414
%416 = load x86_fp80*, x86_fp80** %16
%417 = load i32, i32* %19
%418 = load i32, i32* %11
%419 = mul nsw i32 %417, %418
%420 = load i32, i32* %20
%421 = add nsw i32 %419, %420
%422 = sext i32 %421 to i64
%423 = getelementptr inbounds x86_fp80, x86_fp80* %416, i64 %422
%424 = load x86_fp80, x86_fp80* %423
%425 = fneg x86_fp80 %415
%426 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %425, x86_fp80 %424, x86_fp80 %406)
%427 = load x86_fp80, x86_fp80* %22
%428 = fadd x86_fp80 %427, %426
store x86_fp80 %428, x86_fp80* %22
br label %429
429: ; preds = %384
%430 = load i32, i32* %19
%431 = add nsw i32 %430, 1
store i32 %431, i32* %19
br label %338
432: ; preds = %338
br label %433
433: ; preds = %432
%434 = load i32, i32* %20
%435 = add nsw i32 %434, 1
store i32 %435, i32* %20
br label %333
436: ; preds = %333
br label %437
437: ; preds = %436, %331
%438 = load x86_fp80, x86_fp80* %22
ret x86_fp80 %438
}

LLVM IR (-O2):
define x86_fp80 @mv_vonmises_lossFunction(i32 %0, i32 %1, double* nocapture %2, double* %3, x86_fp80* %4, x86_fp80* nocapture %5, x86_fp80* %6, double* %7, double* %8) {
%10 = tail call i32 @generalMatrixMatrix(i32 %0, i32 %1, i32 %1, i32 %1, i8 signext 110, i8 signext 110, x86_fp80* %4, double* %3, x86_fp80* %6)
%11 = icmp ne double* %8, null
%12 = icmp ne double* %7, null
%13 = and i1 %12, %11
br i1 %13, label %21, label %14
14: ; preds = %9
%15 = icmp sgt i32 %1, 0
br i1 %15, label %16, label %219
16: ; preds = %14
%17 = icmp sgt i32 %0, 0
%18 = zext i32 %1 to i64
%19 = zext i32 %1 to i64
%20 = zext i32 %0 to i64
br label %173
21: ; preds = %9
%22 = shl i32 %1, 3
%23 = mul i32 %22, %1
%24 = tail call i32 @memset(double* %8, i32 0, i32 %23)
%25 = tail call i32 @memset(double* %7, i32 0, i32 %22)
%26 = icmp sgt i32 %1, 0
br i1 %26, label %27, label %219
27: ; preds = %21
%28 = icmp sgt i32 %0, 0
%29 = zext i32 %1 to i64
%30 = zext i32 %1 to i64
%31 = zext i32 %0 to i64
br label %35
32: ; preds = %163, %157
%33 = add nuw nsw i64 %37, 1
%34 = icmp eq i64 %158, %30
br i1 %34, label %219, label %35
35: ; preds = %27, %32
%36 = phi i64 [ 0, %27 ], [ %158, %32 ]
%37 = phi i64 [ 1, %27 ], [ %33, %32 ]
%38 = phi x86_fp80 [ 0xK00000000000000000000, %27 ], [ %159, %32 ]
br i1 %28, label %41, label %39
39: ; preds = %35
%40 = add nuw nsw i64 %36, 1
br label %157
41: ; preds = %35
%42 = getelementptr inbounds double, double* %2, i64 %36
%43 = getelementptr inbounds double, double* %7, i64 %36
%44 = icmp eq i64 %36, 0
%45 = add nuw nsw i64 %36, 1
%46 = icmp slt i64 %45, %29
%47 = mul nsw i64 %36, %29
%48 = and i64 %36, 1
%49 = icmp eq i64 %36, 1
%50 = and i64 %36, -2
%51 = icmp eq i64 %48, 0
br label %52
52: ; preds = %41, %154
%53 = phi i64 [ 0, %41 ], [ %155, %154 ]
%54 = phi x86_fp80 [ %38, %41 ], [ %90, %154 ]
%55 = load double, double* %42
%56 = fmul double %55, %55
%57 = fpext double %56 to x86_fp80
%58 = mul nsw i64 %53, %29
%59 = add nsw i64 %58, %36
%60 = getelementptr inbounds x86_fp80, x86_fp80* %6, i64 %59
%61 = load x86_fp80, x86_fp80* %60
%62 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %61, x86_fp80 %61, x86_fp80 %57)
%63 = fptrunc x86_fp80 %62 to double
%64 = tail call x86_fp80 @sqrtl(double %63)
%65 = fcmp olt x86_fp80 %64, 0xK4065FC6F7C4045812000
br i1 %65, label %66, label %69
66: ; preds = %52
%67 = tail call x86_fp80 @bessi0_spd_exponScaled(x86_fp80 %64)
%68 = tail call x86_fp80 @bessi1_spd_exponScaled(x86_fp80 %64)
br label %72
69: ; preds = %52
%70 = tail call x86_fp80 @bessi0_salahat_exponScaled(x86_fp80 %64)
%71 = tail call x86_fp80 @bessi1_salahat_exponScaled(x86_fp80 %64)
br label %72
72: ; preds = %69, %66
%73 = phi x86_fp80 [ %67, %66 ], [ %70, %69 ]
%74 = phi x86_fp80 [ %68, %66 ], [ %71, %69 ]
%75 = fmul x86_fp80 %64, %73
%76 = fdiv x86_fp80 %74, %75
%77 = tail call x86_fp80 @logl(x86_fp80 %73)
%78 = fadd x86_fp80 %64, %77
%79 = getelementptr inbounds x86_fp80, x86_fp80* %5, i64 %59
%80 = load x86_fp80, x86_fp80* %79
%81 = load double, double* %42
%82 = fpext double %81 to x86_fp80
%83 = fneg x86_fp80 %80
%84 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %83, x86_fp80 %82, x86_fp80 %78)
%85 = getelementptr inbounds x86_fp80, x86_fp80* %4, i64 %59
%86 = load x86_fp80, x86_fp80* %85
%87 = load x86_fp80, x86_fp80* %60
%88 = fneg x86_fp80 %86
%89 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %88, x86_fp80 %87, x86_fp80 %84)
%90 = fadd x86_fp80 %54, %89
%91 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %76, x86_fp80 %82, x86_fp80 %83)
%92 = load double, double* %43
%93 = fpext double %92 to x86_fp80
%94 = fadd x86_fp80 %91, %93
%95 = fptrunc x86_fp80 %94 to double
store double %95, double* %43
br i1 %44, label %111, label %96
96: ; preds = %72
%97 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %76, x86_fp80 %87, x86_fp80 %88)
br i1 %49, label %98, label %114
98: ; preds = %114, %96
%99 = phi i64 [ 0, %96 ], [ %138, %114 ]
br i1 %51, label %111, label %100
100: ; preds = %98
%101 = add nuw nsw i64 %99, %58
%102 = getelementptr inbounds x86_fp80, x86_fp80* %4, i64 %101
%103 = load x86_fp80, x86_fp80* %102
%104 = mul nsw i64 %99, %29
%105 = add nsw i64 %104, %36
%106 = getelementptr inbounds double, double* %8, i64 %105
%107 = load double, double* %106
%108 = fpext double %107 to x86_fp80
%109 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %103, x86_fp80 %97, x86_fp80 %108)
%110 = fptrunc x86_fp80 %109 to double
store double %110, double* %106
br label %111
111: ; preds = %100, %98, %72
br i1 %46, label %112, label %154
112: ; preds = %111
%113 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %76, x86_fp80 %87, x86_fp80 %88)
br label %141
114: ; preds = %96, %114
%115 = phi i64 [ %138, %114 ], [ 0, %96 ]
%116 = phi i64 [ %139, %114 ], [ 0, %96 ]
%117 = add nuw nsw i64 %115, %58
%118 = getelementptr inbounds x86_fp80, x86_fp80* %4, i64 %117
%119 = load x86_fp80, x86_fp80* %118
%120 = mul nsw i64 %115, %29
%121 = add nsw i64 %120, %36
%122 = getelementptr inbounds double, double* %8, i64 %121
%123 = load double, double* %122
%124 = fpext double %123 to x86_fp80
%125 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %119, x86_fp80 %97, x86_fp80 %124)
%126 = fptrunc x86_fp80 %125 to double
store double %126, double* %122
%127 = or i64 %115, 1
%128 = add nuw nsw i64 %127, %58
%129 = getelementptr inbounds x86_fp80, x86_fp80* %4, i64 %128
%130 = load x86_fp80, x86_fp80* %129
%131 = mul nsw i64 %127, %29
%132 = add nsw i64 %131, %36
%133 = getelementptr inbounds double, double* %8, i64 %132
%134 = load double, double* %133
%135 = fpext double %134 to x86_fp80
%136 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %130, x86_fp80 %97, x86_fp80 %135)
%137 = fptrunc x86_fp80 %136 to double
store double %137, double* %133
%138 = add nuw nsw i64 %115, 2
%139 = add i64 %116, 2
%140 = icmp eq i64 %139, %50
br i1 %140, label %98, label %114
141: ; preds = %112, %141
%142 = phi i64 [ %37, %112 ], [ %152, %141 ]
%143 = add nuw nsw i64 %142, %58
%144 = getelementptr inbounds x86_fp80, x86_fp80* %4, i64 %143
%145 = load x86_fp80, x86_fp80* %144
%146 = add nsw i64 %142, %47
%147 = getelementptr inbounds double, double* %8, i64 %146
%148 = load double, double* %147
%149 = fpext double %148 to x86_fp80
%150 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %145, x86_fp80 %113, x86_fp80 %149)
%151 = fptrunc x86_fp80 %150 to double
store double %151, double* %147
%152 = add nuw nsw i64 %142, 1
%153 = icmp eq i64 %152, %30
br i1 %153, label %154, label %141
154: ; preds = %141, %111
%155 = add nuw nsw i64 %53, 1
%156 = icmp eq i64 %155, %31
br i1 %156, label %157, label %52
157: ; preds = %154, %39
%158 = phi i64 [ %40, %39 ], [ %45, %154 ]
%159 = phi x86_fp80 [ %38, %39 ], [ %90, %154 ]
%160 = icmp slt i64 %158, %29
br i1 %160, label %161, label %32
161: ; preds = %157
%162 = mul nsw i64 %36, %29
br label %163
163: ; preds = %161, %163
%164 = phi i64 [ %37, %161 ], [ %171, %163 ]
%165 = add nsw i64 %164, %162
%166 = getelementptr inbounds double, double* %8, i64 %165
%167 = load double, double* %166
%168 = mul nsw i64 %164, %29
%169 = add nsw i64 %168, %36
%170 = getelementptr inbounds double, double* %8, i64 %169
store double %167, double* %170
%171 = add nuw nsw i64 %164, 1
%172 = icmp eq i64 %171, %30
br i1 %172, label %32, label %163
173: ; preds = %16, %215
%174 = phi i64 [ 0, %16 ], [ %217, %215 ]
%175 = phi x86_fp80 [ 0xK00000000000000000000, %16 ], [ %216, %215 ]
br i1 %17, label %176, label %215
176: ; preds = %173
%177 = getelementptr inbounds double, double* %2, i64 %174
%178 = load double, double* %177
br label %179
179: ; preds = %176, %197
%180 = phi double [ %178, %176 ], [ %203, %197 ]
%181 = phi i64 [ 0, %176 ], [ %213, %197 ]
%182 = phi x86_fp80 [ %175, %176 ], [ %212, %197 ]
%183 = fmul double %180, %180
%184 = fpext double %183 to x86_fp80
%185 = mul nsw i64 %181, %18
%186 = add nuw nsw i64 %185, %174
%187 = getelementptr inbounds x86_fp80, x86_fp80* %6, i64 %186
%188 = load x86_fp80, x86_fp80* %187
%189 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %188, x86_fp80 %188, x86_fp80 %184)
%190 = fptrunc x86_fp80 %189 to double
%191 = tail call x86_fp80 @sqrtl(double %190)
%192 = fcmp olt x86_fp80 %191, 0xK4065FC6F7C4045812000
br i1 %192, label %193, label %195
193: ; preds = %179
%194 = tail call x86_fp80 @bessi0_spd_exponScaled(x86_fp80 %191)
br label %197
195: ; preds = %179
%196 = tail call x86_fp80 @bessi0_salahat_exponScaled(x86_fp80 %191)
br label %197
197: ; preds = %195, %193
%198 = phi x86_fp80 [ %194, %193 ], [ %196, %195 ]
%199 = tail call x86_fp80 @logl(x86_fp80 %198)
%200 = fadd x86_fp80 %191, %199
%201 = getelementptr inbounds x86_fp80, x86_fp80* %5, i64 %186
%202 = load x86_fp80, x86_fp80* %201
%203 = load double, double* %177
%204 = fpext double %203 to x86_fp80
%205 = fneg x86_fp80 %202
%206 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %205, x86_fp80 %204, x86_fp80 %200)
%207 = getelementptr inbounds x86_fp80, x86_fp80* %4, i64 %186
%208 = load x86_fp80, x86_fp80* %207
%209 = load x86_fp80, x86_fp80* %187
%210 = fneg x86_fp80 %208
%211 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %210, x86_fp80 %209, x86_fp80 %206)
%212 = fadd x86_fp80 %182, %211
%213 = add nuw nsw i64 %181, 1
%214 = icmp eq i64 %213, %20
br i1 %214, label %215, label %179
215: ; preds = %197, %173
%216 = phi x86_fp80 [ %175, %173 ], [ %212, %197 ]
%217 = add nuw nsw i64 %174, 1
%218 = icmp eq i64 %217, %19
br i1 %218, label %219, label %173
219: ; preds = %215, %32, %14, %21
%220 = phi x86_fp80 [ 0xK00000000000000000000, %21 ], [ 0xK00000000000000000000, %14 ], [ %159, %32 ], [ %216, %215 ]
ret x86_fp80 %220
}