#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 */
int /*<<< orphan*/ BasisFuns(int, double, int, double *, double *, double *,
                             double *);
int FindSpan(int, int, double, double *);
void findNURBSbasisFunV(int ii, int iters, double *us, double oldFunVal,
                        double stepV, int degV, double *cp, int fourncp,
                        int kcp, double *knotV, double *leftV, double *rightV,
                        double *NV, int ind) {
  int itr, i, spanV, ind2, myint, cpInd;
  double wgh, v, funVal;
  cpInd = ii * fourncp + ind;
  for (itr = 0; itr < iters; itr++) {
    v = us[1] - stepV;
    spanV = FindSpan(kcp, degV, v, knotV);
    BasisFuns(spanV, v, degV, knotV, NV, leftV, rightV);
    ind2 = spanV - degV;
    myint = ind2 * fourncp + ind;
    wgh = 0.0;
    for (i = 0; i <= degV; i++) {
      wgh += NV[i] * cp[i * fourncp + myint];
    }
    funVal = NV[ii - ind2] * cp[cpInd] / wgh;
    if (funVal > oldFunVal) {
      us[1] = v;
      oldFunVal = funVal;
    } else {
      v += 2 * stepV;
      spanV = FindSpan(kcp, degV, v, knotV);
      BasisFuns(spanV, v, degV, knotV, NV, leftV, rightV);
      ind2 = spanV - degV;
      myint = ind2 * fourncp + ind;
      wgh = 0.0;
      for (i = 0; i <= degV; i++) {
        wgh += NV[i] * cp[i * fourncp + myint];
      }
      funVal = NV[ii - ind2] * cp[cpInd] / wgh;
      if (funVal > oldFunVal) {
        us[1] = v;
        oldFunVal = funVal;
      }
    }
    stepV = 0.5 * stepV;
  }
  if (us[1] < knotV[0]) {
    us[1] = knotV[0];
  } else if (us[1] > knotV[kcp]) {
    us[1] = knotV[kcp];
  }
  return;
}


x86 assembly (clang, -O0):
<findNURBSbasisFunV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x34(%rbp),%eax
add    0x38(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13c9 <findNURBSbasisFunV+0x2a9>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    0x10(%rbp),%edi
mov    -0x24(%rbp),%esi
movsd  -0x60(%rbp),%xmm0
mov    0x18(%rbp),%rdx
call   1040 <FindSpan@plt>
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%edi
movsd  -0x60(%rbp),%xmm0
mov    -0x24(%rbp),%esi
mov    0x18(%rbp),%rdx
mov    0x30(%rbp),%rcx
mov    0x20(%rbp),%r8
mov    0x28(%rbp),%r9
call   1030 <BasisFuns@plt>
mov    -0x40(%rbp),%eax
sub    -0x24(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
imul   -0x34(%rbp),%eax
add    0x38(%rbp),%eax
mov    %eax,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     123b <findNURBSbasisFunV+0x11b>
mov    0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x48(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11ec <findNURBSbasisFunV+0xcc>
mov    0x30(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x44(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1291 <findNURBSbasisFunV+0x171>
movsd  -0x60(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    13a9 <findNURBSbasisFunV+0x289>
movsd  -0x20(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    0x10(%rbp),%edi
mov    -0x24(%rbp),%esi
movsd  -0x60(%rbp),%xmm0
mov    0x18(%rbp),%rdx
call   1040 <FindSpan@plt>
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%edi
movsd  -0x60(%rbp),%xmm0
mov    -0x24(%rbp),%esi
mov    0x18(%rbp),%rdx
mov    0x30(%rbp),%rcx
mov    0x20(%rbp),%r8
mov    0x28(%rbp),%r9
call   1030 <BasisFuns@plt>
mov    -0x40(%rbp),%eax
sub    -0x24(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
imul   -0x34(%rbp),%eax
add    0x38(%rbp),%eax
mov    %eax,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     1353 <findNURBSbasisFunV+0x233>
mov    0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x48(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1304 <findNURBSbasisFunV+0x1e4>
mov    0x30(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x44(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    13a4 <findNURBSbasisFunV+0x284>
movsd  -0x60(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    13a9 <findNURBSbasisFunV+0x289>
movsd  0xc4f(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1171 <findNURBSbasisFunV+0x51>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    13fa <findNURBSbasisFunV+0x2da>
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
jmp    1431 <findNURBSbasisFunV+0x311>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    0x18(%rbp),%rax
movslq 0x10(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    142c <findNURBSbasisFunV+0x30c>
mov    0x18(%rbp),%rax
movslq 0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
jmp    1431 <findNURBSbasisFunV+0x311>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findNURBSbasisFunV>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,0x20(%rsp)
mov    %rcx,0x38(%rsp)
mov    %edi,0xc(%rsp)
mov    %esi,0x44(%rsp)
test   %esi,%esi
jle    14fe <findNURBSbasisFunV+0x3de>
mov    %r8,%rbp
mov    0xd0(%rsp),%r14
mov    0x20(%rsp),%rcx
mov    %ecx,%eax
imul   0xc(%rsp),%eax
add    0xd8(%rsp),%eax
cltq
mov    %rax,0x68(%rsp)
mov    0x38(%rsp),%rax
lea    0x1(%rax),%edi
lea    -0x1(%rdi),%rsi
mov    %rsi,0x58(%rsp)
mov    %rdi,0x60(%rsp)
mov    %edi,%esi
and    $0xfffffffe,%esi
mov    $0x1,%edi
sub    %eax,%edi
mov    %rdi,0x48(%rsp)
lea    (%rcx,%rcx,1),%r15d
neg    %eax
mov    %eax,0x34(%rsp)
xor    %eax,%eax
mov    %rdx,0x28(%rsp)
mov    %rsi,0x50(%rsp)
jmp    11d7 <findNURBSbasisFunV+0xb7>
nopl   0x0(%rax)
movapd %xmm5,%xmm3
mov    0x70(%rsp),%rax
movsd  %xmm3,0x8(%rdx)
movapd %xmm2,%xmm0
mulsd  0xe36(%rip),%xmm1
add    $0x1,%eax
cmp    0x44(%rsp),%eax
je     14fe <findNURBSbasisFunV+0x3de>
mov    %rax,0x70(%rsp)
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rdx),%xmm0
movsd  %xmm1,0x18(%rsp)
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
mov    0xb0(%rsp),%edi
mov    0x38(%rsp),%r13
mov    %r13d,%esi
mov    0xb8(%rsp),%rbx
mov    %rbx,%rdx
call   1040 <FindSpan@plt>
mov    %eax,%r12d
mov    %eax,%edi
movsd  (%rsp),%xmm0
mov    %r13d,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    0xc0(%rsp),%r8
mov    0xc8(%rsp),%r9
call   1030 <BasisFuns@plt>
mov    %r12d,%eax
sub    %r13d,%eax
test   %r13d,%r13d
js     12f0 <findNURBSbasisFunV+0x1d0>
cmpq   $0x0,0x58(%rsp)
je     1310 <findNURBSbasisFunV+0x1f0>
mov    0x48(%rsp),%rcx
lea    (%rcx,%r12,1),%edi
mov    0x20(%rsp),%rcx
imul   %ecx,%edi
mov    0xd8(%rsp),%esi
add    %esi,%edi
add    0x34(%rsp),%r12d
imul   %ecx,%r12d
add    %esi,%r12d
xorpd  %xmm3,%xmm3
xor    %ecx,%ecx
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm4
mov    0x50(%rsp),%rsi
mov    0x28(%rsp),%rdx
movsd  (%rsp),%xmm5
nop
movslq %r12d,%r12
movsd  (%r14,%rcx,8),%xmm2
movsd  0x8(%r14,%rcx,8),%xmm0
mulsd  0x0(%rbp,%r12,8),%xmm2
addsd  %xmm3,%xmm2
movslq %edi,%rdi
mulsd  0x0(%rbp,%rdi,8),%xmm0
addsd  %xmm2,%xmm0
add    $0x2,%rcx
add    %r15d,%edi
add    %r15d,%r12d
movapd %xmm0,%xmm3
cmp    %rcx,%rsi
jne    12a0 <findNURBSbasisFunV+0x180>
testb  $0x1,0x60(%rsp)
jne    1333 <findNURBSbasisFunV+0x213>
jmp    1354 <findNURBSbasisFunV+0x234>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xorpd  %xmm0,%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm4
mov    0x28(%rsp),%rdx
movsd  (%rsp),%xmm5
jmp    1354 <findNURBSbasisFunV+0x234>
nopl   0x0(%rax)
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm4
mov    0x28(%rsp),%rdx
movsd  (%rsp),%xmm5
testb  $0x1,0x60(%rsp)
je     1354 <findNURBSbasisFunV+0x234>
movsd  (%r14,%rcx,8),%xmm2
add    %eax,%ecx
imul   0x20(%rsp),%ecx
add    0xd8(%rsp),%ecx
movslq %ecx,%rcx
mulsd  0x0(%rbp,%rcx,8),%xmm2
addsd  %xmm2,%xmm0
mov    0xc(%rsp),%ecx
sub    %eax,%ecx
movslq %ecx,%rax
movsd  (%r14,%rax,8),%xmm2
mov    0x68(%rsp),%rax
mulsd  0x0(%rbp,%rax,8),%xmm2
divsd  %xmm0,%xmm2
ucomisd %xmm4,%xmm2
ja     11b0 <findNURBSbasisFunV+0x90>
movapd %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm5,%xmm0
movsd  %xmm0,(%rsp)
mov    0xb0(%rsp),%edi
mov    0x38(%rsp),%r13
mov    %r13d,%esi
mov    0xb8(%rsp),%r12
mov    %r12,%rdx
call   1040 <FindSpan@plt>
mov    %eax,%ebx
mov    %eax,%edi
movsd  (%rsp),%xmm0
mov    %r13d,%esi
mov    %r12,%rdx
mov    %r14,%rcx
mov    0xc0(%rsp),%r8
mov    0xc8(%rsp),%r9
call   1030 <BasisFuns@plt>
mov    %ebx,%eax
sub    %r13d,%eax
test   %r13d,%r13d
js     146c <findNURBSbasisFunV+0x34c>
cmpq   $0x0,0x58(%rsp)
je     1488 <findNURBSbasisFunV+0x368>
mov    0x48(%rsp),%rcx
lea    (%rcx,%rbx,1),%edx
mov    0x20(%rsp),%rcx
imul   %ecx,%edx
mov    0xd8(%rsp),%esi
add    %esi,%edx
add    0x34(%rsp),%ebx
imul   %ecx,%ebx
add    %esi,%ebx
xorpd  %xmm3,%xmm3
xor    %ecx,%ecx
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
mov    0x50(%rsp),%rsi
cs nopw 0x0(%rax,%rax,1)
movslq %ebx,%rbx
movsd  (%r14,%rcx,8),%xmm2
movsd  0x8(%r14,%rcx,8),%xmm4
mulsd  0x0(%rbp,%rbx,8),%xmm2
addsd  %xmm3,%xmm2
movslq %edx,%rdx
mulsd  0x0(%rbp,%rdx,8),%xmm4
addsd  %xmm2,%xmm4
add    $0x2,%rcx
add    %r15d,%edx
add    %r15d,%ebx
movapd %xmm4,%xmm3
cmp    %rcx,%rsi
jne    1430 <findNURBSbasisFunV+0x310>
jmp    149a <findNURBSbasisFunV+0x37a>
xorpd  %xmm4,%xmm4
mov    0x28(%rsp),%rdx
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm3
jmp    14cc <findNURBSbasisFunV+0x3ac>
xorpd  %xmm4,%xmm4
xor    %ecx,%ecx
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
testb  $0x1,0x60(%rsp)
mov    0x28(%rsp),%rdx
movsd  (%rsp),%xmm3
je     14cc <findNURBSbasisFunV+0x3ac>
movsd  (%r14,%rcx,8),%xmm2
add    %eax,%ecx
imul   0x20(%rsp),%ecx
add    0xd8(%rsp),%ecx
movslq %ecx,%rcx
mulsd  0x0(%rbp,%rcx,8),%xmm2
addsd  %xmm2,%xmm4
mov    0xc(%rsp),%ecx
sub    %eax,%ecx
movslq %ecx,%rax
movsd  (%r14,%rax,8),%xmm2
mov    0x68(%rsp),%rax
mulsd  0x0(%rbp,%rax,8),%xmm2
divsd  %xmm4,%xmm2
ucomisd %xmm0,%xmm2
mov    0x70(%rsp),%rax
ja     11b9 <findNURBSbasisFunV+0x99>
jmp    11c2 <findNURBSbasisFunV+0xa2>
movsd  0x8(%rdx),%xmm1
mov    0xb8(%rsp),%rcx
movsd  (%rcx),%xmm0
ucomisd %xmm1,%xmm0
ja     1528 <findNURBSbasisFunV+0x408>
movslq 0xb0(%rsp),%rax
movsd  (%rcx,%rax,8),%xmm0
ucomisd %xmm0,%xmm1
jbe    152d <findNURBSbasisFunV+0x40d>
movsd  %xmm0,0x8(%rdx)
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @findNURBSbasisFunV(i32 %0, i32 %1, double* %2, double %3, double %4, i32 %5, double* %6, i32 %7, i32 %8, double* %9, double* %10, double* %11, double* %12, i32 %13) {
%15 = alloca i32
%16 = alloca i32
%17 = alloca double*
%18 = alloca double
%19 = alloca double
%20 = alloca i32
%21 = alloca double*
%22 = alloca i32
%23 = alloca i32
%24 = alloca double*
%25 = alloca double*
%26 = alloca double*
%27 = alloca double*
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca double
%36 = alloca double
%37 = alloca double
store i32 %0, i32* %15
store i32 %1, i32* %16
store double* %2, double** %17
store double %3, double* %18
store double %4, double* %19
store i32 %5, i32* %20
store double* %6, double** %21
store i32 %7, i32* %22
store i32 %8, i32* %23
store double* %9, double** %24
store double* %10, double** %25
store double* %11, double** %26
store double* %12, double** %27
store i32 %13, i32* %28
%38 = load i32, i32* %15
%39 = load i32, i32* %22
%40 = mul nsw i32 %38, %39
%41 = load i32, i32* %28
%42 = add nsw i32 %40, %41
store i32 %42, i32* %34
store i32 0, i32* %29
br label %43
43: ; preds = %199, %14
%44 = load i32, i32* %29
%45 = load i32, i32* %16
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %202
47: ; preds = %43
%48 = load double*, double** %17
%49 = getelementptr inbounds double, double* %48, i64 1
%50 = load double, double* %49
%51 = load double, double* %19
%52 = fsub double %50, %51
store double %52, double* %36
%53 = load i32, i32* %23
%54 = load i32, i32* %20
%55 = load double, double* %36
%56 = load double*, double** %24
%57 = call i32 @FindSpan(i32 %53, i32 %54, double %55, double* %56)
store i32 %57, i32* %31
%58 = load i32, i32* %31
%59 = load double, double* %36
%60 = load i32, i32* %20
%61 = load double*, double** %24
%62 = load double*, double** %27
%63 = load double*, double** %25
%64 = load double*, double** %26
%65 = call i32 @BasisFuns(i32 %58, double %59, i32 %60, double* %61, double* %62, double* %63, double* %64)
%66 = load i32, i32* %31
%67 = load i32, i32* %20
%68 = sub nsw i32 %66, %67
store i32 %68, i32* %32
%69 = load i32, i32* %32
%70 = load i32, i32* %22
%71 = mul nsw i32 %69, %70
%72 = load i32, i32* %28
%73 = add nsw i32 %71, %72
store i32 %73, i32* %33
store double 0.000000e+00, double* %35
store i32 0, i32* %30
br label %74
74: ; preds = %95, %47
%75 = load i32, i32* %30
%76 = load i32, i32* %20
%77 = icmp sle i32 %75, %76
br i1 %77, label %78, label %98
78: ; preds = %74
%79 = load double*, double** %27
%80 = load i32, i32* %30
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %79, i64 %81
%83 = load double, double* %82
%84 = load double*, double** %21
%85 = load i32, i32* %30
%86 = load i32, i32* %22
%87 = mul nsw i32 %85, %86
%88 = load i32, i32* %33
%89 = add nsw i32 %87, %88
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %84, i64 %90
%92 = load double, double* %91
%93 = load double, double* %35
%94 = call double @llvm.fmuladd.f64(double %83, double %92, double %93)
store double %94, double* %35
br label %95
95: ; preds = %78
%96 = load i32, i32* %30
%97 = add nsw i32 %96, 1
store i32 %97, i32* %30
br label %74
98: ; preds = %74
%99 = load double*, double** %27
%100 = load i32, i32* %15
%101 = load i32, i32* %32
%102 = sub nsw i32 %100, %101
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %99, i64 %103
%105 = load double, double* %104
%106 = load double*, double** %21
%107 = load i32, i32* %34
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %106, i64 %108
%110 = load double, double* %109
%111 = fmul double %105, %110
%112 = load double, double* %35
%113 = fdiv double %111, %112
store double %113, double* %37
%114 = load double, double* %37
%115 = load double, double* %18
%116 = fcmp ogt double %114, %115
br i1 %116, label %117, label %122
117: ; preds = %98
%118 = load double, double* %36
%119 = load double*, double** %17
%120 = getelementptr inbounds double, double* %119, i64 1
store double %118, double* %120
%121 = load double, double* %37
store double %121, double* %18
br label %196
122: ; preds = %98
%123 = load double, double* %19
%124 = load double, double* %36
%125 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %123, double %124)
store double %125, double* %36
%126 = load i32, i32* %23
%127 = load i32, i32* %20
%128 = load double, double* %36
%129 = load double*, double** %24
%130 = call i32 @FindSpan(i32 %126, i32 %127, double %128, double* %129)
store i32 %130, i32* %31
%131 = load i32, i32* %31
%132 = load double, double* %36
%133 = load i32, i32* %20
%134 = load double*, double** %24
%135 = load double*, double** %27
%136 = load double*, double** %25
%137 = load double*, double** %26
%138 = call i32 @BasisFuns(i32 %131, double %132, i32 %133, double* %134, double* %135, double* %136, double* %137)
%139 = load i32, i32* %31
%140 = load i32, i32* %20
%141 = sub nsw i32 %139, %140
store i32 %141, i32* %32
%142 = load i32, i32* %32
%143 = load i32, i32* %22
%144 = mul nsw i32 %142, %143
%145 = load i32, i32* %28
%146 = add nsw i32 %144, %145
store i32 %146, i32* %33
store double 0.000000e+00, double* %35
store i32 0, i32* %30
br label %147
147: ; preds = %168, %122
%148 = load i32, i32* %30
%149 = load i32, i32* %20
%150 = icmp sle i32 %148, %149
br i1 %150, label %151, label %171
151: ; preds = %147
%152 = load double*, double** %27
%153 = load i32, i32* %30
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds double, double* %152, i64 %154
%156 = load double, double* %155
%157 = load double*, double** %21
%158 = load i32, i32* %30
%159 = load i32, i32* %22
%160 = mul nsw i32 %158, %159
%161 = load i32, i32* %33
%162 = add nsw i32 %160, %161
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds double, double* %157, i64 %163
%165 = load double, double* %164
%166 = load double, double* %35
%167 = call double @llvm.fmuladd.f64(double %156, double %165, double %166)
store double %167, double* %35
br label %168
168: ; preds = %151
%169 = load i32, i32* %30
%170 = add nsw i32 %169, 1
store i32 %170, i32* %30
br label %147
171: ; preds = %147
%172 = load double*, double** %27
%173 = load i32, i32* %15
%174 = load i32, i32* %32
%175 = sub nsw i32 %173, %174
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds double, double* %172, i64 %176
%178 = load double, double* %177
%179 = load double*, double** %21
%180 = load i32, i32* %34
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds double, double* %179, i64 %181
%183 = load double, double* %182
%184 = fmul double %178, %183
%185 = load double, double* %35
%186 = fdiv double %184, %185
store double %186, double* %37
%187 = load double, double* %37
%188 = load double, double* %18
%189 = fcmp ogt double %187, %188
br i1 %189, label %190, label %195
190: ; preds = %171
%191 = load double, double* %36
%192 = load double*, double** %17
%193 = getelementptr inbounds double, double* %192, i64 1
store double %191, double* %193
%194 = load double, double* %37
store double %194, double* %18
br label %195
195: ; preds = %190, %171
br label %196
196: ; preds = %195, %117
%197 = load double, double* %19
%198 = fmul double 5.000000e-01, %197
store double %198, double* %19
br label %199
199: ; preds = %196
%200 = load i32, i32* %29
%201 = add nsw i32 %200, 1
store i32 %201, i32* %29
br label %43
202: ; preds = %43
%203 = load double*, double** %17
%204 = getelementptr inbounds double, double* %203, i64 1
%205 = load double, double* %204
%206 = load double*, double** %24
%207 = getelementptr inbounds double, double* %206, i64 0
%208 = load double, double* %207
%209 = fcmp olt double %205, %208
br i1 %209, label %210, label %216
210: ; preds = %202
%211 = load double*, double** %24
%212 = getelementptr inbounds double, double* %211, i64 0
%213 = load double, double* %212
%214 = load double*, double** %17
%215 = getelementptr inbounds double, double* %214, i64 1
store double %213, double* %215
br label %235
216: ; preds = %202
%217 = load double*, double** %17
%218 = getelementptr inbounds double, double* %217, i64 1
%219 = load double, double* %218
%220 = load double*, double** %24
%221 = load i32, i32* %23
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds double, double* %220, i64 %222
%224 = load double, double* %223
%225 = fcmp ogt double %219, %224
br i1 %225, label %226, label %234
226: ; preds = %216
%227 = load double*, double** %24
%228 = load i32, i32* %23
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds double, double* %227, i64 %229
%231 = load double, double* %230
%232 = load double*, double** %17
%233 = getelementptr inbounds double, double* %232, i64 1
store double %231, double* %233
br label %234
234: ; preds = %226, %216
br label %235
235: ; preds = %234, %210
ret void
}

LLVM IR (-O2):
define void @findNURBSbasisFunV(i32 %0, i32 %1, double* nocapture %2, double %3, double %4, i32 %5, double* nocapture %6, i32 %7, i32 %8, double* %9, double* %10, double* %11, double* %12, i32 %13) {
%15 = icmp sgt i32 %1, 0
br i1 %15, label %16, label %164
16: ; preds = %14
%17 = mul nsw i32 %7, %0
%18 = add nsw i32 %17, %13
%19 = getelementptr inbounds double, double* %2, i64 1
%20 = icmp slt i32 %5, 0
%21 = sext i32 %18 to i64
%22 = getelementptr inbounds double, double* %6, i64 %21
%23 = add i32 %5, 1
%24 = zext i32 %23 to i64
%25 = add nsw i64 %24, -1
%26 = and i64 %24, 1
%27 = icmp eq i64 %25, 0
%28 = and i64 %24, 4294967294
%29 = icmp eq i64 %26, 0
%30 = and i64 %24, 1
%31 = icmp eq i64 %25, 0
%32 = and i64 %24, 4294967294
%33 = icmp eq i64 %30, 0
br label %34
34: ; preds = %16, %159
%35 = phi double [ %3, %16 ], [ %160, %159 ]
%36 = phi i32 [ 0, %16 ], [ %162, %159 ]
%37 = phi double [ %4, %16 ], [ %161, %159 ]
%38 = load double, double* %19
%39 = fsub double %38, %37
%40 = tail call i32 @FindSpan(i32 %8, i32 %5, double %39, double* %9)
%41 = tail call i32 @BasisFuns(i32 %40, double %39, i32 %5, double* %9, double* %12, double* %10, double* %11)
%42 = sub nsw i32 %40, %5
br i1 %20, label %87, label %43
43: ; preds = %34
br i1 %27, label %72, label %44
44: ; preds = %43, %44
%45 = phi i64 [ %69, %44 ], [ 0, %43 ]
%46 = phi double [ %68, %44 ], [ 0.000000e+00, %43 ]
%47 = phi i64 [ %70, %44 ], [ 0, %43 ]
%48 = getelementptr inbounds double, double* %12, i64 %45
%49 = load double, double* %48
%50 = trunc i64 %45 to i32
%51 = add i32 %42, %50
%52 = mul i32 %51, %7
%53 = add i32 %52, %13
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %6, i64 %54
%56 = load double, double* %55
%57 = tail call double @llvm.fmuladd.f64(double %49, double %56, double %46)
%58 = or i64 %45, 1
%59 = getelementptr inbounds double, double* %12, i64 %58
%60 = load double, double* %59
%61 = trunc i64 %58 to i32
%62 = add i32 %42, %61
%63 = mul i32 %62, %7
%64 = add i32 %63, %13
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %6, i64 %65
%67 = load double, double* %66
%68 = tail call double @llvm.fmuladd.f64(double %60, double %67, double %57)
%69 = add nuw nsw i64 %45, 2
%70 = add i64 %47, 2
%71 = icmp eq i64 %70, %28
br i1 %71, label %72, label %44
72: ; preds = %44, %43
%73 = phi double [ undef, %43 ], [ %68, %44 ]
%74 = phi i64 [ 0, %43 ], [ %69, %44 ]
%75 = phi double [ 0.000000e+00, %43 ], [ %68, %44 ]
br i1 %29, label %87, label %76
76: ; preds = %72
%77 = getelementptr inbounds double, double* %12, i64 %74
%78 = load double, double* %77
%79 = trunc i64 %74 to i32
%80 = add i32 %42, %79
%81 = mul i32 %80, %7
%82 = add i32 %81, %13
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %6, i64 %83
%85 = load double, double* %84
%86 = tail call double @llvm.fmuladd.f64(double %78, double %85, double %75)
br label %87
87: ; preds = %76, %72, %34
%88 = phi double [ 0.000000e+00, %34 ], [ %73, %72 ], [ %86, %76 ]
%89 = sub nsw i32 %0, %42
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %12, i64 %90
%92 = load double, double* %91
%93 = load double, double* %22
%94 = fmul double %92, %93
%95 = fdiv double %94, %88
%96 = fcmp ogt double %95, %35
br i1 %96, label %156, label %97
97: ; preds = %87
%98 = tail call double @llvm.fmuladd.f64(double %37, double 2.000000e+00, double %39)
%99 = tail call i32 @FindSpan(i32 %8, i32 %5, double %98, double* %9)
%100 = tail call i32 @BasisFuns(i32 %99, double %98, i32 %5, double* %9, double* %12, double* %10, double* %11)
%101 = sub nsw i32 %99, %5
br i1 %20, label %146, label %102
102: ; preds = %97
br i1 %31, label %131, label %103
103: ; preds = %102, %103
%104 = phi i64 [ %128, %103 ], [ 0, %102 ]
%105 = phi double [ %127, %103 ], [ 0.000000e+00, %102 ]
%106 = phi i64 [ %129, %103 ], [ 0, %102 ]
%107 = getelementptr inbounds double, double* %12, i64 %104
%108 = load double, double* %107
%109 = trunc i64 %104 to i32
%110 = add i32 %101, %109
%111 = mul i32 %110, %7
%112 = add i32 %111, %13
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %6, i64 %113
%115 = load double, double* %114
%116 = tail call double @llvm.fmuladd.f64(double %108, double %115, double %105)
%117 = or i64 %104, 1
%118 = getelementptr inbounds double, double* %12, i64 %117
%119 = load double, double* %118
%120 = trunc i64 %117 to i32
%121 = add i32 %101, %120
%122 = mul i32 %121, %7
%123 = add i32 %122, %13
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds double, double* %6, i64 %124
%126 = load double, double* %125
%127 = tail call double @llvm.fmuladd.f64(double %119, double %126, double %116)
%128 = add nuw nsw i64 %104, 2
%129 = add i64 %106, 2
%130 = icmp eq i64 %129, %32
br i1 %130, label %131, label %103
131: ; preds = %103, %102
%132 = phi double [ undef, %102 ], [ %127, %103 ]
%133 = phi i64 [ 0, %102 ], [ %128, %103 ]
%134 = phi double [ 0.000000e+00, %102 ], [ %127, %103 ]
br i1 %33, label %146, label %135
135: ; preds = %131
%136 = getelementptr inbounds double, double* %12, i64 %133
%137 = load double, double* %136
%138 = trunc i64 %133 to i32
%139 = add i32 %101, %138
%140 = mul i32 %139, %7
%141 = add i32 %140, %13
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds double, double* %6, i64 %142
%144 = load double, double* %143
%145 = tail call double @llvm.fmuladd.f64(double %137, double %144, double %134)
br label %146
146: ; preds = %135, %131, %97
%147 = phi double [ 0.000000e+00, %97 ], [ %132, %131 ], [ %145, %135 ]
%148 = sub nsw i32 %0, %101
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds double, double* %12, i64 %149
%151 = load double, double* %150
%152 = load double, double* %22
%153 = fmul double %151, %152
%154 = fdiv double %153, %147
%155 = fcmp ogt double %154, %35
br i1 %155, label %156, label %159
156: ; preds = %146, %87
%157 = phi double [ %39, %87 ], [ %98, %146 ]
%158 = phi double [ %95, %87 ], [ %154, %146 ]
store double %157, double* %19
br label %159
159: ; preds = %156, %146
%160 = phi double [ %35, %146 ], [ %158, %156 ]
%161 = fmul double %37, 5.000000e-01
%162 = add nuw nsw i32 %36, 1
%163 = icmp eq i32 %162, %1
br i1 %163, label %164, label %34
164: ; preds = %159, %14
%165 = getelementptr inbounds double, double* %2, i64 1
%166 = load double, double* %165
%167 = load double, double* %9
%168 = fcmp olt double %166, %167
br i1 %168, label %174, label %169
169: ; preds = %164
%170 = sext i32 %8 to i64
%171 = getelementptr inbounds double, double* %9, i64 %170
%172 = load double, double* %171
%173 = fcmp ogt double %166, %172
br i1 %173, label %174, label %176
174: ; preds = %169, %164
%175 = phi double [ %167, %164 ], [ %172, %169 ]
store double %175, double* %165
br label %176
176: ; preds = %174, %169
ret void
}