LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: qloadkvx
int qloadkvx(int voxindex, char *filename)
{
	int i, fil, dasiz, lengcnt, lengtot;
	unsigned char *ptr;

	if ((fil = kopen4load(filename,0)) == -1) return -1;

	lengcnt = 0;
	lengtot = kfilelength(fil);

	for(i=0;i<MAXVOXMIPS;i++)
	{
		kread(fil,&dasiz,4); dasiz = B_LITTLE32(dasiz);
			//Must store filenames to use cacheing system :(
		voxlock[voxindex][i] = 200;
		allocache((void **)&voxoff[voxindex][i],dasiz,&voxlock[voxindex][i]);
		ptr = (unsigned char *)voxoff[voxindex][i];
		kread(fil,ptr,dasiz);

		lengcnt += dasiz+4;
		if (lengcnt >= lengtot-768) break;
	}
	kclose(fil);

#if USE_POLYMOST && USE_OPENGL
	if (voxmodels[voxindex]) {
		voxfree(voxmodels[voxindex]);
		voxmodels[voxindex] = NULL;
	}
	voxmodels[voxindex] = voxload(filename);
#endif
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movl %edi, %r15d
xorl %ebx, %ebx
movq %rsi, %rdi
xorl %esi, %esi
callq 0x1dc36
cmpl $-0x1, %eax
je 0x32f0c
movl %eax, %ebp
movq %r14, 0x10(%rsp)
movl %eax, %edi
callq 0x1e14c
movl %eax, %r14d
movslq %r15d, %rcx
addl $0xfffffd00, %r14d      # imm = 0xFFFFFD00
leaq (%rcx,%rcx,4), %rax
leaq 0x34cc63(%rip), %r12    # 0x37fad0
addq %rax, %r12
movq %rcx, 0x8(%rsp)
imulq $0x28, %rcx, %rax
leaq 0x324c50(%rip), %r15    # 0x357ad0
addq %rax, %r15
xorl %r13d, %r13d
cmpq $0x5, %r13
je 0x32ed4
movl %ebp, %edi
leaq 0x4(%rsp), %rsi
pushq $0x4
popq %rdx
callq 0x1de3f
leaq (%r12,%r13), %rdx
movb $-0x38, (%r12,%r13)
movslq 0x4(%rsp), %rsi
movq %r15, %rdi
callq 0x1cfb5
movq (%r15), %rsi
movl 0x4(%rsp), %edx
movl %ebp, %edi
callq 0x1de3f
movl 0x4(%rsp), %eax
addl %eax, %ebx
addl $0x4, %ebx
incq %r13
addq $0x8, %r15
cmpl %r14d, %ebx
jl 0x32e86
movl %ebp, %edi
callq 0x1e2db
leaq 0x62a17e(%rip), %rbx    # 0x65d060
movq 0x8(%rsp), %r14
movq (%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x32efa
callq 0x56d8b
andq $0x0, (%rbx,%r14,8)
movq 0x10(%rsp), %rdi
callq 0x56db9
movq %rax, (%rbx,%r14,8)
xorl %eax, %eax
jmp 0x32f0f
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: clipinsidebox
int clipinsidebox(int x, int y, short wallnum, int walldist)
{
	walltype *wal;
	int x1, y1, x2, y2, r;

	r = (walldist<<1);
	wal = &wall[wallnum];     x1 = wal->x+walldist-x; y1 = wal->y+walldist-y;
	wal = &wall[wal->point2]; x2 = wal->x+walldist-x; y2 = wal->y+walldist-y;

	if ((x1 < 0) && (x2 < 0)) return(0);
	if ((y1 < 0) && (y2 < 0)) return(0);
	if ((x1 >= r) && (x2 >= r)) return(0);
	if ((y1 >= r) && (y2 >= r)) return(0);

	x2 -= x1; y2 -= y1;
	if (x2*(walldist-y1) >= y2*(walldist-x1))  //Front
	{
		if (x2 > 0) x2 *= (0-y1); else x2 *= (r-y1);
		if (y2 > 0) y2 *= (r-x1); else y2 *= (0-x1);
		return(x2 < y2);
	}
	if (x2 > 0) x2 *= (r-y1); else x2 *= (0-y1);
	if (y2 > 0) y2 *= (0-x1); else y2 *= (r-x1);
	return((x2 >= y2)<<1);
}

// Assembly:
movslq %edx, %r9
shlq $0x5, %r9
leaq 0x17eb24(%rip), %r10    # 0x1b1a50
movl %ecx, %edx
subl %edi, %edx
movl %ecx, %edi
subl %esi, %edi
movl 0x4(%r9,%r10), %esi
addl %edi, %esi
movswq 0x8(%r9,%r10), %rax
shlq $0x5, %rax
movl (%rax,%r10), %r8d
addl 0x4(%rax,%r10), %edi
addl %edx, %r8d
xorl %eax, %eax
addl (%r9,%r10), %edx
jns 0x32f5f
testl %r8d, %r8d
jns 0x32f5f
retq
testl %esi, %esi
jns 0x32f67
testl %edi, %edi
js 0x32f5e
leal (%rcx,%rcx), %r11d
movl %r11d, %r9d
subl %edx, %r9d
jg 0x32f78
cmpl %r11d, %r8d
jge 0x32f5e
movl %r11d, %r10d
subl %esi, %r10d
jg 0x32f85
cmpl %r11d, %edi
jge 0x32f5e
subl %edx, %r8d
subl %esi, %edi
movl %ecx, %eax
subl %esi, %eax
imull %r8d, %eax
subl %edx, %ecx
imull %edi, %ecx
cmpl %ecx, %eax
jge 0x32fc6
imull %r8d, %r10d
imull %r8d, %esi
negl %esi
testl %r8d, %r8d
cmovgl %r10d, %esi
imull %edi, %edx
negl %edx
imull %edi, %r9d
testl %edi, %edi
cmovgl %edx, %r9d
xorl %eax, %eax
cmpl %r9d, %esi
setge %al
addl %eax, %eax
retq
imull %r8d, %esi
negl %esi
imull %r8d, %r10d
testl %r8d, %r8d
cmovgl %esi, %r10d
imull %edi, %r9d
imull %edi, %edx
negl %edx
testl %edi, %edi
cmovgl %r9d, %edx
xorl %eax, %eax
cmpl %edx, %r10d
setl %al
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: clipinsideboxline
int clipinsideboxline(int x, int y, int x1, int y1, int x2, int y2, int walldist)
{
	int r;

	r = (walldist<<1);

	x1 += walldist-x; x2 += walldist-x;
	if ((x1 < 0) && (x2 < 0)) return(0);
	if ((x1 >= r) && (x2 >= r)) return(0);

	y1 += walldist-y; y2 += walldist-y;
	if ((y1 < 0) && (y2 < 0)) return(0);
	if ((y1 >= r) && (y2 >= r)) return(0);

	x2 -= x1; y2 -= y1;
	if (x2*(walldist-y1) >= y2*(walldist-x1))  //Front
	{
		if (x2 > 0) x2 *= (0-y1); else x2 *= (r-y1);
		if (y2 > 0) y2 *= (r-x1); else y2 *= (0-x1);
		return(x2 < y2);
	}
	if (x2 > 0) x2 *= (r-y1); else x2 *= (0-y1);
	if (y2 > 0) y2 *= (0-x1); else y2 *= (r-x1);
	return((x2 >= y2)<<1);
}

// Assembly:
pushq %rbp
pushq %rbx
movl 0x18(%rsp), %r11d
movl %r11d, %r10d
subl %edi, %r10d
addl %r10d, %edx
addl %r8d, %r10d
xorl %eax, %eax
testl %r10d, %edx
js 0x330c5
leal (%r11,%r11), %ebx
movl %ebx, %edi
subl %edx, %edi
setg %r8b
cmpl %ebx, %r10d
setl %bpl
orb %r8b, %bpl
cmpb $0x1, %bpl
jne 0x330c5
movl %r11d, %r8d
subl %esi, %r8d
addl %r8d, %ecx
addl %r9d, %r8d
testl %r8d, %ecx
js 0x330c5
movl %ebx, %esi
subl %ecx, %esi
setg %r9b
cmpl %ebx, %r8d
setl %bl
orb %r9b, %bl
cmpb $0x1, %bl
jne 0x330c5
subl %edx, %r10d
subl %ecx, %r8d
movl %r11d, %eax
subl %ecx, %eax
imull %r10d, %eax
subl %edx, %r11d
imull %r8d, %r11d
cmpl %r11d, %eax
jge 0x3309e
imull %r10d, %esi
imull %r10d, %ecx
negl %ecx
testl %r10d, %r10d
cmovgl %esi, %ecx
imull %r8d, %edx
negl %edx
imull %r8d, %edi
testl %r8d, %r8d
cmovgl %edx, %edi
xorl %eax, %eax
cmpl %edi, %ecx
setge %al
addl %eax, %eax
jmp 0x330c5
imull %r10d, %ecx
negl %ecx
imull %r10d, %esi
testl %r10d, %r10d
cmovgl %ecx, %esi
imull %r8d, %edi
imull %r8d, %edx
negl %edx
testl %r8d, %r8d
cmovgl %edi, %edx
xorl %eax, %eax
cmpl %edx, %esi
setl %al
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: inside
int inside(int x, int y, short sectnum)
{
	walltype *wal;
	int i, x1, y1, x2, y2;
	unsigned int cnt;

	if ((sectnum < 0) || (sectnum >= numsectors)) return(-1);

	cnt = 0;
	wal = &wall[sector[sectnum].wallptr];
	i = sector[sectnum].wallnum;
	do
	{
		y1 = wal->y-y; y2 = wall[wal->point2].y-y;
		if ((y1^y2) < 0)
		{
			x1 = wal->x-x; x2 = wall[wal->point2].x-x;
			if ((x1^x2) >= 0) cnt ^= x1; else cnt ^= (x1*y2-x2*y1)^y2;
		}
		wal++; i--;
	} while (i);
	return(cnt>>31);
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testw %dx, %dx
js 0x33163
cmpw %dx, 0x395e83(%rip)     # 0x3c8f60
jle 0x33163
pushq %rbp
pushq %rbx
movzwl %dx, %eax
imulq $0x28, %rax, %rax
leaq 0x20996d(%rip), %rcx    # 0x23ca60
movswq (%rax,%rcx), %r8
movswl 0x2(%rax,%rcx), %ecx
shlq $0x5, %r8
leaq 0x17e948(%rip), %rdx    # 0x1b1a50
addq %rdx, %r8
addq $0x8, %r8
xorl %eax, %eax
movl -0x4(%r8), %r9d
subl %esi, %r9d
movswq (%r8), %rbx
shlq $0x5, %rbx
movl 0x4(%rbx,%rdx), %r10d
subl %esi, %r10d
movl %r10d, %r11d
xorl %r9d, %r11d
jns 0x33156
addq %rdx, %rbx
movl -0x8(%r8), %r11d
subl %edi, %r11d
movl (%rbx), %ebx
subl %edi, %ebx
movl %ebx, %ebp
xorl %r11d, %ebp
jns 0x33153
imull %r10d, %r11d
imull %r9d, %ebx
subl %ebx, %r11d
xorl %r10d, %eax
xorl %r11d, %eax
addq $0x20, %r8
decl %ecx
jne 0x33111
shrl $0x1f, %eax
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: getangle
int getangle(int xvect, int yvect)
{
	if ((xvect|yvect) == 0) return(0);
	if (xvect == 0) return(512+((yvect<0)<<10));
	if (yvect == 0) return(((xvect<0)<<10));
	if (xvect == yvect) return(256+((xvect<0)<<10));
	if (xvect == -yvect) return(768+((xvect>0)<<10));
	if (klabs(xvect) > klabs(yvect))
		return(((radarang[640+scale(160,yvect,xvect)]>>6)+((xvect<0)<<10))&2047);
	return(((radarang[640-scale(160,xvect,yvect)]>>6)+512+((yvect<0)<<10))&2047);
}

// Assembly:
movl %esi, %eax
orl %edi, %eax
je 0x3318a
testl %edi, %edi
je 0x33191
testl %esi, %esi
je 0x331a5
cmpl %esi, %edi
jne 0x331b5
shrl $0x15, %esi
andl $0x400, %esi            # imm = 0x400
orl $0x100, %esi            # imm = 0x100
jmp 0x33269
xorl %esi, %esi
jmp 0x33269
shrl $0x15, %esi
andl $0x400, %esi            # imm = 0x400
orl $0x200, %esi            # imm = 0x200
jmp 0x33269
shrl $0x15, %edi
andl $0x400, %edi            # imm = 0x400
movl %edi, %esi
jmp 0x33269
movl %esi, %eax
addl %edi, %eax
jne 0x331d1
xorl %esi, %esi
testl %edi, %edi
setg %sil
shll $0xa, %esi
orl $0x300, %esi            # imm = 0x300
jmp 0x33269
movabsq $0x28000000000, %rcx    # imm = 0x28000000000
movl %edi, %eax
negl %eax
cmovsl %edi, %eax
movl %esi, %edx
negl %edx
cmovsl %esi, %edx
cmpl %edx, %eax
jbe 0x3322b
movslq %esi, %rax
imulq $0xa0, %rax, %rax
movslq %edi, %rsi
cqto
idivq %rsi
shlq $0x20, %rax
addq %rcx, %rax
sarq $0x1f, %rax
leaq 0x3f692f(%rip), %rcx    # 0x429b40
movswl (%rax,%rcx), %eax
sarl $0x6, %eax
shrl $0x15, %edi
andl $0x400, %edi            # imm = 0x400
addl %eax, %edi
andl $0x7ff, %edi            # imm = 0x7FF
jmp 0x331ae
movslq %edi, %rax
imulq $0xa0, %rax, %rax
movslq %esi, %rdi
cqto
idivq %rdi
shlq $0x20, %rax
subq %rax, %rcx
sarq $0x1f, %rcx
leaq 0x3f68f1(%rip), %rax    # 0x429b40
movswl (%rcx,%rax), %eax
sarl $0x6, %eax
addl $0x200, %eax            # imm = 0x200
movzwl %ax, %eax
shrl $0x15, %esi
andl $0x400, %esi            # imm = 0x400
addl %eax, %esi
movl %esi, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: setsprite
int setsprite(short spritenum, int newx, int newy, int newz)
{
	short tempsectnum;

	sprite[spritenum].x = newx;
	sprite[spritenum].y = newy;
	sprite[spritenum].z = newz;

	tempsectnum = sprite[spritenum].sectnum;
	updatesector(newx,newy,&tempsectnum);
	if (tempsectnum < 0)
		return(-1);
	if (tempsectnum != sprite[spritenum].sectnum)
		changespritesect(spritenum,tempsectnum);

	return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
movslq %edi, %rax
imulq $0x2c, %rax, %rax
leaq 0x242a23(%rip), %rdi    # 0x275cb0
movl %esi, (%rax,%rdi)
movl %edx, 0x4(%rax,%rdi)
movl %ecx, 0x8(%rax,%rdi)
movzwl 0x18(%rax,%rdi), %r15d
leaq 0x6(%rsp), %r14
movw %r15w, (%r14)
movl %esi, %edi
movl %edx, %esi
movq %r14, %rdx
callq 0x23663
movzwl (%r14), %eax
testw %ax, %ax
js 0x332d1
xorl %ebp, %ebp
cmpw %r15w, %ax
je 0x332d4
movswl %bx, %edi
movswl %ax, %esi
callq 0x332e1
jmp 0x332d4
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: changespritesect
int changespritesect(short spritenum, short newsectnum)
{
	if ((newsectnum < 0) || (newsectnum > MAXSECTORS)) return(-1);
	if (sprite[spritenum].sectnum == newsectnum) return(0);
	if (sprite[spritenum].sectnum == MAXSECTORS) return(-1);
	if (deletespritesect(spritenum) < 0) return(-1);
	insertspritesect(newsectnum);
	return(0);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
pushq $-0x1
popq %rbx
cmpw $0x1000, %bp            # imm = 0x1000
ja 0x33325
movswq %di, %rax
imulq $0x2c, %rax, %rax
leaq 0x2429b1(%rip), %rcx    # 0x275cb0
movzwl 0x18(%rax,%rcx), %eax
cmpw %bp, %ax
je 0x33323
cmpw $0x1000, %ax            # imm = 0x1000
je 0x33325
movswl %di, %edi
callq 0x336a8
testl %eax, %eax
js 0x33325
movswl %bp, %edi
callq 0x33579
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: setspritez
int setspritez(short spritenum, int newx, int newy, int newz)
{
	short tempsectnum;

	sprite[spritenum].x = newx;
	sprite[spritenum].y = newy;
	sprite[spritenum].z = newz;

	tempsectnum = sprite[spritenum].sectnum;
	updatesectorz(newx,newy,newz,&tempsectnum);
	if (tempsectnum < 0)
		return(-1);
	if (tempsectnum != sprite[spritenum].sectnum)
		changespritesect(spritenum,tempsectnum);

	return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
movslq %edi, %rax
imulq $0x2c, %rax, %rax
leaq 0x24296b(%rip), %rdi    # 0x275cb0
movl %esi, (%rax,%rdi)
movl %edx, 0x4(%rax,%rdi)
movl %ecx, 0x8(%rax,%rdi)
movzwl 0x18(%rax,%rdi), %r15d
leaq 0x6(%rsp), %r14
movw %r15w, (%r14)
movl %esi, %edi
movl %edx, %esi
movl %ecx, %edx
movq %r14, %rcx
callq 0x3339b
movzwl (%r14), %eax
testw %ax, %ax
js 0x3338b
xorl %ebp, %ebp
cmpw %r15w, %ax
je 0x3338e
movswl %bx, %edi
movswl %ax, %esi
callq 0x332e1
jmp 0x3338e
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: updatesectorz
void updatesectorz(int x, int y, int z, short *sectnum)
{
	walltype *wal;
	int i, j, cz, fz;

	getzsofslope(*sectnum, x, y, &cz, &fz);
	if ((z >= cz) && (z <= fz))
		if (inside(x,y,*sectnum) != 0) return;

	if ((*sectnum >= 0) && (*sectnum < numsectors))
	{
		wal = &wall[sector[*sectnum].wallptr];
		j = sector[*sectnum].wallnum;
		do
		{
			i = wal->nextsector;
			if (i >= 0)
			{
				getzsofslope(i, x, y, &cz, &fz);
				if ((z >= cz) && (z <= fz))
					if (inside(x,y,(short)i) == 1)
						{ *sectnum = i; return; }
			}
			wal++; j--;
		} while (j != 0);
	}

	for (i=numsectors-1;i>=0;i--)
	{
		getzsofslope(i, x, y, &cz, &fz);
		if ((z >= cz) && (z <= fz))
			if (inside(x,y,(short)i) == 1)
				{ *sectnum = i; return; }
	}

	*sectnum = -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r14
movl %edx, %ebp
movl %esi, %edx
movl %edi, %esi
movswl (%rcx), %r12d
leaq 0x8(%rsp), %rbx
leaq 0x4(%rsp), %r8
movl %r12d, %edi
movl %esi, (%rsp)
movl %edx, %r15d
movq %rbx, %rcx
callq 0x2373c
cmpl %ebp, (%rbx)
jg 0x333f1
cmpl %ebp, 0x4(%rsp)
jl 0x333f1
movl (%rsp), %edi
movl %r15d, %esi
movl %r12d, %edx
callq 0x330c8
testl %eax, %eax
jne 0x334ee
movq %r14, 0x10(%rsp)
movslq %r12d, %rax
testw %ax, %ax
setns %cl
movzwl 0x395b5a(%rip), %edx    # 0x3c8f60
movw %dx, 0xe(%rsp)
cmpw %dx, %ax
setl %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x3348d
imulq $0x28, %rax, %rax
leaq 0x20963d(%rip), %rcx    # 0x23ca60
movswq (%rax,%rcx), %rdx
movswl 0x2(%rax,%rcx), %r13d
shlq $0x5, %rdx
leaq 0x17e617(%rip), %rax    # 0x1b1a50
leaq (%rdx,%rax), %r14
addq $0xc, %r14
movzwl (%r14), %r12d
testw %r12w, %r12w
js 0x33484
movswl %r12w, %ebx
movl %ebx, %edi
movl (%rsp), %esi
movl %r15d, %edx
leaq 0x8(%rsp), %rcx
leaq 0x4(%rsp), %r8
callq 0x2373c
cmpl %ebp, 0x8(%rsp)
jg 0x33484
cmpl %ebp, 0x4(%rsp)
jl 0x33484
movl (%rsp), %edi
movl %r15d, %esi
movl %ebx, %edx
callq 0x330c8
cmpl $0x1, %eax
je 0x334e5
addq $0x20, %r14
decl %r13d
jne 0x33441
movswl 0xe(%rsp), %r14d
leal -0x1(%r14), %r12d
leaq 0x4(%rsp), %r13
testl %r14d, %r14d
jle 0x334e0
movswl %r12w, %ebx
movl %ebx, %edi
movl (%rsp), %esi
movl %r15d, %edx
leaq 0x8(%rsp), %rcx
movq %r13, %r8
callq 0x2373c
cmpl %ebp, 0x8(%rsp)
jg 0x334d8
cmpl %ebp, 0x4(%rsp)
jl 0x334d8
movl (%rsp), %edi
movl %r15d, %esi
movl %ebx, %edx
callq 0x330c8
cmpl $0x1, %eax
je 0x334e5
decl %r12d
decl %r14d
jmp 0x3349c
movw $0xffff, %r12w          # imm = 0xFFFF
movq 0x10(%rsp), %rax
movw %r12w, (%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: insertspritestat
static int insertspritestat(short statnum)
{
	short blanktouse;

	if ((statnum >= MAXSTATUS) || (headspritestat[MAXSTATUS] == -1))
		return(-1);  //list full

	blanktouse = headspritestat[MAXSTATUS];

	headspritestat[MAXSTATUS] = nextspritestat[blanktouse];
	if (headspritestat[MAXSTATUS] >= 0)
		prevspritestat[headspritestat[MAXSTATUS]] = -1;

	prevspritestat[blanktouse] = -1;
	nextspritestat[blanktouse] = headspritestat[statnum];
	if (headspritestat[statnum] >= 0)
		prevspritestat[headspritestat[statnum]] = blanktouse;
	headspritestat[statnum] = blanktouse;

	sprite[blanktouse].statnum = statnum;

	return(blanktouse);
}

// Assembly:
cmpw $0x400, %di             # imm = 0x400
setge %cl
movzwl 0x384814(%rip), %eax    # 0x3b7d20
cmpw $-0x1, %ax
sete %dl
orb %cl, %dl
jne 0x33578
movswq %ax, %rax
leaq 0x38c80e(%rip), %rcx    # 0x3bfd30
movswq (%rcx,%rax,2), %rsi
movw %si, 0x3847f2(%rip)     # 0x3b7d20
leaq 0x3847fb(%rip), %rdx    # 0x3b7d30
testq %rsi, %rsi
js 0x3353f
orw $-0x1, (%rdx,%rsi,2)
orw $-0x1, (%rdx,%rax,2)
movswq %di, %rsi
leaq 0x383fd1(%rip), %r8     # 0x3b7520
movswq (%r8,%rsi,2), %r9
movw %r9w, (%rcx,%rax,2)
testq %r9, %r9
js 0x33563
movw %ax, (%rdx,%r9,2)
movw %ax, (%r8,%rsi,2)
imulq $0x2c, %rax, %rax
leaq 0x24273d(%rip), %rcx    # 0x275cb0
movw %di, 0x1a(%rax,%rcx)
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: insertspritesect
static int insertspritesect(short sectnum)
{
	short blanktouse;

	if ((sectnum >= MAXSECTORS) || (headspritesect[MAXSECTORS] == -1))
		return(-1);  //list full

	blanktouse = headspritesect[MAXSECTORS];

	headspritesect[MAXSECTORS] = nextspritesect[blanktouse];
	if (headspritesect[MAXSECTORS] >= 0)
		prevspritesect[headspritesect[MAXSECTORS]] = -1;

	prevspritesect[blanktouse] = -1;
	nextspritesect[blanktouse] = headspritesect[sectnum];
	if (headspritesect[sectnum] >= 0)
		prevspritesect[headspritesect[sectnum]] = blanktouse;
	headspritesect[sectnum] = blanktouse;

	sprite[blanktouse].sectnum = sectnum;

	return(blanktouse);
}

// Assembly:
cmpw $0x1000, %di            # imm = 0x1000
setge %cl
movzwl 0x373f88(%rip), %eax    # 0x3a7510
cmpw $-0x1, %ax
sete %dl
orb %cl, %dl
je 0x33597
pushq $-0x1
popq %rax
retq
movswq %ax, %rcx
leaq 0x37bf7e(%rip), %rax    # 0x3af520
movswq (%rax,%rcx,2), %rsi
movw %si, 0x373f62(%rip)     # 0x3a7510
leaq 0x373f6b(%rip), %rdx    # 0x3a7520
testq %rsi, %rsi
js 0x335bf
orw $-0x1, (%rdx,%rsi,2)
orw $-0x1, (%rdx,%rcx,2)
movswq %di, %rsi
leaq 0x371f41(%rip), %r8     # 0x3a5510
movswq (%r8,%rsi,2), %r9
movw %r9w, (%rax,%rcx,2)
testq %r9, %r9
js 0x335e3
movw %cx, (%rdx,%r9,2)
movswl %cx, %eax
movw %cx, (%r8,%rsi,2)
imulq $0x2c, %rcx, %rcx
leaq 0x2426ba(%rip), %rdx    # 0x275cb0
movw %di, 0x18(%rcx,%rdx)
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: deletespritestat
static int deletespritestat(short deleteme)
{
	if (sprite[deleteme].statnum == MAXSTATUS)
		return(-1);

	if (headspritestat[sprite[deleteme].statnum] == deleteme)
		headspritestat[sprite[deleteme].statnum] = nextspritestat[deleteme];

	if (prevspritestat[deleteme] >= 0) nextspritestat[prevspritestat[deleteme]] = nextspritestat[deleteme];
	if (nextspritestat[deleteme] >= 0) prevspritestat[nextspritestat[deleteme]] = prevspritestat[deleteme];

	if (headspritestat[MAXSTATUS] >= 0) prevspritestat[headspritestat[MAXSTATUS]] = deleteme;
	prevspritestat[deleteme] = -1;
	nextspritestat[deleteme] = headspritestat[MAXSTATUS];
	headspritestat[MAXSTATUS] = deleteme;

	sprite[deleteme].statnum = MAXSTATUS;
	return(0);
}

// Assembly:
movslq %edi, %rax
imulq $0x2c, %rax, %rdx
leaq 0x242696(%rip), %rsi    # 0x275cb0
movswq 0x1a(%rdx,%rsi), %r8
cmpq $0x400, %r8             # imm = 0x400
jne 0x3362d
pushq $-0x1
popq %rax
retq
leaq 0x383eec(%rip), %r9     # 0x3b7520
leaq 0x38c6f5(%rip), %rcx    # 0x3bfd30
cmpw %di, (%r9,%r8,2)
jne 0x3364c
movzwl (%rcx,%rax,2), %r10d
movw %r10w, (%r9,%r8,2)
leaq 0x3846dd(%rip), %r8     # 0x3b7d30
movswq (%r8,%rax,2), %r9
movzwl (%rcx,%rax,2), %r10d
testq %r9, %r9
js 0x33667
movw %r10w, (%rcx,%r9,2)
testw %r10w, %r10w
js 0x33676
movzwl %r10w, %r10d
movw %r9w, (%r8,%r10,2)
addq %rsi, %rdx
addq $0x1a, %rdx
movswq 0x38469b(%rip), %rsi    # 0x3b7d20
testq %rsi, %rsi
js 0x3368f
movw %di, (%r8,%rsi,2)
orw $-0x1, (%r8,%rax,2)
movw %si, (%rcx,%rax,2)
movw %di, 0x384680(%rip)     # 0x3b7d20
movw $0x400, (%rdx)          # imm = 0x400
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: deletespritesect
static int deletespritesect(short deleteme)
{
	if (sprite[deleteme].sectnum == MAXSECTORS)
		return(-1);

	if (headspritesect[sprite[deleteme].sectnum] == deleteme)
		headspritesect[sprite[deleteme].sectnum] = nextspritesect[deleteme];

	if (prevspritesect[deleteme] >= 0) nextspritesect[prevspritesect[deleteme]] = nextspritesect[deleteme];
	if (nextspritesect[deleteme] >= 0) prevspritesect[nextspritesect[deleteme]] = prevspritesect[deleteme];

	if (headspritesect[MAXSECTORS] >= 0) prevspritesect[headspritesect[MAXSECTORS]] = deleteme;
	prevspritesect[deleteme] = -1;
	nextspritesect[deleteme] = headspritesect[MAXSECTORS];
	headspritesect[MAXSECTORS] = deleteme;

	sprite[deleteme].sectnum = MAXSECTORS;
	return(0);
}

// Assembly:
movslq %edi, %rax
imulq $0x2c, %rax, %rdx
leaq 0x2425fa(%rip), %rsi    # 0x275cb0
movswq 0x18(%rdx,%rsi), %r8
cmpq $0x1000, %r8            # imm = 0x1000
jne 0x336c9
pushq $-0x1
popq %rax
retq
leaq 0x371e40(%rip), %r9     # 0x3a5510
leaq 0x37be49(%rip), %rcx    # 0x3af520
cmpw %di, (%r9,%r8,2)
jne 0x336e8
movzwl (%rcx,%rax,2), %r10d
movw %r10w, (%r9,%r8,2)
leaq 0x373e31(%rip), %r8     # 0x3a7520
movswq (%r8,%rax,2), %r9
movzwl (%rcx,%rax,2), %r10d
testq %r9, %r9
js 0x33703
movw %r10w, (%rcx,%r9,2)
testw %r10w, %r10w
js 0x33712
movzwl %r10w, %r10d
movw %r9w, (%r8,%r10,2)
addq %rsi, %rdx
addq $0x18, %rdx
movswq 0x373def(%rip), %rsi    # 0x3a7510
testq %rsi, %rsi
js 0x3372b
movw %di, (%r8,%rsi,2)
orw $-0x1, (%r8,%rax,2)
movw %si, (%rcx,%rax,2)
movw %di, 0x373dd4(%rip)     # 0x3a7510
movw $0x1000, (%rdx)         # imm = 0x1000
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: changespritestat
int changespritestat(short spritenum, short newstatnum)
{
	if ((newstatnum < 0) || (newstatnum > MAXSTATUS)) return(-1);
	if (sprite[spritenum].statnum == newstatnum) return(0);
	if (sprite[spritenum].statnum == MAXSTATUS) return(-1);
	if (deletespritestat(spritenum) < 0) return(-1);
	insertspritestat(newstatnum);
	return(0);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
pushq $-0x1
popq %rbx
cmpw $0x400, %bp             # imm = 0x400
ja 0x33788
movswq %di, %rax
imulq $0x2c, %rax, %rax
leaq 0x24254e(%rip), %rcx    # 0x275cb0
movzwl 0x1a(%rax,%rcx), %eax
cmpw %bp, %ax
je 0x33786
cmpw $0x400, %ax             # imm = 0x400
je 0x33788
movswl %di, %edi
callq 0x3360c
testl %eax, %eax
js 0x33788
movswl %bp, %edi
callq 0x334fd
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: rintersect
static int rintersect(int x1, int y1, int z1, int vx, int vy, int vz, int x3,
		  int y3, int x4, int y4, int *intx, int *inty, int *intz)
{     //p1 towards p2 is a ray
	int x34, y34, x31, y31, bot, topt, topu, t;

	x34 = x3-x4; y34 = y3-y4;
	bot = vx*y34 - vy*x34;
	if (bot >= 0)
	{
		if (bot == 0) return(0);
		x31 = x3-x1; y31 = y3-y1;
		topt = x31*y34 - y31*x34; if (topt < 0) return(0);
		topu = vx*y31 - vy*x31; if ((topu < 0) || (topu >= bot)) return(0);
	}
	else
	{
		x31 = x3-x1; y31 = y3-y1;
		topt = x31*y34 - y31*x34; if (topt > 0) return(0);
		topu = vx*y31 - vy*x31; if ((topu > 0) || (topu <= bot)) return(0);
	}
	t = divscale16(topt,bot);
	*intx = x1 + mulscale16(vx,t);
	*inty = y1 + mulscale16(vy,t);
	*intz = z1 + mulscale16(vz,t);
	return(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r10d
movl 0x38(%rsp), %ebx
movl 0x30(%rsp), %ebp
movl %ebp, %r14d
subl 0x40(%rsp), %r14d
movl %ebx, %edx
subl 0x48(%rsp), %edx
movl %edx, %r15d
imull %ecx, %r15d
movl %r14d, %r12d
imull %r8d, %r12d
movl %r15d, %r11d
subl %r12d, %r11d
js 0x34c2d
xorl %eax, %eax
cmpl %r12d, %r15d
je 0x34cac
subl %edi, %ebp
subl %esi, %ebx
imull %ebp, %edx
imull %ebx, %r14d
subl %r14d, %edx
js 0x34cac
imull %ecx, %ebx
imull %r8d, %ebp
subl %ebp, %ebx
cmpl %r11d, %ebx
jb 0x34c57
jmp 0x34cac
subl %edi, %ebp
subl %esi, %ebx
imull %ebp, %edx
imull %ebx, %r14d
xorl %eax, %eax
subl %r14d, %edx
jg 0x34cac
imull %ecx, %ebx
imull %r8d, %ebp
subl %ebp, %ebx
setg %bpl
cmpl %r11d, %ebx
setle %bl
orb %bpl, %bl
jne 0x34cac
movq 0x60(%rsp), %rbx
movq 0x58(%rsp), %r14
movq 0x50(%rsp), %r15
movslq %edx, %rax
shlq $0x10, %rax
movslq %r11d, %r11
cqto
idivq %r11
movslq %ecx, %rcx
cltq
imulq %rax, %rcx
shrq $0x10, %rcx
addl %edi, %ecx
movl %ecx, (%r15)
movslq %r8d, %rcx
imulq %rax, %rcx
shrq $0x10, %rcx
addl %esi, %ecx
movl %ecx, (%r14)
movslq %r9d, %rcx
imulq %rax, %rcx
shrq $0x10, %rcx
addl %r10d, %ecx
movl %ecx, (%rbx)
movl $0x1, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: dragpoint
void dragpoint(short pointhighlight, int dax, int day)
{
	short cnt, tempshort;

	wall[pointhighlight].x = dax;
	wall[pointhighlight].y = day;

	cnt = MAXWALLS;
	tempshort = pointhighlight;    //search points CCW
	do
	{
		if (wall[tempshort].nextwall >= 0)
		{
			tempshort = wall[wall[tempshort].nextwall].point2;
			wall[tempshort].x = dax;
			wall[tempshort].y = day;
		}
		else
		{
			tempshort = pointhighlight;    //search points CW if not searched all the way around
			do
			{
				if (wall[lastwall(tempshort)].nextwall >= 0)
				{
					tempshort = wall[lastwall(tempshort)].nextwall;
					wall[tempshort].x = dax;
					wall[tempshort].y = day;
				}
				else
				{
					break;
				}
				cnt--;
			}
			while ((tempshort != pointhighlight) && (cnt > 0));
			break;
		}
		cnt--;
	}
	while ((tempshort != pointhighlight) && (cnt > 0));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movl %edi, %r14d
movslq %edi, %rax
shlq $0x5, %rax
leaq 0x17c737(%rip), %r15    # 0x1b1a50
movl %esi, (%rax,%r15)
movl %edx, 0x4(%rax,%r15)
movw $0x4000, %r12w          # imm = 0x4000
movl %r14d, %eax
movswq %ax, %rax
shlq $0x5, %rax
movswq 0xa(%rax,%r15), %rax
testq %rax, %rax
js 0x3536e
shlq $0x5, %rax
movswq 0x8(%rax,%r15), %rax
movq %rax, %rcx
shlq $0x5, %rcx
movl %ebp, (%rcx,%r15)
movl %ebx, 0x4(%rcx,%r15)
cmpw %r14w, %ax
je 0x353af
leal -0x1(%r12), %ecx
cmpw $0x1, %r12w
movl %ecx, %r12d
jne 0x3532a
jmp 0x353af
movl %r14d, %eax
movswl %ax, %edi
callq 0x2bf2f
cltq
shlq $0x5, %rax
movswq 0xa(%rax,%r15), %rax
testq %rax, %rax
js 0x353af
movq %rax, %rcx
shlq $0x5, %rcx
movl %ebp, (%rcx,%r15)
movl %ebx, 0x4(%rcx,%r15)
cmpw %r14w, %ax
je 0x353af
leal -0x1(%r12), %ecx
cmpw $0x1, %r12w
movl %ecx, %r12d
jg 0x35371
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: getflorzofslope
int getflorzofslope(short sectnum, int dax, int day)
{
	int dx, dy, i, j;
	walltype *wal;

	if (!(sector[sectnum].floorstat&2)) return(sector[sectnum].floorz);
	wal = &wall[sector[sectnum].wallptr];
	dx = wall[wal->point2].x-wal->x; dy = wall[wal->point2].y-wal->y;
	i = (nsqrtasm(dx*dx+dy*dy)<<5); if (i == 0) return(sector[sectnum].floorz);
	j = dmulscale3(dx,day-wal->y,-dy,dax-wal->x);
	return(sector[sectnum].floorz+scale(sector[sectnum].floorheinum,j,i));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq %edi, %rax
imulq $0x28, %rax, %rax
leaq 0x20594c(%rip), %rcx    # 0x23ca60
leaq (%rcx,%rax), %r14
testb $0x2, 0xe(%rax,%rcx)
je 0x371b1
movl %edx, %ebp
movl %esi, 0x4(%rsp)
movswq (%r14), %rax
shlq $0x5, %rax
leaq 0x17a918(%rip), %rcx    # 0x1b1a50
movswq 0x8(%rax,%rcx), %rdx
shlq $0x5, %rdx
movslq (%rdx,%rcx), %r15
movslq (%rax,%rcx), %r12
subq %r12, %r15
movslq 0x4(%rdx,%rcx), %r13
movslq 0x4(%rax,%rcx), %rbx
subq %rbx, %r13
movl %r15d, %eax
imull %r15d, %eax
movl %r13d, %edi
imull %r13d, %edi
addl %eax, %edi
callq 0x22169
shll $0x5, %eax
je 0x371b1
movslq %ebp, %rcx
subq %rbx, %rcx
negq %r13
movslq 0x4(%rsp), %rdx
subq %r12, %rdx
imulq %r13, %rdx
imulq %r15, %rcx
addq %rdx, %rcx
movswq 0x1a(%r14), %rdx
shrq $0x3, %rcx
movslq %ecx, %rcx
imulq %rdx, %rcx
movslq %eax, %rsi
movq %rcx, %rax
cqto
idivq %rsi
addl 0x8(%r14), %eax
jmp 0x371b5
movl 0x8(%r14), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: getceilzofslope
int getceilzofslope(short sectnum, int dax, int day)
{
	int dx, dy, i, j;
	walltype *wal;

	if (!(sector[sectnum].ceilingstat&2)) return(sector[sectnum].ceilingz);
	wal = &wall[sector[sectnum].wallptr];
	dx = wall[wal->point2].x-wal->x; dy = wall[wal->point2].y-wal->y;
	i = (nsqrtasm(dx*dx+dy*dy)<<5); if (i == 0) return(sector[sectnum].ceilingz);
	j = dmulscale3(dx,day-wal->y,-dy,dax-wal->x);
	return(sector[sectnum].ceilingz+scale(sector[sectnum].ceilingheinum,j,i));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq %edi, %rax
imulq $0x28, %rax, %rax
leaq 0x205883(%rip), %rcx    # 0x23ca60
leaq (%rcx,%rax), %r14
testb $0x2, 0xc(%rax,%rcx)
je 0x3727a
movl %edx, %ebp
movl %esi, 0x4(%rsp)
movswq (%r14), %rax
shlq $0x5, %rax
leaq 0x17a84f(%rip), %rcx    # 0x1b1a50
movswq 0x8(%rax,%rcx), %rdx
shlq $0x5, %rdx
movslq (%rdx,%rcx), %r15
movslq (%rax,%rcx), %r12
subq %r12, %r15
movslq 0x4(%rdx,%rcx), %r13
movslq 0x4(%rax,%rcx), %rbx
subq %rbx, %r13
movl %r15d, %eax
imull %r15d, %eax
movl %r13d, %edi
imull %r13d, %edi
addl %eax, %edi
callq 0x22169
shll $0x5, %eax
je 0x3727a
movslq %ebp, %rcx
subq %rbx, %rcx
negq %r13
movslq 0x4(%rsp), %rdx
subq %r12, %rdx
imulq %r13, %rdx
imulq %r15, %rcx
addq %rdx, %rcx
movswq 0x12(%r14), %rdx
shrq $0x3, %rcx
movslq %ecx, %rcx
imulq %rdx, %rcx
movslq %eax, %rsi
movq %rcx, %rax
cqto
idivq %rsi
addl 0x4(%r14), %eax
jmp 0x3727e
movl 0x4(%r14), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: setaspect
void setaspect(int daxrange, int daaspect)
{
    int ys = mulscale16(200, pixelaspect);

    viewingrange = daxrange;
    viewingrangerecip = divscale32(1L,daxrange);

    yxaspect = daaspect;
    xyaspect = divscale32(1,yxaspect);
    xdimenscale = scale(xdimen,yxaspect,320);
    xdimscale = scale(320,xyaspect,xdimen);

    ydimenscale = scale(ydimen, yxaspect, ys);
}

// Assembly:
movslq 0x3d7b5a(%rip), %r8     # 0x40fc78
movl %edi, 0x390c2c(%rip)    # 0x3c8d50
movslq %edi, %rdi
movabsq $0x100000000, %rcx      # imm = 0x100000000
movq %rcx, %rax
xorl %edx, %edx
idivq %rdi
movl %eax, 0x38fbf9(%rip)    # 0x3c7d38
movl %esi, 0x3c8ea3(%rip)    # 0x400fe8
movslq %esi, %rsi
movq %rcx, %rax
xorl %edx, %edx
idivq %rsi
movq %rax, %rcx
movl %ecx, 0x31e75f(%rip)    # 0x3568b8
movslq 0x656d0(%rip), %rdi     # 0x9d830
movq %rdi, %rax
imulq %rsi, %rax
movl $0x140, %r9d            # imm = 0x140
cqto
idivq %r9
movl %eax, 0x23c920(%rip)    # 0x274a98
movslq %ecx, %rax
imulq $0x140, %rax, %rax      # imm = 0x140
cqto
idivq %rdi
movl %eax, 0x38fba7(%rip)    # 0x3c7d34
movslq 0x23c900(%rip), %rax    # 0x274a94
imulq %rsi, %rax
imulq $0xc80000, %r8, %rcx    # imm = 0xC80000
sarq $0x20, %rcx
cqto
idivq %rcx
movl %eax, 0x3f73f2(%rip)    # 0x42f5a0
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: setvgapalette
void setvgapalette(void)
{
	int i;

	for (i=0;i<256;i++) {
		curpalettefaded[i].b = curpalette[i].b = vgapal16[4*i] << 2;
		curpalettefaded[i].g = curpalette[i].g = vgapal16[4*i+1] << 2;
		curpalettefaded[i].r = curpalette[i].r = vgapal16[4*i+2] << 2;
	}
	setpalette(0,256,vgapal16);
}

// Assembly:
xorl %eax, %eax
leaq 0x64fbf(%rip), %rcx     # 0x9d840
leaq 0x3f7128(%rip), %rdx    # 0x42f9b0
leaq 0x3f7521(%rip), %rsi    # 0x42fdb0
cmpq $0x100, %rax            # imm = 0x100
je 0x388d2
movb (%rcx,%rax,4), %dil
movb 0x1(%rcx,%rax,4), %r8b
shlb $0x2, %dil
movb %dil, 0x2(%rdx,%rax,4)
movb %dil, 0x2(%rsi,%rax,4)
shlb $0x2, %r8b
movb %r8b, 0x1(%rdx,%rax,4)
movb %r8b, 0x1(%rsi,%rax,4)
movb 0x2(%rcx,%rax,4), %dil
shlb $0x2, %dil
movb %dil, (%rdx,%rax,4)
movb %dil, (%rsi,%rax,4)
incq %rax
jmp 0x3888f
leaq 0x64f67(%rip), %rdx     # 0x9d840
xorl %edi, %edi
movl $0x100, %esi            # imm = 0x100
jmp 0x639dd
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: setpalettefade
void setpalettefade(unsigned char r, unsigned char g, unsigned char b, unsigned char offset)
{
	int i,k;
	palette_t p;

	palfadergb.r = min(63,r) << 2;
	palfadergb.g = min(63,g) << 2;
	palfadergb.b = min(63,b) << 2;
	palfadedelta = min(63,offset) << 2;

	k = 0;
	for (i=0;i<256;i++) {
		if (usegammabrightness) p = curpalette[i];
		else {
			p.b = britable[curbrightness][ curpalette[i].b ];
			p.g	= britable[curbrightness][ curpalette[i].g ];
			p.r = britable[curbrightness][ curpalette[i].r ];
		}

		tempbuf[k++] =
			(curpalettefaded[i].b =
				p.b + ( ( ( (int)palfadergb.b - (int)p.b ) * (int)offset ) >> 6 ) ) >> 2;
		tempbuf[k++] =
			(curpalettefaded[i].g =
				p.g + ( ( ( (int)palfadergb.g - (int)p.g ) * (int)offset ) >> 6 ) ) >> 2;
		tempbuf[k++] =
			(curpalettefaded[i].r =
				p.r + ( ( ( (int)palfadergb.r - (int)p.r ) * (int)offset ) >> 6 ) ) >> 2;
		tempbuf[k++] = curpalettefaded[i].f = 0;
	}

	setpalette(0,256,(unsigned char*)tempbuf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
cmpb $0x3f, %dil
movl $0x3f, %eax
cmovael %eax, %edi
shlb $0x2, %dil
movb %dil, 0x179139(%rip)    # 0x1b1a3f
cmpb $0x3f, %sil
cmovael %eax, %esi
shlb $0x2, %sil
movb %sil, 0x179128(%rip)    # 0x1b1a40
cmpb $0x3f, %dl
cmovael %eax, %edx
shlb $0x2, %dl
cmpl %eax, %ecx
cmovbl %ecx, %eax
movb %dl, 0x179115(%rip)     # 0x1b1a41
shlb $0x2, %al
movb %al, 0x17910e(%rip)     # 0x1b1a43
movl 0x64e51(%rip), %eax     # 0x9d78c
movzbl %dl, %edx
movzbl %sil, %esi
movzbl %dil, %edi
movslq 0x1790b7(%rip), %r11    # 0x1b1a04
xorl %r8d, %r8d
leaq 0x3f7059(%rip), %r9     # 0x42f9b0
shlq $0x8, %r11
leaq 0x3f784e(%rip), %r10    # 0x4301b0
addq %r11, %r10
leaq 0x3f7444(%rip), %r11    # 0x42fdb0
leaq 0x39be5d(%rip), %rbx    # 0x3d47d0
xorl %r14d, %r14d
cmpq $0x400, %r14            # imm = 0x400
je 0x38a32
testl %eax, %eax
je 0x3899c
leaq (%r9,%r14), %r13
leaq (%r14,%r9), %r12
incq %r12
leaq (%r14,%r9), %r15
addq $0x2, %r15
jmp 0x389b6
movzbl 0x2(%r14,%r9), %r15d
addq %r10, %r15
movzbl 0x1(%r14,%r9), %r12d
addq %r10, %r12
movzbl (%r14,%r9), %r13d
addq %r10, %r13
movzbl (%r13), %ebp
movzbl (%r12), %r12d
movzbl (%r15), %r15d
movl %edx, %r13d
subl %r15d, %r13d
imull %ecx, %r13d
shrl $0x6, %r13d
addb %r15b, %r13b
movb %r13b, 0x2(%r14,%r11)
shrb $0x2, %r13b
movb %r13b, (%r14,%rbx)
movl %esi, %r15d
subl %r12d, %r15d
imull %ecx, %r15d
shrl $0x6, %r15d
addb %r12b, %r15b
movb %r15b, 0x1(%r14,%r11)
shrb $0x2, %r15b
movb %r15b, 0x1(%r14,%rbx)
movl %edi, %r15d
subl %ebp, %r15d
imull %ecx, %r15d
shrl $0x6, %r15d
addb %bpl, %r15b
movb %r15b, (%r14,%r11)
shrb $0x2, %r15b
movb %r15b, 0x2(%r14,%rbx)
movb %r8b, 0x3(%r14,%r11)
movb %r8b, 0x3(%r14,%rbx)
addq $0x4, %r14
jmp 0x38976
leaq 0x39bd97(%rip), %rdx    # 0x3d47d0
xorl %edi, %edi
movl $0x100, %esi            # imm = 0x100
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x639dd
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: setviewback
void setviewback(void)
{
	int i, j, k;

	if (setviewcnt <= 0) return;
	setviewcnt--;

	offscreenrendering = (setviewcnt>0);
#if USE_POLYMOST
	if (setviewcnt == 0) {
		rendmode = bakrendmode;
#if USE_OPENGL
		invalidatetile(baktile,-1,-1);
#endif
	}
#endif

	setview(bakwindowx1[setviewcnt],bakwindowy1[setviewcnt],
			  bakwindowx2[setviewcnt],bakwindowy2[setviewcnt]);
	copybufbyte(&bakumost[windowx1],&startumost[windowx1],(windowx2-windowx1+1)*sizeof(startumost[0]));
	copybufbyte(&bakdmost[windowx1],&startdmost[windowx1],(windowx2-windowx1+1)*sizeof(startdmost[0]));
	frameplace = bakframeplace[setviewcnt];
	if (setviewcnt == 0)
		k = bakxsiz[0];
	else
		k = max(bakxsiz[setviewcnt-1],bakxsiz[setviewcnt]);
	j = 0; for(i=0;i<=k;i++) ylookup[i] = j, j += bytesperline;
	setvlinebpl(bytesperline);
}

// Assembly:
movl 0x3f8402(%rip), %eax    # 0x4311d0
testl %eax, %eax
jle 0x38edb
pushq %rax
cmpl $0x1, %eax
leaq 0x13e2d7(%rip), %rcx    # 0x1770b8
setne (%rcx)
decl %eax
movl %eax, 0x3f83e4(%rip)    # 0x4311d0
jne 0x38e14
movl 0x3f844c(%rip), %eax    # 0x431240
leaq 0x5bab55(%rip), %rcx    # 0x5f3950
movl %eax, (%rcx)
movswl 0x3f8440(%rip), %edi    # 0x431244
pushq $-0x1
popq %rdx
movl %edx, %esi
callq 0x38f10
movl 0x3f83bc(%rip), %eax    # 0x4311d0
cltq
leaq 0x3f83e3(%rip), %rcx    # 0x431200
movl (%rcx,%rax,4), %edi
leaq 0x3f83e9(%rip), %rcx    # 0x431210
movl (%rcx,%rax,4), %esi
leaq 0x3f83ef(%rip), %rcx    # 0x431220
movl (%rcx,%rax,4), %edx
leaq 0x3f83f5(%rip), %rcx    # 0x431230
movl (%rcx,%rax,4), %ecx
callq 0x3111e
movslq 0x391f26(%rip), %rax    # 0x3cad70
leaq 0x3f83ff(%rip), %rcx    # 0x431250
leaq (%rcx,%rax,2), %rdi
leaq 0x390114(%rip), %rcx    # 0x3c8f70
leaq (%rcx,%rax,2), %rsi
movl 0x3c817a(%rip), %ecx    # 0x400fe0
subl %eax, %ecx
leal 0x2(,%rcx,2), %edx
callq 0x44524
movslq 0x391ef5(%rip), %rax    # 0x3cad70
leaq 0x3fa1ce(%rip), %rcx    # 0x433050
leaq (%rcx,%rax,2), %rdi
leaq 0x391ef3(%rip), %rcx    # 0x3cad80
leaq (%rcx,%rax,2), %rsi
movl 0x3c8149(%rip), %ecx    # 0x400fe0
subl %eax, %ecx
leal 0x2(,%rcx,2), %edx
callq 0x44524
movslq 0x3f8324(%rip), %rax    # 0x4311d0
leaq 0x3f832d(%rip), %rcx    # 0x4311e0
movq (%rcx,%rax,8), %rcx
leaq 0x13e1f2(%rip), %rdx    # 0x1770b0
movq %rcx, (%rdx)
testq %rax, %rax
je 0x38edc
leaq 0x3f82f3(%rip), %rcx    # 0x4311c0
movl -0x4(%rcx,%rax,4), %edx
movl (%rcx,%rax,4), %eax
cmpl %eax, %edx
cmovgl %edx, %eax
jmp 0x38ee2
retq
movl 0x3f82de(%rip), %eax    # 0x4311c0
leaq 0x13e39b(%rip), %rcx    # 0x177284
movl (%rcx), %edi
cltq
leaq 0x3d6dac(%rip), %rcx    # 0x40fca0
xorl %edx, %edx
xorl %esi, %esi
cmpq %rax, %rsi
jg 0x38f0a
movl %edx, (%rcx)
incq %rsi
addq $0x4, %rcx
addl %edi, %edx
jmp 0x38ef8
popq %rax
jmp 0x64198
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: invalidatetile
void invalidatetile(short tilenume, int pal, int how)
{
	int numpal, firstpal, np;
	int hp;

	if (rendmode < 3) return;

	if (pal < 0) {
		numpal = MAXPALOOKUPS;
		firstpal = 0;
	} else {
		numpal = 1;
		firstpal = pal % MAXPALOOKUPS;
	}

	for (hp = 0; hp < 8; hp+=4) {
		if (!(how & pow2long[hp])) continue;

		for (np = firstpal; np < firstpal+numpal; np++) {
			polymost_texinvalidate(tilenume, np, hp);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x5baa2e(%rip), %rax    # 0x5f3950
cmpl $0x3, (%rax)
jge 0x38f36
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %edx, %ebx
xorl %r14d, %r14d
testl %esi, %esi
movzbl %sil, %r12d
cmovsl %r14d, %r12d
leal 0x1(%r12), %eax
leal 0x100(%r12), %r13d
testl %esi, %esi
cmovnsl %eax, %r13d
movswl %di, %ebp
cmpq $0x7, %r14
ja 0x38f27
leaq 0x64848(%rip), %rax     # 0x9d7b0
testl %ebx, (%rax,%r14,4)
je 0x38f88
movl %r12d, %r15d
cmpl %r13d, %r15d
jae 0x38f88
movl %ebp, %edi
movl %r15d, %esi
movl %r14d, %edx
callq 0x465d3
incl %r15d
jmp 0x38f71
addq $0x4, %r14
jmp 0x38f5b
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: squarerotatetile
void squarerotatetile(short tilenume)
{
	int i, j, k, xsiz, ysiz;
	unsigned char *ptr1, *ptr2;

	xsiz = tilesizx[tilenume]; ysiz = tilesizy[tilenume];

		//supports square tiles only for rotation part
	if (xsiz == ysiz)
	{
		k = (xsiz<<1);
		for(i=xsiz-1;i>=0;i--)
		{
			ptr1 = (unsigned char *)(waloff[tilenume]+i*(xsiz+1)); ptr2 = ptr1;
			if ((i&1) != 0) { ptr1--; ptr2 -= xsiz; swapchar(ptr1,ptr2); }
			for(j=(i>>1)-1;j>=0;j--)
				{ ptr1 -= 2; ptr2 -= k; swapchar2(ptr1,ptr2,xsiz); }
		}
	}
}

// Assembly:
movslq %edi, %rax
leaq 0x3d0088(%rip), %rcx    # 0x409020
movswq (%rcx,%rax,2), %rcx
leaq 0x3c183c(%rip), %rdx    # 0x3fa7e0
cmpw (%rdx,%rax,2), %cx
jne 0x3903b
pushq %rbp
pushq %r14
pushq %rbx
movl %ecx, %edx
leal (%rdx,%rdx), %edi
negl %edi
incq %rcx
movslq %edx, %rdx
movq %rdx, %rsi
negq %rsi
movslq %edi, %rdi
leaq 0x359311(%rip), %r8     # 0x3922e0
movq %rdx, %r9
testq %r9, %r9
jle 0x39037
decq %r9
movq %r9, %r10
imulq %rcx, %r10
addq (%r8,%rax,8), %r10
movq %r10, %r11
testb $0x1, %r9b
je 0x39004
movb (%r10,%rsi), %bl
movb -0x1(%r10), %bpl
movb %bpl, (%r10,%rsi)
movb %bl, -0x1(%r10)
decq %r10
addq %rsi, %r11
movl %r9d, %ebx
shrl %ebx
decq %r10
addq %rdi, %r11
testl %ebx, %ebx
jle 0x38fd2
decl %ebx
movb (%r11), %bpl
movb -0x1(%r10), %r14b
movb %r14b, (%r11)
movb %bpl, -0x1(%r10)
movb (%r11,%rdx), %bpl
movb (%r10), %r14b
movb %r14b, (%r11,%rdx)
movb %bpl, (%r10)
addq $-0x2, %r10
jmp 0x3900c
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: completemirror
void completemirror(void)
{
	int i, dy;
	intptr_t p;

#if USE_POLYMOST
	if (rendmode) return;
#endif

		//Can't reverse with uninitialized data
	if (inpreparemirror) { inpreparemirror = 0; return; }
	if (mirrorsx1 > 0) mirrorsx1--;
	if (mirrorsx2 < windowx2-windowx1-1) mirrorsx2++;
	if (mirrorsx2 < mirrorsx1) return;

	p = frameplace+ylookup[windowy1+mirrorsy1]+windowx1+mirrorsx1;
	i = windowx2-windowx1-mirrorsx2-mirrorsx1; mirrorsx2 -= mirrorsx1;
	for(dy=mirrorsy2-mirrorsy1-1;dy>=0;dy--)
	{
		copybufbyte((void*)(p+1),tempbuf,mirrorsx2+1);
		tempbuf[mirrorsx2] = tempbuf[mirrorsx2-1];
		copybufreverse(&tempbuf[mirrorsx2],(void*)(p+i),mirrorsx2+1);
		p += ylookup[1];
		faketimerhandler();
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0x5ba833(%rip), %rax    # 0x5f3950
cmpl $0x0, (%rax)
jne 0x39171
cmpb $0x0, 0x178915(%rip)    # 0x1b1a3e
je 0x39134
movb $0x0, 0x17890c(%rip)    # 0x1b1a3e
jmp 0x39171
movl 0x397672(%rip), %eax    # 0x3d07ac
testl %eax, %eax
jle 0x39146
decl %eax
movl %eax, 0x397666(%rip)    # 0x3d07ac
movl 0x397664(%rip), %edx    # 0x3d07b0
movl 0x3c7e8e(%rip), %ecx    # 0x400fe0
movslq 0x391c17(%rip), %rsi    # 0x3cad70
movl %esi, %edi
notl %edi
addl %ecx, %edi
cmpl %edi, %edx
jge 0x3916b
incl %edx
movl %edx, 0x397645(%rip)    # 0x3d07b0
movl %edx, %edi
subl %eax, %edi
jge 0x3917d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x13df2c(%rip), %r8     # 0x1770b0
movslq 0x3939f5(%rip), %r9     # 0x3ccb80
movslq 0x39b62e(%rip), %r14    # 0x3d47c0
addq %r14, %r9
leaq 0x3d6b04(%rip), %r10    # 0x40fca0
movslq (%r10,%r9,4), %r9
movslq %eax, %r15
addq %rsi, %r15
addq (%r8), %r15
addq %r9, %r15
addl %esi, %edx
addl %eax, %edx
subl %edx, %ecx
movl %edi, 0x3975f8(%rip)    # 0x3d07b0
notl %r14d
addl 0x39b602(%rip), %r14d   # 0x3d47c4
movslq %ecx, %r12
leaq 0x39b604(%rip), %rbx    # 0x3d47d0
testl %r14d, %r14d
js 0x39171
leaq 0x1(%r15), %rdi
movl 0x3975d5(%rip), %edx    # 0x3d07b0
incl %edx
movq %rbx, %rsi
callq 0x44524
movslq 0x3975c4(%rip), %rax    # 0x3d07b0
movb -0x1(%rax,%rbx), %cl
leaq (%rbx,%rax), %rdi
movb %cl, (%rax,%rbx)
leaq (%r15,%r12), %rsi
leal 0x1(%rax), %edx
callq 0x44538
movslq 0x3d6a9a(%rip), %rax    # 0x40fca4
addq %rax, %r15
callq 0x9fd2
decl %r14d
jmp 0x391cc
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: sectorofwall
int sectorofwall(short theline)
{
	int i, gap;

	if ((theline < 0) || (theline >= numwalls)) return(-1);
	i = wall[theline].nextwall; if (i >= 0) return(wall[i].nextsector);

	gap = (numsectors>>1); i = gap;
	while (gap > 1)
	{
		gap >>= 1;
		if (sector[i].wallptr < theline) i += gap; else i -= gap;
	}
	while (sector[i].wallptr > theline) i--;
	while (sector[i].wallptr+sector[i].wallnum <= theline) i++;
	return(i);
}

// Assembly:
pushq $-0x1
popq %rax
testw %di, %di
js 0x392b0
cmpw %di, 0x3d6a3e(%rip)     # 0x40fc68
jle 0x392b0
movzwl %di, %ecx
shll $0x5, %ecx
leaq 0x178813(%rip), %rax    # 0x1b1a50
movswq 0xa(%rcx,%rax), %rcx
testq %rcx, %rcx
js 0x39252
shlq $0x5, %rcx
movswl 0xc(%rcx,%rax), %eax
retq
movswl 0x38fd07(%rip), %eax    # 0x3c8f60
sarl %eax
leaq 0x2037fe(%rip), %rcx    # 0x23ca60
movl %eax, %edx
movslq %eax, %rsi
cmpl $0x1, %edx
jle 0x39283
shrl %edx
imulq $0x28, %rsi, %r8
movl %edx, %esi
cmpw %di, (%r8,%rcx)
jl 0x3927f
movl %edx, %esi
negl %esi
addl %esi, %eax
jmp 0x39264
imulq $0x28, %rsi, %rdx
addq %rdx, %rcx
addq $0x2a, %rcx
movq %rcx, %rdx
addq $-0x28, %rcx
decl %eax
cmpw %di, -0x2a(%rdx)
jg 0x3928e
movswl -0x2(%rcx), %edx
movswl (%rcx), %esi
addl %edx, %esi
incl %eax
addq $0x28, %rcx
cmpl %edi, %esi
jle 0x3929d
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: alignceilslope
void alignceilslope(short dasect, int x, int y, int z)
{
	int i, dax, day;
	walltype *wal;

	wal = &wall[sector[dasect].wallptr];
	dax = wall[wal->point2].x-wal->x;
	day = wall[wal->point2].y-wal->y;

	i = (y-wal->y)*dax - (x-wal->x)*day; if (i == 0) return;
	sector[dasect].ceilingheinum = scale((z-sector[dasect].ceilingz)<<8,
	  nsqrtasm(dax*dax+day*day),i);

	if (sector[dasect].ceilingheinum == 0) sector[dasect].ceilingstat &= ~2;
	else sector[dasect].ceilingstat |= 2;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %ecx, %ebx
movslq %edi, %rax
imulq $0x28, %rax, %rcx
leaq 0x20379b(%rip), %r14    # 0x23ca60
movswq (%rcx,%r14), %r8
shlq $0x5, %r8
leaq 0x17877b(%rip), %r9     # 0x1b1a50
movswq 0x8(%r8,%r9), %rdi
shlq $0x5, %rdi
movl (%rdi,%r9), %eax
movl 0x4(%rdi,%r9), %edi
movl (%r8,%r9), %ebp
movl 0x4(%r8,%r9), %r8d
subl %ebp, %eax
subl %r8d, %edi
subl %r8d, %edx
imull %eax, %edx
subl %esi, %ebp
imull %edi, %ebp
addl %edx, %ebp
je 0x39349
addq %rcx, %r14
subl 0x4(%r14), %ebx
shll $0x8, %ebx
imull %eax, %eax
imull %edi, %edi
addl %eax, %edi
callq 0x22169
movslq %ebx, %rcx
cltq
imulq %rcx, %rax
movslq %ebp, %rcx
cqto
idivq %rcx
movw %ax, 0x12(%r14)
xorl %ecx, %ecx
testw %ax, %ax
setne %cl
movl 0xc(%r14), %eax
andl $-0x3, %eax
leal (%rax,%rcx,2), %eax
movw %ax, 0xc(%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: alignflorslope
void alignflorslope(short dasect, int x, int y, int z)
{
	int i, dax, day;
	walltype *wal;

	wal = &wall[sector[dasect].wallptr];
	dax = wall[wal->point2].x-wal->x;
	day = wall[wal->point2].y-wal->y;

	i = (y-wal->y)*dax - (x-wal->x)*day; if (i == 0) return;
	sector[dasect].floorheinum = scale((z-sector[dasect].floorz)<<8,
	  nsqrtasm(dax*dax+day*day),i);

	if (sector[dasect].floorheinum == 0) sector[dasect].floorstat &= ~2;
	else sector[dasect].floorstat |= 2;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %ecx, %ebx
movslq %edi, %rax
imulq $0x28, %rax, %rcx
leaq 0x2036fe(%rip), %r14    # 0x23ca60
movswq (%rcx,%r14), %r8
shlq $0x5, %r8
leaq 0x1786de(%rip), %r9     # 0x1b1a50
movswq 0x8(%r8,%r9), %rdi
shlq $0x5, %rdi
movl (%rdi,%r9), %eax
movl 0x4(%rdi,%r9), %edi
movl (%r8,%r9), %ebp
movl 0x4(%r8,%r9), %r8d
subl %ebp, %eax
subl %r8d, %edi
subl %r8d, %edx
imull %eax, %edx
subl %esi, %ebp
imull %edi, %ebp
addl %edx, %ebp
je 0x393e7
addq %rcx, %r14
subl 0x8(%r14), %ebx
shll $0x8, %ebx
imull %eax, %eax
imull %edi, %edi
addl %eax, %edi
callq 0x22169
movslq %ebx, %rcx
cltq
imulq %rcx, %rax
movslq %ebp, %rcx
cqto
idivq %rcx
movw %ax, 0x1a(%r14)
xorl %ecx, %ecx
testw %ax, %ax
setne %cl
movzwl 0xe(%r14), %eax
andl $-0x3, %eax
leal (%rax,%rcx,2), %eax
movw %ax, 0xe(%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: loopnumofsector
int loopnumofsector(short sectnum, short wallnum)
{
	int i, numloops, startwall, endwall;

	numloops = 0;
	startwall = sector[sectnum].wallptr;
	endwall = startwall + sector[sectnum].wallnum;
	for(i=startwall;i<endwall;i++)
	{
		if (i == wallnum) return(numloops);
		if (wall[i].point2 < i) numloops++;
	}
	return(-1);
}

// Assembly:
movslq %edi, %rax
imulq $0x28, %rax, %rax
leaq 0x203666(%rip), %rdx    # 0x23ca60
movswq (%rax,%rdx), %rcx
movswq 0x2(%rax,%rdx), %rdx
addq %rcx, %rdx
movslq %esi, %rsi
movq %rcx, %rax
shlq $0x5, %rax
leaq 0x178637(%rip), %rdi    # 0x1b1a50
leaq (%rax,%rdi), %r8
addq $0x8, %r8
xorl %edi, %edi
pushq $-0x1
popq %rax
cmpq %rdx, %rcx
jge 0x3944c
cmpq %rcx, %rsi
je 0x3944a
movswq (%r8), %r9
xorl %r10d, %r10d
cmpq %r9, %rcx
setg %r10b
addl %r10d, %edi
incq %rcx
addq $0x20, %r8
jmp 0x39426
movl %edi, %eax
retq