// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/mdsprite.c
// Function: voxload
voxmodel *voxload (const char *filnam)
{
	int is8bit, ret;
	voxmodel *vm;
	char *dot;

	dot = strrchr(filnam, '.'); if (!dot) return(0);
	     if (!strcasecmp(dot,".vox")) { ret = loadvox(filnam); is8bit = 1; }
	else if (!strcasecmp(dot,".kvx")) { ret = loadkvx(filnam); is8bit = 1; }
	else if (!strcasecmp(dot,".kv6")) { ret = loadkv6(filnam); is8bit = 0; }
	//else if (!strcasecmp(dot,".vxl")) { ret = loadvxl(filnam); is8bit = 0; }
	else return(0);
	if (ret >= 0) vm = vox2poly(); else vm = 0;
	if (vm)
	{
		vm->mdnum = 1; //VOXel model id
		vm->scale = vm->bscale = 1.0;
		vm->xsiz = xsiz; vm->ysiz = ysiz; vm->zsiz = zsiz;
		vm->xpiv = xpiv; vm->ypiv = ypiv; vm->zpiv = zpiv;
		vm->is8bit = is8bit;

		vm->texid = (unsigned int *)calloc(MAXPALOOKUPS,sizeof(unsigned int));
		if (!vm->texid) { voxfree(vm); vm = 0; }
	}
	if (shcntmal) { free(shcntmal); shcntmal = 0; }
	if (vbit) { free(vbit); vbit = 0; }
	if (vcol) { free(vcol); vcol = 0; vnum = 0; vmax = 0; }
	if (vcolhashead) { free(vcolhashead); vcolhashead = 0; }
	return(vm);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2e, %esi
callq 0x6910
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x90342
movq $0x0, -0x8(%rbp)
jmp 0x9055d
movq -0x28(%rbp), %rdi
leaq 0x26e70(%rip), %rsi     # 0xb71bd
callq 0x67c0
cmpl $0x0, %eax
jne 0x9036c
movq -0x10(%rbp), %rdi
callq 0x90570
movl %eax, -0x18(%rbp)
movl $0x1, -0x14(%rbp)
jmp 0x903d1
movq -0x28(%rbp), %rdi
leaq 0x26e4b(%rip), %rsi     # 0xb71c2
callq 0x67c0
cmpl $0x0, %eax
jne 0x90396
movq -0x10(%rbp), %rdi
callq 0x90bc0
movl %eax, -0x18(%rbp)
movl $0x1, -0x14(%rbp)
jmp 0x903cf
movq -0x28(%rbp), %rdi
leaq 0x26e26(%rip), %rsi     # 0xb71c7
callq 0x67c0
cmpl $0x0, %eax
jne 0x903c0
movq -0x10(%rbp), %rdi
callq 0x91220
movl %eax, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
jmp 0x903cd
movq $0x0, -0x8(%rbp)
jmp 0x9055d
jmp 0x903cf
jmp 0x903d1
cmpl $0x0, -0x18(%rbp)
jl 0x903e2
callq 0x91660
movq %rax, -0x20(%rbp)
jmp 0x903ea
movq $0x0, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x904bd
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
movq -0x20(%rbp), %rax
movss 0x229f5(%rip), %xmm0    # 0xb2e00
movss %xmm0, 0xc(%rax)
movq -0x20(%rbp), %rax
movss 0x229e4(%rip), %xmm0    # 0xb2e00
movss %xmm0, 0x8(%rax)
movl 0x616c21(%rip), %ecx    # 0x6a7048
movq -0x20(%rbp), %rax
movl %ecx, 0x58(%rax)
movl 0x616c18(%rip), %ecx    # 0x6a704c
movq -0x20(%rbp), %rax
movl %ecx, 0x5c(%rax)
movl 0x616c0f(%rip), %ecx    # 0x6a7050
movq -0x20(%rbp), %rax
movl %ecx, 0x60(%rax)
movss 0x616c04(%rip), %xmm0   # 0x6a7054
movq -0x20(%rbp), %rax
movss %xmm0, 0x64(%rax)
movss 0x616bf7(%rip), %xmm0   # 0x6a7058
movq -0x20(%rbp), %rax
movss %xmm0, 0x68(%rax)
movss 0x616bea(%rip), %xmm0   # 0x6a705c
movq -0x20(%rbp), %rax
movss %xmm0, 0x6c(%rax)
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x70(%rax)
movl $0x100, %edi            # imm = 0x100
movl $0x4, %esi
callq 0x6880
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x904bb
movq -0x20(%rbp), %rdi
callq 0x902a0
movq $0x0, -0x20(%rbp)
jmp 0x904bd
cmpq $0x0, 0x616b9b(%rip)    # 0x6a7060
je 0x904de
movq 0x616b92(%rip), %rdi    # 0x6a7060
callq 0x61c0
movq $0x0, 0x616b82(%rip) # 0x6a7060
cmpq $0x0, 0x616b82(%rip)    # 0x6a7068
je 0x904ff
movq 0x616b79(%rip), %rdi    # 0x6a7068
callq 0x61c0
movq $0x0, 0x616b69(%rip) # 0x6a7068
cmpq $0x0, 0x616b69(%rip)    # 0x6a7070
je 0x90534
movq 0x616b60(%rip), %rdi    # 0x6a7070
callq 0x61c0
movq $0x0, 0x616b50(%rip) # 0x6a7070
movl $0x0, 0x616b16(%rip)    # 0x6a7040
movl $0x0, 0x616b10(%rip)    # 0x6a7044
cmpq $0x0, 0x616b3c(%rip)    # 0x6a7078
je 0x90555
movq 0x616b33(%rip), %rdi    # 0x6a7078
callq 0x61c0
movq $0x0, 0x616b23(%rip) # 0x6a7078
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)