// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/jfbuild/src/mdsprite.c
// Function: mdload
mdmodel *mdload (const char *filnam)
{
	mdmodel *vm;
	int fil;
	int i;

	vm = (mdmodel*)voxload(filnam); if (vm) return(vm);

	fil = kopen4load((char *)filnam,0); if (fil < 0) return(0);
	kread(fil,&i,4); klseek(fil,0,SEEK_SET);
	switch(B_LITTLE32(i))
	{
		case 0x32504449: vm = (mdmodel*)md2load(fil,filnam); break; //IDP2
		case 0x33504449: vm = (mdmodel*)md3load(fil); break; //IDP3
		default: vm = (mdmodel*)0; break;
	}
	kclose(fil);
	return(vm);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4b8, %rsp            # imm = 0x4B8
movq %rdi, %r15
callq 0x5f483
movq %rax, %r14
testq %rax, %rax
jne 0x5e851
xorl %r14d, %r14d
movq %r15, %rdi
xorl %esi, %esi
callq 0x1ff50
testl %eax, %eax
js 0x5e851
movl %eax, %ebp
leaq 0x40(%rsp), %rbx
movl %eax, %edi
movq %rbx, %rsi
movl $0x4, %edx
callq 0x201c2
xorl %r14d, %r14d
movl %ebp, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x203a8
movl (%rbx), %eax
cmpl $0x33504449, %eax       # imm = 0x33504449
je 0x5e366
cmpl $0x32504449, %eax       # imm = 0x32504449
jne 0x5e84a
movl $0x1, %edi
movl $0x98, %esi
callq 0x6930
testq %rax, %rax
je 0x5e847
movq %rax, %r14
movl $0x2, (%rax)
movl $0x3c23d70a, 0x8(%rax)  # imm = 0x3C23D70A
leaq 0x44(%rsp), %rbx
movl %ebp, %edi
movq %rbx, %rsi
movl $0x44, %edx
callq 0x201c2
cmpl $0x32504449, (%rbx)     # imm = 0x32504449
jne 0x5e83f
cmpl $0x8, 0x48(%rsp)
jne 0x5e83f
movl 0x58(%rsp), %eax
movl %eax, 0x50(%r14)
movl 0x6c(%rsp), %eax
movl %eax, 0x20(%r14)
movl 0x5c(%rsp), %eax
movl %eax, 0x58(%r14)
movslq 0x60(%rsp), %rdi
movl %edi, 0x5c(%r14)
movl 0x64(%rsp), %eax
movl %eax, 0x60(%r14)
movl 0x54(%rsp), %eax
movl %eax, 0x64(%r14)
movl 0x4c(%rsp), %eax
movl %eax, 0x68(%r14)
movl 0x50(%rsp), %eax
movl %eax, 0x6c(%r14)
movl $0x4, %esi
callq 0x6930
movq %rax, 0x78(%r14)
testq %rax, %rax
je 0x5e83f
movl 0x74(%rsp), %esi
movl %ebp, %edi
xorl %edx, %edx
callq 0x203a8
movq 0x78(%r14), %rsi
movl 0x5c(%r14), %edx
shll $0x2, %edx
movl %ebp, %edi
callq 0x201c2
cltq
movslq 0x5c(%r14), %rcx
shlq $0x2, %rcx
cmpq %rax, %rcx
jne 0x5e83f
movslq 0x60(%r14), %rdi
movl $0xc, %esi
callq 0x6930
movq %rax, 0x80(%r14)
testq %rax, %rax
je 0x5e83f
movl 0x78(%rsp), %esi
movl %ebp, %edi
xorl %edx, %edx
callq 0x203a8
movq 0x80(%r14), %rsi
movl 0x60(%r14), %eax
shll $0x2, %eax
leal (%rax,%rax,2), %edx
movl %ebp, %edi
callq 0x201c2
cltq
movslq 0x60(%r14), %rcx
shlq $0x2, %rcx
leaq (%rcx,%rcx,2), %rcx
cmpq %rax, %rcx
jne 0x5e83f
movslq 0x20(%r14), %rdi
movslq 0x64(%r14), %rsi
callq 0x6930
movq %rax, 0x70(%r14)
testq %rax, %rax
je 0x5e83f
movl 0x7c(%rsp), %esi
movl %ebp, %edi
xorl %edx, %edx
callq 0x203a8
movq 0x70(%r14), %rsi
movl 0x64(%r14), %edx
imull 0x20(%r14), %edx
movl %ebp, %edi
callq 0x201c2
movl 0x64(%r14), %ecx
imull 0x20(%r14), %ecx
cmpl %ecx, %eax
jne 0x5e83f
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6430
movq %rbx, %rdi
callq 0x6420
incq %rax
cmpq $0x2, %rax
je 0x5e77f
movzbl 0xae(%rsp,%rax), %ecx
decq %rax
cmpl $0x5c, %ecx
je 0x5e781
cmpl $0x2f, %ecx
jne 0x5e33e
jmp 0x5e781
movl $0x1, %edi
movl $0xd8, %esi
callq 0x6930
testq %rax, %rax
je 0x5e847
movq %rax, %r14
movl $0x3, (%rax)
movq $0x0, 0x18(%rax)
movl $0x3c23d70a, 0x8(%rax)  # imm = 0x3C23D70A
leaq 0xb0(%rsp), %rbx
movl %ebp, %edi
movq %rbx, %rsi
movl $0x6c, %edx
callq 0x201c2
movl (%rbx), %edx
movl %edx, 0x58(%r14)
movl 0x4(%rbx), %esi
movl %esi, 0x5c(%r14)
movups 0x8(%rbx), %xmm0
movups 0x18(%rbx), %xmm1
movups 0x28(%rbx), %xmm2
movups 0x38(%rbx), %xmm3
movups %xmm3, 0x90(%r14)
movups %xmm2, 0x80(%r14)
movups %xmm1, 0x70(%r14)
movups %xmm0, 0x60(%r14)
movl 0x48(%rbx), %eax
movl %eax, 0xa0(%r14)
movl 0x4c(%rbx), %eax
movl %eax, 0xa4(%r14)
movl 0x50(%rbx), %ecx
movl %ecx, 0xa8(%r14)
movl 0x54(%rbx), %ecx
movl %ecx, 0xac(%r14)
movl 0x58(%rbx), %ecx
movl %ecx, 0xb0(%r14)
movl 0x68(%rbx), %edi
movl %edi, 0xd0(%r14)
cmpl $0x33504449, %edx       # imm = 0x33504449
sete %dl
cmpl $0xf, %esi
sete %sil
orb %dl, %sil
cmpb $0x1, %sil
movl %ebp, 0xc(%rsp)
jne 0x5e76b
movl %ecx, 0x50(%r14)
movl %eax, 0x20(%r14)
movl 0x10c(%rsp), %esi
movl 0xc(%rsp), %edi
xorl %edx, %edx
callq 0x203a8
movl 0xa4(%r14), %ebx
movslq %ebx, %rdi
movl $0x38, %esi
callq 0x6930
movq %rax, 0xb8(%r14)
testq %rax, %rax
je 0x5e76b
imull $0x38, %ebx, %edx
movl 0xc(%rsp), %ebx
movl %ebx, %edi
movq %rax, %rsi
callq 0x201c2
cmpl $0x0, 0xa8(%r14)
je 0x5e4e1
movl 0x110(%rsp), %esi
movl %ebx, %edi
xorl %edx, %edx
callq 0x203a8
movl 0xa8(%r14), %ebx
movslq %ebx, %rdi
movl $0x70, %esi
callq 0x6930
movq %rax, 0xc0(%r14)
testq %rax, %rax
je 0x5e76b
imull $0x70, %ebx, %edx
movl 0xc(%rsp), %ebx
movl %ebx, %edi
movq %rax, %rsi
callq 0x201c2
jmp 0x5e4ec
movq $0x0, 0xc0(%r14)
movl 0x114(%rsp), %esi
movl %ebx, %edi
xorl %edx, %edx
callq 0x203a8
movl 0xac(%r14), %ebx
movslq %ebx, %rdi
movl $0x80, %esi
callq 0x6930
movq %rax, 0xc8(%r14)
testq %rax, %rax
je 0x5e76b
movl 0xc(%rsp), %ebp
testl %ebx, %ebx
jle 0x5e84a
movl 0x114(%rsp), %r12d
movl $0x78, %ebx
xorl %ecx, %ecx
movq %rcx, 0x38(%rsp)
movq 0xc8(%r14), %r15
movl %ebp, %edi
movl %r12d, 0x14(%rsp)
movl %r12d, %esi
xorl %edx, %edx
callq 0x203a8
movl %ebp, %edi
leaq 0x44(%rsp), %rsi
movl $0x6c, %edx
callq 0x201c2
movl 0x44(%rsp), %eax
movl %eax, -0x78(%r15,%rbx)
leaq 0x48(%rsp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups 0x30(%rax), %xmm3
movups %xmm3, -0x44(%r15,%rbx)
movups %xmm2, -0x54(%r15,%rbx)
movups %xmm1, -0x64(%r15,%rbx)
movups %xmm0, -0x74(%r15,%rbx)
movl 0x88(%rsp), %eax
movl %eax, -0x34(%r15,%rbx)
movl 0x8c(%rsp), %r12d
movl %r12d, -0x30(%r15,%rbx)
movl 0x90(%rsp), %eax
movl %eax, -0x2c(%r15,%rbx)
movl 0x94(%rsp), %ebp
movl %ebp, -0x28(%r15,%rbx)
movl 0x98(%rsp), %ecx
movl %ecx, -0x24(%r15,%rbx)
movl 0xac(%rsp), %edx
movl %edx, (%r15,%rbx)
movl 0x9c(%rsp), %edx
movl %edx, 0x18(%rsp)
movl 0xa0(%rsp), %edx
movl %edx, 0x20(%rsp)
shll $0x2, %ecx
leal (%rcx,%rcx,2), %edx
movl %eax, %ecx
shll $0x6, %ecx
leal (%rcx,%rax,4), %ecx
movl 0xa4(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0xa8(%rsp), %r13d
imull %ebp, %r12d
movq %rcx, 0x30(%rsp)
leal (%rcx,%rbp,8), %eax
leal (%rax,%r12,8), %eax
movl %edx, 0x2c(%rsp)
addl %edx, %eax
movslq %eax, %rdi
callq 0x69a0
movq %rax, -0x20(%r15,%rbx)
testq %rax, %rax
je 0x5e76b
shll $0x3, %ebp
shll $0x3, %r12d
movl 0x14(%rsp), %ecx
addl %ecx, %r13d
movl %r13d, 0x28(%rsp)
addl %ecx, 0x10(%rsp)
movl 0x20(%rsp), %r13d
addl %ecx, %r13d
movl 0x18(%rsp), %esi
addl %ecx, %esi
movslq 0x2c(%rsp), %rcx
movq %rcx, 0x18(%rsp)
addq %rcx, %rax
movq %rax, -0x18(%r15,%rbx)
movslq 0x30(%rsp), %rcx
addq %rax, %rcx
movq %rcx, -0x10(%r15,%rbx)
movslq %ebp, %rax
movq %rax, 0x20(%rsp)
addq %rax, %rcx
movq %rcx, -0x8(%r15,%rbx)
movl 0xc(%rsp), %ebp
movl %ebp, %edi
xorl %edx, %edx
callq 0x203a8
movq -0x20(%r15,%rbx), %rsi
movl %ebp, %edi
movq 0x18(%rsp), %rdx
callq 0x201c2
movl %ebp, %edi
movl %r13d, %esi
xorl %edx, %edx
callq 0x203a8
movq -0x18(%r15,%rbx), %rsi
movl %ebp, %edi
movq 0x30(%rsp), %rdx
callq 0x201c2
movl %ebp, %edi
movl 0x10(%rsp), %esi
xorl %edx, %edx
callq 0x203a8
movq -0x10(%r15,%rbx), %rsi
movl %ebp, %edi
movq 0x20(%rsp), %rdx
callq 0x201c2
movl %ebp, %edi
movl 0x28(%rsp), %esi
xorl %edx, %edx
callq 0x203a8
movq -0x8(%r15,%rbx), %rsi
movl %ebp, %edi
movl %r12d, %edx
movl 0x14(%rsp), %r12d
callq 0x201c2
movl 0x60493b(%rip), %eax    # 0x663058
movl -0x28(%r15,%rbx), %ecx
cmpl %ecx, %eax
cmovgl %eax, %ecx
movl %ecx, 0x60492b(%rip)    # 0x663058
movl 0x604935(%rip), %eax    # 0x663068
movl -0x24(%r15,%rbx), %ecx
leal (%rcx,%rcx,2), %ecx
cmpl %ecx, %eax
cmovgl %eax, %ecx
movl %ecx, 0x604922(%rip)    # 0x663068
addl (%r15,%rbx), %r12d
movq 0x38(%rsp), %rcx
incq %rcx
movslq 0xac(%r14), %rax
subq $-0x80, %rbx
cmpq %rax, %rcx
jl 0x5e53b
jmp 0x5e84a
movq %r14, %rdi
callq 0x6379d
xorl %r14d, %r14d
movl 0xc(%rsp), %ebp
jmp 0x5e84a
xorl %eax, %eax
movb $0x0, 0xb0(%rsp,%rax)
incq %rax
movq %rax, %rdi
callq 0x69a0
movq %rax, 0x88(%r14)
testq %rax, %rax
je 0x5e83f
leaq 0xb0(%rsp), %rsi
movq %rax, %rdi
callq 0x6430
movslq 0x50(%r14), %rdi
movl $0x40, %esi
callq 0x6930
movq %rax, 0x90(%r14)
testq %rax, %rax
je 0x5e83f
movl 0x70(%rsp), %esi
movl %ebp, %edi
xorl %edx, %edx
callq 0x203a8
movq 0x90(%r14), %rsi
movl 0x50(%r14), %edx
shll $0x6, %edx
movl %ebp, %edi
callq 0x201c2
movslq 0x50(%r14), %rdi
movl %edi, %ecx
shll $0x6, %ecx
cmpl %ecx, %eax
jne 0x5e83f
movl $0x20, %esi
callq 0x6930
movq %rax, 0x18(%r14)
testq %rax, %rax
je 0x5e83f
movl 0x604842(%rip), %eax    # 0x663058
movl 0x58(%r14), %ecx
cmpl %ecx, %eax
cmovgl %eax, %ecx
movl %ecx, 0x604833(%rip)    # 0x663058
movl 0x60483d(%rip), %eax    # 0x663068
movl 0x60(%r14), %ecx
leal (%rcx,%rcx,2), %ecx
cmpl %ecx, %eax
cmovgl %eax, %ecx
movl %ecx, 0x60482b(%rip)    # 0x663068
jmp 0x5e84a
movq %r14, %rdi
callq 0x636e1
xorl %r14d, %r14d
movl %ebp, %edi
callq 0x20671
movq %r14, %rax
addq $0x4b8, %rsp            # imm = 0x4B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq