// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/cache1d.c
// Function: lzwcompress
static int lzwcompress(unsigned char *lzwinbuf, int uncompleng, unsigned char *lzwoutbuf)
{
	int i, addr, newaddr, addrcnt, zx;
	int *intptr;
	int bytecnt1, bitcnt, numbits, oneupnumbits;
	short *shortptr;

	for(i=255;i>=0;i--) { lzwbuf1[i] = i; lzwbuf3[i] = (i+1)&255; }
	clearbuf(lzwbuf2,256>>1,0xffffffff);
	clearbuf(lzwoutbuf,((uncompleng+15)+3)>>2,0L);

	addrcnt = 256; bytecnt1 = 0; bitcnt = (4<<3);
	numbits = 8; oneupnumbits = (1<<8);
	do
	{
		addr = lzwinbuf[bytecnt1];
		do
		{
			bytecnt1++;
			if (bytecnt1 == uncompleng) break;
			if (lzwbuf2[addr] < 0) {lzwbuf2[addr] = addrcnt; break;}
			newaddr = lzwbuf2[addr];
			while (lzwbuf1[newaddr] != lzwinbuf[bytecnt1])
			{
				zx = lzwbuf3[newaddr];
				if (zx < 0) {lzwbuf3[newaddr] = addrcnt; break;}
				newaddr = zx;
			}
			if (lzwbuf3[newaddr] == addrcnt) break;
			addr = newaddr;
		} while (addr >= 0);
		lzwbuf1[addrcnt] = lzwinbuf[bytecnt1];
		lzwbuf2[addrcnt] = -1;
		lzwbuf3[addrcnt] = -1;

		intptr = (int *)&lzwoutbuf[bitcnt>>3];
		intptr[0] |= B_LITTLE32(addr<<(bitcnt&7));
		bitcnt += numbits;
		if ((addr&((oneupnumbits>>1)-1)) > ((addrcnt-1)&((oneupnumbits>>1)-1)))
			bitcnt--;

		addrcnt++;
		if (addrcnt > oneupnumbits) { numbits++; oneupnumbits <<= 1; }
	} while ((bytecnt1 < uncompleng) && (bitcnt < (uncompleng<<3)));

	intptr = (int *)&lzwoutbuf[bitcnt>>3];
	intptr[0] |= B_LITTLE32(addr<<(bitcnt&7));
	bitcnt += numbits;
	if ((addr&((oneupnumbits>>1)-1)) > ((addrcnt-1)&((oneupnumbits>>1)-1)))
		bitcnt--;

	shortptr = (short *)lzwoutbuf;
	shortptr[0] = B_LITTLE16((short)uncompleng);
	if (((bitcnt+7)>>3) < uncompleng)
	{
		shortptr[1] = B_LITTLE16((short)addrcnt);
		return((bitcnt+7)>>3);
	}
	shortptr[1] = 0;
	for(i=0;i<uncompleng;i++) lzwoutbuf[i+4] = lzwinbuf[i];
	return(uncompleng+4);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl $0xff, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x3202b
movl -0x24(%rbp), %eax
movb %al, %dl
movq 0x1c353c(%rip), %rax    # 0x1f5538
movslq -0x24(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
andl $0xff, %eax
movw %ax, %dx
movq 0x1c3530(%rip), %rax    # 0x1f5548
movslq -0x24(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x31fea
movq 0x1c350e(%rip), %rdi    # 0x1f5540
movl $0x80, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6ed50
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
addl $0xf, %esi
addl $0x3, %esi
sarl $0x2, %esi
xorl %edx, %edx
callq 0x6ed50
movl $0x100, -0x30(%rbp)     # imm = 0x100
movl $0x0, -0x44(%rbp)
movl $0x20, -0x48(%rbp)
movl $0x8, -0x4c(%rbp)
movl $0x100, -0x50(%rbp)     # imm = 0x100
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x28(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x320a0
jmp 0x3215c
movq 0x1c3499(%rip), %rax    # 0x1f5540
movslq -0x28(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
jge 0x320ce
movl -0x30(%rbp), %eax
movw %ax, %dx
movq 0x1c347f(%rip), %rax    # 0x1f5540
movslq -0x28(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
jmp 0x3215c
movq 0x1c346b(%rip), %rax    # 0x1f5540
movslq -0x28(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
movl %eax, -0x2c(%rbp)
movq 0x1c3451(%rip), %rax    # 0x1f5538
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x10(%rbp), %rcx
movslq -0x44(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x32136
movq 0x1c3442(%rip), %rax    # 0x1f5548
movslq -0x2c(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0x3212e
movl -0x30(%rbp), %eax
movw %ax, %dx
movq 0x1c3424(%rip), %rax    # 0x1f5548
movslq -0x2c(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
jmp 0x32136
movl -0x34(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x320e0
movq 0x1c340b(%rip), %rax    # 0x1f5548
movslq -0x2c(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
cmpl -0x30(%rbp), %eax
jne 0x3214c
jmp 0x3215c
movl -0x2c(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jge 0x3208a
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movb (%rax,%rcx), %dl
movq 0x1c33ca(%rip), %rax    # 0x1f5538
movslq -0x30(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq 0x1c33c4(%rip), %rax    # 0x1f5540
movslq -0x30(%rbp), %rcx
movw $0xffff, (%rax,%rcx,2)  # imm = 0xFFFF
movq 0x1c33bb(%rip), %rax    # 0x1f5548
movslq -0x30(%rbp), %rcx
movw $0xffff, (%rax,%rcx,2)  # imm = 0xFFFF
movq -0x20(%rbp), %rax
movl -0x48(%rbp), %ecx
sarl $0x3, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl -0x28(%rbp), %eax
movl -0x48(%rbp), %ecx
andl $0x7, %ecx
shll %cl, %eax
movl %eax, %ecx
movq -0x40(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
movl -0x4c(%rbp), %eax
addl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x28(%rbp), %eax
movl -0x50(%rbp), %ecx
sarl %ecx
subl $0x1, %ecx
andl %ecx, %eax
movl -0x30(%rbp), %ecx
subl $0x1, %ecx
movl -0x50(%rbp), %edx
sarl %edx
subl $0x1, %edx
andl %edx, %ecx
cmpl %ecx, %eax
jle 0x321f3
movl -0x48(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x48(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x50(%rbp), %eax
jle 0x32215
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x50(%rbp), %eax
shll %eax
movl %eax, -0x50(%rbp)
jmp 0x32217
movl -0x44(%rbp), %ecx
xorl %eax, %eax
cmpl -0x14(%rbp), %ecx
movb %al, -0x59(%rbp)
jge 0x32235
movl -0x48(%rbp), %eax
movl -0x14(%rbp), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x3207b
movq -0x20(%rbp), %rax
movl -0x48(%rbp), %ecx
sarl $0x3, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl -0x28(%rbp), %eax
movl -0x48(%rbp), %ecx
andl $0x7, %ecx
shll %cl, %eax
movl %eax, %ecx
movq -0x40(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
movl -0x4c(%rbp), %eax
addl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x28(%rbp), %eax
movl -0x50(%rbp), %ecx
sarl %ecx
subl $0x1, %ecx
andl %ecx, %eax
movl -0x30(%rbp), %ecx
subl $0x1, %ecx
movl -0x50(%rbp), %edx
sarl %edx
subl $0x1, %edx
andl %edx, %ecx
cmpl %ecx, %eax
jle 0x3229c
movl -0x48(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x14(%rbp), %eax
movw %ax, %cx
movq -0x58(%rbp), %rax
movw %cx, (%rax)
movl -0x48(%rbp), %eax
addl $0x7, %eax
sarl $0x3, %eax
cmpl -0x14(%rbp), %eax
jge 0x322db
movl -0x30(%rbp), %eax
movw %ax, %cx
movq -0x58(%rbp), %rax
movw %cx, 0x2(%rax)
movl -0x48(%rbp), %eax
addl $0x7, %eax
sarl $0x3, %eax
movl %eax, -0x4(%rbp)
jmp 0x32323
movq -0x58(%rbp), %rax
movw $0x0, 0x2(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x3231a
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x20(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x322ec
movl -0x14(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)