// File: /workspace/github_c_makefile_star2_O3/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, 0x5e90f0(%rip)    # 0x649024
jle 0x60078
xorl %r15d, %r15d
leaq 0x59a7fc(%rip), %r12    # 0x5fa740
xorl %r13d, %r13d
movq 0x5e90da(%rip), %rax    # 0x649028
movq (%rax,%r13,8), %rbp
movl (%rbp), %eax
leal -0x2(%rax), %ecx
cmpl $0x2, %ecx
jae 0x5fff2
movl 0x50(%rbp), %eax
testl %eax, %eax
jle 0x5ffac
xorl %ebx, %ebx
movq 0x18(%rbp), %rcx
movq (%rcx,%rbx,8), %rsi
testq %rsi, %rsi
je 0x5ff9a
cmpl $0x0, (%rsi)
je 0x5ff9a
movl $0x1, %edi
callq *0xc0(%r12)
movq 0x18(%rbp), %rax
movq (%rax,%rbx,8), %rax
movl $0x0, (%rax)
movl 0x50(%rbp), %eax
incq %rbx
leal (,%rax,4), %ecx
movslq %ecx, %rcx
cmpq %rcx, %rbx
jl 0x5ff6a
movq 0x48(%rbp), %rbx
testq %rbx, %rbx
je 0x60065
xorl %r14d, %r14d
movq 0x18(%rbx,%r14,8), %rsi
testq %rsi, %rsi
je 0x5ffe3
cmpl $0x0, (%rsi)
je 0x5ffe3
movl $0x1, %edi
callq *0xc0(%r12)
movq 0x18(%rbx,%r14,8), %rax
movl $0x0, (%rax)
incq %r14
cmpq $0x4, %r14
jne 0x5ffbc
movq 0x38(%rbx), %rbx
jmp 0x5ffb0
cmpl $0x1, %eax
jne 0x60065
xorl %ebx, %ebx
movq 0x18(%rbp), %rsi
cmpl $0x0, (%rsi,%rbx)
je 0x60017
addq %rbx, %rsi
movl $0x1, %edi
callq *0xc0(%r12)
movq 0x18(%rbp), %rsi
movl $0x0, (%rsi,%rbx)
addq $0x4, %rbx
cmpq $0x400, %rbx            # imm = 0x400
jne 0x5fff9
leaq 0x74(%rbp), %rbx
cmpl $0x0, 0x74(%rbp)
je 0x60045
movl $0x1, %edi
movq %rbx, %rsi
callq *0x110(%r12)
leaq 0x78(%rbp), %r14
cmpl $0x0, 0x78(%rbp)
je 0x6005f
movl $0x1, %edi
movq %r14, %rsi
callq *0x110(%r12)
movl %r15d, (%rbx)
movl %r15d, (%r14)
incq %r13
movslq 0x5e8fb5(%rip), %rax    # 0x649024
cmpq %rax, %r13
jl 0x5ff47
xorl %r15d, %r15d
leaq 0x59a6be(%rip), %r13    # 0x5fa740
xorl %ebp, %ebp
leaq 0x603fd5(%rip), %rax    # 0x664060
movq (%rax,%rbp,8), %r12
testq %r12, %r12
je 0x60107
xorl %ebx, %ebx
movq 0x18(%r12), %rsi
cmpl $0x0, (%rsi,%rbx)
je 0x600b5
addq %rbx, %rsi
movl $0x1, %edi
callq *0xc0(%r13)
movq 0x18(%r12), %rsi
movl $0x0, (%rsi,%rbx)
addq $0x4, %rbx
cmpq $0x400, %rbx            # imm = 0x400
jne 0x60096
leaq 0x74(%r12), %rbx
cmpl $0x0, 0x74(%r12)
je 0x600e5
movl $0x1, %edi
movq %rbx, %rsi
callq *0x110(%r13)
leaq 0x78(%r12), %r14
cmpl $0x0, 0x78(%r12)
je 0x60101
movl $0x1, %edi
movq %r14, %rsi
callq *0x110(%r13)
movl %r15d, (%rbx)
movl %r15d, (%r14)
incq %rbp
cmpq $0x1000, %rbp           # imm = 0x1000
jne 0x60084
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq