// File: /workspace/github_c_makefile_star2_O1/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 0x3d3bc0(%rip), %rcx    # 0x40f020
movw %r14w, (%rcx,%rax,2)
leaq 0x3c5374(%rip), %rcx    # 0x4007e0
movw %bx, (%rcx,%rax,2)
movslq 0x3fbd59(%rip), %rdx    # 0x4371d0
leaq 0x3fbd42(%rip), %rcx    # 0x4371c0
movl %esi, (%rcx,%rdx,4)
leaq 0x141c28(%rip), %rcx    # 0x17d0b0
movq (%rcx), %rsi
leaq 0x3fbd4e(%rip), %r8     # 0x4371e0
movq %rsi, (%r8,%rdx,8)
leaq 0x35ce43(%rip), %rsi    # 0x3982e0
movq (%rsi,%rax,8), %rax
movq %rax, (%rcx)
movslq 0x3958c5(%rip), %rax    # 0x3d0d70
leaq 0x3fbd4e(%rip), %rcx    # 0x437200
movl %eax, (%rcx,%rdx,4)
movl 0x3976c5(%rip), %ecx    # 0x3d2b80
leaq 0x3fbd4e(%rip), %rsi    # 0x437210
movl %ecx, (%rsi,%rdx,4)
movl 0x3cbb15(%rip), %ecx    # 0x406fe0
leaq 0x3fbd4e(%rip), %rsi    # 0x437220
movl %ecx, (%rsi,%rdx,4)
movl 0x3cbb09(%rip), %esi    # 0x406fe4
leaq 0x3fbd4e(%rip), %r8     # 0x437230
movl %esi, (%r8,%rdx,4)
testq %rdx, %rdx
jne 0x3b503
leaq 0x5be45e(%rip), %rdx    # 0x5f9950
movl (%rdx), %edx
movl %edx, 0x3fbd46(%rip)    # 0x437240
movswl %di, %edx
movl %edx, 0x3fbd41(%rip)    # 0x437244
leaq 0x5be446(%rip), %rdx    # 0x5f9950
movl $0x0, (%rdx)
leaq 0x393a59(%rip), %rdx    # 0x3cef70
leaq (%rdx,%rax,2), %rdi
leaq 0x3fbd2e(%rip), %rdx    # 0x437250
leaq (%rdx,%rax,2), %rsi
subl %eax, %ecx
leal 0x2(,%rcx,2), %edx
callq 0x4ac52
movslq 0x395835(%rip), %rax    # 0x3d0d70
leaq 0x39583e(%rip), %rcx    # 0x3d0d80
leaq (%rcx,%rax,2), %rdi
leaq 0x3fdb03(%rip), %rcx    # 0x439050
leaq (%rcx,%rax,2), %rsi
movl 0x3cba89(%rip), %ecx    # 0x406fe0
subl %eax, %ecx
leal 0x2(,%rcx,2), %edx
callq 0x4ac52
incl 0x3fbc65(%rip)          # 0x4371d0
leaq 0x141b46(%rip), %rax    # 0x17d0b8
movb $0x1, (%rax)
leal -0x1(%rbx), %edx
leal -0x1(%r14), %ecx
xorl %r15d, %r15d
xorl %edi, %edi
xorl %esi, %esi
callq 0x33586
movslq 0x3da6e9(%rip), %rcx    # 0x415c78
movl $0x10000, %eax          # imm = 0x10000
movl %eax, 0x3937b6(%rip)    # 0x3ced50
movl %eax, 0x392798(%rip)    # 0x3cdd38
movl %eax, 0x3cba42(%rip)    # 0x406fe8
movl %eax, 0x32130c(%rip)    # 0x35c8b8
movslq 0x6827d(%rip), %rsi     # 0xa3830
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, 0x23f4be(%rip)    # 0x27aa98
movl $0x1400000, %eax        # imm = 0x1400000
xorl %edx, %edx
idivq %rsi
movl %eax, 0x39274a(%rip)    # 0x3cdd34
movslq 0x23f4a3(%rip), %rax    # 0x27aa94
shlq $0x10, %rax
imulq $0xc80000, %rcx, %rcx   # imm = 0xC80000
sarq $0x20, %rcx
cqto
idivq %rcx
movl %eax, 0x3f9f95(%rip)    # 0x4355a0
testl %r14d, %r14d
js 0x3b634
movl %r14d, %eax
leaq 0x4(,%rax,4), %rax
leaq 0x3da67e(%rip), %rcx    # 0x415ca0
xorl %edx, %edx
movl %r15d, (%rdx,%rcx)
addl %ebx, %r15d
addq $0x4, %rdx
cmpq %rdx, %rax
jne 0x3b624
movl %ebx, %edi
popq %rbx
popq %r14
popq %r15
jmp 0x6dcbc