// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movq %rcx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movw (%rax), %ax
movl -0x4(%rbp), %esi
movl -0x8(%rbp), %edx
leaq -0x2c(%rbp), %rcx
leaq -0x30(%rbp), %r8
movswl %ax, %edi
callq 0x393f0
movl -0xc(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jl 0x4f430
movl -0xc(%rbp), %eax
cmpl -0x30(%rbp), %eax
jg 0x4f430
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movq -0x18(%rbp), %rax
movswl (%rax), %edx
callq 0x4ee70
cmpl $0x0, %eax
je 0x4f42e
jmp 0x4f59f
jmp 0x4f430
movq -0x18(%rbp), %rax
movswl (%rax), %eax
cmpl $0x0, %eax
jl 0x4f526
movq -0x18(%rbp), %rax
movswl (%rax), %eax
movswl 0x3bd672(%rip), %ecx    # 0x40cac0
cmpl %ecx, %eax
jge 0x4f526
movq -0x18(%rbp), %rax
movswq (%rax), %rcx
leaq 0x23115b(%rip), %rax    # 0x2805c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movswq (%rax), %rcx
leaq 0x1a6139(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movswq (%rax), %rcx
leaq 0x23112f(%rip), %rax    # 0x2805c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movswl 0x2(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movswl 0xc(%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x4f505
movl -0x24(%rbp), %eax
movl -0x4(%rbp), %esi
movl -0x8(%rbp), %edx
leaq -0x2c(%rbp), %rcx
leaq -0x30(%rbp), %r8
movswl %ax, %edi
callq 0x393f0
movl -0xc(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jl 0x4f503
movl -0xc(%rbp), %eax
cmpl -0x30(%rbp), %eax
jg 0x4f503
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0x24(%rbp), %eax
movswl %ax, %edx
callq 0x4ee70
cmpl $0x1, %eax
jne 0x4f501
movl -0x24(%rbp), %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, (%rax)
jmp 0x4f59f
jmp 0x4f503
jmp 0x4f505
movq -0x20(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x20(%rbp)
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x4f49f
jmp 0x4f526
movswl 0x3bd593(%rip), %eax    # 0x40cac0
subl $0x1, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x4f596
movl -0x24(%rbp), %eax
movl -0x4(%rbp), %esi
movl -0x8(%rbp), %edx
leaq -0x2c(%rbp), %rcx
leaq -0x30(%rbp), %r8
movswl %ax, %edi
callq 0x393f0
movl -0xc(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jl 0x4f589
movl -0xc(%rbp), %eax
cmpl -0x30(%rbp), %eax
jg 0x4f589
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0x24(%rbp), %eax
movswl %ax, %edx
callq 0x4ee70
cmpl $0x1, %eax
jne 0x4f587
movl -0x24(%rbp), %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, (%rax)
jmp 0x4f59f
jmp 0x4f589
jmp 0x4f58b
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x4f533
movq -0x18(%rbp), %rax
movw $0xffff, (%rax)         # imm = 0xFFFF
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)