// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: prepwall
static void prepwall(int z, walltype *wal)
{
	int i, l=0, ol=0, splc, sinc, x, topinc, top, botinc, bot, walxrepeat;

	walxrepeat = (wal->xrepeat<<3);

		//lwall calculation
	i = xb1[z]-halfxdimen;
	topinc = -(ry1[z]>>2);
	botinc = ((ry2[z]-ry1[z])>>8);
	top = mulscale5(rx1[z],xdimen)+mulscale2(topinc,i);
	bot = mulscale11(rx1[z]-rx2[z],xdimen)+mulscale2(botinc,i);

	splc = mulscale19(ry1[z],xdimscale);
	sinc = mulscale16(ry2[z]-ry1[z],xdimscale);

	x = xb1[z];
	if (bot != 0)
	{
		l = divscale12(top,bot);
		swall[x] = mulscale21(l,sinc)+splc;
		l *= walxrepeat;
		lwall[x] = (l>>18);
	}
	while (x+4 <= xb2[z])
	{
		top += topinc; bot += botinc;
		if (bot != 0)
		{
			ol = l; l = divscale12(top,bot);
			swall[x+4] = mulscale21(l,sinc)+splc;
			l *= walxrepeat;
			lwall[x+4] = (l>>18);
		}
		i = ((ol+l)>>1);
		lwall[x+2] = (i>>18);
		lwall[x+1] = ((ol+i)>>19);
		lwall[x+3] = ((l+i)>>19);
		swall[x+2] = ((swall[x]+swall[x+4])>>1);
		swall[x+1] = ((swall[x]+swall[x+2])>>1);
		swall[x+3] = ((swall[x+4]+swall[x+2])>>1);
		x += 4;
	}
	if (x+2 <= xb2[z])
	{
		top += (topinc>>1); bot += (botinc>>1);
		if (bot != 0)
		{
			ol = l; l = divscale12(top,bot);
			swall[x+2] = mulscale21(l,sinc)+splc;
			l *= walxrepeat;
			lwall[x+2] = (l>>18);
		}
		lwall[x+1] = ((l+ol)>>19);
		swall[x+1] = ((swall[x]+swall[x+2])>>1);
		x += 2;
	}
	if (x+1 <= xb2[z])
	{
		bot += (botinc>>2);
		if (bot != 0)
		{
			l = divscale12(top+(topinc>>2),bot);
			swall[x+1] = mulscale21(l,sinc)+splc;
			lwall[x+1] = mulscale18(l,walxrepeat);
		}
	}

	if (lwall[xb1[z]] < 0) lwall[xb1[z]] = 0;
	if ((lwall[xb2[z]] >= walxrepeat) && (walxrepeat)) lwall[xb2[z]] = walxrepeat-1;
	if (wal->cstat&8)
	{
		walxrepeat--;
		for(x=xb1[z];x<=xb2[z];x++) lwall[x] = walxrepeat-lwall[x];
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, -0x40(%rsp)
movzbl 0x16(%rsi), %eax
movq %rax, -0x18(%rsp)
leal (,%rax,8), %r10d
movslq %edi, %rsi
leaq 0x22d058(%rip), %rax    # 0x26aa70
movl (%rax,%rsi,4), %eax
movq %rax, %r13
movslq %eax, %r11
movslq 0x3da43c(%rip), %rax    # 0x417e64
movq %r11, %rcx
subq %rax, %rcx
leaq 0x3cd5cb(%rip), %rax    # 0x40b000
movslq (%rax,%rsi,4), %r14
movl %r14d, %eax
sarl $0x2, %eax
movl %eax, -0x4c(%rsp)
movl %eax, %ebx
negl %ebx
leaq 0x4614c2(%rip), %rax    # 0x49ef10
movslq (%rax,%rsi,4), %r12
subq %r14, %r12
leaq 0x3c95a4(%rip), %rax    # 0x407000
movslq (%rax,%rsi,4), %r8
movslq 0x65dc9(%rip), %rax     # 0xa3830
movq %rax, %rdx
imulq %r8, %rdx
shrq $0x5, %rdx
movq %rbx, -0x60(%rsp)
movslq %ebx, %rdi
imulq %rcx, %rdi
shrq $0x2, %rdi
addl %edx, %edi
leaq 0x45d485(%rip), %rdx    # 0x49af10
movslq (%rdx,%rsi,4), %rdx
subq %rdx, %r8
imulq %rax, %r8
movslq 0x390297(%rip), %rax    # 0x3cdd34
imulq %rax, %r14
movq %r12, %rbx
imulq %rax, %rbx
movq %r12, -0x48(%rsp)
movl %r12d, %eax
sarl $0x8, %eax
shrq $0xb, %r8
cltq
movq %rax, -0x28(%rsp)
imulq %rax, %rcx
shrq $0x2, %rcx
shrq $0x13, %r14
shrq $0x10, %rbx
movq $0x0, -0x70(%rsp)
movl %ecx, %ebp
movl $0x0, %eax
movq %rax, -0x78(%rsp)
addl %r8d, %ebp
movq %rbx, -0x68(%rsp)
je 0x3db37
movslq %edi, %rax
shlq $0xc, %rax
movslq %ebp, %rbx
cqto
idivq %rbx
movq -0x68(%rsp), %rbx
movslq %eax, %r12
movslq %ebx, %rax
imulq %r12, %rax
shrq $0x15, %rax
addl %r14d, %eax
leaq 0x46c1f7(%rip), %rdx    # 0x4a9d10
movl %eax, (%rdx,%r11,4)
imull %r10d, %r12d
movq %r12, -0x78(%rsp)
movl %r12d, %eax
sarl $0x12, %eax
leaq 0x46fddd(%rip), %rdx    # 0x4ad910
movl %eax, (%rdx,%r11,4)
movq %r14, -0x58(%rsp)
leaq 0x230f3d(%rip), %rax    # 0x26ea80
movslq (%rax,%rsi,4), %r14
leaq 0x4(%r11), %r12
cmpl %r14d, %r12d
movq %rdi, %rdx
jle 0x3db5b
movl %r13d, %r8d
jmp 0x3dcd0
movq %r11, -0x20(%rsp)
movq %r10, -0x38(%rsp)
movslq %ebx, %rax
movq %rax, -0x10(%rsp)
movslq %r8d, %rdi
movslq %ecx, %rax
leal (%rax,%rdi), %r9d
negl %r9d
addq -0x28(%rsp), %rdi
addq %rax, %rdi
leaq (,%r12,4), %rax
movq %rax, -0x30(%rsp)
xorl %r8d, %r8d
leaq 0x46fd77(%rip), %r15    # 0x4ad910
leaq 0x46c170(%rip), %rbp    # 0x4a9d10
movq $0x0, -0x70(%rsp)
movq %r14, -0x8(%rsp)
movq -0x78(%rsp), %r11
testq %rdi, %rdi
je 0x3dc01
movq -0x60(%rsp), %rax
addl %edx, %eax
cltq
shlq $0xc, %rax
movq %rdx, %r10
cqto
idivq %rdi
cltq
movq %rax, %rdx
imulq -0x10(%rsp), %rdx
shrq $0x15, %rdx
addl -0x58(%rsp), %edx
movq -0x30(%rsp), %r14
leaq (%r14,%r8,4), %rbx
movl %edx, (%rbp,%rbx)
imull -0x38(%rsp), %eax
movl %r11d, %esi
movl %eax, %r11d
sarl $0x12, %eax
movl %eax, (%r15,%rbx)
jmp 0x3dc0e
movq -0x70(%rsp), %rsi
movq %rdx, %r10
movq -0x30(%rsp), %r14
movq %r11, -0x78(%rsp)
leaq (%r8,%r13), %rdx
leal (%r11,%rsi), %ebx
movl %ebx, %eax
sarl %eax
sarl $0x13, %ebx
leal (%r8,%r13), %r11d
addl $0x2, %r11d
movslq %r11d, %r11
movl %ebx, (%r15,%r11,4)
movq %rsi, -0x70(%rsp)
leal (%rax,%rsi), %ebx
sarl $0x13, %ebx
leal (%r8,%r13), %esi
incl %esi
movslq %esi, %rsi
movl %ebx, (%r15,%rsi,4)
movslq %edx, %rdx
movl (%rbp,%rdx,4), %edx
leaq (%r14,%r8,4), %rbx
movl (%rbp,%rbx), %ebx
leal (%rbx,%rdx), %r14d
sarl %r14d
movl %r14d, (%rbp,%r11,4)
addl %r14d, %edx
sarl %edx
movl %edx, (%rbp,%rsi,4)
movq -0x78(%rsp), %r11
addl %r11d, %eax
sarl $0x13, %eax
leal (%r8,%r13), %edx
addl $0x3, %edx
movslq %edx, %rdx
movl %eax, (%r15,%rdx,4)
addl %ebx, %r14d
sarl %r14d
movl %r14d, (%rbp,%rdx,4)
subl -0x4c(%rsp), %r10d
movq -0x28(%rsp), %rax
subl %eax, %r9d
addq %rax, %rdi
leaq (%r12,%r8), %rax
addq $0x4, %rax
addq $0x4, %r8
movq -0x8(%rsp), %r14
cmpq %r14, %rax
movq %r10, %rdx
jle 0x3dbb3
movl %r9d, %ebp
negl %ebp
addl %r13d, %r8d
movq -0x38(%rsp), %r10
movq -0x20(%rsp), %r11
movq -0x40(%rsp), %r12
leal 0x2(%r8), %ecx
cmpl %r14d, %ecx
jle 0x3dce6
movl %r8d, %ecx
jmp 0x3dd89
movq -0x60(%rsp), %rax
sarl %eax
addl %eax, %edx
movq -0x48(%rsp), %rax
sarl $0x9, %eax
movslq %ecx, %rdi
addl %eax, %ebp
je 0x3dd4a
movq %r13, %r9
movq %rdx, %rsi
movslq %edx, %rax
shlq $0xc, %rax
movslq %ebp, %rbx
cqto
idivq %rbx
cltq
movslq -0x68(%rsp), %rdx
imulq %rax, %rdx
shrq $0x15, %rdx
addl -0x58(%rsp), %edx
leaq 0x46bfe3(%rip), %rbx    # 0x4a9d10
movl %edx, (%rbx,%rdi,4)
imull %r10d, %eax
movq -0x78(%rsp), %r13
movl %eax, %ebx
sarl $0x12, %eax
leaq 0x46fbcb(%rip), %rdx    # 0x4ad910
movl %eax, (%rdx,%rdi,4)
jmp 0x3dd5a
movq %rdx, %rsi
movq %r13, %r9
movq -0x78(%rsp), %rbx
movq -0x70(%rsp), %r13
addl %ebx, %r13d
sarl $0x13, %r13d
leaq 0x46fba8(%rip), %rax    # 0x4ad910
movslq %r8d, %rdx
movl %r13d, 0x4(%rax,%rdx,4)
leaq 0x46bf99(%rip), %rax    # 0x4a9d10
movl (%rax,%rdi,4), %edi
addl (%rax,%rdx,4), %edi
sarl %edi
movl %edi, 0x4(%rax,%rdx,4)
movq %r9, %r13
movq %rsi, %rdx
cmpl %r14d, %ecx
movq -0x58(%rsp), %rbx
jge 0x3ddee
movq -0x48(%rsp), %rax
sarl $0xa, %eax
addl %eax, %ebp
je 0x3ddee
incl %ecx
movq -0x60(%rsp), %rax
sarl $0x2, %eax
addl %eax, %edx
movslq %edx, %rax
shlq $0xc, %rax
movslq %ebp, %r8
cqto
idivq %r8
cltq
movslq -0x68(%rsp), %rdx
imulq %rax, %rdx
shrq $0x15, %rdx
addl %ebx, %edx
movslq %ecx, %rcx
leaq 0x46bf3b(%rip), %r8     # 0x4a9d10
movl %edx, (%r8,%rcx,4)
movq %r10, %rdx
imulq %rax, %rdx
shrq $0x12, %rdx
leaq 0x46fb25(%rip), %rax    # 0x4ad910
movl %edx, (%rax,%rcx,4)
leaq 0x46fb1b(%rip), %rax    # 0x4ad910
cmpl $0x0, (%rax,%r11,4)
jns 0x3de04
movl $0x0, (%rax,%r11,4)
cmpl %r10d, (%rax,%r14,4)
setge %cl
cmpb $0x0, -0x18(%rsp)
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x3de22
leal -0x1(%r10), %ecx
movl %ecx, (%rax,%r14,4)
testb $0x8, 0xe(%r12)
sete %cl
cmpl %r14d, %r13d
setg %dl
orb %cl, %dl
jne 0x3de58
shlq $0x2, %r11
subl %r13d, %r14d
incl %r14d
xorl %ecx, %ecx
leaq (%r11,%rcx,4), %rdx
movl (%rax,%rdx), %esi
notl %esi
addl %r10d, %esi
movl %esi, (%rax,%rdx)
incq %rcx
cmpl %ecx, %r14d
jne 0x3de41
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq