// File: sundale[P]gcode/rs274ngc/nurbs_additional_functions.cc
// Function: nurbs_point(double, unsigned int, std::vector<CONTROL_POINT, std::allocator<CONTROL_POINT>>, std::vector<unsigned int, std::allocator<unsigned int>>)
PLANE_POINT nurbs_point(double u, unsigned int k, 
                  std::vector<CONTROL_POINT> nurbs_control_points,
                  std::vector<unsigned int> knot_vector) {

    unsigned int i;
    PLANE_POINT point;
    point.X = 0;
    point.Y = 0;
    for (i=0; i<(nurbs_control_points.size()); i++) {
        point.X = point.X + nurbs_control_points[i].X*Nmix(i,k,u,knot_vector)
	*nurbs_control_points[i].W/Rden(u,k,nurbs_control_points,knot_vector);
        point.Y = point.Y + nurbs_control_points[i].Y*Nmix(i,k,u,knot_vector)
	*nurbs_control_points[i].W/Rden(u,k,nurbs_control_points,knot_vector);
    }
    return point;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rsi, -0xe8(%rbp)
movq %rdx, -0xe0(%rbp)
movsd %xmm0, -0x18(%rbp)
movl %edi, -0x1c(%rbp)
movq %rsi, -0x28(%rbp)
movq %rdx, -0x30(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x10(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
movl $0x0, -0x34(%rbp)
movq -0xe8(%rbp), %rdi
movl -0x34(%rbp), %eax
movq %rax, -0xf0(%rbp)
callq 0x10bf0
movq %rax, %rcx
movq -0xf0(%rbp), %rax
cmpq %rcx, %rax
jae 0x6f71d
movq -0xe8(%rbp), %rdi
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x120(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0x12250
movq -0xe0(%rbp), %rsi
movsd (%rax), %xmm0
movsd %xmm0, -0x118(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x110(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x10c(%rbp)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x108(%rbp)
leaq -0x50(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x10400
movl -0x110(%rbp), %edi
movl -0x10c(%rbp), %esi
movsd -0x108(%rbp), %xmm0
movq -0x100(%rbp), %rdx
callq 0x12260
movsd %xmm0, -0xf8(%rbp)
jmp 0x6f403
movq -0xe8(%rbp), %rdi
movsd -0xf8(%rbp), %xmm1
movsd -0x118(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x140(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0x12250
movsd -0x140(%rbp), %xmm0
movq -0xe8(%rbp), %rsi
movsd 0x10(%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x138(%rbp)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x130(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x124(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x10970
jmp 0x6f471
movq -0xe0(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x10400
jmp 0x6f486
movl -0x124(%rbp), %edi
movsd -0x130(%rbp), %xmm0
leaq -0x78(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x11070
movsd %xmm0, -0x148(%rbp)
jmp 0x6f4ae
movsd -0x120(%rbp), %xmm0
movsd -0x148(%rbp), %xmm2
movsd -0x138(%rbp), %xmm1
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x12390
leaq -0x78(%rbp), %rdi
callq 0x123e0
leaq -0x50(%rbp), %rdi
callq 0x12390
movq -0xe8(%rbp), %rdi
movsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x178(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0x12250
movq -0xe0(%rbp), %rsi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x170(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x168(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x164(%rbp)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x160(%rbp)
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x10400
movl -0x168(%rbp), %edi
movl -0x164(%rbp), %esi
movsd -0x160(%rbp), %xmm0
movq -0x158(%rbp), %rdx
callq 0x12260
movsd %xmm0, -0x150(%rbp)
jmp 0x6f57f
movq -0xe8(%rbp), %rdi
movsd -0x150(%rbp), %xmm1
movsd -0x170(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x198(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0x12250
movsd -0x198(%rbp), %xmm0
movq -0xe8(%rbp), %rsi
movsd 0x10(%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x190(%rbp)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x188(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x17c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x10970
jmp 0x6f5f0
movq -0xe0(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x10400
jmp 0x6f605
movl -0x17c(%rbp), %edi
movsd -0x188(%rbp), %xmm0
leaq -0xc0(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x11070
movsd %xmm0, -0x1a0(%rbp)
jmp 0x6f630
movsd -0x178(%rbp), %xmm0
movsd -0x1a0(%rbp), %xmm2
movsd -0x190(%rbp), %xmm1
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x12390
leaq -0xc0(%rbp), %rdi
callq 0x123e0
leaq -0xa8(%rbp), %rdi
callq 0x12390
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x6f350
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x6f6c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x6f6bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x12390
leaq -0x78(%rbp), %rdi
callq 0x123e0
leaq -0x50(%rbp), %rdi
callq 0x12390
jmp 0x6f730
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x6f70f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x6f703
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x12390
leaq -0xc0(%rbp), %rdi
callq 0x123e0
leaq -0xa8(%rbp), %rdi
callq 0x12390
jmp 0x6f730
movsd -0x10(%rbp), %xmm0
movsd -0x8(%rbp), %xmm1
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x11f50
nopl (%rax)