// File: /workspace/github_c_makefile_star2_O3/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 0x614ca
movq %rax, %r14
testq %rax, %rax
jne 0x608d2
xorl %r14d, %r14d
movq %r15, %rdi
xorl %esi, %esi
callq 0x2043c
testl %eax, %eax
js 0x608d2
movl %eax, %ebp
leaq 0x40(%rsp), %rbx
movl %eax, %edi
movq %rbx, %rsi
movl $0x4, %edx
callq 0x20684
xorl %r14d, %r14d
movl %ebp, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x20872
movl (%rbx), %eax
cmpl $0x33504449, %eax       # imm = 0x33504449
je 0x60422
cmpl $0x32504449, %eax       # imm = 0x32504449
jne 0x608cb
movl $0x1, %edi
movl $0x98, %esi
callq 0x6930
testq %rax, %rax
je 0x608c8
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 0x20684
cmpl $0x32504449, (%rbx)     # imm = 0x32504449
jne 0x608c0
cmpl $0x8, 0x48(%rsp)
jne 0x608c0
movl 0x58(%rsp), %eax
movl %eax, 0x50(%r14)
movl 0x6c(%rsp), %eax
movl %eax, 0x20(%r14)
movl 0x5c(%rsp), %eax
movl %eax, 0x58(%r14)
movq 0x60(%rsp), %rax
movq %rax, 0x5c(%r14)
movl 0x54(%rsp), %ecx
movl %ecx, 0x64(%r14)
movq 0x4c(%rsp), %rcx
movq %rcx, 0x68(%r14)
movslq %eax, %rdi
movl $0x4, %esi
callq 0x6930
movq %rax, 0x78(%r14)
testq %rax, %rax
je 0x608c0
movl 0x74(%rsp), %esi
movl %ebp, %edi
xorl %edx, %edx
callq 0x20872
movq 0x78(%r14), %rsi
movl 0x5c(%r14), %edx
shll $0x2, %edx
movl %ebp, %edi
callq 0x20684
cltq
movslq 0x5c(%r14), %rcx
shlq $0x2, %rcx
cmpq %rax, %rcx
jne 0x608c0
movslq 0x60(%r14), %rdi
movl $0xc, %esi
callq 0x6930
movq %rax, 0x80(%r14)
testq %rax, %rax
je 0x608c0
movl 0x78(%rsp), %esi
movl %ebp, %edi
xorl %edx, %edx
callq 0x20872
movq 0x80(%r14), %rsi
movl 0x60(%r14), %eax
shll $0x2, %eax
leal (%rax,%rax,2), %edx
movl %ebp, %edi
callq 0x20684
cltq
movslq 0x60(%r14), %rcx
shlq $0x2, %rcx
leaq (%rcx,%rcx,2), %rcx
cmpq %rax, %rcx
jne 0x608c0
movslq 0x20(%r14), %rdi
movslq 0x64(%r14), %rsi
callq 0x6930
movq %rax, 0x70(%r14)
testq %rax, %rax
je 0x608c0
movl 0x7c(%rsp), %esi
movl %ebp, %edi
xorl %edx, %edx
callq 0x20872
movq 0x70(%r14), %rsi
movl 0x64(%r14), %edx
imull 0x20(%r14), %edx
movl %ebp, %edi
callq 0x20684
movl 0x64(%r14), %ecx
imull 0x20(%r14), %ecx
cmpl %ecx, %eax
jne 0x608c0
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6430
movq %rbx, %rdi
callq 0x6420
incq %rax
cmpq $0x2, %rax
je 0x60800
movzbl 0xae(%rsp,%rax), %ecx
decq %rax
cmpl $0x5c, %ecx
je 0x60802
cmpl $0x2f, %ecx
jne 0x603fa
jmp 0x60802
movl $0x1, %edi
movl $0xd8, %esi
callq 0x6930
testq %rax, %rax
je 0x608c8
movq %rax, %r14
movl $0x3, (%rax)
movl $0x3c23d70a, 0x8(%rax)  # imm = 0x3C23D70A
leaq 0xb0(%rsp), %rbx
movl %ebp, %edi
movq %rbx, %rsi
movl $0x6c, %edx
callq 0x20684
movl (%rbx), %ecx
movl %ecx, 0x58(%r14)
movl 0x4(%rbx), %edx
movl %edx, 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 %ebp, 0x4(%rsp)
movl 0x4c(%rbx), %ebp
movl %ebp, 0xa4(%r14)
movslq 0x50(%rbx), %r15
movl %r15d, 0xa8(%r14)
movslq 0x54(%rbx), %rax
movq %rax, 0x10(%rsp)
movl %eax, 0xac(%r14)
movl 0x58(%rbx), %eax
movl %eax, 0xb0(%r14)
movl 0x68(%rbx), %esi
movl %esi, 0xd0(%r14)
cmpl $0x33504449, %ecx       # imm = 0x33504449
sete %cl
cmpl $0xf, %edx
sete %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x607ec
movslq %ebp, %rbx
movl %eax, 0x50(%r14)
movl %ebp, 0x20(%r14)
movl 0x10c(%rsp), %esi
movl 0x4(%rsp), %edi
xorl %edx, %edx
callq 0x20872
movl $0x38, %esi
movq %rbx, %rdi
callq 0x6930
movq %rax, 0xb8(%r14)
testq %rax, %rax
je 0x607ec
imull $0x38, %ebp, %edx
movl 0x4(%rsp), %ebx
movl %ebx, %edi
movq %rax, %rsi
callq 0x20684
testl %r15d, %r15d
je 0x60588
movl 0x110(%rsp), %esi
movl %ebx, %edi
xorl %edx, %edx
callq 0x20872
movl $0x70, %esi
movq %r15, %rdi
callq 0x6930
movq %rax, 0xc0(%r14)
testq %rax, %rax
je 0x607ec
imull $0x70, %r15d, %edx
movl 0x4(%rsp), %ebx
movl %ebx, %edi
movq %rax, %rsi
callq 0x20684
movl 0x114(%rsp), %esi
movl %ebx, %edi
xorl %edx, %edx
callq 0x20872
movl $0x80, %esi
movq 0x10(%rsp), %rdi
callq 0x6930
movq %rax, 0xc8(%r14)
testq %rax, %rax
je 0x607ec
movl 0x4(%rsp), %ebp
cmpl $0x0, 0x10(%rsp)
jle 0x608cb
movq %rax, %r12
movl 0x114(%rsp), %esi
addq $0x78, %r12
xorl %eax, %eax
movq %rax, 0x38(%rsp)
movl %ebp, %edi
movl %esi, 0xc(%rsp)
xorl %edx, %edx
callq 0x20872
movl %ebp, %edi
leaq 0x44(%rsp), %rsi
movl $0x6c, %edx
callq 0x20684
movl 0x44(%rsp), %eax
movl %eax, -0x78(%r12)
leaq 0x48(%rsp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups 0x30(%rax), %xmm3
movups %xmm3, -0x44(%r12)
movups %xmm2, -0x54(%r12)
movups %xmm1, -0x64(%r12)
movups %xmm0, -0x74(%r12)
movl 0x88(%rsp), %eax
movl %eax, -0x34(%r12)
movl 0x8c(%rsp), %r13d
movl %r13d, -0x30(%r12)
movl 0x90(%rsp), %eax
movl %eax, -0x2c(%r12)
movl 0x94(%rsp), %ebp
movl %ebp, -0x28(%r12)
movl 0x98(%rsp), %ecx
movl %ecx, -0x24(%r12)
movl 0xac(%rsp), %edx
movl %edx, (%r12)
movl 0x9c(%rsp), %edx
movl %edx, 0x18(%rsp)
movl 0xa0(%rsp), %edx
movl %edx, 0x20(%rsp)
shll $0x2, %ecx
leal (%rcx,%rcx,2), %r15d
movl %eax, %ecx
shll $0x6, %ecx
leal (%rcx,%rax,4), %ecx
movl 0xa4(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0xa8(%rsp), %ebx
imull %ebp, %r13d
movq %rcx, 0x30(%rsp)
leal (%rcx,%rbp,8), %eax
leal (%rax,%r13,8), %eax
addl %r15d, %eax
movslq %eax, %rdi
callq 0x69a0
movq %rax, -0x20(%r12)
testq %rax, %rax
je 0x607ec
shll $0x3, %ebp
shll $0x3, %r13d
movl 0xc(%rsp), %ecx
addl %ecx, %ebx
movl %ebx, 0x2c(%rsp)
addl %ecx, 0x8(%rsp)
movl 0x20(%rsp), %ebx
addl %ecx, %ebx
movl 0x18(%rsp), %esi
addl %ecx, %esi
movslq %r15d, %rcx
movq %rcx, 0x18(%rsp)
addq %rcx, %rax
movq %rax, -0x18(%r12)
movq 0x30(%rsp), %r15
movslq %r15d, %rcx
addq %rax, %rcx
movq %rcx, -0x10(%r12)
movslq %ebp, %rax
movq %rax, 0x20(%rsp)
addq %rax, %rcx
movq %rcx, -0x8(%r12)
movl 0x4(%rsp), %ebp
movl %ebp, %edi
xorl %edx, %edx
callq 0x20872
movq -0x20(%r12), %rsi
movl %ebp, %edi
movq 0x18(%rsp), %rdx
callq 0x20684
movl %ebp, %edi
movl %ebx, %esi
xorl %edx, %edx
callq 0x20872
movq -0x18(%r12), %rsi
movl %ebp, %edi
movl %r15d, %edx
callq 0x20684
movl %ebp, %edi
movl 0x8(%rsp), %esi
xorl %edx, %edx
callq 0x20872
movq -0x10(%r12), %rsi
movl %ebp, %edi
movq 0x20(%rsp), %rdx
callq 0x20684
movl %ebp, %edi
movl 0x2c(%rsp), %esi
xorl %edx, %edx
callq 0x20872
movq -0x8(%r12), %rsi
movl %ebp, %edi
movl %r13d, %edx
callq 0x20684
movl 0x6038a9(%rip), %eax    # 0x664048
movl -0x28(%r12), %ecx
cmpl %ecx, %eax
cmovgl %eax, %ecx
movl %ecx, 0x603899(%rip)    # 0x664048
movl 0x6038a3(%rip), %eax    # 0x664058
movl -0x24(%r12), %ecx
leal (%rcx,%rcx,2), %ecx
cmpl %ecx, %eax
cmovgl %eax, %ecx
movl 0xc(%rsp), %esi
addl (%r12), %esi
movl %ecx, 0x603888(%rip)    # 0x664058
movq 0x38(%rsp), %rax
incq %rax
subq $-0x80, %r12
cmpq 0x10(%rsp), %rax
jl 0x605d6
jmp 0x608cb
movq %r14, %rdi
callq 0x653fb
xorl %r14d, %r14d
movl 0x4(%rsp), %ebp
jmp 0x608cb
xorl %eax, %eax
movb $0x0, 0xb0(%rsp,%rax)
incq %rax
movq %rax, %rdi
callq 0x69a0
movq %rax, 0x88(%r14)
testq %rax, %rax
je 0x608c0
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 0x608c0
movl 0x70(%rsp), %esi
movl %ebp, %edi
xorl %edx, %edx
callq 0x20872
movq 0x90(%r14), %rsi
movl 0x50(%r14), %edx
shll $0x6, %edx
movl %ebp, %edi
callq 0x20684
movslq 0x50(%r14), %rdi
movl %edi, %ecx
shll $0x6, %ecx
cmpl %ecx, %eax
jne 0x608c0
movl $0x20, %esi
callq 0x6930
movq %rax, 0x18(%r14)
testq %rax, %rax
je 0x608c0
movl 0x6037b1(%rip), %eax    # 0x664048
movl 0x58(%r14), %ecx
cmpl %ecx, %eax
cmovgl %eax, %ecx
movl %ecx, 0x6037a2(%rip)    # 0x664048
movl 0x6037ac(%rip), %eax    # 0x664058
movl 0x60(%r14), %ecx
leal (%rcx,%rcx,2), %ecx
cmpl %ecx, %eax
cmovgl %eax, %ecx
movl %ecx, 0x60379a(%rip)    # 0x664058
jmp 0x608cb
movq %r14, %rdi
callq 0x6533f
xorl %r14d, %r14d
movl %ebp, %edi
callq 0x20b40
movq %r14, %rax
addq $0x4b8, %rsp            # imm = 0x4B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq