// File: /workspace/github_c_makefile_star2_O1/Nealsbo[P]C-Software-Renderer/src/objloader.c
// Function: Model_Test
void Model_Test(void *_model){
    obj_model_t *model = (obj_model_t *)_model;
    int i;
    if(model == NULL){
        printf("====================\n");
        printf("Warning: Bad model test!\n");
        return;
    }
    printf("====================\n");
    printf("Model Test(obj parser):\n\tModel name: \"%s\"\n\tVertex count: %d, Face count: %d, Triangle count: %d\n",
           model->name, model->vertCount, model->trisCount / 2, model->trisCount);

    printf("\tPosition: ");
    vec3_print(model->position);
    printf("\tRotation: ");
    vec3_print(model->rotation);
    printf("\tScale: ");
    vec3_print(model->scale);

    printf("Vertices: \n");
    for(i = 0; i < model->vertCount; i++){
        vec3_print(model->vertices[i]);
    }

    printf("Normals: \n");
    for(i = 0; i < model->trisCount * 2; i++){
        vec3_print(model->normals[i]);
    }

    printf("Texture Coordinates: \n");
    for(i = 0; i < model->trisCount * 2; i++){
        vec2_print(model->textcoords[i]);
    }

    printf("Faces: \n");
    for(i = 0; i < model->trisCount; i++){
        Face_Print(model->faces[i]);
    }
    printf("====================\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x5b2f
movq %rdi, %r14
leaq 0x32b8(%rip), %rbx      # 0x8c27
movq %rbx, %rdi
callq 0x11f0
movl 0x120(%r14), %edx
movl 0x12c(%r14), %r8d
movl %r8d, %ecx
shrl $0x1f, %ecx
addl %r8d, %ecx
sarl %ecx
leaq 0x31ad(%rip), %rdi      # 0x8b44
movq %r14, %rsi
xorl %eax, %eax
callq 0x1040
leaq 0x31fd(%rip), %rdi      # 0x8ba5
xorl %eax, %eax
callq 0x1040
movsd 0x130(%r14), %xmm0
movss 0x138(%r14), %xmm1
callq 0x2d37
leaq 0x31e4(%rip), %rdi      # 0x8bb1
xorl %eax, %eax
callq 0x1040
movsd 0x13c(%r14), %xmm0
movss 0x144(%r14), %xmm1
callq 0x2d37
leaq 0x31cb(%rip), %rdi      # 0x8bbd
xorl %eax, %eax
callq 0x1040
movsd 0x148(%r14), %xmm0
movss 0x150(%r14), %xmm1
callq 0x2d37
leaq 0x31dd(%rip), %rdi      # 0x8bf4
callq 0x11f0
cmpl $0x0, 0x120(%r14)
jle 0x5a5b
movl $0x8, %r15d
xorl %r12d, %r12d
movq 0x100(%r14), %rax
movsd -0x8(%rax,%r15), %xmm0
movss (%rax,%r15), %xmm1
callq 0x2d37
incq %r12
movslq 0x120(%r14), %rax
addq $0xc, %r15
cmpq %rax, %r12
jl 0x5a2f
leaq 0x319d(%rip), %rdi      # 0x8bff
callq 0x11f0
cmpl $0x0, 0x12c(%r14)
jle 0x5aa9
movl $0x8, %r15d
xorl %r12d, %r12d
movq 0x110(%r14), %rax
movsd -0x8(%rax,%r15), %xmm0
movss (%rax,%r15), %xmm1
callq 0x2d37
incq %r12
movslq 0x12c(%r14), %rax
addq %rax, %rax
addq $0xc, %r15
cmpq %rax, %r12
jl 0x5a7a
leaq 0x3159(%rip), %rdi      # 0x8c09
callq 0x11f0
cmpl $0x0, 0x12c(%r14)
jle 0x5ae6
xorl %r15d, %r15d
movq 0x118(%r14), %rax
movsd (%rax,%r15,8), %xmm0
callq 0x28f5
incq %r15
movslq 0x12c(%r14), %rax
addq %rax, %rax
cmpq %rax, %r15
jl 0x5ac2
leaq 0x3132(%rip), %rdi      # 0x8c1f
callq 0x11f0
cmpl $0x0, 0x12c(%r14)
jle 0x5b42
movl $0x8, %r15d
xorl %r12d, %r12d
movq 0x108(%r14), %rax
movl -0x8(%rax,%r15), %edi
movq (%rax,%r15), %rsi
callq 0x48f0
incq %r12
movslq 0x12c(%r14), %rax
addq $0x10, %r15
cmpq %rax, %r12
jl 0x5b05
jmp 0x5b42
leaq 0x30f1(%rip), %rdi      # 0x8c27
callq 0x11f0
leaq 0x30fa(%rip), %rbx      # 0x8c3c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x11f0