// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: kgifrend
static int kgifrend (const char *kfilebuf, int kfilelength,
	intptr_t daframeplace, int dabytesperline, int daxres, int dayres,
	int daglobxoffs, int daglobyoffs)
{
	int i, x, y, xsiz, ysiz, yinc, xend, xspan, yspan, currstr, numbitgoal;
	int lzcols, dat, blocklen, bitcnt, xoff, yoff, transcol, backcol, *lptr;
	intptr_t p=0;
	unsigned char numbits, startnumbits, chunkind, ilacefirst;
	const unsigned char *ptr, *cptr=NULL;

	(void)kfilelength;

	coltype = 3; bitdepth = 8; //For PNGOUT

	if ((kfilebuf[0] != 'G') || (kfilebuf[1] != 'I') ||
		 (kfilebuf[2] != 'F') || (kfilebuf[12])) return(-1);
	paleng = (1<<((kfilebuf[10]&7)+1));
	ptr = (unsigned char *)&kfilebuf[13];
	if (kfilebuf[10]&128) { cptr = ptr; ptr += paleng*3; }
	transcol = -1;
	while ((chunkind = *ptr++) == '!')
	{      //! 0xf9 leng flags ?? ?? transcol
		if (ptr[0] == 0xf9) { if (ptr[2]&1) transcol = (int)(((unsigned char)ptr[5])); }
		ptr++;
		do { i = *ptr++; ptr += i; } while (i);
	}
	if (chunkind != ',') return(-1);

	xoff = SSWAPIB(*(unsigned short *)&ptr[0]);
	yoff = SSWAPIB(*(unsigned short *)&ptr[2]);
	xspan = SSWAPIB(*(unsigned short *)&ptr[4]);
	yspan = SSWAPIB(*(unsigned short *)&ptr[6]); ptr += 9;
	if (ptr[-1]&64) { yinc = 8; ilacefirst = 1; }
				  else { yinc = 1; ilacefirst = 0; }
	if (ptr[-1]&128)
	{
		paleng = (1<<((ptr[-1]&7)+1));
		cptr = ptr; ptr += paleng*3;
	}

	for(i=0;i<paleng;i++)
		palcol[i] = LSWAPIB((((int)cptr[i*3])<<16) + (((int)cptr[i*3+1])<<8) + ((int)cptr[i*3+2]) + 0xff000000);
	for(;i<256;i++) palcol[i] = LSWAPIB(0xff000000);
	if (transcol >= 0) palcol[transcol] &= LSWAPIB(~0xff000000);

		//Handle GIF files with different logical&image sizes or non-0 offsets (added 05/15/2004)
	xsiz = SSWAPIB(*(unsigned short *)&kfilebuf[6]);
	ysiz = SSWAPIB(*(unsigned short *)&kfilebuf[8]);
	if ((xoff != 0) || (yoff != 0) || (xsiz != xspan) || (ysiz != yspan))
	{
		int xx[4], yy[4];
		if (kfilebuf[10]&128) backcol = palcol[(unsigned char)kfilebuf[11]]; else backcol = 0;

			//Fill border to backcol
		xx[0] = max(daglobxoffs           ,     0); yy[0] = max(daglobyoffs           ,     0);
		xx[1] = min(daglobxoffs+xoff      ,daxres); yy[1] = min(daglobyoffs+yoff      ,dayres);
		xx[2] = max(daglobxoffs+xoff+xspan,     0); yy[2] = min(daglobyoffs+yoff+yspan,dayres);
		xx[3] = min(daglobxoffs+xsiz      ,daxres); yy[3] = min(daglobyoffs+ysiz      ,dayres);

		lptr = (int *)(yy[0]*dabytesperline+daframeplace);
		for(y=yy[0];y<yy[1];y++,lptr=(int *)(((intptr_t)lptr)+dabytesperline))
			for(x=xx[0];x<xx[3];x++) lptr[x] = backcol;
		for(;y<yy[2];y++,lptr=(int *)(((intptr_t)lptr)+dabytesperline))
		{  for(x=xx[0];x<xx[1];x++) lptr[x] = backcol;
			for(x=xx[2];x<xx[3];x++) lptr[x] = backcol;
		}
		for(;y<yy[3];y++,lptr=(int *)(((intptr_t)lptr)+dabytesperline))
			for(x=xx[0];x<xx[3];x++) lptr[x] = backcol;

		daglobxoffs += xoff; //Offset bitmap image by extra amount
		daglobyoffs += yoff;
	}

	xspan += daglobxoffs;
	yspan += daglobyoffs;  //UGLY HACK
	y = daglobyoffs;
	if ((unsigned int)y < (unsigned int)dayres)
		{ p = y*dabytesperline+daframeplace; x = daglobxoffs; xend = xspan; }
	else
		{ x = daglobxoffs+0x80000000; xend = xspan+0x80000000; }

	lzcols = (1<<(*ptr)); startnumbits = (unsigned char)((*ptr)+1); ptr++;
	for(i=lzcols-1;i>=0;i--) { suffix[i] = (unsigned char)(prefix[i] = i); }
	currstr = lzcols+2; numbits = startnumbits; numbitgoal = (lzcols<<1);
	blocklen = *ptr++;
	memcpy(filbuffer,ptr,blocklen); ptr += blocklen;
	bitcnt = 0;
	while (1)
	{
		dat = (LSWAPIB(*(int *)&filbuffer[bitcnt>>3])>>(bitcnt&7)) & (numbitgoal-1);
		bitcnt += numbits;
		if ((bitcnt>>3) > blocklen-3)
		{
			*(short *)filbuffer = *(short *)&filbuffer[bitcnt>>3];
			i = blocklen-(bitcnt>>3);
			blocklen = (int)*ptr++;
			memcpy(&filbuffer[i],ptr,blocklen); ptr += blocklen;
			bitcnt &= 7; blocklen += i;
		}
		if (dat == lzcols)
		{
			currstr = lzcols+2; numbits = startnumbits; numbitgoal = (lzcols<<1);
			continue;
		}
		if ((currstr == numbitgoal) && (numbits < 12))
			{ numbits++; numbitgoal <<= 1; }

		prefix[currstr] = dat;
		for(i=0;dat>=lzcols;dat=prefix[dat]) tempstack[i++] = suffix[dat];
		tempstack[i] = (unsigned char)prefix[dat];
		suffix[currstr-1] = suffix[currstr] = (unsigned char)dat;

		for(;i>=0;i--)
		{
			if ((unsigned int)x < (unsigned int)daxres)
				*(int *)(p+(x<<2)) = palcol[(int)tempstack[i]];
			x++;
			if (x == xend)
			{
				y += yinc;
				if (y >= yspan)
					switch(yinc)
					{
						case 8: if (!ilacefirst) { y = daglobyoffs+2; yinc = 4; break; }
								  ilacefirst = 0; y = daglobyoffs+4; yinc = 8; break;
						case 4: y = daglobyoffs+1; yinc = 2; break;
						case 2: case 1: return(0);
					}
				if ((unsigned int)y < (unsigned int)dayres)
					{ p = y*dabytesperline+daframeplace; x = daglobxoffs; xend = xspan; }
				else
					{ x = daglobxoffs+0x80000000; xend = xspan+0x80000000; }
			}
		}
		currstr++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq $0x0, -0x88(%rbp)
movq $0x0, -0xa0(%rbp)
movb $0x3, 0x55d76c(%rip)    # 0x5c2d80
movb $0x8, 0x55d766(%rip)    # 0x5c2d81
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x47, %eax
jne 0x6564e
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x49, %eax
jne 0x6564e
movq -0x10(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x46, %eax
jne 0x6564e
movq -0x10(%rbp), %rax
movsbl 0xc(%rax), %eax
cmpl $0x0, %eax
je 0x6565a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6609b
movq -0x10(%rbp), %rax
movsbl 0xa(%rax), %ecx
andl $0x7, %ecx
addl $0x1, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x5434db(%rip)    # 0x5a8b50
movq -0x10(%rbp), %rax
addq $0xd, %rax
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rax
movsbl 0xa(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x656bf
movq -0x98(%rbp), %rax
movq %rax, -0xa0(%rbp)
imull $0x3, 0x5434a5(%rip), %ecx # 0x5a8b50
movq -0x98(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movl $0xffffffff, -0x74(%rbp) # imm = 0xFFFFFFFF
movq -0x98(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x98(%rbp)
movb (%rax), %al
movb %al, -0x8b(%rbp)
movzbl %al, %eax
cmpl $0x21, %eax
jne 0x65772
movq -0x98(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xf9, %eax
jne 0x65723
movq -0x98(%rbp), %rax
movzbl 0x2(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x65721
movq -0x98(%rbp), %rax
movzbl 0x5(%rax), %eax
movl %eax, -0x74(%rbp)
jmp 0x65723
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x98(%rbp)
movzbl (%rax), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %ecx
movq -0x98(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0x65735
jmp 0x656c6
movzbl -0x8b(%rbp), %eax
cmpl $0x2c, %eax
je 0x6578a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6609b
movq -0x98(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0x6c(%rbp)
movq -0x98(%rbp), %rax
movzwl 0x2(%rax), %eax
movl %eax, -0x70(%rbp)
movq -0x98(%rbp), %rax
movzwl 0x4(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x98(%rbp), %rax
movzwl 0x6(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x98(%rbp), %rax
addq $0x9, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movzbl -0x1(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x657f6
movl $0x8, -0x44(%rbp)
movb $0x1, -0x8c(%rbp)
jmp 0x65804
movl $0x1, -0x44(%rbp)
movb $0x0, -0x8c(%rbp)
movq -0x98(%rbp), %rax
movzbl -0x1(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x65860
movq -0x98(%rbp), %rax
movzbl -0x1(%rax), %ecx
andl $0x7, %ecx
addl $0x1, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x543319(%rip)    # 0x5a8b50
movq -0x98(%rbp), %rax
movq %rax, -0xa0(%rbp)
imull $0x3, 0x543304(%rip), %ecx # 0x5a8b50
movq -0x98(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl 0x5432e0(%rip), %eax    # 0x5a8b50
jge 0x658d7
movq -0xa0(%rbp), %rax
imull $0x3, -0x30(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %edx
shll $0x10, %edx
movq -0xa0(%rbp), %rax
imull $0x3, -0x30(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
shll $0x8, %eax
addl %eax, %edx
movq -0xa0(%rbp), %rax
imull $0x3, -0x30(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
addl %eax, %edx
addl $0xff000000, %edx       # imm = 0xFF000000
movslq -0x30(%rbp), %rcx
leaq 0x55d0b7(%rip), %rax    # 0x5c2980
movl %edx, (%rax,%rcx,4)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x65867
jmp 0x658d9
cmpl $0x100, -0x30(%rbp)     # imm = 0x100
jge 0x658ff
movslq -0x30(%rbp), %rcx
leaq 0x55d093(%rip), %rax    # 0x5c2980
movl $0xff000000, (%rax,%rcx,4) # imm = 0xFF000000
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x658d9
cmpl $0x0, -0x74(%rbp)
jl 0x65923
movslq -0x74(%rbp), %rcx
leaq 0x55d070(%rip), %rax    # 0x5c2980
movl (%rax,%rcx,4), %edx
andl $0xffffff, %edx         # imm = 0xFFFFFF
leaq 0x55d060(%rip), %rax    # 0x5c2980
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movzwl 0x6(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x8(%rax), %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x6c(%rbp)
jne 0x65959
cmpl $0x0, -0x70(%rbp)
jne 0x65959
movl -0x3c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jne 0x65959
movl -0x40(%rbp), %eax
cmpl -0x50(%rbp), %eax
je 0x65c59
movq -0x10(%rbp), %rax
movsbl 0xa(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x65984
movq -0x10(%rbp), %rax
movzbl 0xb(%rax), %eax
movl %eax, %ecx
leaq 0x55d004(%rip), %rax    # 0x5c2980
movl (%rax,%rcx,4), %eax
movl %eax, -0x78(%rbp)
jmp 0x6598b
movl $0x0, -0x78(%rbp)
cmpl $0x0, 0x10(%rbp)
jle 0x6599c
movl 0x10(%rbp), %eax
movl %eax, -0xc4(%rbp)
jmp 0x659a6
xorl %eax, %eax
movl %eax, -0xc4(%rbp)
jmp 0x659a6
movl -0xc4(%rbp), %eax
movl %eax, -0xb0(%rbp)
cmpl $0x0, 0x18(%rbp)
jle 0x659c3
movl 0x18(%rbp), %eax
movl %eax, -0xc8(%rbp)
jmp 0x659cd
xorl %eax, %eax
movl %eax, -0xc8(%rbp)
jmp 0x659cd
movl -0xc8(%rbp), %eax
movl %eax, -0xc0(%rbp)
movl 0x10(%rbp), %eax
addl -0x6c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x659f2
movl 0x10(%rbp), %eax
addl -0x6c(%rbp), %eax
movl %eax, -0xcc(%rbp)
jmp 0x659fb
movl -0x28(%rbp), %eax
movl %eax, -0xcc(%rbp)
movl -0xcc(%rbp), %eax
movl %eax, -0xac(%rbp)
movl 0x18(%rbp), %eax
addl -0x70(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x65a20
movl 0x18(%rbp), %eax
addl -0x70(%rbp), %eax
movl %eax, -0xd0(%rbp)
jmp 0x65a29
movl -0x2c(%rbp), %eax
movl %eax, -0xd0(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, -0xbc(%rbp)
movl 0x10(%rbp), %eax
addl -0x6c(%rbp), %eax
addl -0x4c(%rbp), %eax
cmpl $0x0, %eax
jle 0x65a54
movl 0x10(%rbp), %eax
addl -0x6c(%rbp), %eax
addl -0x4c(%rbp), %eax
movl %eax, -0xd4(%rbp)
jmp 0x65a5e
xorl %eax, %eax
movl %eax, -0xd4(%rbp)
jmp 0x65a5e
movl -0xd4(%rbp), %eax
movl %eax, -0xa8(%rbp)
movl 0x18(%rbp), %eax
addl -0x70(%rbp), %eax
addl -0x50(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x65a89
movl 0x18(%rbp), %eax
addl -0x70(%rbp), %eax
addl -0x50(%rbp), %eax
movl %eax, -0xd8(%rbp)
jmp 0x65a92
movl -0x2c(%rbp), %eax
movl %eax, -0xd8(%rbp)
movl -0xd8(%rbp), %eax
movl %eax, -0xb8(%rbp)
movl 0x10(%rbp), %eax
addl -0x3c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x65ab7
movl 0x10(%rbp), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0xdc(%rbp)
jmp 0x65ac0
movl -0x28(%rbp), %eax
movl %eax, -0xdc(%rbp)
movl -0xdc(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl 0x18(%rbp), %eax
addl -0x40(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x65ae5
movl 0x18(%rbp), %eax
addl -0x40(%rbp), %eax
movl %eax, -0xe0(%rbp)
jmp 0x65aee
movl -0x2c(%rbp), %eax
movl %eax, -0xe0(%rbp)
movl -0xe0(%rbp), %eax
movl %eax, -0xb4(%rbp)
movl -0xc0(%rbp), %eax
imull -0x24(%rbp), %eax
cltq
addq -0x20(%rbp), %rax
movq %rax, -0x80(%rbp)
movl -0xc0(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0xbc(%rbp), %eax
jge 0x65b6b
movl -0xb0(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0xa4(%rbp), %eax
jge 0x65b4f
movl -0x78(%rbp), %edx
movq -0x80(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x65b2b
jmp 0x65b51
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x80(%rbp), %rax
movslq -0x24(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
jmp 0x65b17
jmp 0x65b6d
movl -0x38(%rbp), %eax
cmpl -0xb8(%rbp), %eax
jge 0x65bf1
movl -0xb0(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0xac(%rbp), %eax
jge 0x65ba5
movl -0x78(%rbp), %edx
movq -0x80(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x65b81
movl -0xa8(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0xa4(%rbp), %eax
jge 0x65bd2
movl -0x78(%rbp), %edx
movq -0x80(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x65bae
jmp 0x65bd4
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x80(%rbp), %rax
movslq -0x24(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
jmp 0x65b6d
jmp 0x65bf3
movl -0x38(%rbp), %eax
cmpl -0xb4(%rbp), %eax
jge 0x65c47
movl -0xb0(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0xa4(%rbp), %eax
jge 0x65c2b
movl -0x78(%rbp), %edx
movq -0x80(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x65c07
jmp 0x65c2d
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x80(%rbp), %rax
movslq -0x24(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
jmp 0x65bf3
movl -0x6c(%rbp), %eax
addl 0x10(%rbp), %eax
movl %eax, 0x10(%rbp)
movl -0x70(%rbp), %eax
addl 0x18(%rbp), %eax
movl %eax, 0x18(%rbp)
movl 0x10(%rbp), %eax
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl 0x18(%rbp), %eax
addl -0x50(%rbp), %eax
movl %eax, -0x50(%rbp)
movl 0x18(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jae 0x65c9b
movl -0x38(%rbp), %eax
imull -0x24(%rbp), %eax
cltq
addq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
movl 0x10(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x65cb1
movl 0x10(%rbp), %eax
addl $0x80000000, %eax       # imm = 0x80000000
movl %eax, -0x34(%rbp)
movl -0x4c(%rbp), %eax
addl $0x80000000, %eax       # imm = 0x80000000
movl %eax, -0x48(%rbp)
movq -0x98(%rbp), %rax
movzbl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x5c(%rbp)
movq -0x98(%rbp), %rax
movzbl (%rax), %eax
addl $0x1, %eax
movb %al, -0x8a(%rbp)
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
movl -0x5c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jl 0x65d25
movl -0x30(%rbp), %eax
movslq -0x30(%rbp), %rdx
leaq 0x57a259(%rip), %rcx    # 0x5dff60
movl %eax, (%rcx,%rdx,4)
movb %al, %dl
movslq -0x30(%rbp), %rcx
leaq 0x57e259(%rip), %rax    # 0x5e3f70
movb %dl, (%rax,%rcx)
movl -0x30(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x65cf3
movl -0x5c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x54(%rbp)
movb -0x8a(%rbp), %al
movb %al, -0x89(%rbp)
movl -0x5c(%rbp), %eax
shll %eax
movl %eax, -0x58(%rbp)
movq -0x98(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x98(%rbp)
movzbl (%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x98(%rbp), %rsi
movslq -0x64(%rbp), %rdx
leaq 0x57f211(%rip), %rdi    # 0x5e4f80
callq 0x60c0
movl -0x64(%rbp), %ecx
movq -0x98(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movl $0x0, -0x68(%rbp)
movl -0x68(%rbp), %eax
sarl $0x3, %eax
movslq %eax, %rcx
leaq 0x57f1de(%rip), %rax    # 0x5e4f80
movl (%rax,%rcx), %eax
movl -0x68(%rbp), %ecx
andl $0x7, %ecx
sarl %cl, %eax
movl -0x58(%rbp), %ecx
subl $0x1, %ecx
andl %ecx, %eax
movl %eax, -0x60(%rbp)
movzbl -0x89(%rbp), %eax
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
sarl $0x3, %eax
movl -0x64(%rbp), %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jle 0x65e64
movl -0x68(%rbp), %eax
sarl $0x3, %eax
movslq %eax, %rcx
leaq 0x57f197(%rip), %rax    # 0x5e4f80
movw (%rax,%rcx), %ax
movw %ax, 0x57f18c(%rip)     # 0x5e4f80
movl -0x64(%rbp), %eax
movl -0x68(%rbp), %ecx
sarl $0x3, %ecx
subl %ecx, %eax
movl %eax, -0x30(%rbp)
movq -0x98(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x98(%rbp)
movzbl (%rax), %eax
movl %eax, -0x64(%rbp)
movslq -0x30(%rbp), %rax
leaq 0x57f158(%rip), %rdi    # 0x5e4f80
addq %rax, %rdi
movq -0x98(%rbp), %rsi
movslq -0x64(%rbp), %rdx
callq 0x60c0
movl -0x64(%rbp), %ecx
movq -0x98(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movl -0x68(%rbp), %eax
andl $0x7, %eax
movl %eax, -0x68(%rbp)
movl -0x30(%rbp), %eax
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jne 0x65e8e
movl -0x5c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x54(%rbp)
movb -0x8a(%rbp), %al
movb %al, -0x89(%rbp)
movl -0x5c(%rbp), %eax
shll %eax
movl %eax, -0x58(%rbp)
jmp 0x65d92
movl -0x54(%rbp), %eax
cmpl -0x58(%rbp), %eax
jne 0x65eb8
movzbl -0x89(%rbp), %eax
cmpl $0xc, %eax
jge 0x65eb8
movb -0x89(%rbp), %al
addb $0x1, %al
movb %al, -0x89(%rbp)
movl -0x58(%rbp), %eax
shll %eax
movl %eax, -0x58(%rbp)
movl -0x60(%rbp), %edx
movslq -0x54(%rbp), %rcx
leaq 0x57a09a(%rip), %rax    # 0x5dff60
movl %edx, (%rax,%rcx,4)
movl $0x0, -0x30(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jl 0x65f11
movslq -0x60(%rbp), %rcx
leaq 0x57e08d(%rip), %rax    # 0x5e3f70
movb (%rax,%rcx), %dl
movl -0x30(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp)
movslq %eax, %rcx
leaq 0x57f385(%rip), %rax    # 0x5e5280
movb %dl, (%rax,%rcx)
movslq -0x60(%rbp), %rcx
leaq 0x57a057(%rip), %rax    # 0x5dff60
movl (%rax,%rcx,4), %eax
movl %eax, -0x60(%rbp)
jmp 0x65ed0
movslq -0x60(%rbp), %rcx
leaq 0x57a044(%rip), %rax    # 0x5dff60
movl (%rax,%rcx,4), %eax
movb %al, %dl
movslq -0x30(%rbp), %rcx
leaq 0x57f354(%rip), %rax    # 0x5e5280
movb %dl, (%rax,%rcx)
movl -0x60(%rbp), %eax
movb %al, %dl
movslq -0x54(%rbp), %rcx
leaq 0x57e031(%rip), %rax    # 0x5e3f70
movb %dl, (%rax,%rcx)
movl -0x54(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x57e01e(%rip), %rax    # 0x5e3f70
movb %dl, (%rax,%rcx)
cmpl $0x0, -0x30(%rbp)
jl 0x6608d
movl -0x34(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0x65f98
movslq -0x30(%rbp), %rcx
leaq 0x57f30e(%rip), %rax    # 0x5e5280
movzbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x55ca00(%rip), %rax    # 0x5c2980
movl (%rax,%rcx,4), %ecx
movq -0x88(%rbp), %rax
movl -0x34(%rbp), %edx
shll $0x2, %edx
movslq %edx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x48(%rbp), %eax
jne 0x6607d
movl -0x44(%rbp), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x50(%rbp), %eax
jl 0x6603b
movl -0x44(%rbp), %eax
movl %eax, -0xe4(%rbp)
decl %eax
subl $0x2, %eax
jb 0x66030
jmp 0x65fd0
movl -0xe4(%rbp), %eax
subl $0x4, %eax
je 0x6601e
jmp 0x65fdd
movl -0xe4(%rbp), %eax
subl $0x8, %eax
jne 0x66039
jmp 0x65fea
cmpb $0x0, -0x8c(%rbp)
jne 0x66005
movl 0x18(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x38(%rbp)
movl $0x4, -0x44(%rbp)
jmp 0x66039
movb $0x0, -0x8c(%rbp)
movl 0x18(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x38(%rbp)
movl $0x8, -0x44(%rbp)
jmp 0x66039
movl 0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl $0x2, -0x44(%rbp)
jmp 0x66039
movl $0x0, -0x4(%rbp)
jmp 0x6609b
jmp 0x6603b
movl -0x38(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jae 0x66065
movl -0x38(%rbp), %eax
imull -0x24(%rbp), %eax
cltq
addq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
movl 0x10(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x6607b
movl 0x10(%rbp), %eax
addl $0x80000000, %eax       # imm = 0x80000000
movl %eax, -0x34(%rbp)
movl -0x4c(%rbp), %eax
addl $0x80000000, %eax       # imm = 0x80000000
movl %eax, -0x48(%rbp)
jmp 0x6607d
jmp 0x6607f
movl -0x30(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x65f55
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x65d92
movl -0x4(%rbp), %eax
addq $0xf0, %rsp
popq %rbp
retq
nopw (%rax,%rax)