#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 NURBScurveEval(int deg, double *cp, int ncp, double *knot, double *us,
                    int nus, double *ep, double *left, double *right,
                    double *N) {
  int i, jj, span, ind, fourncp;
  double wgh;
  fourncp = 4 * ncp;
  for (jj = 0; jj < nus; jj++) {
    if (us[jj] <= knot[deg]) {
      ep[jj * 3] = cp[0] / cp[3];
      ep[jj * 3 + 1] = cp[1] / cp[3];
      ep[jj * 3 + 2] = cp[2] / cp[3];
    } else if (us[jj] >= knot[ncp]) {
      ep[jj * 3] = cp[fourncp - 4] / cp[fourncp - 1];
      ep[jj * 3 + 1] = cp[fourncp - 3] / cp[fourncp - 1];
      ep[jj * 3 + 2] = cp[fourncp - 2] / cp[fourncp - 1];
    } else {
      ep[jj * 3] = 0.0;
      ep[jj * 3 + 1] = 0.0;
      ep[jj * 3 + 2] = 0.0;
      wgh = 0.0;
      span = FindSpan(ncp, deg, us[jj], knot);
      BasisFuns(span, us[jj], deg, knot, N, left, right);
      ind = span - deg;
      for (i = 0; i <= deg; i++) {
        ep[jj * 3] += N[i] * cp[(i + ind) * 4];
        ep[jj * 3 + 1] += N[i] * cp[(i + ind) * 4 + 1];
        ep[jj * 3 + 2] += N[i] * cp[(i + ind) * 4 + 2];
        wgh += N[i] * cp[(i + ind) * 4 + 3];
      }
      ep[jj * 3] = ep[jj * 3] / wgh;
      ep[jj * 3 + 1] = ep[jj * 3 + 1] / wgh;
      ep[jj * 3 + 2] = ep[jj * 3 + 2] / wgh;
    }
  }
}


x86 assembly (clang, -O0):
<NURBScurveEval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1510 <NURBScurveEval+0x3f0>
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jb     11fe <NURBScurveEval+0xde>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x18(%rax),%xmm0
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x18(%rax),%xmm0
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x18(%rax),%xmm0
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    14fd <NURBScurveEval+0x3dd>
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jb     12c5 <NURBScurveEval+0x1a5>
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x4,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    14f8 <NURBScurveEval+0x3d8>
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rdx
call   1040 <FindSpan@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%edi
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x4(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    0x28(%rbp),%rcx
mov    0x18(%rbp),%r8
mov    0x20(%rbp),%r9
call   1030 <BasisFuns@plt>
mov    -0x38(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     147d <NURBScurveEval+0x35d>
mov    0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    -0x3c(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    -0x3c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    -0x3c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    -0x3c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1363 <NURBScurveEval+0x243>
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x48(%rbp),%xmm0
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x48(%rbp),%xmm0
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x48(%rbp),%xmm0
mov    0x10(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    14fd <NURBScurveEval+0x3dd>
jmp    1502 <NURBScurveEval+0x3e2>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    115e <NURBScurveEval+0x3e>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NURBScurveEval>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rdx,0x30(%rsp)
mov    %edi,0x4(%rsp)
test   %r9d,%r9d
jle    143b <NURBScurveEval+0x31b>
mov    %r9d,%r14d
mov    %rcx,%r10
mov    %rsi,%rbx
mov    0xc8(%rsp),%rbp
mov    0xb0(%rsp),%r13
mov    0x30(%rsp),%rcx
lea    0x0(,%rcx,4),%eax
movslq 0x4(%rsp),%r11
movslq %ecx,%r9
lea    -0x4(%rax),%ecx
movslq %ecx,%rcx
mov    %rcx,0x68(%rsp)
lea    -0x1(%rax),%ecx
movslq %ecx,%rcx
mov    %rcx,0x60(%rsp)
lea    -0x3(%rax),%ecx
movslq %ecx,%rcx
mov    %rcx,0x58(%rsp)
add    $0xfffffffe,%eax
cltq
mov    %rax,0x50(%rsp)
lea    0x1(%r11),%edi
mov    %r14d,%esi
lea    0x0(,%r11,4),%eax
neg    %eax
mov    %rax,0x38(%rsp)
shl    $0x2,%rdi
xor    %r12d,%r12d
mov    %r8,0x18(%rsp)
mov    %r10,0x10(%rsp)
mov    %r11,0x28(%rsp)
mov    %r9,0x20(%rsp)
mov    %rdi,0x40(%rsp)
mov    %rsi,0x48(%rsp)
jmp    1223 <NURBScurveEval+0x103>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rbx),%xmm0
divsd  0x18(%rbx),%xmm0
lea    (%r12,%r12,2),%eax
movsd  %xmm0,0x0(%r13,%rax,8)
movsd  0x8(%rbx),%xmm0
divsd  0x18(%rbx),%xmm0
movsd  %xmm0,0x8(%r13,%rax,8)
movsd  0x10(%rbx),%xmm0
divsd  0x18(%rbx),%xmm0
movsd  %xmm0,0x10(%r13,%rax,8)
add    $0x1,%r12
cmp    %rsi,%r12
je     143b <NURBScurveEval+0x31b>
movsd  (%r8,%r12,8),%xmm0
movsd  (%r10,%r11,8),%xmm1
ucomisd %xmm0,%xmm1
jae    11e0 <NURBScurveEval+0xc0>
ucomisd (%r10,%r9,8),%xmm0
jae    1390 <NURBScurveEval+0x270>
lea    (%r12,%r12,2),%r14d
movq   $0x0,0x0(%r13,%r14,8)
lea    0x1(%r14),%r15
movq   $0x0,0x8(%r13,%r14,8)
lea    0x2(%r14),%rax
mov    %rax,0x8(%rsp)
movq   $0x0,0x10(%r13,%r14,8)
movsd  (%r8,%r12,8),%xmm0
mov    0x30(%rsp),%rdi
mov    0x4(%rsp),%esi
mov    %r10,%rdx
call   1040 <FindSpan@plt>
mov    0x18(%rsp),%rcx
movsd  (%rcx,%r12,8),%xmm0
mov    %rax,0x70(%rsp)
mov    %eax,%edi
mov    0x4(%rsp),%esi
mov    0x10(%rsp),%rdx
mov    %rbp,%rcx
mov    0xb8(%rsp),%r8
mov    0xc0(%rsp),%r9
call   1030 <BasisFuns@plt>
cmpl   $0x0,0x4(%rsp)
js     13d9 <NURBScurveEval+0x2b9>
movsd  0x0(%r13,%r14,8),%xmm2
movsd  0x0(%r13,%r15,8),%xmm1
mov    0x8(%rsp),%rax
movsd  0x0(%r13,%rax,8),%xmm0
mov    0x38(%rsp),%rax
mov    0x70(%rsp),%rcx
lea    (%rax,%rcx,4),%eax
xorpd  %xmm3,%xmm3
xor    %ecx,%ecx
mov    0x18(%rsp),%r8
mov    0x10(%rsp),%r10
mov    0x28(%rsp),%r11
mov    0x20(%rsp),%r9
mov    0x40(%rsp),%rdi
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%rcx,2),%xmm4
lea    (%rax,%rcx,1),%rdx
movslq %edx,%rdx
mulsd  (%rbx,%rdx,8),%xmm4
addsd  %xmm4,%xmm2
movsd  %xmm2,0x0(%r13,%r14,8)
movsd  0x0(%rbp,%rcx,2),%xmm4
lea    0x1(%rdx),%esi
movslq %esi,%rsi
mulsd  (%rbx,%rsi,8),%xmm4
addsd  %xmm4,%xmm1
movsd  %xmm1,0x0(%r13,%r15,8)
movsd  0x0(%rbp,%rcx,2),%xmm4
lea    0x2(%rdx),%esi
movslq %esi,%rsi
mulsd  (%rbx,%rsi,8),%xmm4
addsd  %xmm4,%xmm0
mov    0x8(%rsp),%rsi
movsd  %xmm0,0x0(%r13,%rsi,8)
movsd  0x0(%rbp,%rcx,2),%xmm4
add    $0x3,%edx
movslq %edx,%rdx
mulsd  (%rbx,%rdx,8),%xmm4
addsd  %xmm4,%xmm3
add    $0x4,%rcx
cmp    %rcx,%rdi
jne    1310 <NURBScurveEval+0x1f0>
jmp    140b <NURBScurveEval+0x2eb>
nopl   (%rax)
mov    0x68(%rsp),%rax
movsd  (%rbx,%rax,8),%xmm0
mov    0x60(%rsp),%rcx
divsd  (%rbx,%rcx,8),%xmm0
lea    (%r12,%r12,2),%eax
movsd  %xmm0,0x0(%r13,%rax,8)
mov    0x58(%rsp),%rdx
movsd  (%rbx,%rdx,8),%xmm0
divsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x8(%r13,%rax,8)
mov    0x50(%rsp),%rdx
movsd  (%rbx,%rdx,8),%xmm0
divsd  (%rbx,%rcx,8),%xmm0
jmp    120f <NURBScurveEval+0xef>
movsd  0x0(%r13,%r14,8),%xmm2
movsd  0x0(%r13,%r15,8),%xmm1
mov    0x8(%rsp),%rax
movsd  0x0(%r13,%rax,8),%xmm0
xorpd  %xmm3,%xmm3
mov    0x18(%rsp),%r8
mov    0x10(%rsp),%r10
mov    0x28(%rsp),%r11
mov    0x20(%rsp),%r9
divsd  %xmm3,%xmm2
movsd  %xmm2,0x0(%r13,%r14,8)
divsd  %xmm3,%xmm1
movsd  %xmm1,0x0(%r13,%r15,8)
divsd  %xmm3,%xmm0
mov    0x8(%rsp),%rax
movsd  %xmm0,0x0(%r13,%rax,8)
mov    0x48(%rsp),%rsi
jmp    1216 <NURBScurveEval+0xf6>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @NURBScurveEval(i32 %0, double* %1, i32 %2, double* %3, double* %4, i32 %5, double* %6, double* %7, double* %8, double* %9) {
%11 = alloca i32
%12 = alloca double*
%13 = alloca i32
%14 = alloca double*
%15 = alloca double*
%16 = alloca i32
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca double
store i32 %0, i32* %11
store double* %1, double** %12
store i32 %2, i32* %13
store double* %3, double** %14
store double* %4, double** %15
store i32 %5, i32* %16
store double* %6, double** %17
store double* %7, double** %18
store double* %8, double** %19
store double* %9, double** %20
%27 = load i32, i32* %13
%28 = mul nsw i32 4, %27
store i32 %28, i32* %25
store i32 0, i32* %22
br label %29
29: ; preds = %329, %10
%30 = load i32, i32* %22
%31 = load i32, i32* %16
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %332
33: ; preds = %29
%34 = load double*, double** %15
%35 = load i32, i32* %22
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %34, i64 %36
%38 = load double, double* %37
%39 = load double*, double** %14
%40 = load i32, i32* %11
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
%43 = load double, double* %42
%44 = fcmp ole double %38, %43
br i1 %44, label %45, label %84
45: ; preds = %33
%46 = load double*, double** %12
%47 = getelementptr inbounds double, double* %46, i64 0
%48 = load double, double* %47
%49 = load double*, double** %12
%50 = getelementptr inbounds double, double* %49, i64 3
%51 = load double, double* %50
%52 = fdiv double %48, %51
%53 = load double*, double** %17
%54 = load i32, i32* %22
%55 = mul nsw i32 %54, 3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %53, i64 %56
store double %52, double* %57
%58 = load double*, double** %12
%59 = getelementptr inbounds double, double* %58, i64 1
%60 = load double, double* %59
%61 = load double*, double** %12
%62 = getelementptr inbounds double, double* %61, i64 3
%63 = load double, double* %62
%64 = fdiv double %60, %63
%65 = load double*, double** %17
%66 = load i32, i32* %22
%67 = mul nsw i32 %66, 3
%68 = add nsw i32 %67, 1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double, double* %65, i64 %69
store double %64, double* %70
%71 = load double*, double** %12
%72 = getelementptr inbounds double, double* %71, i64 2
%73 = load double, double* %72
%74 = load double*, double** %12
%75 = getelementptr inbounds double, double* %74, i64 3
%76 = load double, double* %75
%77 = fdiv double %73, %76
%78 = load double*, double** %17
%79 = load i32, i32* %22
%80 = mul nsw i32 %79, 3
%81 = add nsw i32 %80, 2
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %78, i64 %82
store double %77, double* %83
br label %328
84: ; preds = %33
%85 = load double*, double** %15
%86 = load i32, i32* %22
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %85, i64 %87
%89 = load double, double* %88
%90 = load double*, double** %14
%91 = load i32, i32* %13
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %90, i64 %92
%94 = load double, double* %93
%95 = fcmp oge double %89, %94
br i1 %95, label %96, label %153
96: ; preds = %84
%97 = load double*, double** %12
%98 = load i32, i32* %25
%99 = sub nsw i32 %98, 4
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %97, i64 %100
%102 = load double, double* %101
%103 = load double*, double** %12
%104 = load i32, i32* %25
%105 = sub nsw i32 %104, 1
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %103, i64 %106
%108 = load double, double* %107
%109 = fdiv double %102, %108
%110 = load double*, double** %17
%111 = load i32, i32* %22
%112 = mul nsw i32 %111, 3
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %110, i64 %113
store double %109, double* %114
%115 = load double*, double** %12
%116 = load i32, i32* %25
%117 = sub nsw i32 %116, 3
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds double, double* %115, i64 %118
%120 = load double, double* %119
%121 = load double*, double** %12
%122 = load i32, i32* %25
%123 = sub nsw i32 %122, 1
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds double, double* %121, i64 %124
%126 = load double, double* %125
%127 = fdiv double %120, %126
%128 = load double*, double** %17
%129 = load i32, i32* %22
%130 = mul nsw i32 %129, 3
%131 = add nsw i32 %130, 1
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds double, double* %128, i64 %132
store double %127, double* %133
%134 = load double*, double** %12
%135 = load i32, i32* %25
%136 = sub nsw i32 %135, 2
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds double, double* %134, i64 %137
%139 = load double, double* %138
%140 = load double*, double** %12
%141 = load i32, i32* %25
%142 = sub nsw i32 %141, 1
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %140, i64 %143
%145 = load double, double* %144
%146 = fdiv double %139, %145
%147 = load double*, double** %17
%148 = load i32, i32* %22
%149 = mul nsw i32 %148, 3
%150 = add nsw i32 %149, 2
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds double, double* %147, i64 %151
store double %146, double* %152
br label %327
153: ; preds = %84
%154 = load double*, double** %17
%155 = load i32, i32* %22
%156 = mul nsw i32 %155, 3
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds double, double* %154, i64 %157
store double 0.000000e+00, double* %158
%159 = load double*, double** %17
%160 = load i32, i32* %22
%161 = mul nsw i32 %160, 3
%162 = add nsw i32 %161, 1
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds double, double* %159, i64 %163
store double 0.000000e+00, double* %164
%165 = load double*, double** %17
%166 = load i32, i32* %22
%167 = mul nsw i32 %166, 3
%168 = add nsw i32 %167, 2
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds double, double* %165, i64 %169
store double 0.000000e+00, double* %170
store double 0.000000e+00, double* %26
%171 = load i32, i32* %13
%172 = load i32, i32* %11
%173 = load double*, double** %15
%174 = load i32, i32* %22
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds double, double* %173, i64 %175
%177 = load double, double* %176
%178 = load double*, double** %14
%179 = call i32 @FindSpan(i32 %171, i32 %172, double %177, double* %178)
store i32 %179, i32* %23
%180 = load i32, i32* %23
%181 = load double*, double** %15
%182 = load i32, i32* %22
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds double, double* %181, i64 %183
%185 = load double, double* %184
%186 = load i32, i32* %11
%187 = load double*, double** %14
%188 = load double*, double** %20
%189 = load double*, double** %18
%190 = load double*, double** %19
%191 = call i32 @BasisFuns(i32 %180, double %185, i32 %186, double* %187, double* %188, double* %189, double* %190)
%192 = load i32, i32* %23
%193 = load i32, i32* %11
%194 = sub nsw i32 %192, %193
store i32 %194, i32* %24
store i32 0, i32* %21
br label %195
195: ; preds = %280, %153
%196 = load i32, i32* %21
%197 = load i32, i32* %11
%198 = icmp sle i32 %196, %197
br i1 %198, label %199, label %283
199: ; preds = %195
%200 = load double*, double** %20
%201 = load i32, i32* %21
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds double, double* %200, i64 %202
%204 = load double, double* %203
%205 = load double*, double** %12
%206 = load i32, i32* %21
%207 = load i32, i32* %24
%208 = add nsw i32 %206, %207
%209 = mul nsw i32 %208, 4
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds double, double* %205, i64 %210
%212 = load double, double* %211
%213 = load double*, double** %17
%214 = load i32, i32* %22
%215 = mul nsw i32 %214, 3
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds double, double* %213, i64 %216
%218 = load double, double* %217
%219 = call double @llvm.fmuladd.f64(double %204, double %212, double %218)
store double %219, double* %217
%220 = load double*, double** %20
%221 = load i32, i32* %21
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds double, double* %220, i64 %222
%224 = load double, double* %223
%225 = load double*, double** %12
%226 = load i32, i32* %21
%227 = load i32, i32* %24
%228 = add nsw i32 %226, %227
%229 = mul nsw i32 %228, 4
%230 = add nsw i32 %229, 1
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds double, double* %225, i64 %231
%233 = load double, double* %232
%234 = load double*, double** %17
%235 = load i32, i32* %22
%236 = mul nsw i32 %235, 3
%237 = add nsw i32 %236, 1
%238 = sext i32 %237 to i64
%239 = getelementptr inbounds double, double* %234, i64 %238
%240 = load double, double* %239
%241 = call double @llvm.fmuladd.f64(double %224, double %233, double %240)
store double %241, double* %239
%242 = load double*, double** %20
%243 = load i32, i32* %21
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds double, double* %242, i64 %244
%246 = load double, double* %245
%247 = load double*, double** %12
%248 = load i32, i32* %21
%249 = load i32, i32* %24
%250 = add nsw i32 %248, %249
%251 = mul nsw i32 %250, 4
%252 = add nsw i32 %251, 2
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds double, double* %247, i64 %253
%255 = load double, double* %254
%256 = load double*, double** %17
%257 = load i32, i32* %22
%258 = mul nsw i32 %257, 3
%259 = add nsw i32 %258, 2
%260 = sext i32 %259 to i64
%261 = getelementptr inbounds double, double* %256, i64 %260
%262 = load double, double* %261
%263 = call double @llvm.fmuladd.f64(double %246, double %255, double %262)
store double %263, double* %261
%264 = load double*, double** %20
%265 = load i32, i32* %21
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds double, double* %264, i64 %266
%268 = load double, double* %267
%269 = load double*, double** %12
%270 = load i32, i32* %21
%271 = load i32, i32* %24
%272 = add nsw i32 %270, %271
%273 = mul nsw i32 %272, 4
%274 = add nsw i32 %273, 3
%275 = sext i32 %274 to i64
%276 = getelementptr inbounds double, double* %269, i64 %275
%277 = load double, double* %276
%278 = load double, double* %26
%279 = call double @llvm.fmuladd.f64(double %268, double %277, double %278)
store double %279, double* %26
br label %280
280: ; preds = %199
%281 = load i32, i32* %21
%282 = add nsw i32 %281, 1
store i32 %282, i32* %21
br label %195
283: ; preds = %195
%284 = load double*, double** %17
%285 = load i32, i32* %22
%286 = mul nsw i32 %285, 3
%287 = sext i32 %286 to i64
%288 = getelementptr inbounds double, double* %284, i64 %287
%289 = load double, double* %288
%290 = load double, double* %26
%291 = fdiv double %289, %290
%292 = load double*, double** %17
%293 = load i32, i32* %22
%294 = mul nsw i32 %293, 3
%295 = sext i32 %294 to i64
%296 = getelementptr inbounds double, double* %292, i64 %295
store double %291, double* %296
%297 = load double*, double** %17
%298 = load i32, i32* %22
%299 = mul nsw i32 %298, 3
%300 = add nsw i32 %299, 1
%301 = sext i32 %300 to i64
%302 = getelementptr inbounds double, double* %297, i64 %301
%303 = load double, double* %302
%304 = load double, double* %26
%305 = fdiv double %303, %304
%306 = load double*, double** %17
%307 = load i32, i32* %22
%308 = mul nsw i32 %307, 3
%309 = add nsw i32 %308, 1
%310 = sext i32 %309 to i64
%311 = getelementptr inbounds double, double* %306, i64 %310
store double %305, double* %311
%312 = load double*, double** %17
%313 = load i32, i32* %22
%314 = mul nsw i32 %313, 3
%315 = add nsw i32 %314, 2
%316 = sext i32 %315 to i64
%317 = getelementptr inbounds double, double* %312, i64 %316
%318 = load double, double* %317
%319 = load double, double* %26
%320 = fdiv double %318, %319
%321 = load double*, double** %17
%322 = load i32, i32* %22
%323 = mul nsw i32 %322, 3
%324 = add nsw i32 %323, 2
%325 = sext i32 %324 to i64
%326 = getelementptr inbounds double, double* %321, i64 %325
store double %320, double* %326
br label %327
327: ; preds = %283, %96
br label %328
328: ; preds = %327, %45
br label %329
329: ; preds = %328
%330 = load i32, i32* %22
%331 = add nsw i32 %330, 1
store i32 %331, i32* %22
br label %29
332: ; preds = %29
ret void
}

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