// File: /workspace/github_cpp_makefile_star2_O1/sundale[P]gcode/rs274ngc/nurbs_additional_functions.cc
// Function: Nmix(unsigned int, unsigned int, double, std::vector<unsigned int, std::allocator<unsigned int>>)
double Nmix(unsigned int i, unsigned int k, double u, 
                    std::vector<unsigned int> knot_vector) {

    if (k == 1){
        if ((u >= knot_vector[i]) && (u <= knot_vector[i+1])) {
            return 1;
        } else {
            return 0;}
    } else if (k > 1) {
        if ((knot_vector[i+k-1]-knot_vector[i] == 0) && 
            (knot_vector[i+k]-knot_vector[i+1] != 0)) {
            return ((knot_vector[i+k] - u)*Nmix(i+1,k-1,u,knot_vector))/
                    (knot_vector[i+k]-knot_vector[i+1]);
        } else if ((knot_vector[i+k]-knot_vector[i+1] == 0) && 
            (knot_vector[i+k-1]-knot_vector[i] != 0)) {
            return ((u - knot_vector[i])*Nmix(i,k-1,u,knot_vector))/
                    (knot_vector[i+k-1]-knot_vector[i]);
        } else if ((knot_vector[i+k-1]-knot_vector[i] == 0) && 
            (knot_vector[i+k]-knot_vector[i+1] == 0)) {
            return 0;
        } else {
            return ((u - knot_vector[i])*Nmix(i,k-1,u,knot_vector))/
                    (knot_vector[i+k-1]-knot_vector[i]) + ((knot_vector[i+k] - u)*
                    Nmix(i+1,k-1,u,knot_vector))/(knot_vector[i+k]-knot_vector[i+1]);
        }
    }
    else return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
testl %esi, %esi
je 0x31099
movq %rdx, %rbx
movl %esi, %r14d
movl %edi, %r15d
cmpl $0x1, %esi
jne 0x310a6
movl %r15d, %ecx
movq (%rbx), %rax
movl (%rax,%rcx,4), %ecx
cvtsi2sd %rcx, %xmm1
ucomisd %xmm1, %xmm0
jb 0x31090
incl %r15d
movl (%rax,%r15,4), %eax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
ucomisd %xmm0, %xmm1
jae 0x31291
xorpd %xmm2, %xmm2
jmp 0x31318
movsd 0x57cf(%rip), %xmm2     # 0x36870
jmp 0x31318
leal (%r14,%r15), %edx
leal (%r14,%r15), %r8d
decl %r8d
movq (%rbx), %rcx
movl (%rcx,%r8,4), %eax
movl %r15d, %r9d
movl (%rcx,%r9,4), %r13d
movl %edx, %edx
cmpl %r13d, %eax
movq %rdx, -0x40(%rbp)
jne 0x310db
movl (%rcx,%rdx,4), %esi
leal 0x1(%r15), %r12d
cmpl (%rcx,%r12,4), %esi
jne 0x3129b
cmpl %r13d, %eax
sete %sil
movl (%rcx,%rdx,4), %edx
leal 0x1(%r15), %r12d
movl (%rcx,%r12,4), %ecx
cmpl %ecx, %edx
setne %dil
orb %sil, %dil
je 0x31211
cmpl %ecx, %edx
jne 0x3110d
xorpd %xmm2, %xmm2
cmpl %r13d, %eax
je 0x31318
movq %r9, -0x48(%rbp)
movq %r8, -0x38(%rbp)
decl %r14d
leaq -0x80(%rbp), %rdi
movq %rbx, %rsi
movsd %xmm0, -0x30(%rbp)
callq 0xa240
movl %r15d, %edi
movl %r14d, %esi
movsd -0x30(%rbp), %xmm0
leaq -0x80(%rbp), %rdx
callq 0xb5f0
movsd %xmm0, -0x50(%rbp)
movq (%rbx), %rax
movq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %r15d
movq -0x48(%rbp), %rcx
subl (%rax,%rcx,4), %r15d
movq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq %rax, -0x38(%rbp)
leaq -0x68(%rbp), %rdi
movq %rbx, %rsi
callq 0xa240
leaq -0x68(%rbp), %rdx
movl %r12d, %edi
movl %r14d, %esi
movsd -0x30(%rbp), %xmm0
callq 0xb5f0
movl %r13d, %eax
cvtsi2sd %rax, %xmm1
movsd -0x30(%rbp), %xmm4
movapd %xmm4, %xmm2
subsd %xmm1, %xmm2
mulsd -0x50(%rbp), %xmm2
xorps %xmm1, %xmm1
cvtsi2sd %r15, %xmm1
cvtsi2sdq -0x38(%rbp), %xmm3
divsd %xmm1, %xmm2
subsd %xmm4, %xmm3
movq (%rbx), %rax
movq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
subl (%rax,%r12,4), %ecx
xorps %xmm1, %xmm1
cvtsi2sd %rcx, %xmm1
mulsd %xmm0, %xmm3
divsd %xmm1, %xmm3
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x311f7
movq -0x58(%rbp), %rsi
subq %rdi, %rsi
movsd %xmm2, -0x30(%rbp)
movsd %xmm3, -0x40(%rbp)
callq 0xaae0
movsd -0x40(%rbp), %xmm3
movsd -0x30(%rbp), %xmm2
addsd %xmm3, %xmm2
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x31318
movq -0x70(%rbp), %rsi
jmp 0x31306
movq %r9, -0x48(%rbp)
movq %r8, -0x38(%rbp)
decl %r14d
leaq -0x98(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movsd %xmm0, -0x30(%rbp)
callq 0xa240
movl %r15d, %edi
movl %r14d, %esi
movsd -0x30(%rbp), %xmm0
movq %r12, %rdx
callq 0xb5f0
movl %r13d, %eax
cvtsi2sd %rax, %xmm1
movsd -0x30(%rbp), %xmm2
subsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
movq (%rbx), %rax
movq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x48(%rbp), %rdx
subl (%rax,%rdx,4), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
divsd %xmm0, %xmm2
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x31318
movq -0x88(%rbp), %rsi
jmp 0x31306
movsd 0x5c07(%rip), %xmm2     # 0x36ea0
jmp 0x31318
movl %esi, %r13d
decl %r14d
leaq -0xb0(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movsd %xmm0, -0x30(%rbp)
callq 0xa240
movl %r12d, %edi
movl %r14d, %esi
movsd -0x30(%rbp), %xmm0
movq %r15, %rdx
callq 0xb5f0
movl %r13d, %eax
cvtsi2sd %rax, %xmm2
subsd -0x30(%rbp), %xmm2
movq (%rbx), %rax
movq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
subl (%rax,%r12,4), %ecx
cvtsi2sd %rcx, %xmm1
mulsd %xmm0, %xmm2
divsd %xmm1, %xmm2
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x31318
movq -0xa0(%rbp), %rsi
subq %rdi, %rsi
movsd %xmm2, -0x30(%rbp)
callq 0xaae0
movsd -0x30(%rbp), %xmm2
movapd %xmm2, %xmm0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x3135e
movq -0x58(%rbp), %rsi
subq %rdi, %rsi
callq 0xaae0
jmp 0x3135e
leaq -0xa0(%rbp), %rcx
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
jmp 0x3137e
movq %rax, %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x3138e
leaq -0x70(%rbp), %rcx
jmp 0x31383
leaq -0x88(%rbp), %rcx
movq %rax, %rbx
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x3138e
movq (%rcx), %rsi
subq %rdi, %rsi
callq 0xaae0
movq %rbx, %rdi
callq 0xb3b0