// File: XuhuiSun95[P]My-OpenGL/primitive.cpp
// Function: surfaceCheck(std::vector<pixel, std::allocator<pixel>>)
void surfaceCheck(vector<pixel> pointList){
    vector<line> edgeList;
    vector<pixel>::iterator it=pointList.begin();
    double xmin = it -> x, xmax = it -> x, ymin = it -> y, ymax = it -> y, zvalueAverage = it -> zDepth;
    for (; it != pointList.end() - 1; it++){
        line e(*it, *(it + 1));
        edgeList.push_back(e);
        lineCheck(*it, *(it + 1));
        if(it -> x < xmin)	xmin = it -> x;
        if(it -> x > xmax)	xmax = it -> x;
        if(it -> y < ymin)	ymin = it -> y;
        if(it -> y > ymax)	ymax = it -> y;
        zvalueAverage += it -> zDepth;
    }
    it = pointList.end() - 1;
    if(it -> x < xmin)	xmin = it -> x;
    if(it -> x > xmax)	xmax = it -> x;
    if(it -> y < ymin)	ymin = it -> y;
    if(it -> y > ymax)	ymax = it -> y;
    line e(*(pointList.end()-1), *pointList.begin());
    edgeList.push_back(e);
    lineCheck(*(pointList.end()-1), *pointList.begin());
    zvalueAverage /= pointList.size();
    int numLine = (ymax - ymin) / (frustumTop - frustumBottom) * dimy;
    double xInc = (frustumRight - frustumLeft) / dimx, yInc = (frustumTop - frustumBottom) / dimy, x, y, x1, y1, x2, y2;
    vector<pixel> insecPoint;
    pixel pleft, pright;
    double x_1 = pointList[0].x;
    double y_1 = pointList[0].y;
    double z_1 = pointList[0].zDepth;
    double x_2 = pointList[1].x;
    double y_2 = pointList[1].y;
    double z_2 = pointList[1].zDepth;
    double x_3 = pointList[2].x;
    double y_3 = pointList[2].y;
    double z_3 = pointList[2].zDepth;
    double xvalue = x_1 * y_2 - x_2 * y_1 - x_1 * y_3 + x_3 * y_1 + x_2 * y_3 - x_3 * y_2;
    double avalue, bvalue, cvalue;
    if(xvalue != 0){
        avalue = - (y_1 * z_2 - y_2 * z_1 - y_1 * z_3 + y_3 * z_1 + y_2 * z_3 - y_3 * z_2) / xvalue;
        bvalue = (x_1 * z_2 - x_2 * z_1 - x_1 * z_3 + x_3 * z_1 + x_2 * z_3 - x_3 * z_2) / xvalue;
        cvalue = (x_1 * y_2 * z_3 - x_1 * y_3 * z_2 - x_2 * y_1 * z_3 + x_2 * y_3 * z_1 + x_3 * y_1 * z_2 - x_3 * y_2 * z_1) / xvalue;
    }
    for(int i = 1; i < numLine; i++){
        insecPoint.clear();
        y = ymin + yInc * i;
        for(vector<line>::iterator it = edgeList.begin(); it != edgeList.end(); it++){
            x1 = it -> p1.x;
            x2 = it -> p2.x;
            y1 = it -> p1.y;
            y2 = it -> p2.y;
            if((y >= y1 && y <= y2) || (y <= y1 && y >= y2)){
                x = (x2 - x1) / (y2 - y1) * (y - y1) + x1;
                insecPoint.push_back(pixel(x, y, 1));
            }
        }
        sort(insecPoint.begin(), insecPoint.end());
        for(int i = 0; i < insecPoint.size() - 1; i++){
            if(fabs(insecPoint[i].x - insecPoint[i+1].x) <= xInc)
                insecPoint.erase(insecPoint.begin()+i+1);
        }
        for(int i = 0; i < insecPoint.size() / 2; i++){
            pleft = insecPoint[2*i];
            pright = insecPoint[2*i + 1];
            x = pleft.x;
            int pxleft  = round(dimx / 2 + dimx / (frustumRight - frustumLeft) * pleft.x);
            int pxright  = round(dimx / 2 + dimx / (frustumRight - frustumLeft) * pright.x);
            while(x < pright.x){
                x += xInc;
                int px = round(dimx / 2 + dimx / (frustumRight - frustumLeft) * x);
                int py = round(dimy / 2 - dimy / (frustumTop - frustumBottom) * y);
                double zDepth = -100;
                if(xvalue != 0)
                    zDepth = avalue * x + bvalue * y + cvalue;
                if(px < (pxright - 1) && px > (pxleft + 1))
                    hidenSurface(px, py, zDepth);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x410, %rsp            # imm = 0x410
movq %rdi, -0x3a0(%rbp)
movq %rdi, -0x8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xb4e0
movq -0x3a0(%rbp), %rdi
callq 0x5ed0
movq %rax, -0x28(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x3a0(%rbp), %rdi
callq 0x5f00
movq %rax, -0x60(%rbp)
leaq -0x60(%rbp), %rdi
movl $0x1, %esi
callq 0x73f0
movq %rax, -0x58(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x8160
testb $0x1, %al
jne 0xa2a4
jmp 0xa4ec
leaq -0x28(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
callq 0x7430
movq -0x3a8(%rbp), %rdi
movq 0x10(%rax), %rcx
movq %rcx, -0xa0(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0xb0(%rbp)
movl $0x1, %esi
callq 0x7b80
movq %rax, -0xd8(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x7430
movq 0x10(%rax), %rcx
movq %rcx, -0xc0(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0xd0(%rbp)
movq -0xc0(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x28(%rax)
movaps -0xd0(%rbp), %xmm0
movups %xmm0, 0x18(%rax)
movq -0xa0(%rbp), %rcx
movq %rcx, 0x10(%rax)
movaps -0xb0(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x90(%rbp), %rdi
callq 0xb520
jmp 0xa33e
leaq -0x20(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xb570
jmp 0xa350
leaq -0x28(%rbp), %rdi
callq 0x7430
movq (%rax), %rcx
movq %rcx, -0x100(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0xf8(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0xf0(%rbp)
leaq -0x28(%rbp), %rdi
movl $0x1, %esi
callq 0x7b80
movq %rax, -0x120(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x7430
movq (%rax), %rcx
movq %rcx, -0x118(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x110(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x108(%rbp)
leaq -0x100(%rbp), %rcx
leaq -0x118(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, (%rsp)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rsp)
movq (%rax), %rcx
movq %rcx, 0x18(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x20(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x28(%rsp)
callq 0x9e80
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd (%rax), %xmm1
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xa443
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0xa443
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
jmp 0xb3b8
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd (%rax), %xmm0
ucomisd -0x38(%rbp), %xmm0
jbe 0xa469
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd 0x8(%rax), %xmm1
movsd -0x40(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xa495
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd 0x8(%rax), %xmm0
ucomisd -0x48(%rbp), %xmm0
jbe 0xa4bd
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd 0x10(%rax), %xmm0
addsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
leaq -0x28(%rbp), %rdi
xorl %esi, %esi
callq 0xb5e0
movq %rax, -0x128(%rbp)
jmp 0xa26c
movq -0x3a0(%rbp), %rdi
callq 0x5f00
movq %rax, -0x138(%rbp)
leaq -0x138(%rbp), %rdi
movl $0x1, %esi
callq 0x73f0
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd (%rax), %xmm1
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xa54c
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd (%rax), %xmm0
ucomisd -0x38(%rbp), %xmm0
jbe 0xa572
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd 0x8(%rax), %xmm1
movsd -0x40(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xa59e
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd 0x8(%rax), %xmm0
ucomisd -0x48(%rbp), %xmm0
jbe 0xa5c6
leaq -0x28(%rbp), %rdi
callq 0xb500
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x3a0(%rbp), %rdi
callq 0x5f00
movq %rax, -0x190(%rbp)
leaq -0x190(%rbp), %rdi
movl $0x1, %esi
callq 0x73f0
movq %rax, -0x188(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x7430
movq -0x3a0(%rbp), %rdi
movq 0x10(%rax), %rcx
movq %rcx, -0x170(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x180(%rbp)
callq 0x5ed0
movq %rax, -0x1b8(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x7430
movq 0x10(%rax), %rcx
movq %rcx, -0x1a0(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x1b0(%rbp)
movq -0x1a0(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x28(%rax)
movaps -0x1b0(%rbp), %xmm0
movups %xmm0, 0x18(%rax)
movq -0x170(%rbp), %rcx
movq %rcx, 0x10(%rax)
movaps -0x180(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x168(%rbp), %rdi
callq 0xb520
jmp 0xa682
leaq -0x20(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0xb570
jmp 0xa694
movq -0x3a0(%rbp), %rdi
callq 0x5f00
movq %rax, -0x1e0(%rbp)
leaq -0x1e0(%rbp), %rdi
movl $0x1, %esi
callq 0x73f0
movq %rax, -0x1d8(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x7430
movq -0x3a0(%rbp), %rdi
movq 0x10(%rax), %rcx
movq %rcx, -0x1c0(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x1d0(%rbp)
callq 0x5ed0
movq %rax, -0x208(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x7430
movq 0x10(%rax), %rcx
movq %rcx, -0x1f0(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x200(%rbp)
movq -0x1f0(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x28(%rax)
movaps -0x200(%rbp), %xmm0
movups %xmm0, 0x18(%rax)
movq -0x1c0(%rbp), %rcx
movq %rcx, 0x10(%rax)
movaps -0x1d0(%rbp), %xmm0
movups %xmm0, (%rax)
callq 0x9e80
movq -0x3a0(%rbp), %rdi
callq 0x70f0
movq %rax, %xmm1
movaps 0x3de1(%rip), %xmm0     # 0xe540
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x3de5(%rip), %xmm0     # 0xe550
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movsd -0x50(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x48(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd 0x9a7a(%rip), %xmm1     # 0x14218
movsd 0x9a6a(%rip), %xmm2     # 0x14210
subsd %xmm2, %xmm1
divsd %xmm1, %xmm0
cvtsi2sdl 0x9a96(%rip), %xmm1 # 0x1424c
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x20c(%rbp)
movsd 0x9a3c(%rip), %xmm0     # 0x14208
movsd 0x9a2c(%rip), %xmm1     # 0x14200
subsd %xmm1, %xmm0
cvtsi2sdl 0x9a68(%rip), %xmm1 # 0x14248
divsd %xmm1, %xmm0
movsd %xmm0, -0x218(%rbp)
movsd 0x9a24(%rip), %xmm0     # 0x14218
movsd 0x9a14(%rip), %xmm1     # 0x14210
subsd %xmm1, %xmm0
cvtsi2sdl 0x9a44(%rip), %xmm1 # 0x1424c
divsd %xmm1, %xmm0
movsd %xmm0, -0x220(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x5ba0
leaq -0x280(%rbp), %rdi
callq 0xb620
jmp 0xa82e
leaq -0x298(%rbp), %rdi
callq 0xb620
jmp 0xa83c
movq -0x3a0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xb630
movq -0x3a0(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x2a0(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0xb630
movq -0x3a0(%rbp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x2a8(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0xb630
movq -0x3a0(%rbp), %rdi
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x2b0(%rbp)
movl $0x1, %esi
callq 0xb630
movq -0x3a0(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x2b8(%rbp)
movl $0x1, %esi
callq 0xb630
movq -0x3a0(%rbp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x2c0(%rbp)
movl $0x1, %esi
callq 0xb630
movq -0x3a0(%rbp), %rdi
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x2c8(%rbp)
movl $0x2, %esi
callq 0xb630
movq -0x3a0(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x2d0(%rbp)
movl $0x2, %esi
callq 0xb630
movq -0x3a0(%rbp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x2d8(%rbp)
movl $0x2, %esi
callq 0xb630
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x2e0(%rbp)
movsd -0x2a0(%rbp), %xmm0
movsd -0x2c0(%rbp), %xmm2
movsd -0x2b8(%rbp), %xmm1
mulsd -0x2a8(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd -0x2a0(%rbp), %xmm1
movsd -0x2d8(%rbp), %xmm2
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x2d0(%rbp), %xmm0
movsd -0x2a8(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd -0x2b8(%rbp), %xmm1
movsd -0x2d8(%rbp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x2d0(%rbp), %xmm0
movsd -0x2c0(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x2e8(%rbp)
movsd -0x2e8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xaa31
jp 0xaa31
jmp 0xad34
movsd -0x2a8(%rbp), %xmm0
movsd -0x2c8(%rbp), %xmm2
movsd -0x2c0(%rbp), %xmm1
mulsd -0x2b0(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd -0x2a8(%rbp), %xmm1
movsd -0x2e0(%rbp), %xmm2
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x2d8(%rbp), %xmm0
movsd -0x2b0(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd -0x2c0(%rbp), %xmm1
movsd -0x2e0(%rbp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x2d8(%rbp), %xmm0
movsd -0x2c8(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
divsd -0x2e8(%rbp), %xmm0
movsd %xmm0, -0x2f0(%rbp)
movsd -0x2a0(%rbp), %xmm0
movsd -0x2c8(%rbp), %xmm2
movsd -0x2b8(%rbp), %xmm1
mulsd -0x2b0(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd -0x2a0(%rbp), %xmm1
movsd -0x2e0(%rbp), %xmm2
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x2d0(%rbp), %xmm0
movsd -0x2b0(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd -0x2b8(%rbp), %xmm1
movsd -0x2e0(%rbp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x2d0(%rbp), %xmm0
movsd -0x2c8(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd -0x2e8(%rbp), %xmm0
movsd %xmm0, -0x2f8(%rbp)
movsd -0x2a0(%rbp), %xmm0
mulsd -0x2c0(%rbp), %xmm0
movsd -0x2e0(%rbp), %xmm2
movsd -0x2a0(%rbp), %xmm1
mulsd -0x2d8(%rbp), %xmm1
mulsd -0x2c8(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd -0x2b8(%rbp), %xmm1
mulsd -0x2a8(%rbp), %xmm1
movsd -0x2e0(%rbp), %xmm2
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x2b8(%rbp), %xmm0
mulsd -0x2d8(%rbp), %xmm0
movsd -0x2b0(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd -0x2d0(%rbp), %xmm1
mulsd -0x2a8(%rbp), %xmm1
movsd -0x2c8(%rbp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x2d0(%rbp), %xmm0
mulsd -0x2c0(%rbp), %xmm0
movsd -0x2b0(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd -0x2e8(%rbp), %xmm0
movsd %xmm0, -0x300(%rbp)
jmp 0xad34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x5de0
jmp 0xb3b8
movl $0x1, -0x304(%rbp)
movl -0x304(%rbp), %eax
cmpl -0x20c(%rbp), %eax
jge 0xb39a
leaq -0x268(%rbp), %rdi
callq 0xb650
movsd -0x40(%rbp), %xmm1
movsd -0x220(%rbp), %xmm0
cvtsi2sdl -0x304(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x230(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xb670
movq %rax, -0x310(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xb6e0
movq %rax, -0x318(%rbp)
leaq -0x310(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0xb6a0
testb $0x1, %al
jne 0xadbd
jmp 0xaf19
leaq -0x310(%rbp), %rdi
callq 0xb710
movsd (%rax), %xmm0
movsd %xmm0, -0x238(%rbp)
leaq -0x310(%rbp), %rdi
callq 0xb710
movsd 0x18(%rax), %xmm0
movsd %xmm0, -0x248(%rbp)
leaq -0x310(%rbp), %rdi
callq 0xb710
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x240(%rbp)
leaq -0x310(%rbp), %rdi
callq 0xb710
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x250(%rbp)
movsd -0x230(%rbp), %xmm0
ucomisd -0x240(%rbp), %xmm0
jb 0xae48
movsd -0x230(%rbp), %xmm1
movsd -0x250(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jae 0xae78
movsd -0x230(%rbp), %xmm1
movsd -0x240(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0xaefd
movsd -0x230(%rbp), %xmm0
ucomisd -0x250(%rbp), %xmm0
jb 0xaefd
movsd -0x248(%rbp), %xmm0
movsd -0x238(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd -0x250(%rbp), %xmm2
movsd -0x240(%rbp), %xmm3
subsd %xmm3, %xmm2
divsd %xmm2, %xmm0
movsd -0x230(%rbp), %xmm2
subsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x228(%rbp)
movsd -0x228(%rbp), %xmm0
movsd -0x230(%rbp), %xmm1
leaq -0x330(%rbp), %rdi
movsd 0x3161(%rip), %xmm2     # 0xe040
callq 0xb4a0
jmp 0xaee6
leaq -0x268(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0x5c80
jmp 0xaefb
jmp 0xaefd
jmp 0xaeff
leaq -0x310(%rbp), %rdi
xorl %esi, %esi
callq 0xb730
movq %rax, -0x338(%rbp)
jmp 0xad91
leaq -0x268(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0x5ed0
movq -0x3b0(%rbp), %rdi
movq %rax, -0x340(%rbp)
callq 0x5f00
movq %rax, -0x348(%rbp)
movq -0x340(%rbp), %rdi
movq -0x348(%rbp), %rsi
callq 0xb770
jmp 0xaf5b
movl $0x0, -0x34c(%rbp)
movslq -0x34c(%rbp), %rax
movq %rax, -0x3b8(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x70f0
movq %rax, %rcx
movq -0x3b8(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0xb095
movslq -0x34c(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0xb630
movsd (%rax), %xmm0
movsd %xmm0, -0x3c0(%rbp)
movl -0x34c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq -0x268(%rbp), %rdi
callq 0xb630
movsd -0x3c0(%rbp), %xmm1
subsd (%rax), %xmm1
movaps 0x3550(%rip), %xmm0     # 0xe530
pand %xmm0, %xmm1
movsd -0x218(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0xb07f
leaq -0x268(%rbp), %rdi
movq %rdi, -0x3d0(%rbp)
callq 0x5ed0
movq %rax, -0x370(%rbp)
movslq -0x34c(%rbp), %rsi
leaq -0x370(%rbp), %rdi
callq 0x7b80
movq %rax, -0x368(%rbp)
leaq -0x368(%rbp), %rdi
movl $0x1, %esi
callq 0x7b80
movq %rax, -0x360(%rbp)
leaq -0x358(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x5fe0
movq -0x3d0(%rbp), %rdi
movq -0x358(%rbp), %rsi
callq 0xb7b0
movq %rax, -0x3c8(%rbp)
jmp 0xb071
movq -0x3c8(%rbp), %rax
movq %rax, -0x378(%rbp)
jmp 0xb081
movl -0x34c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34c(%rbp)
jmp 0xaf65
movl $0x0, -0x37c(%rbp)
movslq -0x37c(%rbp), %rax
movq %rax, -0x3d8(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x70f0
movq %rax, %rcx
movq -0x3d8(%rbp), %rax
shrq %rcx
cmpq %rcx, %rax
jae 0xb384
movl -0x37c(%rbp), %eax
shll %eax
movslq %eax, %rsi
leaq -0x268(%rbp), %rdi
callq 0xb630
movq (%rax), %rcx
movq %rcx, -0x280(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x278(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x270(%rbp)
movl -0x37c(%rbp), %eax
shll %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq -0x268(%rbp), %rdi
callq 0xb630
movq (%rax), %rcx
movq %rcx, -0x298(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x290(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x288(%rbp)
movsd -0x280(%rbp), %xmm0
movsd %xmm0, -0x228(%rbp)
movl 0x90f2(%rip), %eax      # 0x14248
movl $0x2, %ecx
cltd
idivl %ecx
cvtsi2sd %eax, %xmm1
cvtsi2sdl 0x90de(%rip), %xmm0 # 0x14248
movsd 0x9096(%rip), %xmm2     # 0x14208
subsd 0x9086(%rip), %xmm2     # 0x14200
divsd %xmm2, %xmm0
movsd -0x280(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x1090
cvttsd2si %xmm0, %eax
movl %eax, -0x380(%rbp)
movl 0x90a5(%rip), %eax      # 0x14248
movl $0x2, %ecx
cltd
idivl %ecx
cvtsi2sd %eax, %xmm1
cvtsi2sdl 0x9091(%rip), %xmm0 # 0x14248
movsd 0x9049(%rip), %xmm2     # 0x14208
subsd 0x9039(%rip), %xmm2     # 0x14200
divsd %xmm2, %xmm0
movsd -0x298(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x1090
cvttsd2si %xmm0, %eax
movl %eax, -0x384(%rbp)
movsd -0x228(%rbp), %xmm1
movsd -0x298(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xb36e
movsd -0x218(%rbp), %xmm0
addsd -0x228(%rbp), %xmm0
movsd %xmm0, -0x228(%rbp)
movl 0x9026(%rip), %eax      # 0x14248
movl $0x2, %ecx
cltd
idivl %ecx
cvtsi2sd %eax, %xmm1
cvtsi2sdl 0x9012(%rip), %xmm0 # 0x14248
movsd 0x8fca(%rip), %xmm2     # 0x14208
subsd 0x8fba(%rip), %xmm2     # 0x14200
divsd %xmm2, %xmm0
movsd -0x228(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x1090
cvttsd2si %xmm0, %eax
movl %eax, -0x388(%rbp)
movl 0x8fdd(%rip), %eax      # 0x1424c
movl $0x2, %ecx
cltd
idivl %ecx
cvtsi2sd %eax, %xmm1
cvtsi2sdl 0x8fc9(%rip), %xmm0 # 0x1424c
movsd 0x8f8d(%rip), %xmm2     # 0x14218
subsd 0x8f7d(%rip), %xmm2     # 0x14210
divsd %xmm2, %xmm0
movsd -0x230(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x1090
cvttsd2si %xmm0, %eax
movl %eax, -0x38c(%rbp)
movsd 0x328b(%rip), %xmm0     # 0xe560
movsd %xmm0, -0x398(%rbp)
movsd -0x2e8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xb2f2
jp 0xb2f2
jmp 0xb32a
movsd -0x2f0(%rbp), %xmm0
movsd -0x228(%rbp), %xmm2
movsd -0x2f8(%rbp), %xmm1
mulsd -0x230(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addsd -0x300(%rbp), %xmm0
movsd %xmm0, -0x398(%rbp)
movl -0x388(%rbp), %eax
movl -0x384(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xb369
movl -0x388(%rbp), %eax
movl -0x380(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jle 0xb369
movl -0x388(%rbp), %edi
movl -0x38c(%rbp), %esi
movsd -0x398(%rbp), %xmm0
callq 0x9de0
jmp 0xb1ea
jmp 0xb370
movl -0x37c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x37c(%rbp)
jmp 0xb09f
jmp 0xb386
movl -0x304(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x304(%rbp)
jmp 0xad3e
leaq -0x268(%rbp), %rdi
callq 0x5de0
leaq -0x20(%rbp), %rdi
callq 0xb820
addq $0x410, %rsp            # imm = 0x410
popq %rbp
retq
leaq -0x20(%rbp), %rdi
callq 0xb820
movq -0xe0(%rbp), %rdi
callq 0x11a0
nopl (%rax)