// File: /workspace/github_cpp_makefile_star2_O3/thierry7100[P]CutOptim/src/Geometry.cpp
// Function: Polygon::enlarge(double)
Polygon *Polygon::enlarge(double Diff)
{
int First = 1;
Point OldA2 = Point(0, 0);
Point OldB2 = Point(0, 0);
Segment A2B2 = Segment(OldA2, OldB2);
Line OldLine(1, 1, 0);
Line FirstLine(1, 1, 0);
int newVertices = 0;
double a, b, c;

    //  Then create larger polygon.
    Polygon *LargePoly = new Polygon();

    for ( int i = 0; i < nVertices - 1; i++)
    {
        //  For each segment create a segment which is parallel to the original segment, but translated at distance Diff
        a = _Vertices[i].y - _Vertices[i+1].y;
        b = _Vertices[i+1].x - _Vertices[i].x;
        c = _Vertices[i].x * _Vertices[i+1].y - _Vertices[i+1].x * _Vertices[i].y;
        //  If equation of first segment is ax + by + c = 0, the translated segment has an equation like ax + by + C = 0 where C = c + Diff*sqrt(a*a + b*b)
        //  Here we will first build a segment which begins in A' and end in B' where A' is the point on the line perpendicular to the segment and which starts in A
        double C = c + Diff*sqrt(a*a+b*b);
        Line A1B1 = Line(a, b, C);
        //  Now the lines which are perpendicular in A or B to the segment
        Line AB_perpendicular_A = Line(-b, a, b*_Vertices[i].x - a*_Vertices[i].y);
        Line AB_perpendicular_B = Line(-b, a, b*_Vertices[i+1].x - a*_Vertices[i+1].y);
        // Compute intersection of AB_perpendicular_A and A1B1 (point A1)
        Point A1 = A1B1.Intersect(AB_perpendicular_A);
        Point B1 = A1B1.Intersect(AB_perpendicular_B);
        //  Now enlarge segment to reach A2 which is Diff further from A1 and B2 which is also Diff further from B1
        double distA1B1 = A1.Distance(B1);
        double Coeff = Diff/distA1B1;
        //  Now compute A2 and B2
        //  A2B1 = Coeff*A1B1
        Point A2 = A1 + Coeff*(A1-B1);
        Point B2 = B1 + Coeff*(B1-A1);
        A2B2 = Segment(A2, B2);
        //  Compute intersection between segment A2B2 and Old Segment A2B2 if not processing the first vertice
        if ( !First )
        {
            Point A3 = A1B1.Intersect(OldLine);
            //  If A3 is between A2 and B2, keep segment A3 - B2
            if (A2B2.InSegment(A3) )
            {
                //Change end of previous segment to A3, so change vertice of largePoly
                LargePoly->_Vertices[newVertices-1] = A3;
                //  And add new point B2
                LargePoly->addVertice(B2);
                newVertices = LargePoly->_Vertices.size();
#if DEBUG_CONSOLE > 1
                printf("Changing last point to A3 (%.3f,%.3f) and add one point (%d) B2 : (%.3f,%.3f)\n", A3.x, A3.y, newVertices, B2.x, B2.y);
#endif // DEBUG_CONSOLE
            }
            else
            {
                // Add vertice A2 and B2
                LargePoly->addVertice(A2);
                LargePoly->addVertice(B2);
                newVertices = LargePoly->_Vertices.size();
#if DEBUG_CONSOLE > 1
                printf("Add 2 points (%d and %d) A2 point (%.3f,%.3f) and B2 (%.3f,%.3f)\n", newVertices-1, newVertices, A2.x, A2.y, B2.x, B2.y);
#endif // DEBUG_CONSOLE
            }
        }
        else
        {
            LargePoly->addVertice(A2);
            LargePoly->addVertice(B2);
            newVertices = LargePoly->_Vertices.size();
            FirstLine = A1B1;
            First = 0;
#if DEBUG_CONSOLE > 1
            printf("Add First %d points : (%.3f, %.3f)   (%.3f,%.3f)\n", newVertices, A2.x, A2.y, B2.x, B2.y);
#endif // DEBUG_CONSOLE
        }
        OldA2 = A2;
        OldB2 = B2;
        OldLine = A1B1;
    }
    //  Now change first segment, compute intersection with OldLine
    Point A3;
    if ( OldLine.hasIntersect(&FirstLine, A3 ) )
    {
        //  If A3 is between A2 and B2, keep segment A3 - B2
        if (A2B2.InSegment(A3) )
        {
            //Change end of previous segment to A3, so change vertice of largePoly
            LargePoly->_Vertices[newVertices-1] = A3;
            //  And set First point of Poly to be the same
            LargePoly->_Vertices[0] = A3;
#if DEBUG_CONSOLE > 1
            printf("Changing first/last point (%d) A3 : (%.3f,%.3f)\n", newVertices, A3.x, A3.y);
    #endif // DEBUG_CONSOLE
        }
        else
        {
            // Add vertice between B2 and first point
            LargePoly->addVertice(LargePoly->_Vertices[0]);
            newVertices = LargePoly->_Vertices.size();
    #if DEBUG_CONSOLE > 1
            printf("Add 1 point (%d) (%3.f,%.3f) , closing polygon\n", newVertices, LargePoly->_Vertices[0].x, LargePoly->_Vertices[0].y);
    #endif // DEBUG_CONSOLE
        }
    }
    else
    {       //  No intersection, add point
            // Add vertice between B2 and first point
        LargePoly->addVertice(LargePoly->_Vertices[0]);
        newVertices = LargePoly->_Vertices.size();
#if DEBUG_CONSOLE > 1
        printf("NoIntersect, Add 1 point (%d) (%3.f,%.3f) , closing polygon\n", newVertices, LargePoly->_Vertices[0].x, LargePoly->_Vertices[0].y);
#endif // DEBUG_CONSOLE
    }
    LargePoly->CheckClosed();
    LargePoly->ReCalcBoundingBox();

    //  Now check that all edges of the enlarged polygon dont intersect
    //  If edge I (_Vertice[i] --> _Vertice[i+1]) intersect edge j (_Vertice[j] --> _Vertice[j+1] ) in point Ai with j > i
    //  1) Change _Vertice[i+1] to Ai
    //  2) Delete All vertices from i+2 to j
    //  The resulting polygon will have an edge from _Vertice[i] --> Ai and Ai --> Vertice[j] (with old indexes i and j).
#if DEBUG_CONSOLE > 0
    printf("Large Poly before post processing with %d (%zu) vertices\n", newVertices, LargePoly->_Vertices.size());
    for (int v = 0; v < newVertices; v++)
    {
        printf("Vertex %d : (%.3f,%.3f)\n", v, LargePoly->_Vertices[v].x, LargePoly->_Vertices[v].y);
    }
#endif
    //  After this step, remove vertices which are inside the polygon.
    //  The edges should never intersect
    int modified = true;
    Point Intersection;
    while ( modified )
    {
        modified = false;
        for (int i = 0; i < newVertices - 2; i++)
        {
            Segment AiBi = Segment(LargePoly->_Vertices[i], LargePoly->_Vertices[i+1]);
            for ( int j = i+2; j < newVertices - 1; j++)
            {
                if ( j == newVertices-2 && i == 0 ) break;      //  Do not check this case, last segment will always intersect first one !
                Segment AjBj = Segment(LargePoly->_Vertices[j],LargePoly->_Vertices[j+1]);
                if ( AiBi.isCrossing(&AjBj, &Intersection))
                {
                //  The two segments are crossing
                //  First change Bi to Intersection
#if DEBUG_CONSOLE > 0
                    printf("Intersection detected between segment %d (%.3f,%.3f -- %.3f,%.3f) and segment %d (%.3f,%.3f -- %.3f,%.3f)\n",
                                i, LargePoly->_Vertices[i].x, LargePoly->_Vertices[i].y, LargePoly->_Vertices[i+1].x, LargePoly->_Vertices[i+1].y,
                                j, LargePoly->_Vertices[j].x, LargePoly->_Vertices[j].y, LargePoly->_Vertices[j+1].x, LargePoly->_Vertices[j+1].y);
                    printf("Changing end of segment to intersection point (%.3f,%.3f)\n", Intersection.x, Intersection.y);
#endif
                //  Build 2 polygons, first one contains segments between i+1 (modified to intersection) and j also modified as intersection
                //  The second one contains all other points
                    Polygon *Poly1 = new Polygon;
                    Polygon *Poly2 = new Polygon;
                    for ( int k = 0; k < newVertices; k++)
                    {
                        if ( k < i || k > j )
                        {
                            Poly1->addVertice(LargePoly->_Vertices[k]);
                        }
                        else if ( k == i )
                        {
                            Poly1->addVertice(LargePoly->_Vertices[k]);
                            Poly1->addVertice(Intersection);
                        }
                        else if ( k == i+1 )
                        {
                            Poly2->addVertice(Intersection);
                            Poly2->addVertice(LargePoly->_Vertices[k]);
                        }
                        else if ( k < j )
                        {
                            Poly2->addVertice(LargePoly->_Vertices[k]);
                        }
                        else
                        {
                            Poly2->addVertice(LargePoly->_Vertices[k]);
                            Poly2->addVertice(Intersection);
                        }
                    }
                    //  Keep the largest one
                    double area1 = fabs(Poly1->area());
                    double area2 = fabs(Poly2->area());
                    if ( area1 > area2 )
                    {
#if DEBUG_CONSOLE > 0
                        printf("Area1 = %.3f, Area2 = %.3f, keep polygon1", area1, area2);
#endif
                        delete Poly2;
                        delete LargePoly;
                        LargePoly = Poly1;
                    }
                    else
                    {
#if DEBUG_CONSOLE > 0
                        printf("Area1 = %.3f, Area2 = %.3f, keep polygon2", area1, area2);
#endif
                        delete Poly1;
                        delete LargePoly;
                        LargePoly = Poly2;
                    }
                    newVertices = LargePoly->_Vertices.size();
                    modified = true;
                    break;
                }
            }
            if ( modified ) break;
        }

    }
    for (int i = 0; i < newVertices; i++)
    {
        if ( isInPoly(&LargePoly->_Vertices[i]) > 0 || distance(LargePoly->_Vertices[i]) < Diff - precision )
        {
            // Inside poly or too close, delete vertex
            LargePoly->delVertex(i);
            newVertices = LargePoly->nVertices;
        }
    }

    LargePoly->CheckClosed();
    LargePoly->ReCalcArea();
#if DEBUG_CONSOLE > 0
    Rectangle BBox = LargePoly->GetBoundingBox();
    printf("After postprocessing, %d vertices, area = %.3f, Bounding box (%.3f,%.3f) - (%.3f,%.3f), closed = %d\n",
        LargePoly->nVertices, LargePoly->area(), BBox.A.x, BBox.A.y, BBox.B.x, BBox.B.y, LargePoly->isClosed());
#endif
    return(LargePoly);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movsd %xmm0, 0x58(%rsp)
movq %rdi, %r13
movl $0xc0, %edi
callq 0x7440
movq %rax, %rbx
leaq 0x2a174(%rip), %rax     # 0x50ca0
movq %rax, (%rbx)
leaq 0x10(%rbx), %rdi
xorl %ebp, %ebp
movl %ebp, 0x8(%rbx)
movl $0x8c, %edx
xorl %esi, %esi
callq 0x7270
xorpd %xmm3, %xmm3
movupd %xmm3, 0xb0(%rbx)
movl $0x1, 0x9c(%rbx)
incq 0x2ae9f(%rip)           # 0x51a00
movsd 0x174f7(%rip), %xmm0    # 0x3e060
incq 0x2aec0(%rip)           # 0x51a30
movupd %xmm0, 0xa0(%rbx)
movq %rbx, 0x8(%rsp)
movl %ebp, 0xc(%rbx)
cmpl $0x2, 0x8(%r13)
movq %r13, 0x50(%rsp)
jl 0x26f97
movsd 0x15470(%rip), %xmm0    # 0x3c008
movsd 0x15468(%rip), %xmm1    # 0x3c008
movl $0x18, %ebx
xorl %r15d, %r15d
movapd 0x1750f(%rip), %xmm9    # 0x3e0c0
leaq 0xb0(%rsp), %r12
xorl %r14d, %r14d
movq %r13, %rcx
xorl %r13d, %r13d
xorl %ebp, %ebp
movapd %xmm1, 0xa0(%rsp)
movapd %xmm0, 0x80(%rsp)
movapd %xmm0, %xmm11
movapd %xmm1, %xmm12
movq 0x10(%rcx), %rax
movsd -0x18(%rax,%rbx), %xmm1
movsd -0x10(%rax,%rbx), %xmm0
movsd (%rax,%rbx), %xmm4
movapd %xmm0, %xmm10
subsd %xmm4, %xmm10
movsd -0x8(%rax,%rbx), %xmm2
movapd %xmm2, %xmm8
subsd %xmm1, %xmm8
movapd %xmm0, %xmm3
mulsd %xmm2, %xmm3
movapd %xmm1, %xmm5
mulsd %xmm4, %xmm5
subsd %xmm3, %xmm5
movapd %xmm8, %xmm3
mulsd %xmm8, %xmm3
movapd %xmm10, %xmm6
mulsd %xmm10, %xmm6
addsd %xmm6, %xmm3
sqrtsd %xmm3, %xmm7
mulsd 0x58(%rsp), %xmm7
addsd %xmm5, %xmm7
movapd %xmm8, %xmm3
xorpd %xmm9, %xmm3
movapd %xmm10, %xmm13
xorpd %xmm9, %xmm13
mulsd %xmm8, %xmm3
subsd %xmm6, %xmm3
movapd %xmm3, %xmm5
andpd 0x173be(%rip), %xmm5    # 0x3e030
movsd 0x173e6(%rip), %xmm6    # 0x3e060
ucomisd %xmm5, %xmm6
movapd %xmm10, 0x40(%rsp)
movapd %xmm7, 0x10(%rsp)
movapd %xmm8, 0x20(%rsp)
jbe 0x26cee
leaq 0x18632(%rip), %rdi     # 0x3f2cd
movapd %xmm11, 0x70(%rsp)
movapd %xmm12, 0x60(%rsp)
movapd %xmm13, 0x90(%rsp)
callq 0x70b0
movapd 0x90(%rsp), %xmm13
movapd 0x60(%rsp), %xmm12
movapd 0x70(%rsp), %xmm11
movapd 0x40(%rsp), %xmm10
movapd 0x20(%rsp), %xmm8
movapd 0x10(%rsp), %xmm7
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd %xmm0, %xmm4
jmp 0x26d65
mulsd %xmm13, %xmm4
mulsd %xmm8, %xmm2
addsd %xmm4, %xmm2
mulsd %xmm13, %xmm0
mulsd %xmm8, %xmm1
addsd %xmm0, %xmm1
movapd %xmm7, %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
xorpd %xmm9, %xmm1
movapd %xmm7, %xmm5
unpcklpd %xmm2, %xmm5            # xmm5 = xmm5[0],xmm2[0]
xorpd %xmm9, %xmm2
mulsd %xmm8, %xmm2
movapd %xmm8, %xmm4
unpcklpd %xmm8, %xmm4            # xmm4 = xmm4[0],xmm8[0]
unpcklpd %xmm7, %xmm1            # xmm1 = xmm1[0],xmm7[0]
mulpd %xmm4, %xmm1
movapd %xmm10, %xmm4
unpcklpd %xmm10, %xmm4           # xmm4 = xmm4[0],xmm10[0]
mulpd %xmm4, %xmm0
addpd %xmm1, %xmm0
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
divpd %xmm3, %xmm0
movsd %xmm2, %xmm1            # xmm1 = xmm2[0],xmm1[1]
mulpd %xmm5, %xmm4
addpd %xmm1, %xmm4
divpd %xmm3, %xmm4
movapd %xmm0, %xmm1
subpd %xmm4, %xmm1
movapd %xmm1, %xmm2
mulpd %xmm1, %xmm2
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
movapd %xmm1, %xmm3
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
sqrtsd %xmm3, %xmm3
movsd 0x58(%rsp), %xmm2
divsd %xmm3, %xmm2
movapd %xmm4, %xmm3
subpd %xmm0, %xmm3
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm2, %xmm1
addpd %xmm0, %xmm1
movapd %xmm1, 0x30(%rsp)
mulpd %xmm3, %xmm2
addpd %xmm4, %xmm2
movapd %xmm2, 0xb0(%rsp)
movapd %xmm2, %xmm0
minpd %xmm1, %xmm0
movapd %xmm2, %xmm3
maxpd %xmm1, %xmm2
movapd %xmm1, %xmm4
cmpunordpd %xmm1, %xmm4
movapd %xmm4, %xmm5
andnpd %xmm0, %xmm5
andpd %xmm4, %xmm3
orpd %xmm3, %xmm5
addpd 0x172f1(%rip), %xmm5    # 0x3e0e0
andnpd %xmm2, %xmm4
orpd %xmm3, %xmm4
addpd 0x172d1(%rip), %xmm4    # 0x3e0d0
testb $0x1, %r13b
movapd %xmm4, 0x70(%rsp)
movapd %xmm5, 0x60(%rsp)
je 0x26e62
mulsd %xmm11, %xmm13
movapd %xmm12, %xmm1
mulsd %xmm8, %xmm1
addsd %xmm13, %xmm1
movapd %xmm1, %xmm0
andpd 0x171ff(%rip), %xmm0    # 0x3e030
movsd 0x17227(%rip), %xmm2    # 0x3e060
ucomisd %xmm0, %xmm2
movq 0x50(%rsp), %r13
jbe 0x26e9d
leaq 0x18482(%rip), %rdi     # 0x3f2cd
callq 0x70b0
movapd 0x60(%rsp), %xmm5
movapd 0x70(%rsp), %xmm4
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
jmp 0x26ecf
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x26468
movaps 0x20(%rsp), %xmm0
unpcklpd 0x10(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movaps %xmm0, 0x80(%rsp)
movapd 0x40(%rsp), %xmm0
movapd %xmm0, 0xa0(%rsp)
movq 0x50(%rsp), %r13
jmp 0x26f13
movapd %xmm11, %xmm0
shufpd $0x1, %xmm12, %xmm0     # xmm0 = xmm0[1],xmm12[0]
movapd %xmm8, %xmm2
unpcklpd %xmm7, %xmm2            # xmm2 = xmm2[0],xmm7[0]
mulpd %xmm0, %xmm2
movapd %xmm7, %xmm0
unpcklpd %xmm10, %xmm0           # xmm0 = xmm0[0],xmm10[0]
mulpd %xmm11, %xmm0
subpd %xmm2, %xmm0
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
divpd %xmm1, %xmm0
movapd %xmm0, %xmm1
cmpltpd %xmm5, %xmm1
movapd %xmm4, %xmm2
cmpltpd %xmm0, %xmm2
shufps $0x88, %xmm1, %xmm2     # xmm2 = xmm2[0,2],xmm1[0,2]
movmskps %xmm2, %eax
testl %eax, %eax
je 0x26f00
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x26468
jmp 0x26f13
movslq %ebp, %rax
shlq $0x4, %rax
movupd %xmm0, -0x10(%r15,%rax)
movq 0x8(%rsp), %rbp
incq %r14
movq %rbp, %rdi
movq %r12, %rsi
callq 0x26468
movq 0x10(%rbp), %r15
movq 0x18(%rbp), %rbp
subq %r15, %rbp
shrq $0x4, %rbp
movslq 0x8(%r13), %rax
decq %rax
movapd 0x20(%rsp), %xmm6
movapd %xmm6, %xmm11
movapd 0x10(%rsp), %xmm3
unpcklpd %xmm3, %xmm11           # xmm11 = xmm11[0],xmm3[0]
addq $0x10, %rbx
movq %r13, %rcx
movb $0x1, %r13b
cmpq %rax, %r14
movapd 0x1715d(%rip), %xmm9    # 0x3e0c0
movapd 0x40(%rsp), %xmm1
jl 0x26bdb
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
movq %rcx, %r13
movapd 0x80(%rsp), %xmm4
movapd 0xa0(%rsp), %xmm5
movapd 0x70(%rsp), %xmm7
movapd 0x60(%rsp), %xmm8
jmp 0x26fc3
movsd 0x15069(%rip), %xmm5    # 0x3c008
unpcklpd %xmm5, %xmm3            # xmm3 = xmm3[0],xmm5[0]
movapd 0x17125(%rip), %xmm7    # 0x3e0d0
movapd 0x1712c(%rip), %xmm8    # 0x3e0e0
movsd 0x1504c(%rip), %xmm4    # 0x3c008
xorl %r15d, %r15d
movapd %xmm5, %xmm6
movapd %xmm3, %xmm1
unpckhpd %xmm3, %xmm1            # xmm1 = xmm1[1],xmm3[1]
mulsd %xmm4, %xmm1
movapd %xmm5, %xmm0
mulsd %xmm6, %xmm0
subsd %xmm1, %xmm0
movapd 0x1704d(%rip), %xmm1    # 0x3e030
andpd %xmm0, %xmm1
movsd 0x17071(%rip), %xmm2    # 0x3e060
ucomisd %xmm1, %xmm2
ja 0x27058
movapd %xmm4, %xmm1
shufpd $0x1, %xmm5, %xmm1      # xmm1 = xmm1[1],xmm5[0]
unpcklpd %xmm3, %xmm6            # xmm6 = xmm6[0],xmm3[0]
mulpd %xmm1, %xmm6
mulpd %xmm4, %xmm3
subpd %xmm6, %xmm3
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm3
movapd %xmm3, %xmm0
cmpltpd %xmm8, %xmm0
movmskpd %xmm0, %eax
testb $0x1, %al
jne 0x27058
cmpltpd %xmm3, %xmm7
movmskpd %xmm7, %ecx
testb $0x1, %cl
jne 0x27058
shrb %al
jne 0x27058
shrb %cl
jne 0x27058
movslq %ebp, %rax
shlq $0x4, %rax
movupd %xmm3, -0x10(%r15,%rax)
movupd %xmm3, (%r15)
movq 0x8(%rsp), %rbx
jmp 0x27077
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x26468
movq 0x10(%rbx), %r15
movq 0x18(%rbx), %rbp
subq %r15, %rbp
shrq $0x4, %rbp
movslq 0x8(%rbx), %rax
shlq $0x4, %rax
movsd 0x8(%r15), %xmm0
movsd -0x8(%r15,%rax), %xmm1
movsd -0x10(%r15,%rax), %xmm2
movsd (%r15), %xmm3
cmpeqpd %xmm2, %xmm3
cmpeqpd %xmm0, %xmm1
andpd %xmm3, %xmm1
movd %xmm1, %eax
andl $0x1, %eax
movl %eax, 0x98(%rbx)
movq %rbx, %rdi
callq 0x276c8
xorpd %xmm0, %xmm0
leaq 0x30(%rsp), %rax
movapd %xmm0, (%rax)
xorpd %xmm1, %xmm1
movhpd 0x8(%rax), %xmm1        # xmm1 = xmm1[0],mem[0]
xorpd %xmm0, %xmm0
cmpl $0x3, %ebp
setge %r12b
jl 0x275e6
leal -0x2(%rbp), %eax
movslq %eax, %rcx
leal -0x1(%rbp), %edx
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movapd %xmm1, 0x20(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsi), %rsi
leaq 0x30(%rsi), %rdi
movl %ebp, %r8d
negl %r8d
xorl %r9d, %r9d
movq %r9, %rbx
movq %r9, %r11
shlq $0x4, %r11
incq %r9
movq %r9, %r14
shlq $0x4, %r14
movupd (%rsi,%r11), %xmm5
movupd (%rsi,%r14), %xmm0
movapd %xmm5, %xmm1
cmpunordpd %xmm5, %xmm1
movapd %xmm0, %xmm3
andpd %xmm1, %xmm3
movapd %xmm0, %xmm4
minpd %xmm5, %xmm4
movapd %xmm1, %xmm2
andnpd %xmm4, %xmm2
orpd %xmm3, %xmm2
addpd 0x16f88(%rip), %xmm2    # 0x3e0e0
movapd %xmm0, %xmm4
maxpd %xmm5, %xmm4
andnpd %xmm4, %xmm1
orpd %xmm3, %xmm1
addpd 0x16f60(%rip), %xmm1    # 0x3e0d0
leal 0x2(%rbx), %r10d
cmpl %edx, %r10d
jge 0x27359
movq %r14, 0x70(%rsp)
movq %r11, 0x40(%rsp)
movapd %xmm5, %xmm6
unpckhpd %xmm5, %xmm6            # xmm6 = xmm6[1],xmm5[1]
movapd %xmm0, %xmm7
unpckhpd %xmm0, %xmm7            # xmm7 = xmm7[1],xmm0[1]
movapd %xmm6, %xmm4
subsd %xmm7, %xmm4
movapd %xmm4, 0x10(%rsp)
xorpd 0x16f13(%rip), %xmm4    # 0x3e0c0
mulsd %xmm0, %xmm6
subpd %xmm5, %xmm0
mulsd %xmm5, %xmm7
subsd %xmm6, %xmm7
movl %r10d, %r15d
movapd %xmm0, %xmm5
unpcklpd %xmm7, %xmm5            # xmm5 = xmm5[0],xmm7[0]
movq %rdi, %r10
testq %rbx, %rbx
jne 0x271d9
cmpq %r15, %rax
je 0x27359
movupd -0x10(%r10), %xmm8
movupd (%r10), %xmm9
movapd %xmm9, %xmm10
minpd %xmm8, %xmm10
movapd %xmm8, %xmm6
cmpunordpd %xmm8, %xmm6
movapd %xmm6, %xmm7
andnpd %xmm10, %xmm7
movapd %xmm9, %xmm10
andpd %xmm6, %xmm10
orpd %xmm10, %xmm7
addpd 0x16ec7(%rip), %xmm7    # 0x3e0e0
movapd %xmm9, %xmm11
maxpd %xmm8, %xmm11
andnpd %xmm11, %xmm6
orpd %xmm10, %xmm6
addpd 0x16e9b(%rip), %xmm6    # 0x3e0d0
movapd %xmm8, %xmm13
unpckhpd %xmm8, %xmm13           # xmm13 = xmm13[1],xmm8[1]
movapd %xmm9, %xmm14
unpckhpd %xmm9, %xmm14           # xmm14 = xmm14[1],xmm9[1]
movapd %xmm13, %xmm12
subsd %xmm14, %xmm12
movapd %xmm9, %xmm10
subpd %xmm8, %xmm10
movapd %xmm10, %xmm15
mulsd %xmm4, %xmm15
movapd %xmm12, %xmm11
mulsd %xmm0, %xmm11
addsd %xmm15, %xmm11
movapd %xmm11, %xmm15
andpd 0x16dac(%rip), %xmm15   # 0x3e030
movsd 0x16dd4(%rip), %xmm3    # 0x3e060
ucomisd %xmm15, %xmm3
ja 0x27344
mulsd %xmm9, %xmm13
mulsd %xmm14, %xmm8
subsd %xmm13, %xmm8
movapd %xmm5, %xmm9
shufpd $0x1, %xmm8, %xmm9      # xmm9 = xmm9[1],xmm8[0]
unpcklpd %xmm12, %xmm8           # xmm8 = xmm8[0],xmm12[0]
mulpd %xmm5, %xmm8
unpcklpd 0x10(%rsp), %xmm10      # xmm10 = xmm10[0],mem[0]
mulpd %xmm9, %xmm10
subpd %xmm8, %xmm10
unpcklpd %xmm11, %xmm11          # xmm11 = xmm11[0,0]
divpd %xmm11, %xmm10
movapd %xmm10, %xmm8
cmpltpd %xmm2, %xmm8
movmskpd %xmm8, %r11d
testb $0x1, %r11b
movapd %xmm10, 0x20(%rsp)
jne 0x27344
movapd %xmm1, %xmm8
cmpltpd %xmm10, %xmm8
movmskpd %xmm8, %r14d
testb $0x1, %r14b
jne 0x27344
shrb %r11b
jne 0x27344
shrb %r14b
jne 0x27344
movapd %xmm10, %xmm8
cmpltpd %xmm7, %xmm8
movmskpd %xmm8, %r11d
testb $0x1, %r11b
jne 0x27344
cmpltpd %xmm10, %xmm6
movmskpd %xmm6, %r14d
testb $0x1, %r14b
jne 0x27344
shrb %r11b
jne 0x27344
shrb %r14b
je 0x2736f
incq %r15
addq $0x10, %r10
leal (%r8,%r15), %r11d
cmpl $-0x1, %r11d
jne 0x271cb
addq $0x10, %rdi
cmpq %rcx, %r9
setl %r12b
jl 0x2710b
jmp 0x275ec
movb %r12b, 0x80(%rsp)
movapd %xmm10, 0x30(%rsp)
movl $0xc0, %edi
callq 0x7440
movq %rax, %r14
leaq 0x2990e(%rip), %rax     # 0x50ca0
movq %rax, (%r14)
leaq 0x10(%r14), %rdi
xorl %eax, %eax
movl %eax, 0x8(%r14)
xorl %r12d, %r12d
movl $0x8c, %edx
xorl %esi, %esi
callq 0x7270
xorpd %xmm0, %xmm0
movupd %xmm0, 0xb0(%r14)
movl $0x1, %eax
movl %eax, 0x9c(%r14)
movsd 0x16c91(%rip), %xmm0    # 0x3e060
movups %xmm0, 0xa0(%r14)
movq %r14, 0x10(%rsp)
movl %r12d, 0xc(%r14)
movq 0x2a619(%rip), %r14     # 0x51a00
leaq 0x1(%r14), %rax
movq %rax, 0x2a60e(%rip)     # 0x51a00
movq 0x2a637(%rip), %r13     # 0x51a30
leaq 0x1(%r13), %rax
movq %rax, 0x2a62c(%rip)     # 0x51a30
movl $0xc0, %edi
callq 0x7440
movq %rax, %r12
leaq 0x29888(%rip), %rax     # 0x50ca0
movq %rax, (%r12)
leaq 0x10(%r12), %rdi
xorl %eax, %eax
movl %eax, 0x8(%r12)
movl $0x8c, %edx
xorl %esi, %esi
callq 0x7270
xorps %xmm0, %xmm0
movups %xmm0, 0xb0(%r12)
movl $0x1, %eax
movl %eax, 0x9c(%r12)
movsd 0x16c0b(%rip), %xmm0    # 0x3e060
movupd %xmm0, 0xa0(%r12)
xorl %eax, %eax
movl %eax, 0xc(%r12)
addq $0x2, %r14
movq %r14, 0x2a58f(%rip)     # 0x51a00
addq $0x2, %r13
movq %r13, 0x2a5b4(%rip)     # 0x51a30
movl %r15d, %r15d
movl %ebp, %ebp
leaq 0x1(%rbx), %rax
movq %rax, 0x90(%rsp)
movq $-0x10, %r14
xorl %r13d, %r13d
movq %rbp, 0x60(%rsp)
cmpq %rbx, %r13
jb 0x274e1
cmpq %r15, %r13
ja 0x274e1
cmpq %r13, %rbx
jne 0x2750a
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
addq 0x40(%rsp), %rsi
movq %r12, %rbp
movq %r15, %r12
movq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x26468
movq %r15, %rdi
movq %r12, %r15
movq %rbp, %r12
movq 0x60(%rsp), %rbp
leaq 0x30(%rsp), %rsi
jmp 0x274f7
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
leaq (%rax,%r14), %rsi
addq $0x10, %rsi
movq 0x10(%rsp), %rdi
callq 0x26468
incq %r13
addq $0x10, %r14
cmpq %r13, %rbp
jne 0x2749c
jmp 0x27557
cmpq %r13, 0x90(%rsp)
jne 0x27534
movq %r12, %rdi
leaq 0x30(%rsp), %rsi
callq 0x26468
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
addq 0x70(%rsp), %rsi
movq %r12, %rdi
jmp 0x274f7
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
leaq (%rax,%r14), %rsi
addq $0x10, %rsi
movq %r12, %rdi
callq 0x26468
cmpq %r15, %r13
jb 0x274fc
movq %r12, %rdi
jmp 0x274da
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x266bc
movapd %xmm0, %xmm1
movapd 0x16ac0(%rip), %xmm0    # 0x3e030
andpd %xmm0, %xmm1
movapd %xmm1, 0x40(%rsp)
movq %r12, %rdi
callq 0x266bc
andpd 0x16aa6(%rip), %xmm0    # 0x3e030
movapd 0x40(%rsp), %xmm1
ucomisd %xmm0, %xmm1
movq %rbx, %rdi
cmovaq %r12, %rdi
cmovaq %rbx, %r12
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x18(%r12), %rbp
subq 0x10(%r12), %rbp
shrq $0x4, %rbp
movapd 0x20(%rsp), %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
movq %r12, 0x8(%rsp)
testb $0x1, 0x80(%rsp)
movq 0x50(%rsp), %r13
jne 0x270d5
jmp 0x275fd
movapd %xmm1, 0x20(%rsp)
movapd 0x20(%rsp), %xmm0
movapd %xmm0, 0x30(%rsp)
movq 0x8(%rsp), %r12
testl %ebp, %ebp
jle 0x2765e
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x10(%r12), %r15
addq %rbx, %r15
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x27772
testl %eax, %eax
jg 0x2763f
movq %r13, %rdi
movq %r15, %rsi
callq 0x26764
movsd 0x58(%rsp), %xmm1
subsd 0xa0(%r13), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2764f
movq %r12, %rdi
movl %r14d, %esi
callq 0x27ba8
movl 0x8(%r12), %ebp
incq %r14
movslq %ebp, %rax
addq $0x10, %rbx
cmpq %rax, %r14
jl 0x27606
movq 0x10(%r12), %rax
movslq 0x8(%r12), %rcx
shlq $0x4, %rcx
movsd 0x8(%rax), %xmm0
movsd -0x8(%rax,%rcx), %xmm1
movsd -0x10(%rax,%rcx), %xmm2
movsd (%rax), %xmm3
cmpeqpd %xmm2, %xmm3
cmpeqpd %xmm0, %xmm1
andpd %xmm3, %xmm1
movd %xmm1, %eax
andl $0x1, %eax
movl %eax, 0x98(%r12)
movl $0x1, 0x9c(%r12)
movq %r12, %rdi
callq 0x266bc
movq %r12, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop