// File: /workspace/github_cpp_makefile_star2_O3/thierry7100[P]CutOptim/src/Geometry.cpp
// Function: Polygon::Translate(Point const*, int)
Polygon *Polygon::Translate(const Point *pT, int idx_vertex)
{
Polygon *Translated = new Polygon;

    nbTranslatedPoly++;
    nbCreatedTranslatedPoly++;
    Translated->TypePoly = TranslatedPoly;
    Translated->pt_Translation = *pT - _Vertices[idx_vertex];
    Translated->_Vertices = _Vertices;          //      Copy vertice vector
    Translated->nVertices = Translated->_Vertices.size();
    for ( int i = 0; i < nVertices; i++)
    {
        double newx = Translated->_Vertices[i].x + Translated->pt_Translation.x;
        newx = round(newx/precision)*precision;
        Translated->_Vertices[i].x = newx;
        double newy = Translated->_Vertices[i].y + Translated->pt_Translation.y;
        newy = round(newy/precision)*precision;
        Translated->_Vertices[i].y = newy;
    }
    Translated->_Angles = _Angles;
    Translated->poly_area = poly_area;
    Translated->poly_centroid = poly_centroid + Translated->pt_Translation;
    Translated->angle_rotation = angle_rotation;
    Translated->poly_centroid_ok = 1;
    Translated->poly_changed = 0;
    Translated->poly_closed = poly_closed;
    Translated->poly_clockwise = poly_clockwise;
    Translated->BoundingBox.A = BoundingBox.A + Translated->pt_Translation;
    Translated->BoundingBox.B = BoundingBox.B + Translated->pt_Translation;
    Translated->precision = precision;
    return Translated;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
movl $0xc0, %edi
callq 0x7440
movq %rax, %r14
leaq 0x28cc2(%rip), %rax     # 0x50ca0
movq %rax, (%r14)
leaq 0x10(%r14), %r12
movl $0x0, 0x8(%r14)
movl $0x8c, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x7270
movl $0x1, 0x9c(%r14)
incq 0x299f2(%rip)           # 0x51a00
movsd 0x1604a(%rip), %xmm0    # 0x3e060
incq 0x29a13(%rip)           # 0x51a30
movups %xmm0, 0xa0(%r14)
incq 0x299ec(%rip)           # 0x51a18
incq 0x29a15(%rip)           # 0x51a48
movl $0x3, 0xc(%r14)
leaq 0x10(%rbx), %rsi
movslq %ebp, %rax
movq 0x10(%rbx), %rcx
shlq $0x4, %rax
movupd (%r15), %xmm0
movupd (%rcx,%rax), %xmm1
subpd %xmm1, %xmm0
movupd %xmm0, 0xb0(%r14)
movq %r12, %rdi
callq 0x293ae
movq 0x10(%r14), %r15
movq 0x18(%r14), %rax
subq %r15, %rax
shrq $0x4, %rax
movl %eax, 0x8(%r14)
movslq 0x8(%rbx), %r12
testq %r12, %r12
jle 0x280f3
movupd 0xa0(%rbx), %xmm0
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd %xmm0, (%rsp)
shlq $0x4, %r12
xorl %r13d, %r13d
movupd (%r15,%r13), %xmm1
movupd 0xb0(%r14), %xmm0
addpd %xmm1, %xmm0
divpd (%rsp), %xmm0
movapd %xmm0, 0x10(%rsp)
callq 0x71c0
movapd %xmm0, 0x20(%rsp)
movapd 0x10(%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
callq 0x71c0
movapd 0x20(%rsp), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
mulpd (%rsp), %xmm1
movupd %xmm1, (%r15,%r13)
addq $0x10, %r13
cmpq %r13, %r12
jne 0x2809d
leaq 0x40(%rbx), %rsi
movq %r14, %rdi
addq $0x40, %rdi
callq 0x2949e
movsd 0x78(%rbx), %xmm0
movsd %xmm0, 0x78(%r14)
movl $0x1, 0x90(%r14)
movl $0x0, 0x9c(%r14)
movq 0x94(%rbx), %rax
movq %rax, 0x94(%r14)
movupd 0xb0(%r14), %xmm0
movupd 0x80(%rbx), %xmm1
addpd %xmm0, %xmm1
movupd %xmm1, 0x80(%r14)
movupd 0x58(%rbx), %xmm1
addpd %xmm0, %xmm1
movupd %xmm1, 0x58(%r14)
movupd 0x68(%rbx), %xmm1
addpd %xmm0, %xmm1
movupd %xmm1, 0x68(%r14)
movups 0xa0(%rbx), %xmm0
movups %xmm0, 0xa0(%r14)
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop