// File: /workspace/github_c_makefile_star2_O2/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 0x3d03b6(%rip), %rcx    # 0x409020
movw %r14w, (%rcx,%rax,2)
leaq 0x3c1b6a(%rip), %rcx    # 0x3fa7e0
movw %bx, (%rcx,%rax,2)
movslq 0x3f854f(%rip), %rdx    # 0x4311d0
leaq 0x3f8538(%rip), %rcx    # 0x4311c0
movl %esi, (%rcx,%rdx,4)
leaq 0x13e41e(%rip), %rcx    # 0x1770b0
movq (%rcx), %rsi
leaq 0x3f8544(%rip), %r8     # 0x4311e0
movq %rsi, (%r8,%rdx,8)
leaq 0x359639(%rip), %rsi    # 0x3922e0
movq (%rsi,%rax,8), %rax
movq %rax, (%rcx)
movslq 0x3920bb(%rip), %rax    # 0x3cad70
leaq 0x3f8544(%rip), %rcx    # 0x431200
movl %eax, (%rcx,%rdx,4)
movl 0x393ebb(%rip), %ecx    # 0x3ccb80
leaq 0x3f8544(%rip), %rsi    # 0x431210
movl %ecx, (%rsi,%rdx,4)
movl 0x3c830b(%rip), %ecx    # 0x400fe0
leaq 0x3f8544(%rip), %rsi    # 0x431220
movl %ecx, (%rsi,%rdx,4)
movl 0x3c82ff(%rip), %esi    # 0x400fe4
leaq 0x3f8544(%rip), %r8     # 0x431230
movl %esi, (%r8,%rdx,4)
testq %rdx, %rdx
jne 0x38d0d
leaq 0x5bac54(%rip), %rdx    # 0x5f3950
movl (%rdx), %edx
movl %edx, 0x3f853c(%rip)    # 0x431240
movswl %di, %edx
movl %edx, 0x3f8537(%rip)    # 0x431244
leaq 0x5bac3c(%rip), %rdx    # 0x5f3950
andl $0x0, (%rdx)
leaq 0x390252(%rip), %rdx    # 0x3c8f70
leaq (%rdx,%rax,2), %rdi
leaq 0x3f8527(%rip), %rdx    # 0x431250
leaq (%rdx,%rax,2), %rsi
subl %eax, %ecx
leal 0x2(,%rcx,2), %edx
callq 0x44524
movslq 0x39202e(%rip), %rax    # 0x3cad70
leaq 0x392037(%rip), %rcx    # 0x3cad80
leaq (%rcx,%rax,2), %rdi
leaq 0x3fa2fc(%rip), %rcx    # 0x433050
leaq (%rcx,%rax,2), %rsi
movl 0x3c8282(%rip), %ecx    # 0x400fe0
subl %eax, %ecx
leal 0x2(,%rcx,2), %edx
callq 0x44524
incl 0x3f845e(%rip)          # 0x4311d0
leaq 0x13e33f(%rip), %rax    # 0x1770b8
movb $0x1, (%rax)
leal -0x1(%rbx), %edx
leal -0x1(%r14), %ecx
xorl %r15d, %r15d
xorl %edi, %edi
xorl %esi, %esi
callq 0x3111e
movl $0x10000, %edi          # imm = 0x10000
movl $0x10000, %esi          # imm = 0x10000
callq 0x38117
movslq %r14d, %rax
leaq 0x3d6ef8(%rip), %rcx    # 0x40fca0
xorl %edx, %edx
cmpq %rax, %r15
jg 0x38dbc
movl %edx, (%rcx)
addl %ebx, %edx
incq %r15
addq $0x4, %rcx
jmp 0x38daa
movl %ebx, %edi
popq %rbx
popq %r14
popq %r15
jmp 0x64198