// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
callq 0x3cfa6
leaq 0x3b3a8b(%rip), %rcx    # 0x3cff60
movswq (%rcx), %rcx
leaq (%rcx,%rcx,4), %rcx
leaq 0x22757c(%rip), %rsi    # 0x243a60
movswq %ax, %rax
leaq (%rax,%rax,4), %rax
movq 0x20(%rsi,%rax,8), %rdx
movq %rdx, 0x20(%rsi,%rcx,8)
movdqu (%rsi,%rax,8), %xmm0
movdqu 0x10(%rsi,%rax,8), %xmm1
movdqu %xmm1, 0x10(%rsi,%rcx,8)
movdqu %xmm0, (%rsi,%rcx,8)
leaq 0x3fa755(%rip), %rax    # 0x416c68
movzwl (%rax), %r14d
movw %r14w, (%rsi,%rcx,8)
movw $0x0, 0x2(%rsi,%rcx,8)
movl %r14d, %eax
incl %eax
leaq 0x19c521(%rip), %r15    # 0x1b8a50
leaq 0xa(%r15), %rcx
movq %rcx, 0x10(%rsp)
movl %ebx, 0xc(%rsp)
movl %eax, %r13d
movswl %bx, %edi
callq 0x2efee
movl %eax, %ebp
cltq
shlq $0x5, %rax
cmpw $0x0, 0xa(%r15,%rax)
js 0x1c5b7
addq %r15, %rax
movswl 0x8(%rax), %ebp
leaq 0x3fa702(%rip), %rax    # 0x416c68
movswq (%rax), %rax
testq %rax, %rax
jle 0x1c5b7
movslq %ebp, %rdx
shlq $0x5, %rdx
leaq (%r15,%rdx), %rcx
movl (%r15,%rdx), %edx
movq 0x10(%rsp), %rdi
xorl %esi, %esi
movswq -0x2(%rdi), %r8
shlq $0x5, %r8
cmpl %edx, (%r15,%r8)
jne 0x1c5a7
addq %r15, %r8
movl 0x4(%r8), %r8d
cmpl 0x4(%rcx), %r8d
jne 0x1c5a7
cmpw $-0x1, (%rdi)
je 0x1c5b5
incq %rsi
addq $0x20, %rdi
cmpq %rsi, %rax
jne 0x1c585
jmp 0x1c5b7
movl %esi, %ebp
movswq %r14w, %r12
shlq $0x5, %r12
movslq %ebx, %rax
shlq $0x5, %rax
movdqa (%r15,%rax), %xmm0
movdqa 0x10(%r15,%rax), %xmm1
movdqa %xmm0, (%r15,%r12)
movdqa %xmm1, 0x10(%r15,%r12)
movw %bp, 0xa(%r15,%r12)
movswl %bp, %edi
callq 0x3cfa6
movw %ax, 0xc(%r15,%r12)
leaq 0x3b3965(%rip), %rax    # 0x3cff60
movswq (%rax), %rax
leaq (%rax,%rax,4), %rax
leaq 0x227456(%rip), %rcx    # 0x243a60
incw 0x2(%rcx,%rax,8)
incl %r14d
leal 0x1(%r13), %eax
movl %ebp, %ebx
cmpl 0xc(%rsp), %ebp
jne 0x1c53c
leaq 0x3fa63f(%rip), %rax    # 0x416c68
movswl (%rax), %eax
movswl %r14w, %ecx
decl %ecx
cmpl %eax, %ecx
jle 0x1c990
movslq %eax, %rsi
movq %rsi, %rdx
notq %rdx
movswq %r14w, %rdi
addq %rdi, %rdx
decq %rdx
movq %rsi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x57a51(%rip), %xmm1    # 0x740b0
paddq %xmm0, %xmm1
movdqa 0x57a55(%rip), %xmm2    # 0x740c0
paddq %xmm0, %xmm2
movdqa 0x57a59(%rip), %xmm3    # 0x740d0
paddq %xmm0, %xmm3
paddq 0x57a5d(%rip), %xmm0    # 0x740e0
movq %rdx, %xmm4
pshufd $0x44, %xmm4, %xmm4     # xmm4 = xmm4[0,1,0,1]
movswq %r13w, %rdx
subq %rsi, %rdx
addq $0x6, %rdx
andq $-0x8, %rdx
shlq $0x5, %rsi
addq %r15, %rsi
addq $0xe8, %rsi
xorl %edi, %edi
movdqa 0x57a3b(%rip), %xmm9    # 0x740f0
pxor %xmm9, %xmm4
pcmpeqd %xmm10, %xmm10
movdqa 0x57a38(%rip), %xmm11   # 0x74100
movq %rdi, %xmm5
pshufd $0x44, %xmm5, %xmm12    # xmm12 = xmm5[0,1,0,1]
movdqa %xmm12, %xmm5
por 0x57a00(%rip), %xmm5    # 0x740e0
pxor %xmm9, %xmm5
movdqa %xmm5, %xmm14
pcmpgtd %xmm4, %xmm14
pshufd $0xa0, %xmm14, %xmm15   # xmm15 = xmm14[0,0,2,2]
pshuflw $0xe8, %xmm15, %xmm6    # xmm6 = xmm15[0,2,2,3,4,5,6,7]
pcmpeqd %xmm4, %xmm5
pshufd $0xf5, %xmm5, %xmm13    # xmm13 = xmm5[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm7    # xmm7 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm14, %xmm5    # xmm5 = xmm14[1,1,3,3]
pshuflw $0xe8, %xmm5, %xmm6     # xmm6 = xmm5[0,2,2,3,4,5,6,7]
por %xmm7, %xmm6
pxor %xmm10, %xmm6
packssdw %xmm6, %xmm6
movdqa %xmm0, %xmm14
psubq %xmm10, %xmm14
movd %xmm6, %r8d
testb $0x1, %r8b
je 0x1c749
movd %xmm14, %r8d
movw %r8w, -0xe0(%rsi)
pand %xmm15, %xmm13
por %xmm5, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm13
movd %xmm13, %r8d
shrl $0x10, %r8d
testb $0x1, %r8b
je 0x1c77f
pextrw $0x4, %xmm14, %r8d
movw %r8w, -0xc0(%rsi)
movdqa %xmm12, %xmm5
por 0x57944(%rip), %xmm5    # 0x740d0
movdqa %xmm3, %xmm13
psubq %xmm10, %xmm13
pxor %xmm9, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm4, %xmm6
pshufd $0xa0, %xmm6, %xmm14    # xmm14 = xmm6[0,0,2,2]
pcmpeqd %xmm4, %xmm5
pshufd $0xf5, %xmm5, %xmm5     # xmm5 = xmm5[1,1,3,3]
movdqa %xmm5, %xmm7
pand %xmm14, %xmm7
pshufd $0xf5, %xmm6, %xmm15    # xmm15 = xmm6[1,1,3,3]
por %xmm15, %xmm7
packssdw %xmm7, %xmm6
pxor %xmm10, %xmm6
packssdw %xmm6, %xmm6
pextrw $0x2, %xmm6, %r8d
testb $0x1, %r8b
je 0x1c7ec
movd %xmm13, %r8d
movw %r8w, -0xa0(%rsi)
pshufhw $0x84, %xmm14, %xmm6    # xmm6 = xmm14[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm5, %xmm5     # xmm5 = xmm5[0,1,2,3,4,5,4,6]
pand %xmm6, %xmm5
pshufhw $0x84, %xmm15, %xmm6    # xmm6 = xmm15[0,1,2,3,4,5,4,6]
por %xmm5, %xmm6
pxor %xmm10, %xmm6
packssdw %xmm6, %xmm6
pextrw $0x3, %xmm6, %r8d
testb $0x1, %r8b
je 0x1c825
pextrw $0x4, %xmm13, %r8d
movw %r8w, -0x80(%rsi)
movdqa %xmm12, %xmm5
por 0x5788e(%rip), %xmm5    # 0x740c0
movdqa %xmm2, %xmm13
psubq %xmm10, %xmm13
pxor %xmm9, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm4, %xmm6
pshufd $0xa0, %xmm6, %xmm15    # xmm15 = xmm6[0,0,2,2]
pshuflw $0xe8, %xmm15, %xmm7    # xmm7 = xmm15[0,2,2,3,4,5,6,7]
pcmpeqd %xmm4, %xmm5
pshufd $0xf5, %xmm5, %xmm14    # xmm14 = xmm5[1,1,3,3]
pshuflw $0xe8, %xmm14, %xmm8    # xmm8 = xmm14[0,2,2,3,4,5,6,7]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
pshuflw $0xe8, %xmm5, %xmm6     # xmm6 = xmm5[0,2,2,3,4,5,6,7]
por %xmm8, %xmm6
pxor %xmm10, %xmm6
packssdw %xmm6, %xmm6
pextrw $0x4, %xmm6, %r8d
testb $0x1, %r8b
je 0x1c898
movd %xmm13, %r8d
movw %r8w, -0x60(%rsi)
pand %xmm15, %xmm14
por %xmm5, %xmm14
packssdw %xmm14, %xmm14
pxor %xmm10, %xmm14
packssdw %xmm14, %xmm5
pextrw $0x5, %xmm5, %r8d
testb $0x1, %r8b
je 0x1c8c8
pextrw $0x4, %xmm13, %r8d
movw %r8w, -0x40(%rsi)
por 0x577df(%rip), %xmm12   # 0x740b0
movdqa %xmm1, %xmm13
psubq %xmm10, %xmm13
pxor %xmm9, %xmm12
movdqa %xmm12, %xmm6
pcmpgtd %xmm4, %xmm6
pshufd $0xa0, %xmm6, %xmm5     # xmm5 = xmm6[0,0,2,2]
pcmpeqd %xmm4, %xmm12
pshufd $0xf5, %xmm12, %xmm12   # xmm12 = xmm12[1,1,3,3]
movdqa %xmm12, %xmm7
pand %xmm5, %xmm7
pshufd $0xf5, %xmm6, %xmm14    # xmm14 = xmm6[1,1,3,3]
por %xmm14, %xmm7
packssdw %xmm7, %xmm6
pxor %xmm10, %xmm6
packssdw %xmm6, %xmm6
pextrw $0x6, %xmm6, %r8d
testb $0x1, %r8b
je 0x1c930
movd %xmm13, %r8d
movw %r8w, -0x20(%rsi)
pshufhw $0x84, %xmm5, %xmm5     # xmm5 = xmm5[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm12, %xmm6    # xmm6 = xmm12[0,1,2,3,4,5,4,6]
pand %xmm5, %xmm6
pshufhw $0x84, %xmm14, %xmm5    # xmm5 = xmm14[0,1,2,3,4,5,4,6]
por %xmm6, %xmm5
pxor %xmm10, %xmm5
packssdw %xmm5, %xmm5
pextrw $0x7, %xmm5, %r8d
testb $0x1, %r8b
je 0x1c968
pextrw $0x4, %xmm13, %r8d
movw %r8w, (%rsi)
addq $0x8, %rdi
paddq %xmm11, %xmm0
paddq %xmm11, %xmm3
paddq %xmm11, %xmm2
paddq %xmm11, %xmm1
addq $0x100, %rsi            # imm = 0x100
cmpq %rdi, %rdx
jne 0x1c6c8
movslq %ecx, %rcx
shlq $0x5, %rcx
movw %ax, 0x8(%r15,%rcx)
movswl %ax, %edi
callq 0x1cc3c
xorl %ecx, %ecx
negl %eax
sbbl %ecx, %ecx
orl %r14d, %ecx
movl %ecx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq