// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/jfbuild/src/mdsprite.c
// Function: clearskins
void clearskins (void)
{
	mdmodel *m;
	int i, j;

	for(i=0;i<nextmodelid;i++)
	{
		m = models[i];
		if (m->mdnum == 1) {
			voxmodel *v = (voxmodel*)m;
			for(j=0;j<MAXPALOOKUPS;j++) {
				if (v->texid[j]) glfunc.glDeleteTextures(1, &v->texid[j]);
				v->texid[j] = 0;
			}
			if (v->vertexbuf) glfunc.glDeleteBuffers(1, &v->vertexbuf);
			if (v->indexbuf) glfunc.glDeleteBuffers(1, &v->indexbuf);
			v->vertexbuf = 0;
			v->indexbuf = 0;
		} else if (m->mdnum == 2 || m->mdnum == 3) {
			md2model *m2 = (md2model*)m;
			mdskinmap_t *sk;
			for(j=0;j<m2->numskins*(HICEFFECTMASK+1);j++)
			{
				if (m2->tex[j] && m2->tex[j]->glpic) {
					glfunc.glDeleteTextures(1, &m2->tex[j]->glpic);
					m2->tex[j]->glpic = 0;
				}
			}

			for(sk=m2->skinmap;sk;sk=sk->next)
			{
				for(j=0;j<(HICEFFECTMASK+1);j++)
				{
					if (sk->tex[j] && sk->tex[j]->glpic) {
						glfunc.glDeleteTextures(1, &sk->tex[j]->glpic);
						sk->tex[j]->glpic = 0;
					}
				}
			}
		}
	}

	for(i=0;i<MAXVOXELS;i++)
	{
		voxmodel *v = (voxmodel*)voxmodels[i]; if (!v) continue;
		for(j=0;j<MAXPALOOKUPS;j++) {
			if (v->texid[j]) glfunc.glDeleteTextures(1,(GLuint*)&v->texid[j]);
			v->texid[j] = 0;
		}
		if (v->vertexbuf) glfunc.glDeleteBuffers(1, &v->vertexbuf);
		if (v->indexbuf) glfunc.glDeleteBuffers(1, &v->indexbuf);
		v->vertexbuf = 0;
		v->indexbuf = 0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0x5ea1c2(%rip)    # 0x648034
jle 0x5dfb0
xorl %r15d, %r15d
leaq 0x59b8be(%rip), %r12    # 0x5f9740
xorl %r13d, %r13d
movq 0x5ea1ac(%rip), %rax    # 0x648038
movq (%rax,%r13,8), %rbp
movl (%rbp), %eax
leal -0x2(%rax), %ecx
cmpl $0x2, %ecx
jae 0x5df2a
cmpl $0x0, 0x50(%rbp)
jle 0x5dee4
xorl %ebx, %ebx
movq 0x18(%rbp), %rax
movq (%rax,%rbx,8), %rsi
testq %rsi, %rsi
je 0x5ded4
cmpl $0x0, (%rsi)
je 0x5ded4
movl $0x1, %edi
callq *0xc0(%r12)
movq 0x18(%rbp), %rax
movq (%rax,%rbx,8), %rax
movl $0x0, (%rax)
incq %rbx
movslq 0x50(%rbp), %rax
shlq $0x2, %rax
cmpq %rax, %rbx
jl 0x5dea7
movq 0x48(%rbp), %rbx
testq %rbx, %rbx
je 0x5df9d
xorl %r14d, %r14d
movq 0x18(%rbx,%r14,8), %rsi
testq %rsi, %rsi
je 0x5df1b
cmpl $0x0, (%rsi)
je 0x5df1b
movl $0x1, %edi
callq *0xc0(%r12)
movq 0x18(%rbx,%r14,8), %rax
movl $0x0, (%rax)
incq %r14
cmpq $0x4, %r14
jne 0x5def4
movq 0x38(%rbx), %rbx
jmp 0x5dee8
cmpl $0x1, %eax
jne 0x5df9d
xorl %ebx, %ebx
movq 0x18(%rbp), %rsi
cmpl $0x0, (%rsi,%rbx)
je 0x5df4b
addq %rbx, %rsi
movl $0x1, %edi
callq *0xc0(%r12)
movq 0x18(%rbp), %rax
movl $0x0, (%rax,%rbx)
addq $0x4, %rbx
cmpq $0x400, %rbx            # imm = 0x400
jne 0x5df31
leaq 0x74(%rbp), %rbx
cmpl $0x0, 0x74(%rbp)
je 0x5df7d
movl $0x1, %edi
movq %rbx, %rsi
callq *0x110(%r12)
leaq 0x78(%rbp), %r14
cmpl $0x0, 0x78(%rbp)
je 0x5df97
movl $0x1, %edi
movq %r14, %rsi
callq *0x110(%r12)
movl %r15d, (%rbx)
movl %r15d, (%r14)
incq %r13
movslq 0x5ea08d(%rip), %rax    # 0x648034
cmpq %rax, %r13
jl 0x5de85
xorl %r15d, %r15d
leaq 0x59b786(%rip), %r13    # 0x5f9740
xorl %ebp, %ebp
leaq 0x6050ad(%rip), %rax    # 0x663070
movq (%rax,%rbp,8), %r12
testq %r12, %r12
je 0x5e03f
xorl %ebx, %ebx
movq 0x18(%r12), %rsi
cmpl $0x0, (%rsi,%rbx)
je 0x5dfe8
addq %rbx, %rsi
movl $0x1, %edi
callq *0xc0(%r13)
movq 0x18(%r12), %rax
movl $0x0, (%rax,%rbx)
addq $0x4, %rbx
cmpq $0x400, %rbx            # imm = 0x400
jne 0x5dfce
leaq 0x74(%r12), %rbx
cmpl $0x0, 0x74(%r12)
je 0x5e01d
movl $0x1, %edi
movq %rbx, %rsi
callq *0x110(%r13)
leaq 0x78(%r12), %r14
cmpl $0x0, 0x78(%r12)
je 0x5e039
movl $0x1, %edi
movq %r14, %rsi
callq *0x110(%r13)
movl %r15d, (%rbx)
movl %r15d, (%r14)
incq %rbp
cmpq $0x1000, %rbp           # imm = 0x1000
jne 0x5dfbc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq