// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/build.c
// Function: drawtilescreen
int drawtilescreen(int pictopleft, int picbox)
{
	intptr_t vidpos, vidpos2;
	int i, j, wallnum, xdime, ydime, cnt, pinc;
	int dax, day, scaledown, xtiles, ytiles, tottiles;
	unsigned char *picptr;
	char snotbuf[80];

	xtiles = (xdim>>6); ytiles = (ydim>>6); tottiles = xtiles*ytiles;

#if USE_POLYMOST && USE_OPENGL
	setpolymost2dview();	// JBF 20040205: set to 2d rendering
#endif

	pinc = ylookup[1];
	clearview(blackcol);
	for(cnt=0;cnt<(tottiles<<(gettilezoom<<1));cnt++)         //draw the 5*3 grid of tiles
	{
		wallnum = cnt+pictopleft;
		if (wallnum < localartlookupnum)
		{
			wallnum = localartlookup[wallnum];
			if ((tilesizx[wallnum] != 0) && (tilesizy[wallnum] != 0))
			{
				if (waloff[wallnum] == 0) loadtile(wallnum);
				picptr = (unsigned char *)(waloff[wallnum]);
				xdime = tilesizx[wallnum];
				ydime = tilesizy[wallnum];

				dax = ((cnt%(xtiles<<gettilezoom))<<(6-gettilezoom));
				day = ((cnt/(xtiles<<gettilezoom))<<(6-gettilezoom));
#if USE_POLYMOST && USE_OPENGL
				if (polymost_drawtilescreen(dax, day, wallnum, 64>>gettilezoom))
#endif
				{
					vidpos = ylookup[day]+dax+frameplace;
					if ((xdime <= (64>>gettilezoom)) && (ydime <= (64>>gettilezoom)))
					{
						for(i=0;i<xdime;i++)
						{
							vidpos2 = vidpos+i;
							for(j=0;j<ydime;j++)
							{
								*(unsigned char *)vidpos2 = *picptr++;
								vidpos2 += pinc;
							}
						}
					}
					else                          //if 1 dimension > 64
					{
						if (xdime > ydime)
							scaledown = ((xdime+(63>>gettilezoom))>>(6-gettilezoom));
						else
							scaledown = ((ydime+(63>>gettilezoom))>>(6-gettilezoom));

						for(i=0;i<xdime;i+=scaledown)
						{
							if (waloff[wallnum] == 0) loadtile(wallnum);
							picptr = (unsigned char *)(waloff[wallnum]) + ydime*i;
							vidpos2 = vidpos;
							for(j=0;j<ydime;j+=scaledown)
							{
								*(unsigned char *)vidpos2 = *picptr;
								picptr += scaledown;
								vidpos2 += pinc;
							}
							vidpos++;
						}
					}
				}
				if (localartlookupnum < MAXTILES)
				{
					dax = ((cnt%(xtiles<<gettilezoom))<<(6-gettilezoom));
					day = ((cnt/(xtiles<<gettilezoom))<<(6-gettilezoom));
					Bsprintf(snotbuf,"%d",localartfreq[cnt+pictopleft]);
					printext256(dax,day,whitecol,-1,snotbuf,1);
				}
			}
		}
	}

	cnt = picbox-pictopleft;    //draw open white box
	dax = ((cnt%(xtiles<<gettilezoom))<<(6-gettilezoom));
	day = ((cnt/(xtiles<<gettilezoom))<<(6-gettilezoom));

	i = (63>>gettilezoom);
	drawline256((dax  )<<12, (day  )<<12, (dax+i)<<12, (day  )<<12, whitecol);
	drawline256((dax+i)<<12, (day  )<<12, (dax+i)<<12, (day+i)<<12, whitecol);
	drawline256((dax+i)<<12, (day+i)<<12, (dax  )<<12, (day+i)<<12, whitecol);
	drawline256((dax  )<<12, (day+i)<<12, (dax  )<<12, (day  )<<12, whitecol);

	i = localartlookup[picbox];
	Bsprintf(snotbuf,"%d",i);
	printext256(0L,ydim-8,whitecol,-1,snotbuf,0);
	printext256(xdim-((int)strlen(names[i])<<3),ydim-8,whitecol,-1,names[i],0);

	Bsprintf(snotbuf,"%dx%d",tilesizx[i],tilesizy[i]);
	printext256(xdim>>2,ydim-8,whitecol,-1,snotbuf,0);

	return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
leaq 0x41e464(%rip), %rax    # 0x442d4c
movl (%rax), %eax
sarl $0x6, %eax
movl %eax, -0x44(%rbp)
leaq 0x41e459(%rip), %rax    # 0x442d50
movl (%rax), %eax
sarl $0x6, %eax
movl %eax, -0x48(%rbp)
movl -0x44(%rbp), %eax
imull -0x48(%rbp), %eax
movl %eax, -0x4c(%rbp)
callq 0x5a810
leaq 0x42d16b(%rip), %rax    # 0x451a80
movl 0x4(%rax), %eax
movl %eax, -0x34(%rbp)
movl 0x145b8b(%rip), %edi    # 0x16a4ac
callq 0x57e90
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl -0x4c(%rbp), %edx
movl 0xbb66f(%rip), %ecx     # 0xdffa8
shll %ecx
shll %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jge 0x24ce8
movl -0x30(%rbp), %eax
addl -0x4(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movswl 0x159bb6(%rip), %ecx    # 0x17e510
cmpl %ecx, %eax
jge 0x24cd8
movslq -0x24(%rbp), %rcx
leaq 0x1553a3(%rip), %rax    # 0x179d10
movswl (%rax,%rcx,2), %eax
movl %eax, -0x24(%rbp)
movslq -0x24(%rbp), %rcx
leaq 0x426401(%rip), %rax    # 0x44ad80
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
je 0x24cd6
movslq -0x24(%rbp), %rcx
leaq 0x417ba9(%rip), %rax    # 0x43c540
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
je 0x24cd6
movslq -0x24(%rbp), %rcx
leaq 0x3b1491(%rip), %rax    # 0x3d5e40
cmpq $0x0, (%rax,%rcx,8)
jne 0x249c1
movl -0x24(%rbp), %eax
movswl %ax, %edi
callq 0x44df0
movslq -0x24(%rbp), %rcx
leaq 0x3b1474(%rip), %rax    # 0x3d5e40
movq (%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
movslq -0x24(%rbp), %rcx
leaq 0x4263a1(%rip), %rax    # 0x44ad80
movswl (%rax,%rcx,2), %eax
movl %eax, -0x28(%rbp)
movslq -0x24(%rbp), %rcx
leaq 0x417b4f(%rip), %rax    # 0x43c540
movswl (%rax,%rcx,2), %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
movl -0x44(%rbp), %edx
movl 0xbb5a4(%rip), %ecx     # 0xdffa8
shll %cl, %edx
movl %edx, %ecx
cltd
idivl %ecx
movl $0x6, %ecx
subl 0xbb592(%rip), %ecx     # 0xdffa8
shll %cl, %edx
movl %edx, -0x38(%rbp)
movl -0x30(%rbp), %eax
movl -0x44(%rbp), %edx
movl 0xbb581(%rip), %ecx     # 0xdffa8
shll %cl, %edx
movl %edx, %ecx
cltd
idivl %ecx
movl $0x6, %ecx
subl 0xbb56f(%rip), %ecx     # 0xdffa8
shll %cl, %eax
movl %eax, -0x3c(%rbp)
movl -0x38(%rbp), %edi
movl -0x3c(%rbp), %esi
movl -0x24(%rbp), %edx
movl 0xbb55b(%rip), %ecx     # 0xdffa8
movl $0x40, %eax
sarl %cl, %eax
movl %eax, %ecx
callq 0x8a070
cmpl $0x0, %eax
je 0x24c2d
movslq -0x3c(%rbp), %rcx
leaq 0x42d011(%rip), %rax    # 0x451a80
movl (%rax,%rcx,4), %eax
addl -0x38(%rbp), %eax
cltq
leaq 0x196192(%rip), %rcx    # 0x1bac10
addq (%rcx), %rax
movq %rax, -0x10(%rbp)
movl -0x28(%rbp), %eax
movl 0xbb51a(%rip), %ecx     # 0xdffa8
movl $0x40, %edx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jg 0x24b22
movl -0x2c(%rbp), %eax
movl 0xbb500(%rip), %ecx     # 0xdffa8
movl $0x40, %edx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jg 0x24b22
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x24b1d
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x24b10
movq -0x58(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x58(%rbp)
movb (%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movslq -0x34(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x24ada
jmp 0x24b12
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x24abc
jmp 0x24c2b
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jle 0x24b50
movl -0x28(%rbp), %eax
movl 0xbb475(%rip), %ecx     # 0xdffa8
movl $0x3f, %edx
sarl %cl, %edx
movl %edx, %ecx
addl %ecx, %eax
movl $0x6, %ecx
subl 0xbb45f(%rip), %ecx     # 0xdffa8
sarl %cl, %eax
movl %eax, -0x40(%rbp)
jmp 0x24b74
movl -0x2c(%rbp), %eax
movl 0xbb44f(%rip), %ecx     # 0xdffa8
movl $0x3f, %edx
sarl %cl, %edx
movl %edx, %ecx
addl %ecx, %eax
movl $0x6, %ecx
subl 0xbb439(%rip), %ecx     # 0xdffa8
sarl %cl, %eax
movl %eax, -0x40(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x24c29
movslq -0x24(%rbp), %rcx
leaq 0x3b12ae(%rip), %rax    # 0x3d5e40
cmpq $0x0, (%rax,%rcx,8)
jne 0x24ba4
movl -0x24(%rbp), %eax
movswl %ax, %edi
callq 0x44df0
movslq -0x24(%rbp), %rcx
leaq 0x3b1291(%rip), %rax    # 0x3d5e40
movq (%rax,%rcx,8), %rax
movl -0x2c(%rbp), %ecx
imull -0x1c(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x24c0f
movq -0x58(%rbp), %rax
movb (%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movl -0x40(%rbp), %ecx
movq -0x58(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movslq -0x34(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0x40(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x24bd3
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movl -0x40(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x24b7b
jmp 0x24c2b
jmp 0x24c2d
movswl 0x1598dc(%rip), %eax    # 0x17e510
cmpl $0x2400, %eax           # imm = 0x2400
jge 0x24cd4
movl -0x30(%rbp), %eax
movl -0x44(%rbp), %edx
movl 0xbb35d(%rip), %ecx     # 0xdffa8
shll %cl, %edx
movl %edx, %ecx
cltd
idivl %ecx
movl $0x6, %ecx
subl 0xbb34b(%rip), %ecx     # 0xdffa8
shll %cl, %edx
movl %edx, -0x38(%rbp)
movl -0x30(%rbp), %eax
movl -0x44(%rbp), %edx
movl 0xbb33a(%rip), %ecx     # 0xdffa8
shll %cl, %edx
movl %edx, %ecx
cltd
idivl %ecx
movl $0x6, %ecx
subl 0xbb328(%rip), %ecx     # 0xdffa8
shll %cl, %eax
movl %eax, -0x3c(%rbp)
leaq -0xb0(%rbp), %rdi
movl -0x30(%rbp), %eax
addl -0x4(%rbp), %eax
movslq %eax, %rcx
leaq 0x150864(%rip), %rax    # 0x175500
movswl (%rax,%rcx,2), %edx
leaq 0x8bfad(%rip), %rsi     # 0xb0c54
movb $0x0, %al
callq 0x6a30
movl -0x38(%rbp), %edi
movl -0x3c(%rbp), %esi
movl 0x1457ee(%rip), %eax    # 0x16a4a8
leaq -0xb0(%rbp), %r8
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0x1, %r9d
movswl %ax, %edx
callq 0x59a30
jmp 0x24cd6
jmp 0x24cd8
jmp 0x24cda
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x2492d
movl -0x8(%rbp), %eax
subl -0x4(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl -0x44(%rbp), %edx
movl 0xbb2ab(%rip), %ecx     # 0xdffa8
shll %cl, %edx
movl %edx, %ecx
cltd
idivl %ecx
movl $0x6, %ecx
subl 0xbb299(%rip), %ecx     # 0xdffa8
shll %cl, %edx
movl %edx, -0x38(%rbp)
movl -0x30(%rbp), %eax
movl -0x44(%rbp), %edx
movl 0xbb288(%rip), %ecx     # 0xdffa8
shll %cl, %edx
movl %edx, %ecx
cltd
idivl %ecx
movl $0x6, %ecx
subl 0xbb276(%rip), %ecx     # 0xdffa8
shll %cl, %eax
movl %eax, -0x3c(%rbp)
movl 0xbb26b(%rip), %ecx     # 0xdffa8
movl $0x3f, %eax
sarl %cl, %eax
movl %eax, -0x1c(%rbp)
movl -0x38(%rbp), %edi
shll $0xc, %edi
movl -0x3c(%rbp), %esi
shll $0xc, %esi
movl -0x38(%rbp), %edx
addl -0x1c(%rbp), %edx
shll $0xc, %edx
movl -0x3c(%rbp), %ecx
shll $0xc, %ecx
movl 0x145740(%rip), %eax    # 0x16a4a8
movzbl %al, %r8d
callq 0x59560
movl -0x38(%rbp), %edi
addl -0x1c(%rbp), %edi
shll $0xc, %edi
movl -0x3c(%rbp), %esi
shll $0xc, %esi
movl -0x38(%rbp), %edx
addl -0x1c(%rbp), %edx
shll $0xc, %edx
movl -0x3c(%rbp), %ecx
addl -0x1c(%rbp), %ecx
shll $0xc, %ecx
movl 0x145710(%rip), %eax    # 0x16a4a8
movzbl %al, %r8d
callq 0x59560
movl -0x38(%rbp), %edi
addl -0x1c(%rbp), %edi
shll $0xc, %edi
movl -0x3c(%rbp), %esi
addl -0x1c(%rbp), %esi
shll $0xc, %esi
movl -0x38(%rbp), %edx
shll $0xc, %edx
movl -0x3c(%rbp), %ecx
addl -0x1c(%rbp), %ecx
shll $0xc, %ecx
movl 0x1456e0(%rip), %eax    # 0x16a4a8
movzbl %al, %r8d
callq 0x59560
movl -0x38(%rbp), %edi
shll $0xc, %edi
movl -0x3c(%rbp), %esi
addl -0x1c(%rbp), %esi
shll $0xc, %esi
movl -0x38(%rbp), %edx
shll $0xc, %edx
movl -0x3c(%rbp), %ecx
shll $0xc, %ecx
movl 0x1456b6(%rip), %eax    # 0x16a4a8
movzbl %al, %r8d
callq 0x59560
movslq -0x8(%rbp), %rcx
leaq 0x154f0a(%rip), %rax    # 0x179d10
movswl (%rax,%rcx,2), %eax
movl %eax, -0x1c(%rbp)
leaq -0xb0(%rbp), %rdi
movl -0x1c(%rbp), %edx
leaq 0x8be36(%rip), %rsi     # 0xb0c54
movb $0x0, %al
callq 0x6a30
leaq 0x41df24(%rip), %rax    # 0x442d50
movl (%rax), %esi
subl $0x8, %esi
movl 0x145671(%rip), %eax    # 0x16a4a8
leaq -0xb0(%rbp), %r8
xorl %r9d, %r9d
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %r9d, %edi
movswl %ax, %edx
callq 0x59a30
leaq 0x41def4(%rip), %rax    # 0x442d4c
movl (%rax), %eax
movl %eax, -0xb4(%rbp)
movslq -0x1c(%rbp), %rax
leaq 0x1596b5(%rip), %rdi    # 0x17e520
imulq $0x19, %rax, %rax
addq %rax, %rdi
callq 0x63d0
movl -0xb4(%rbp), %edi
shll $0x3, %eax
subl %eax, %edi
leaq 0x41dec7(%rip), %rax    # 0x442d50
movl (%rax), %esi
subl $0x8, %esi
movl 0x145614(%rip), %eax    # 0x16a4a8
movslq -0x1c(%rbp), %rcx
leaq 0x159681(%rip), %r8     # 0x17e520
imulq $0x19, %rcx, %rcx
addq %rcx, %r8
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
movswl %ax, %edx
callq 0x59a30
leaq -0xb0(%rbp), %rdi
movslq -0x1c(%rbp), %rcx
leaq 0x425eb8(%rip), %rax    # 0x44ad80
movswl (%rax,%rcx,2), %edx
movslq -0x1c(%rbp), %rcx
leaq 0x417669(%rip), %rax    # 0x43c540
movswl (%rax,%rcx,2), %ecx
leaq 0x8b527(%rip), %rsi     # 0xb0409
movb $0x0, %al
callq 0x6a30
leaq 0x41de5c(%rip), %rax    # 0x442d4c
movl (%rax), %edi
sarl $0x2, %edi
leaq 0x41de54(%rip), %rax    # 0x442d50
movl (%rax), %esi
subl $0x8, %esi
movl 0x1455a1(%rip), %eax    # 0x16a4a8
leaq -0xb0(%rbp), %r8
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
movswl %ax, %edx
callq 0x59a30
xorl %eax, %eax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)