// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: setviewtotile
void setviewtotile(short tilenume, int xsiz, int ysiz)
{
	int i, j;

		//DRAWROOMS TO TILE BACKUP&SET CODE
	tilesizx[tilenume] = xsiz; tilesizy[tilenume] = ysiz;
	bakxsiz[setviewcnt] = xsiz; bakysiz[setviewcnt] = ysiz;
	bakframeplace[setviewcnt] = frameplace; frameplace = waloff[tilenume];
	bakwindowx1[setviewcnt] = windowx1; bakwindowy1[setviewcnt] = windowy1;
	bakwindowx2[setviewcnt] = windowx2; bakwindowy2[setviewcnt] = windowy2;
#if USE_POLYMOST
	if (setviewcnt == 0) {
		bakrendmode = rendmode;
		baktile = tilenume;
	}
	rendmode = 0;//2;
#endif
	copybufbyte(&startumost[windowx1],&bakumost[windowx1],(windowx2-windowx1+1)*sizeof(bakumost[0]));
	copybufbyte(&startdmost[windowx1],&bakdmost[windowx1],(windowx2-windowx1+1)*sizeof(bakdmost[0]));
	setviewcnt++;

	offscreenrendering = 1;
	setview(0,0,ysiz-1,xsiz-1);
	setaspect(65536,65536);
	j = 0; for(i=0;i<=xsiz;i++) { ylookup[i] = j, j += ysiz; }
	setvlinebpl(ysiz);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %r14d
movslq %edi, %rax
leaq 0x3d38fa(%rip), %rcx    # 0x410020
movw %r14w, (%rcx,%rax,2)
leaq 0x3c50ae(%rip), %rcx    # 0x4017e0
movw %bx, (%rcx,%rax,2)
movslq 0x3fba93(%rip), %rdx    # 0x4381d0
leaq 0x3fba7c(%rip), %rcx    # 0x4381c0
movl %esi, (%rcx,%rdx,4)
leaq 0x141962(%rip), %rcx    # 0x17e0b0
movq (%rcx), %rsi
leaq 0x3fba88(%rip), %r8     # 0x4381e0
movq %rsi, (%r8,%rdx,8)
leaq 0x35cb7d(%rip), %rsi    # 0x3992e0
movq (%rsi,%rax,8), %rax
movq %rax, (%rcx)
movslq 0x3955ff(%rip), %rax    # 0x3d1d70
leaq 0x3fba88(%rip), %rcx    # 0x438200
movl %eax, (%rcx,%rdx,4)
movl 0x3973ff(%rip), %ecx    # 0x3d3b80
leaq 0x3fba88(%rip), %rsi    # 0x438210
movl %ecx, (%rsi,%rdx,4)
movl 0x3cb84f(%rip), %ecx    # 0x407fe0
leaq 0x3fba88(%rip), %rsi    # 0x438220
movl %ecx, (%rsi,%rdx,4)
movl 0x3cb843(%rip), %esi    # 0x407fe4
leaq 0x3fba88(%rip), %r8     # 0x438230
movl %esi, (%r8,%rdx,4)
testq %rdx, %rdx
jne 0x3c7c9
leaq 0x5be198(%rip), %rdx    # 0x5fa950
movl (%rdx), %edx
movl %edx, 0x3fba80(%rip)    # 0x438240
movswl %di, %edx
movl %edx, 0x3fba7b(%rip)    # 0x438244
leaq 0x5be180(%rip), %rdx    # 0x5fa950
movl $0x0, (%rdx)
leaq 0x393793(%rip), %rdx    # 0x3cff70
leaq (%rdx,%rax,2), %rdi
leaq 0x3fba68(%rip), %rdx    # 0x438250
leaq (%rdx,%rax,2), %rsi
subl %eax, %ecx
leal 0x2(,%rcx,2), %edx
callq 0x4d437
movslq 0x39556f(%rip), %rax    # 0x3d1d70
leaq 0x395578(%rip), %rcx    # 0x3d1d80
leaq (%rcx,%rax,2), %rdi
leaq 0x3fd83d(%rip), %rcx    # 0x43a050
leaq (%rcx,%rax,2), %rsi
movl 0x3cb7c3(%rip), %ecx    # 0x407fe0
subl %eax, %ecx
leal 0x2(,%rcx,2), %edx
callq 0x4d437
incl 0x3fb99f(%rip)          # 0x4381d0
leaq 0x141880(%rip), %rax    # 0x17e0b8
movb $0x1, (%rax)
leal -0x1(%rbx), %edx
leal -0x1(%r14), %ecx
xorl %r15d, %r15d
xorl %edi, %edi
xorl %esi, %esi
callq 0x3419e
movslq 0x3da423(%rip), %rcx    # 0x416c78
movl $0x10000, %eax          # imm = 0x10000
movl %eax, 0x3934f0(%rip)    # 0x3cfd50
movl %eax, 0x3924d2(%rip)    # 0x3ced38
movl %eax, 0x3cb77c(%rip)    # 0x407fe8
movl %eax, 0x321046(%rip)    # 0x35d8b8
movslq 0x67fb7(%rip), %rsi     # 0xa4830
movq %rsi, %rax
shlq $0x10, %rax
movabsq $0x6666666666666667, %rdx # imm = 0x6666666666666667
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x7, %rdx
addl %eax, %edx
movl %edx, 0x23f1f8(%rip)    # 0x27ba98
movl $0x1400000, %eax        # imm = 0x1400000
xorl %edx, %edx
idivl %esi
movl %eax, 0x392485(%rip)    # 0x3ced34
movslq 0x23f1de(%rip), %rax    # 0x27ba94
shlq $0x10, %rax
imulq $0xc80000, %rcx, %rcx   # imm = 0xC80000
sarq $0x20, %rcx
cqto
idivq %rcx
movl %eax, 0x3f9cd0(%rip)    # 0x4365a0
testl %r14d, %r14d
js 0x3c9f7
movd %r14d, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl $0x2, %r14d
andl $0x1fffffff, %r14d      # imm = 0x1FFFFFFF
shlq $0x4, %r14
addq $0x10, %r14
leal (%rbx,%rbx,2), %eax
leal (,%rbx,4), %ecx
leal (%rbx,%rbx), %edx
movdqa 0x377c5(%rip), %xmm1    # 0x740d0
movdqa 0x377cd(%rip), %xmm2    # 0x740e0
movdqa 0x377d5(%rip), %xmm3    # 0x740f0
pxor %xmm3, %xmm0
leaq 0x3da37a(%rip), %rsi    # 0x416ca0
pcmpeqd %xmm4, %xmm4
movdqa 0x3a76e(%rip), %xmm5    # 0x770a0
xorl %edi, %edi
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %r8d
notl %r8d
testb $0x1, %r8b
je 0x3c96f
movl %r15d, (%rdi,%rsi)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %r8d
testb $0x1, %r8b
je 0x3c988
leal (%rbx,%r15), %r8d
movl %r8d, 0x4(%rdi,%rsi)
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %r8d
testb $0x1, %r8b
je 0x3c9ca
leal (%rdx,%r15), %r8d
movl %r8d, 0x8(%rdi,%rsi)
pextrw $0x4, %xmm6, %r8d
testb $0x1, %r8b
je 0x3c9df
leal (%rax,%r15), %r8d
movl %r8d, 0xc(%rdi,%rsi)
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
addq $0x10, %rdi
addl %ecx, %r15d
cmpq %rdi, %r14
jne 0x3c934
movl %ebx, %edi
popq %rbx
popq %r14
popq %r15
jmp 0x6fa48