// File: thierry7100[P]CutOptim/src/Geometry.cpp
// Function: Polygon::addVertice(Point&)
void Polygon::addVertice(Point &p)
{
    Point lP = Point(round(p.x/precision)*precision, round(p.y/precision)*precision);
    if ( nVertices > 0 && lP == _Vertices[nVertices-1] ) return;     //  Do NOT Add point if this is the same as the previous one.
    _Vertices.push_back(lP);
    nVertices = _Vertices.size();
    if ( nVertices == 1 )
    {
        BoundingBox.A = lP;
        BoundingBox.B = lP;
    }
    else
    {
        if ( lP.x < BoundingBox.A.x ) BoundingBox.A.x = lP.x;       //  To avoid rounding errors
        if ( lP.y < BoundingBox.A.y ) BoundingBox.A.y = lP.y;       //  To avoid rounding errors
        if ( lP.x > BoundingBox.B.x ) BoundingBox.B.x = lP.x;       //  To avoid rounding errors
        if ( lP.y > BoundingBox.B.y ) BoundingBox.B.y = lP.y;       //  To avoid rounding errors
    }
    if ( nVertices > 2)
        poly_closed = _Vertices[0] == _Vertices[nVertices-1];
    else
        poly_closed = 0;
    poly_changed = 1;
    poly_area = area();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rcx
movsd (%rcx), %xmm0
divsd 0xa0(%rax), %xmm0
callq 0x9220
movq -0x28(%rbp), %rax
mulsd 0xa0(%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x10(%rbp), %rcx
movsd 0x8(%rcx), %xmm0
divsd 0xa0(%rax), %xmm0
callq 0x9220
movq -0x28(%rbp), %rax
movaps %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
mulsd 0xa0(%rax), %xmm1
leaq -0x20(%rbp), %rdi
callq 0x5b520
movq -0x28(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jle 0x5ea0b
movq -0x28(%rbp), %rax
movq %rax, %rdi
addq $0x10, %rdi
movl 0x8(%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x63990
movq %rax, %rsi
leaq -0x20(%rbp), %rdi
callq 0x5c450
testb $0x1, %al
jne 0x5ea06
jmp 0x5ea0b
jmp 0x5eb69
movq -0x28(%rbp), %rdi
addq $0x10, %rdi
leaq -0x20(%rbp), %rsi
callq 0x5b060
movq -0x28(%rbp), %rdi
addq $0x10, %rdi
callq 0x5add0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movl %ecx, 0x8(%rax)
cmpl $0x1, 0x8(%rax)
jne 0x5ea62
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, 0x58(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x60(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x68(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x70(%rax)
jmp 0x5eae4
movq -0x28(%rbp), %rax
movsd -0x20(%rbp), %xmm1
movsd 0x58(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x5ea84
movq -0x28(%rbp), %rax
movsd -0x20(%rbp), %xmm0
movsd %xmm0, 0x58(%rax)
movq -0x28(%rbp), %rax
movsd -0x18(%rbp), %xmm1
movsd 0x60(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x5eaa6
movq -0x28(%rbp), %rax
movsd -0x18(%rbp), %xmm0
movsd %xmm0, 0x60(%rax)
movq -0x28(%rbp), %rax
movsd -0x20(%rbp), %xmm0
ucomisd 0x68(%rax), %xmm0
jbe 0x5eac4
movq -0x28(%rbp), %rax
movsd -0x20(%rbp), %xmm0
movsd %xmm0, 0x68(%rax)
movq -0x28(%rbp), %rax
movsd -0x18(%rbp), %xmm0
ucomisd 0x70(%rax), %xmm0
jbe 0x5eae2
movq -0x28(%rbp), %rax
movsd -0x18(%rbp), %xmm0
movsd %xmm0, 0x70(%rax)
jmp 0x5eae4
movq -0x28(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jle 0x5eb3f
movq -0x28(%rbp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x63990
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq %rax, %rdi
addq $0x10, %rdi
movl 0x8(%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x63990
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x5c450
movb %al, %cl
movq -0x28(%rbp), %rax
andb $0x1, %cl
movzbl %cl, %ecx
movl %ecx, 0x98(%rax)
jmp 0x5eb4d
movq -0x28(%rbp), %rax
movl $0x0, 0x98(%rax)
movq -0x28(%rbp), %rdi
movl $0x1, 0x9c(%rdi)
callq 0x5ed10
movq -0x28(%rbp), %rax
movsd %xmm0, 0x78(%rax)
addq $0x40, %rsp
popq %rbp
retq
nop