// File: /workspace/github_cpp_makefile_star2_O3/Olverine[P]TerminalGraphics/Main.cpp
// Function: main
int main(int argc, char* argv[]) {
    vec4* shape = loadShape(argv[1]);
    initViewPort();

    mat4 model = mat4(1.0);
    mat4 view = getView(vec3(0, 0, 1), vec3(0, 0, 0), vec3(0, 1, 0)); 
    mat4 projection = getPerspective(radians(90.0f), 0.1, 500);

    float rotX = 0;
    float rotY = 0;

    system("clear");

    while (true) {
        clearViewPort();		

        // Rotate the object
        rotX += 0.0001f;
        rotY += 0.0002f;

        model = eulerAngleYXZ(rotY, rotX, 0.0f);

        mat4 mp =  projection * view * model;
        DrawShape(shape, mp);

        cout << out.c_str() << "\033[1;1H";
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq 0x8(%rsi), %rsi
leaq -0xa8(%rbp), %rbx
leaq -0x88(%rbp), %rdx
movq %rbx, %rdi
callq 0x3606
movq %rbx, %rdi
callq 0x2e55
movq %rax, -0x48(%rbp)
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3337
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2140
callq 0x324a
movl $0x3f800000, %ebx       # imm = 0x3F800000
leaq -0x5c(%rbp), %rax
movl %ebx, -0x2c(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x28(%rax)
movl %ebx, -0x18(%rax)
movups %xmm0, -0x14(%rax)
movl %ebx, -0x4(%rax)
movups %xmm0, (%rax)
movl %ebx, 0x10(%rax)
movsd 0xcd9(%rip), %xmm4      # 0x4040
leaq -0x168(%rbp), %rdi
movss 0xc8e(%rip), %xmm1      # 0x4004
xorps %xmm2, %xmm2
xorps %xmm3, %xmm3
xorps %xmm5, %xmm5
callq 0x260c
movabsq $0x3f80000000000000, %rax # imm = 0x3F80000000000000
leaq -0x128(%rbp), %rcx
movq %rax, 0x10(%rcx)
movq $0x0, 0x8(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rcx)
movl %ebx, 0x28(%rcx)
movups %xmm0, 0x2c(%rcx)
movl %ebx, 0x3c(%rcx)
movq $0x3f800000, (%rcx)     # imm = 0x3F800000
leaq 0xcb5(%rip), %rdi       # 0x4075
callq 0x2100
xorl %r15d, %r15d
leaq 0x2de1(%rip), %rbx      # 0x61b0
leaq -0x1a8(%rbp), %r14
movq 0x2bfb(%rip), %r13      # 0x5fd8
xorps %xmm0, %xmm0
movss %xmm0, -0x30(%rbp)
movss %xmm0, -0x2c(%rbp)
leaq 0x2d97(%rip), %rdi      # 0x6188
leaq 0x2d70(%rip), %rsi      # 0x6168
callq 0x20a0
xorl %eax, %eax
movl $0xc59c4000, (%rax,%rbx) # imm = 0xC59C4000
addq $0x4, %rax
cmpq $0x228c, %rax           # imm = 0x228C
jne 0x33ff
movss -0x2c(%rbp), %xmm0
addss 0xbfd(%rip), %xmm0      # 0x401c
movss %xmm0, -0x2c(%rbp)
movss -0x30(%rbp), %xmm0
addss 0xbef(%rip), %xmm0      # 0x4020
movss %xmm0, -0x30(%rbp)
callq 0x20d0
movss %xmm0, -0x3c(%rbp)
movss -0x30(%rbp), %xmm0
callq 0x20f0
movss %xmm0, -0x34(%rbp)
movss -0x2c(%rbp), %xmm0
callq 0x20d0
movss %xmm0, -0x38(%rbp)
movss -0x2c(%rbp), %xmm0
callq 0x20f0
movss -0x34(%rbp), %xmm9
movaps %xmm9, %xmm1
mulss %xmm0, %xmm1
movaps %xmm1, %xmm2
xorps %xmm7, %xmm7
mulss %xmm7, %xmm2
movss -0x3c(%rbp), %xmm8
addss %xmm8, %xmm2
movss -0x38(%rbp), %xmm10
movaps %xmm10, %xmm3
mulss %xmm7, %xmm3
movaps %xmm8, %xmm4
mulss %xmm0, %xmm4
movaps %xmm9, %xmm5
mulss %xmm7, %xmm5
addss %xmm4, %xmm5
mulss %xmm7, %xmm4
subss %xmm9, %xmm4
movaps %xmm8, %xmm6
mulss %xmm7, %xmm6
subss %xmm6, %xmm1
mulss %xmm10, %xmm9
xorps 0xb82(%rip), %xmm0      # 0x4050
mulss %xmm10, %xmm8
leaq -0x5c(%rbp), %rax
xorps %xmm6, %xmm6
movups %xmm6, (%rax)
movss %xmm2, -0x88(%rbp)
movss %xmm3, -0x84(%rbp)
movss %xmm4, -0x80(%rbp)
movl %r15d, -0x7c(%rbp)
movss %xmm1, -0x78(%rbp)
movss %xmm10, -0x74(%rbp)
movss %xmm5, -0x70(%rbp)
movl %r15d, -0x6c(%rbp)
movss %xmm9, -0x68(%rbp)
movss %xmm0, -0x64(%rbp)
movss %xmm8, -0x60(%rbp)
movl $0x3f800000, -0x4c(%rbp) # imm = 0x3F800000
movq %r14, %rdi
leaq -0x128(%rbp), %rsi
leaq -0x168(%rbp), %rdx
callq 0x3643
leaq -0xe8(%rbp), %rdi
movq %r14, %rsi
leaq -0x88(%rbp), %rdx
callq 0x3643
movups -0xe8(%rbp), %xmm0
movups -0xd8(%rbp), %xmm1
movups -0xc8(%rbp), %xmm2
movups -0xb8(%rbp), %xmm3
movups %xmm3, 0x30(%rsp)
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq -0x48(%rbp), %rdi
callq 0x2c28
movq 0x2bfb(%rip), %r12      # 0x6188
testq %r12, %r12
je 0x35aa
movq %r12, %rdi
callq 0x2090
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2170
jmp 0x35c3
movq (%r13), %rax
movq -0x18(%rax), %rax
leaq (%rax,%r13), %rdi
movl 0x20(%r13,%rax), %esi
orl $0x1, %esi
callq 0x21f0
movl $0x6, %edx
movq %r13, %rdi
leaq 0xaa9(%rip), %rsi       # 0x407b
callq 0x2170
jmp 0x33ea
movq %rax, %rbx
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x35fe
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x2200