// File: /workspace/github_c_makefile_star2_O2/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
xorl %r13d, %r13d
leaq 0x59ddce(%rip), %r12    # 0x5f3740
pushq $0x1
popq %rbx
movslq 0x5ec6a8(%rip), %rax    # 0x642024
cmpq %rax, %r13
jge 0x55a93
movq 0x5ec69c(%rip), %rax    # 0x642028
movq (%rax,%r13,8), %rbp
movl (%rbp), %eax
leal -0x2(%rax), %ecx
cmpl $0x2, %ecx
jae 0x559d7
xorl %r14d, %r14d
movslq 0x50(%rbp), %rax
shlq $0x2, %rax
cmpq %rax, %r14
jge 0x55a13
movq 0x18(%rbp), %rax
movq (%rax,%r14,8), %rsi
testq %rsi, %rsi
je 0x559d2
cmpl $0x0, (%rsi)
je 0x559d2
movl %ebx, %edi
callq *0xc0(%r12)
movq 0x18(%rbp), %rax
movq (%rax,%r14,8), %rax
andl $0x0, (%rax)
incq %r14
jmp 0x5599e
cmpl $0x1, %eax
jne 0x55a8b
xorl %r14d, %r14d
cmpq $0x400, %r14            # imm = 0x400
je 0x55a55
movq 0x18(%rbp), %rsi
cmpl $0x0, (%rsi,%r14)
je 0x55a08
addq %r14, %rsi
movl %ebx, %edi
callq *0xc0(%r12)
movq 0x18(%rbp), %rsi
andl $0x0, (%rsi,%r14)
addq $0x4, %r14
jmp 0x559e3
addq $0x48, %rbp
movq (%rbp), %rbp
testq %rbp, %rbp
je 0x55a8b
xorl %r14d, %r14d
cmpq $0x4, %r14
je 0x55a4f
movq 0x18(%rbp,%r14,8), %rsi
testq %rsi, %rsi
je 0x55a4a
cmpl $0x0, (%rsi)
je 0x55a4a
movl %ebx, %edi
callq *0xc0(%r12)
movq 0x18(%rbp,%r14,8), %rax
andl $0x0, (%rax)
incq %r14
jmp 0x55a23
addq $0x38, %rbp
jmp 0x55a17
leaq 0x74(%rbp), %r14
cmpl $0x0, 0x74(%rbp)
je 0x55a6c
movl %ebx, %edi
movq %r14, %rsi
callq *0x110(%r12)
leaq 0x78(%rbp), %r15
cmpl $0x0, 0x78(%rbp)
je 0x55a83
movl %ebx, %edi
movq %r15, %rsi
callq *0x110(%r12)
andl $0x0, (%r14)
andl $0x0, (%r15)
incq %r13
jmp 0x55975
xorl %r13d, %r13d
pushq $0x1
popq %rbx
cmpq $0x1000, %r13           # imm = 0x1000
je 0x55b27
leaq 0x6075b3(%rip), %rax    # 0x65d060
movq (%rax,%r13,8), %rbp
testq %rbp, %rbp
je 0x55b1f
xorl %r14d, %r14d
cmpq $0x400, %r14            # imm = 0x400
je 0x55ae9
movq 0x18(%rbp), %rsi
cmpl $0x0, (%rsi,%r14)
je 0x55ade
addq %r14, %rsi
movl %ebx, %edi
callq *0xc0(%r12)
movq 0x18(%rbp), %rsi
andl $0x0, (%rsi,%r14)
addq $0x4, %r14
jmp 0x55ab9
leaq 0x74(%rbp), %r14
cmpl $0x0, 0x74(%rbp)
je 0x55b00
movl %ebx, %edi
movq %r14, %rsi
callq *0x110(%r12)
leaq 0x78(%rbp), %r15
cmpl $0x0, 0x78(%rbp)
je 0x55b17
movl %ebx, %edi
movq %r15, %rsi
callq *0x110(%r12)
andl $0x0, (%r14)
andl $0x0, (%r15)
incq %r13
jmp 0x55a99
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq