// File: /workspace/github_cpp_makefile_star2_O1/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 -0x80(%rbp), %rdx
movq %rbx, %rdi
callq 0x3734
movq %rbx, %rdi
callq 0x2f33
movq %rax, -0x88(%rbp)
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3458
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2160
callq 0x336b
xorps %xmm0, %xmm0
leaq -0x54(%rbp), %rax
movaps %xmm0, -0x2c(%rax)
movaps %xmm0, -0x1c(%rax)
movaps %xmm0, -0xc(%rax)
movaps %xmm0, 0x4(%rax)
movl $0x3f800000, %ebx       # imm = 0x3F800000
movl %ebx, -0x2c(%rax)
movups %xmm0, -0x28(%rax)
movl %ebx, -0x18(%rax)
movups %xmm0, -0x14(%rax)
movl %ebx, -0x4(%rax)
movups %xmm0, (%rax)
movl %ebx, 0x10(%rax)
movsd 0xba8(%rip), %xmm4      # 0x4040
leaq -0x170(%rbp), %rdi
movss 0xb5d(%rip), %xmm1      # 0x4004
xorps %xmm2, %xmm2
xorps %xmm3, %xmm3
xorps %xmm5, %xmm5
callq 0x2653
leaq -0x130(%rbp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, 0x30(%rax)
movl %ebx, (%rax)
movups %xmm0, 0x4(%rax)
movl %ebx, 0x14(%rax)
movups %xmm0, 0x18(%rax)
movl %ebx, 0x28(%rax)
movups %xmm0, 0x2c(%rax)
movl %ebx, 0x3c(%rax)
movl $0x0, 0x4(%rax)
leaq 0xb82(%rip), %rdi       # 0x4075
callq 0x2120
xorl %r15d, %r15d
leaq 0x2cbe(%rip), %rbx      # 0x61c0
leaq -0x1b0(%rbp), %r14
movq 0x2ac8(%rip), %r13      # 0x5fd8
xorps %xmm0, %xmm0
movss %xmm0, -0x2c(%rbp)
movss %xmm0, -0x30(%rbp)
leaq 0x2c74(%rip), %rdi      # 0x6198
leaq 0x2c4d(%rip), %rsi      # 0x6178
callq 0x20a0
xorl %eax, %eax
movl $0xc59c4000, (%rax,%rbx) # imm = 0xC59C4000
addq $0x4, %rax
cmpq $0x228c, %rax           # imm = 0x228C
jne 0x3532
movss -0x2c(%rbp), %xmm0
addss 0xaca(%rip), %xmm0      # 0x401c
movss %xmm0, -0x2c(%rbp)
movss -0x30(%rbp), %xmm0
addss 0xabc(%rip), %xmm0      # 0x4020
movss %xmm0, -0x30(%rbp)
callq 0x20e0
movss %xmm0, -0x3c(%rbp)
movss -0x30(%rbp), %xmm0
callq 0x2110
movss %xmm0, -0x34(%rbp)
movss -0x2c(%rbp), %xmm0
callq 0x20e0
movss %xmm0, -0x38(%rbp)
movss -0x2c(%rbp), %xmm0
callq 0x2110
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 0xa4f(%rip), %xmm0      # 0x4050
mulss %xmm10, %xmm8
xorps %xmm6, %xmm6
leaq -0x54(%rbp), %rax
movups %xmm6, (%rax)
movss %xmm2, -0x80(%rbp)
movss %xmm3, -0x7c(%rbp)
movss %xmm4, -0x78(%rbp)
movl %r15d, -0x74(%rbp)
movss %xmm1, -0x70(%rbp)
movss %xmm10, -0x6c(%rbp)
movss %xmm5, -0x68(%rbp)
movl %r15d, -0x64(%rbp)
movss %xmm9, -0x60(%rbp)
movss %xmm0, -0x5c(%rbp)
movss %xmm8, -0x58(%rbp)
movl $0x3f800000, -0x44(%rbp) # imm = 0x3F800000
movq %r14, %rdi
leaq -0x130(%rbp), %rsi
leaq -0x170(%rbp), %rdx
callq 0x3771
leaq -0xe8(%rbp), %rdi
movq %r14, %rsi
leaq -0x80(%rbp), %rdx
callq 0x3771
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 -0x88(%rbp), %rdi
callq 0x2d06
movq 0x2ade(%rip), %r12      # 0x6198
testq %r12, %r12
je 0x36d7
movq %r12, %rdi
callq 0x2090
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2190
jmp 0x36f0
movq (%r13), %rax
movq -0x18(%rax), %rax
leaq (%rax,%r13), %rdi
movl 0x20(%r13,%rax), %esi
orl $0x1, %esi
callq 0x2210
movl $0x6, %edx
movq %r13, %rdi
leaq 0x97c(%rip), %rsi       # 0x407b
callq 0x2190
jmp 0x351d
movq %rax, %rbx
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x372b
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2220
nop