// File: /workspace/github_c_makefile_star2_O3/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 0x57f8
movq %rdi, %r14
leaq 0x260f(%rip), %rbx      # 0x7c47
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 0x2504(%rip), %rdi      # 0x7b64
movq %r14, %rsi
xorl %eax, %eax
callq 0x1040
leaq 0x2554(%rip), %rdi      # 0x7bc5
xorl %eax, %eax
callq 0x1040
movsd 0x130(%r14), %xmm0
movss 0x138(%r14), %xmm1
callq 0x2c64
leaq 0x253b(%rip), %rdi      # 0x7bd1
xorl %eax, %eax
callq 0x1040
movsd 0x13c(%r14), %xmm0
movss 0x144(%r14), %xmm1
callq 0x2c64
leaq 0x2522(%rip), %rdi      # 0x7bdd
xorl %eax, %eax
callq 0x1040
movsd 0x148(%r14), %xmm0
movss 0x150(%r14), %xmm1
callq 0x2c64
leaq 0x2534(%rip), %rdi      # 0x7c14
callq 0x11f0
cmpl $0x0, 0x120(%r14)
jle 0x5724
movl $0x8, %r15d
xorl %r12d, %r12d
movq 0x100(%r14), %rax
movsd -0x8(%rax,%r15), %xmm0
movss (%rax,%r15), %xmm1
callq 0x2c64
incq %r12
movslq 0x120(%r14), %rax
addq $0xc, %r15
cmpq %rax, %r12
jl 0x56f8
leaq 0x24f4(%rip), %rdi      # 0x7c1f
callq 0x11f0
cmpl $0x0, 0x12c(%r14)
jle 0x5772
movl $0x8, %r15d
xorl %r12d, %r12d
movq 0x110(%r14), %rax
movsd -0x8(%rax,%r15), %xmm0
movss (%rax,%r15), %xmm1
callq 0x2c64
incq %r12
movslq 0x12c(%r14), %rax
addq %rax, %rax
addq $0xc, %r15
cmpq %rax, %r12
jl 0x5743
leaq 0x24b0(%rip), %rdi      # 0x7c29
callq 0x11f0
cmpl $0x0, 0x12c(%r14)
jle 0x57af
xorl %r15d, %r15d
movq 0x118(%r14), %rax
movsd (%rax,%r15,8), %xmm0
callq 0x28bf
incq %r15
movslq 0x12c(%r14), %rax
addq %rax, %rax
cmpq %rax, %r15
jl 0x578b
leaq 0x2489(%rip), %rdi      # 0x7c3f
callq 0x11f0
cmpl $0x0, 0x12c(%r14)
jle 0x580b
movl $0x8, %r15d
xorl %r12d, %r12d
movq 0x108(%r14), %rax
movl -0x8(%rax,%r15), %edi
movq (%rax,%r15), %rsi
callq 0x45ed
incq %r12
movslq 0x12c(%r14), %rax
addq $0x10, %r15
cmpq %rax, %r12
jl 0x57ce
jmp 0x580b
leaq 0x2448(%rip), %rdi      # 0x7c47
callq 0x11f0
leaq 0x2451(%rip), %rbx      # 0x7c5c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x11f0