// File: /workspace/github_c_makefile_star2_O2/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 0x53b3
movq %rdi, %r14
leaq 0x2a2e(%rip), %rbx      # 0x7c47
movq %rbx, %rdi
callq 0x1200
movl 0x120(%r14), %ecx
movl 0x12c(%r14), %r8d
pushq $0x2
popq %rsi
movl %r8d, %eax
cltd
idivl %esi
leaq 0x2925(%rip), %rdi      # 0x7b64
xorl %r15d, %r15d
movq %r14, %rsi
movl %ecx, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x1040
leaq 0x296e(%rip), %rdi      # 0x7bc5
xorl %eax, %eax
callq 0x1040
movsd 0x130(%r14), %xmm0
movss 0x138(%r14), %xmm1
callq 0x2b47
leaq 0x2955(%rip), %rdi      # 0x7bd1
xorl %eax, %eax
callq 0x1040
movsd 0x13c(%r14), %xmm0
movss 0x144(%r14), %xmm1
callq 0x2b47
leaq 0x293c(%rip), %rdi      # 0x7bdd
xorl %eax, %eax
callq 0x1040
movsd 0x148(%r14), %xmm0
movss 0x150(%r14), %xmm1
callq 0x2b47
leaq 0x294e(%rip), %rdi      # 0x7c14
callq 0x1200
pushq $0x8
popq %r12
movslq 0x120(%r14), %rax
cmpq %rax, %r15
jge 0x52fd
movq 0x100(%r14), %rax
movsd -0x8(%rax,%r12), %xmm0
movss (%rax,%r12), %xmm1
callq 0x2b47
incq %r15
addq $0xc, %r12
jmp 0x52cf
leaq 0x291b(%rip), %rdi      # 0x7c1f
callq 0x1200
pushq $0x8
popq %r15
xorl %r12d, %r12d
movslq 0x12c(%r14), %rax
addq %rax, %rax
cmpq %rax, %r12
jge 0x5341
movq 0x110(%r14), %rax
movsd -0x8(%rax,%r15), %xmm0
movss (%rax,%r15), %xmm1
callq 0x2b47
incq %r12
addq $0xc, %r15
jmp 0x5310
leaq 0x28e1(%rip), %rdi      # 0x7c29
callq 0x1200
xorl %r15d, %r15d
movslq 0x12c(%r14), %rax
addq %rax, %rax
cmpq %rax, %r15
jge 0x5376
movq 0x118(%r14), %rax
movsd (%rax,%r15,8), %xmm0
callq 0x27c9
incq %r15
jmp 0x5350
leaq 0x28c2(%rip), %rdi      # 0x7c3f
callq 0x1200
pushq $0x8
popq %r15
xorl %r12d, %r12d
movslq 0x12c(%r14), %rax
cmpq %rax, %r12
jge 0x53c6
movq 0x108(%r14), %rax
movl -0x8(%rax,%r15), %edi
movq (%rax,%r15), %rsi
callq 0x423b
incq %r12
addq $0x10, %r15
jmp 0x5389
leaq 0x288d(%rip), %rdi      # 0x7c47
callq 0x1200
leaq 0x2896(%rip), %rbx      # 0x7c5c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1200