// File: /workspace/github_c_makefile_star2_O3/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, -0x20(%rsp)
movzbl 0x16(%rsi), %eax
movq %rax, -0x28(%rsp)
leal (,%rax,8), %r10d
movslq %edi, %rdi
leaq 0x22cb99(%rip), %rax    # 0x26ba70
movl (%rax,%rdi,4), %r14d
movslq %r14d, %r11
movslq 0x3d9f7f(%rip), %rax    # 0x418e64
movq %r11, %rcx
subq %rax, %rcx
leaq 0x3cd10e(%rip), %rax    # 0x40c000
movslq (%rax,%rdi,4), %rsi
movl %esi, %eax
sarl $0x2, %eax
movl %eax, -0x4c(%rsp)
movl %eax, %r15d
negl %r15d
leaq 0x461004(%rip), %rax    # 0x49ff10
movslq (%rax,%rdi,4), %r12
subq %rsi, %r12
leaq 0x3c90e6(%rip), %rax    # 0x408000
movslq (%rax,%rdi,4), %r8
movslq 0x6590b(%rip), %rax     # 0xa4830
movq %rax, %rdx
imulq %r8, %rdx
shrq $0x5, %rdx
movq %r15, -0x60(%rsp)
movslq %r15d, %r15
imulq %rcx, %r15
shrq $0x2, %r15
addl %edx, %r15d
leaq 0x45cfc6(%rip), %rdx    # 0x49bf10
movslq (%rdx,%rdi,4), %rdx
subq %rdx, %r8
imulq %rax, %r8
movslq 0x38fdd8(%rip), %rax    # 0x3ced34
imulq %rax, %rsi
movq %r12, %rbx
imulq %rax, %rbx
movq %r12, -0x48(%rsp)
movl %r12d, %eax
sarl $0x8, %eax
shrq $0xb, %r8
cltq
movq %rax, -0x38(%rsp)
imulq %rax, %rcx
shrq $0x2, %rcx
shrq $0x13, %rsi
shrq $0x10, %rbx
xorl %r13d, %r13d
movl %ecx, %ebp
movl $0x0, %r12d
addl %r8d, %ebp
movq %rsi, -0x70(%rsp)
je 0x3efe6
movslq %r15d, %rax
shlq $0xc, %rax
movslq %ebp, %r9
cqto
idivq %r9
movq -0x70(%rsp), %rsi
movslq %eax, %r12
movslq %ebx, %rax
imulq %r12, %rax
shrq $0x15, %rax
addl %esi, %eax
leaq 0x46bd43(%rip), %rdx    # 0x4aad10
movl %eax, (%rdx,%r11,4)
imull %r10d, %r12d
movl %r12d, %eax
sarl $0x12, %eax
leaq 0x46f92e(%rip), %rdx    # 0x4ae910
movl %eax, (%rdx,%r11,4)
movq %rbx, -0x68(%rsp)
leaq 0x230a8e(%rip), %rax    # 0x26fa80
movslq (%rax,%rdi,4), %rdi
leaq 0x4(%r11), %rdx
cmpl %edi, %edx
movq %rdi, -0x58(%rsp)
jle 0x3f00b
movl %r14d, %r8d
jmp 0x3f16b
movq %r11, -0x30(%rsp)
movq %r10, -0x40(%rsp)
movslq -0x68(%rsp), %rax
movq %rax, -0x18(%rsp)
movslq %r8d, %rdi
movslq %ecx, %rax
leal (%rax,%rdi), %ebp
negl %ebp
addq -0x38(%rsp), %rdi
addq %rax, %rdi
leaq (,%rdx,4), %rax
movq %rax, -0x8(%rsp)
xorl %r8d, %r8d
leaq 0x46bcc7(%rip), %r10    # 0x4aad10
leaq 0x46f8c0(%rip), %rsi    # 0x4ae910
xorl %r9d, %r9d
movq %rdx, -0x10(%rsp)
movq -0x8(%rsp), %rax
leaq (%rax,%r8,4), %rbx
testq %rdi, %rdi
je 0x3f0a4
movq -0x60(%rsp), %rax
addl %r15d, %eax
cltq
shlq $0xc, %rax
cqto
idivq %rdi
movslq %eax, %rdx
movq %rdx, %rax
imulq -0x18(%rsp), %rax
shrq $0x15, %rax
addl -0x70(%rsp), %eax
movl %eax, (%r10,%rbx)
imull -0x40(%rsp), %edx
movl %r12d, %r13d
movl %edx, %r12d
sarl $0x12, %edx
movl %edx, (%rsi,%rbx)
jmp 0x3f0ab
movl (%r10,%rbx), %eax
movq %r9, %r13
leaq (%r14,%r8), %rbx
leal (%r12,%r13), %r11d
movl %r11d, %edx
sarl %edx
sarl $0x13, %r11d
leal (%r14,%r8), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl %r11d, (%rsi,%rcx,4)
movq %r13, %r9
leal (%rdx,%r13), %r11d
sarl $0x13, %r11d
movq %r12, %r13
movq %rsi, %r12
leal (%r14,%r8), %esi
incl %esi
movslq %esi, %rsi
movl %r11d, (%r12,%rsi,4)
movslq %ebx, %r11
movl (%r10,%r11,4), %r11d
leal (%rax,%r11), %ebx
sarl %ebx
movl %ebx, (%r10,%rcx,4)
addl %ebx, %r11d
sarl %r11d
movl %r11d, (%r10,%rsi,4)
movq %r12, %rsi
movq %r13, %r12
addl %r12d, %edx
sarl $0x13, %edx
leal (%r14,%r8), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movl %edx, (%rsi,%rcx,4)
addl %eax, %ebx
sarl %ebx
movl %ebx, (%r10,%rcx,4)
subl -0x4c(%rsp), %r15d
movq -0x38(%rsp), %rax
subl %eax, %ebp
addq %rax, %rdi
movq -0x10(%rsp), %rdx
leaq (%rdx,%r8), %rax
addq $0x4, %rax
addq $0x4, %r8
cmpq -0x58(%rsp), %rax
jle 0x3f058
negl %ebp
addl %r14d, %r8d
movq -0x40(%rsp), %r10
movq -0x30(%rsp), %r11
movq -0x70(%rsp), %rsi
movq -0x58(%rsp), %rdi
movq %r9, %r13
leal 0x2(%r8), %ecx
cmpl %edi, %ecx
jle 0x3f17b
movl %r8d, %ecx
jmp 0x3f217
movq -0x60(%rsp), %rax
sarl %eax
addl %eax, %r15d
movq -0x48(%rsp), %rax
sarl $0x9, %eax
addl %eax, %ebp
je 0x3f1da
movslq %r15d, %rax
shlq $0xc, %rax
movslq %ebp, %rdi
cqto
idivq %rdi
movslq %eax, %rdx
movslq -0x68(%rsp), %rax
imulq %rdx, %rax
shrq $0x15, %rax
addl -0x70(%rsp), %eax
movslq %ecx, %rbx
leaq 0x46bb52(%rip), %rdi    # 0x4aad10
movl %eax, (%rdi,%rbx,4)
imull %r10d, %edx
movl %r12d, %r13d
movl %edx, %r12d
sarl $0x12, %edx
leaq 0x46f73b(%rip), %rdi    # 0x4ae910
movl %edx, (%rdi,%rbx,4)
jmp 0x3f1e7
movslq %ecx, %rax
leaq 0x46bb2c(%rip), %rdx    # 0x4aad10
movl (%rdx,%rax,4), %eax
addl %r12d, %r13d
sarl $0x13, %r13d
leaq 0x46f71b(%rip), %rdx    # 0x4ae910
movslq %r8d, %rdi
movl %r13d, 0x4(%rdx,%rdi,4)
leaq 0x46bb0c(%rip), %rdx    # 0x4aad10
addl (%rdx,%rdi,4), %eax
sarl %eax
movl %eax, 0x4(%rdx,%rdi,4)
movq -0x70(%rsp), %rsi
movq -0x58(%rsp), %rdi
cmpl %edi, %ecx
movq -0x68(%rsp), %rbx
jge 0x3f27a
movq -0x48(%rsp), %rax
sarl $0xa, %eax
addl %eax, %ebp
je 0x3f27a
incl %ecx
movq -0x60(%rsp), %rax
sarl $0x2, %eax
addl %eax, %r15d
movslq %r15d, %rax
shlq $0xc, %rax
movslq %ebp, %r8
cqto
idivq %r8
cltq
movslq %ebx, %rdx
imulq %rax, %rdx
shrq $0x15, %rdx
addl %esi, %edx
movslq %ecx, %rcx
leaq 0x46baaf(%rip), %r8     # 0x4aad10
movl %edx, (%r8,%rcx,4)
movq %r10, %rdx
imulq %rax, %rdx
shrq $0x12, %rdx
leaq 0x46f699(%rip), %rax    # 0x4ae910
movl %edx, (%rax,%rcx,4)
leaq 0x46f68f(%rip), %rax    # 0x4ae910
cmpl $0x0, (%rax,%r11,4)
jns 0x3f290
movl $0x0, (%rax,%r11,4)
cmpl %r10d, (%rax,%rdi,4)
setge %cl
cmpb $0x0, -0x28(%rsp)
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x3f2ad
leal -0x1(%r10), %ecx
movl %ecx, (%rax,%rdi,4)
movq -0x20(%rsp), %rcx
testb $0x8, 0xe(%rcx)
sete %cl
cmpl %edi, %r14d
setg %dl
orb %cl, %dl
jne 0x3f2e4
shlq $0x2, %r11
subl %r14d, %edi
incl %edi
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, %edi
jne 0x3f2ce
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq