// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/build.c
// Function: whitelinescan
short whitelinescan(short dalinehighlight)
{
	int i, j, k;
	short sucksect, newnumwalls;

	sucksect = sectorofwall(dalinehighlight);

	Bmemcpy(&sector[numsectors],&sector[sucksect],sizeof(sectortype));
	sector[numsectors].wallptr = numwalls;
	sector[numsectors].wallnum = 0;
	i = dalinehighlight;
	newnumwalls = numwalls;
	do
	{
		j = lastwall((short)i);
		if (wall[j].nextwall >= 0)
		{
			j = wall[j].point2;
			for(k=0;k<numwalls;k++)
			{
				if (wall[wall[k].point2].x == wall[j].x)
					if (wall[wall[k].point2].y == wall[j].y)
						if (wall[k].nextwall == -1)
						{
							j = k;
							break;
						}
			}
		}

		Bmemcpy(&wall[newnumwalls],&wall[i],sizeof(walltype));

		wall[newnumwalls].nextwall = j;
		wall[newnumwalls].nextsector = sectorofwall((short)j);

		newnumwalls++;
		sector[numsectors].wallnum++;

		i = j;
	}
	while (i != dalinehighlight);

	for(i=numwalls;i<newnumwalls-1;i++)
		wall[i].point2 = i+1;
	wall[newnumwalls-1].point2 = numwalls;

	if (clockdir(numwalls) == 1)
		return(-1);
	else
		return(newnumwalls);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %di, %ax
movw %ax, -0x4(%rbp)
movswl -0x4(%rbp), %edi
callq 0x58ba0
movw %ax, -0x12(%rbp)
leaq 0x3e2bfd(%rip), %rax    # 0x40cac0
movswq (%rax), %rax
leaq 0x2566f2(%rip), %rdi    # 0x2805c0
imulq $0x28, %rax, %rax
addq %rax, %rdi
movswq -0x12(%rbp), %rax
leaq 0x2566df(%rip), %rsi    # 0x2805c0
imulq $0x28, %rax, %rax
addq %rax, %rsi
movl $0x28, %edx
callq 0x60c0
leaq 0x427acf(%rip), %rax    # 0x4519c8
movw (%rax), %cx
leaq 0x3e2bbd(%rip), %rax    # 0x40cac0
movswq (%rax), %rdx
leaq 0x2566b2(%rip), %rax    # 0x2805c0
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movw %cx, (%rax)
leaq 0x3e2ba1(%rip), %rax    # 0x40cac0
movswq (%rax), %rcx
leaq 0x256696(%rip), %rax    # 0x2805c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movw $0x0, 0x2(%rax)
movswl -0x4(%rbp), %eax
movl %eax, -0x8(%rbp)
leaq 0x427a83(%rip), %rax    # 0x4519c8
movw (%rax), %ax
movw %ax, -0x14(%rbp)
movl -0x8(%rbp), %eax
movswl %ax, %edi
callq 0x43880
movl %eax, -0xc(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x1cb64b(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0xa(%rax), %eax
cmpl $0x0, %eax
jl 0x2a063
movslq -0xc(%rbp), %rcx
leaq 0x1cb62c(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x8(%rax), %eax
movl %eax, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
leaq 0x427a25(%rip), %rcx    # 0x4519c8
movswl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x2a061
movslq -0x10(%rbp), %rcx
leaq 0x1cb5f7(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cb5e4(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movslq -0xc(%rbp), %rdx
leaq 0x1cb5d0(%rip), %rcx    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x2a051
movslq -0x10(%rbp), %rcx
leaq 0x1cb5ba(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cb5a7(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movslq -0xc(%rbp), %rdx
leaq 0x1cb592(%rip), %rcx    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
jne 0x2a04f
movslq -0x10(%rbp), %rcx
leaq 0x1cb57b(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0xa(%rax), %eax
cmpl $-0x1, %eax
jne 0x2a04d
movl -0x10(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x2a061
jmp 0x2a04f
jmp 0x2a051
jmp 0x2a053
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x29f99
jmp 0x2a063
movswq -0x14(%rbp), %rcx
leaq 0x1cb541(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x8(%rbp), %rdx
leaq 0x1cb52f(%rip), %rcx    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movl -0xc(%rbp), %eax
movw %ax, %cx
movswq -0x14(%rbp), %rdx
leaq 0x1cb4f8(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0xa(%rax)
movl -0xc(%rbp), %eax
movswl %ax, %edi
callq 0x58ba0
movw %ax, %cx
movswq -0x14(%rbp), %rdx
leaq 0x1cb4d3(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0xc(%rax)
movw -0x14(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x14(%rbp)
leaq 0x3e29c5(%rip), %rax    # 0x40cac0
movswq (%rax), %rcx
leaq 0x2564ba(%rip), %rax    # 0x2805c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movw 0x2(%rax), %cx
addw $0x1, %cx
movw %cx, 0x2(%rax)
movl -0xc(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movswl -0x4(%rbp), %ecx
cmpl %ecx, %eax
jne 0x29f4c
leaq 0x427893(%rip), %rax    # 0x4519c8
movswl (%rax), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movswl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2a173
movl -0x8(%rbp), %eax
addl $0x1, %eax
movw %ax, %cx
movslq -0x8(%rbp), %rdx
leaq 0x1cb453(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0x8(%rax)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x2a13b
leaq 0x42784e(%rip), %rax    # 0x4519c8
movw (%rax), %cx
movswl -0x14(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdx
leaq 0x1cb422(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0x8(%rax)
leaq 0x427828(%rip), %rax    # 0x4519c8
movswl (%rax), %edi
callq 0x2a720
cmpl $0x1, %eax
jne 0x2a1b5
movw $0xffff, -0x2(%rbp)     # imm = 0xFFFF
jmp 0x2a1bd
movw -0x14(%rbp), %ax
movw %ax, -0x2(%rbp)
movw -0x2(%rbp), %ax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)