// File: XuhuiSun95[P]My-OpenGL/myGL.cpp
// Function: myEnd()
void myEnd(){
    switch(shapeType){
        case POLYGON:{
            vector<pixel> points;
            for(vector<vertex>::iterator it = vertices.begin(); it != vertices.end(); it++){
                vertex v = modelTransform(*it);
                points.push_back(projection(v));
            }
            surfaceCheck(points);
            break;
        }
        case QUAD_STRIP:{
            vector<pixel> pointsOdd;
            vector<pixel> pointsEven;
            for(int i = 0; i < vertices.size(); i++){
                vertex v = modelTransform(vertices[i]);
                if(i % 2 == 0)
                    pointsEven.push_back(projection(v));
                else
                    pointsOdd.push_back(projection(v));
            }
            reverse(pointsOdd.begin(), pointsOdd.end());
            pointsEven.insert(pointsEven.end(), pointsOdd.begin(), pointsOdd.end());
            surfaceCheck(pointsEven);
            break;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
leaq 0xee2e(%rip), %rax      # 0x14230
movl (%rax), %eax
movl %eax, -0x1e4(%rbp)
testl %eax, %eax
je 0x5424
jmp 0x5410
movl -0x1e4(%rbp), %eax
subl $0x1, %eax
je 0x556d
jmp 0x5845
leaq -0x18(%rbp), %rdi
callq 0x5ba0
leaq 0xecdc(%rip), %rdi      # 0x14110
callq 0x5bc0
movq %rax, -0x20(%rbp)
leaq 0xeccc(%rip), %rdi      # 0x14110
callq 0x5c30
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x5bf0
testb $0x1, %al
jne 0x5463
jmp 0x550d
leaq -0x20(%rbp), %rdi
callq 0x5c60
movq 0x10(%rax), %rcx
movq %rcx, -0x50(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x60(%rbp)
movq -0x50(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movaps -0x60(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x40(%rbp), %rdi
callq 0x9ac0
jmp 0x5498
movq -0x30(%rbp), %rax
movq %rax, -0x90(%rbp)
movups -0x40(%rbp), %xmm0
movaps %xmm0, -0xa0(%rbp)
movq -0x90(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movaps -0xa0(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x88(%rbp), %rdi
callq 0x9c10
jmp 0x54d4
leaq -0x18(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x5c80
jmp 0x54e6
jmp 0x54e8
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x5cb0
movq %rax, -0xa8(%rbp)
jmp 0x543d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x555f
leaq -0xc0(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x5cf0
jmp 0x551f
leaq -0xc0(%rbp), %rdi
callq 0xa1e0
jmp 0x552d
leaq -0xc0(%rbp), %rdi
callq 0x5de0
leaq -0x18(%rbp), %rdi
callq 0x5de0
jmp 0x5845
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x5de0
leaq -0x18(%rbp), %rdi
callq 0x5de0
jmp 0x584e
leaq -0xd8(%rbp), %rdi
callq 0x5ba0
leaq -0xf0(%rbp), %rdi
callq 0x5ba0
movl $0x0, -0xf4(%rbp)
movslq -0xf4(%rbp), %rax
movq %rax, -0x1f0(%rbp)
leaq 0xeb6c(%rip), %rdi      # 0x14110
callq 0x5e40
movq %rax, %rcx
movq -0x1f0(%rbp), %rax
cmpq %rcx, %rax
jae 0x56f6
movslq -0xf4(%rbp), %rsi
leaq 0xeb46(%rip), %rdi      # 0x14110
callq 0x5e70
movq 0x10(%rax), %rcx
movq %rcx, -0x120(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x130(%rbp)
movq -0x120(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movaps -0x130(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x110(%rbp), %rdi
callq 0x9ac0
jmp 0x560a
movl -0xf4(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x5687
movq -0x100(%rbp), %rax
movq %rax, -0x150(%rbp)
movups -0x110(%rbp), %xmm0
movaps %xmm0, -0x160(%rbp)
movq -0x150(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movaps -0x160(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x148(%rbp), %rdi
callq 0x9c10
jmp 0x565f
leaq -0xf0(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x5c80
jmp 0x5674
jmp 0x56e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x582b
movq -0x100(%rbp), %rax
movq %rax, -0x180(%rbp)
movups -0x110(%rbp), %xmm0
movaps %xmm0, -0x190(%rbp)
movq -0x180(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movaps -0x190(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x178(%rbp), %rdi
callq 0x9c10
jmp 0x56c9
leaq -0xd8(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x5c80
jmp 0x56de
jmp 0x56e0
jmp 0x56e2
movl -0xf4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf4(%rbp)
jmp 0x558f
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x5ed0
movq -0x1f8(%rbp), %rdi
movq %rax, -0x198(%rbp)
callq 0x5f00
movq %rax, -0x1a0(%rbp)
movq -0x198(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
callq 0x5e90
jmp 0x5738
leaq -0xf0(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x5f00
movq %rax, -0x1b0(%rbp)
leaq -0x1a8(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x5fe0
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x5ed0
movq -0x210(%rbp), %rdi
movq %rax, -0x1b8(%rbp)
callq 0x5f00
movq -0x208(%rbp), %rdi
movq %rax, -0x1c0(%rbp)
movq -0x1a8(%rbp), %rsi
movq -0x1b8(%rbp), %rdx
movq -0x1c0(%rbp), %rcx
callq 0x5f30
movq %rax, -0x200(%rbp)
jmp 0x57bc
movq -0x200(%rbp), %rax
movq %rax, -0x1c8(%rbp)
leaq -0x1e0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x5cf0
jmp 0x57df
leaq -0x1e0(%rbp), %rdi
callq 0xa1e0
jmp 0x57ed
leaq -0x1e0(%rbp), %rdi
callq 0x5de0
leaq -0xf0(%rbp), %rdi
callq 0x5de0
leaq -0xd8(%rbp), %rdi
callq 0x5de0
jmp 0x5845
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x5de0
leaq -0xf0(%rbp), %rdi
callq 0x5de0
leaq -0xd8(%rbp), %rdi
callq 0x5de0
jmp 0x584e
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x11a0
nopw (%rax,%rax)