// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/build.c
// Function: checksectorpointer
int checksectorpointer(short i, short sectnum)
{
	int j, k, startwall, endwall, x1, y1, x2, y2;

	x1 = wall[i].x;
	y1 = wall[i].y;
	x2 = wall[wall[i].point2].x;
	y2 = wall[wall[i].point2].y;

	if (wall[i].nextwall >= 0)          //Check for early exit
	{
		k = wall[i].nextwall;
		if ((wall[k].x == x2) && (wall[k].y == y2))
			if ((wall[wall[k].point2].x == x1) && (wall[wall[k].point2].y == y1))
				return(0);
	}

	wall[i].nextsector = -1;
	wall[i].nextwall = -1;
	for(j=0;j<numsectors;j++)
	{
		startwall = sector[j].wallptr;
		endwall = startwall + sector[j].wallnum - 1;
		for(k=startwall;k<=endwall;k++)
		{
			if ((wall[k].x == x2) && (wall[k].y == y2))
				if ((wall[wall[k].point2].x == x1) && (wall[wall[k].point2].y == y1))
					if (j != sectnum)
					{
						wall[i].nextsector = j;
						wall[i].nextwall = k;
						wall[k].nextsector = sectnum;
						wall[k].nextwall = i;
					}
		}
	}
	return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movw %si, %ax
movw %di, %cx
movw %cx, -0x6(%rbp)
movw %ax, -0x8(%rbp)
movswq -0x6(%rbp), %rcx
leaq 0x1cbec2(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movswq -0x6(%rbp), %rcx
leaq 0x1cbeaa(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x20(%rbp)
movswq -0x6(%rbp), %rcx
leaq 0x1cbe91(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cbe7e(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movswq -0x6(%rbp), %rcx
leaq 0x1cbe66(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cbe53(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x28(%rbp)
movswq -0x6(%rbp), %rcx
leaq 0x1cbe3a(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0xa(%rax), %eax
cmpl $0x0, %eax
jl 0x29844
movswq -0x6(%rbp), %rcx
leaq 0x1cbe1a(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0xa(%rax), %eax
movl %eax, -0x10(%rbp)
movslq -0x10(%rbp), %rcx
leaq 0x1cbe01(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x24(%rbp), %eax
jne 0x29842
movslq -0x10(%rbp), %rcx
leaq 0x1cbde4(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
cmpl -0x28(%rbp), %eax
jne 0x29842
movslq -0x10(%rbp), %rcx
leaq 0x1cbdca(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cbdb7(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x29840
movslq -0x10(%rbp), %rcx
leaq 0x1cbd9e(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cbd8b(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
cmpl -0x20(%rbp), %eax
jne 0x29840
movl $0x0, -0x4(%rbp)
jmp 0x29a19
jmp 0x29842
jmp 0x29844
movswq -0x6(%rbp), %rcx
leaq 0x1cbd60(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movw $0xffff, 0xc(%rax)      # imm = 0xFFFF
movswq -0x6(%rbp), %rcx
leaq 0x1cbd47(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movw $0xffff, 0xa(%rax)      # imm = 0xFFFF
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0x3e3239(%rip), %rcx    # 0x40cac0
movswl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x29a12
movslq -0xc(%rbp), %rcx
leaq 0x256d23(%rip), %rax    # 0x2805c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movswl (%rax), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movslq -0xc(%rbp), %rdx
leaq 0x256d08(%rip), %rcx    # 0x2805c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movswl 0x2(%rcx), %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x18(%rbp), %eax
jg 0x29a02
movslq -0x10(%rbp), %rcx
leaq 0x1cbcc8(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x24(%rbp), %eax
jne 0x299f2
movslq -0x10(%rbp), %rcx
leaq 0x1cbcab(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
cmpl -0x28(%rbp), %eax
jne 0x299f2
movslq -0x10(%rbp), %rcx
leaq 0x1cbc8d(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cbc7a(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x299f0
movslq -0x10(%rbp), %rcx
leaq 0x1cbc5d(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cbc4a(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
cmpl -0x20(%rbp), %eax
jne 0x299f0
movl -0xc(%rbp), %eax
movswl -0x8(%rbp), %ecx
cmpl %ecx, %eax
je 0x299ee
movl -0xc(%rbp), %eax
movw %ax, %cx
movswq -0x6(%rbp), %rdx
leaq 0x1cbc1e(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0xc(%rax)
movl -0x10(%rbp), %eax
movw %ax, %cx
movswq -0x6(%rbp), %rdx
leaq 0x1cbc01(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0xa(%rax)
movw -0x8(%rbp), %cx
movslq -0x10(%rbp), %rdx
leaq 0x1cbbe7(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0xc(%rax)
movw -0x6(%rbp), %cx
movslq -0x10(%rbp), %rdx
leaq 0x1cbbcd(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0xa(%rax)
jmp 0x299f0
jmp 0x299f2
jmp 0x299f4
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x298d1
jmp 0x29a04
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2987d
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nop