// File: /workspace/github_c_makefile_star2_O0/madler[P]pigz/pigz.c
// Function: unlzw
local void unlzw(void) {
    unsigned bits;              // current bits per code (9..16)
    unsigned mask;              // mask for current bits codes = (1<<bits)-1
    bits_t buf;                 // bit buffer (need 23 bits)
    unsigned left;              // bits left in buf (0..7 after code pulled)
    length_t mark;              // offset where last change in bits began
    unsigned code;              // code, table traversal index
    unsigned max;               // maximum bits per code for this stream
    unsigned flags;             // compress flags, then block compress flag
    unsigned end;               // last valid entry in prefix/suffix tables
    unsigned prev;              // previous code
    unsigned final;             // last character written for previous code
    unsigned stack;             // next position for reversed string
    unsigned outcnt;            // bytes in output buffer
    // memory for unlzw() -- the first 256 entries of prefix[] and suffix[] are
    // never used, so could have offset the index but it's faster to waste a
    // little memory
    prefix_t prefix[65536];             // index to LZW prefix string
    unsigned char suffix[65536];        // one-character LZW suffix
    unsigned char match[65280 + 2];     // buffer for reversed match

    // process remainder of compress header -- a flags byte
    g.out_tot = 0;
    if (NOMORE())
        throw(EDOM, "%s: lzw premature end", g.inf);
    flags = NEXT();
    if (flags & 0x60)
        throw(EDOM, "%s: unknown lzw flags set", g.inf);
    max = flags & 0x1f;
    if (max < 9 || max > 16)
        throw(EDOM, "%s: lzw bits out of range", g.inf);
    if (max == 9)                           // 9 doesn't really mean 9
        max = 10;
    flags &= 0x80;                          // true if block compress

    // mark the start of the compressed data for computing the first flush
    mark = g.in_tot - g.in_left;

    // clear table, start at nine bits per symbol
    bits = 9;
    mask = 0x1ff;
    end = flags ? 256 : 255;

    // set up: get first 9-bit code, which is the first decompressed byte, but
    // don't create a table entry until the next code
    if (NOMORE())                           // no compressed data is ok
        return;
    buf = NEXT();
    if (NOMORE())
        throw(EDOM, "%s: lzw premature end", g.inf);  // need nine bits
    buf += NEXT() << 8;
    final = prev = buf & mask;              // code
    buf >>= bits;
    left = 16 - bits;
    if (prev > 255)
        throw(EDOM, "%s: invalid lzw code", g.inf);
    out_buf[0] = (unsigned char)final;      // write first decompressed byte
    outcnt = 1;

    // decode codes
    stack = 0;
    for (;;) {
        // if the table will be full after this, increment the code size
        if (end >= mask && bits < max) {
            // flush unused input bits and bytes to next 8*bits bit boundary
            // (this is a vestigial aspect of the compressed data format
            // derived from an implementation that made use of a special VAX
            // machine instruction!)
            {
                unsigned rem = ((g.in_tot - g.in_left) - mark) % bits;
                if (rem) {
                    rem = bits - rem;
                    if (NOMORE())
                        break;              // end of compressed data
                    while (rem > g.in_left) {
                        rem -= g.in_left;
                        if (load() == 0)
                            throw(EDOM, "%s: lzw premature end", g.inf);
                    }
                    g.in_left -= rem;
                    g.in_next += rem;
                }
            }
            buf = 0;
            left = 0;

            // mark this new location for computing the next flush
            mark = g.in_tot - g.in_left;

            // go to the next number of bits per symbol
            bits++;
            mask <<= 1;
            mask++;
        }

        // get a code of bits bits
        if (NOMORE())
            break;                          // end of compressed data
        buf += (bits_t)(NEXT()) << left;
        left += 8;
        if (left < bits) {
            if (NOMORE())
                throw(EDOM, "%s: lzw premature end", g.inf);
            buf += (bits_t)(NEXT()) << left;
            left += 8;
        }
        code = buf & mask;
        buf >>= bits;
        left -= bits;

        // process clear code (256)
        if (code == 256 && flags) {
            // flush unused input bits and bytes to next 8*bits bit boundary
            {
                unsigned rem = ((g.in_tot - g.in_left) - mark) % bits;
                if (rem) {
                    rem = bits - rem;
                    while (rem > g.in_left) {
                        rem -= g.in_left;
                        if (load() == 0)
                            throw(EDOM, "%s: lzw premature end", g.inf);
                    }
                    g.in_left -= rem;
                    g.in_next += rem;
                }
            }
            buf = 0;
            left = 0;

            // mark this new location for computing the next flush
            mark = g.in_tot - g.in_left;

            // go back to nine bits per symbol
            bits = 9;                       // initialize bits and mask
            mask = 0x1ff;
            end = 255;                      // empty table
            continue;                       // get next code
        }

        // special code to reuse last match
        {
            unsigned temp = code;           // save the current code
            if (code > end) {
                // be picky on the allowed code here, and make sure that the
                // code we drop through (prev) will be a valid index so that
                // random input does not cause an exception
                if (code != end + 1 || prev > end)
                    throw(EDOM, "%s: invalid lzw code", g.inf);
                match[stack++] = (unsigned char)final;
                code = prev;
            }

            // walk through linked list to generate output in reverse order
            while (code >= 256) {
                match[stack++] = suffix[code];
                code = prefix[code];
            }
            match[stack++] = (unsigned char)code;
            final = code;

            // link new table entry
            if (end < mask) {
                end++;
                prefix[end] = (prefix_t)prev;
                suffix[end] = (unsigned char)final;
            }

            // set previous code for next iteration
            prev = temp;
        }

        // write output in forward order
        while (stack > OUTSIZE - outcnt) {
            while (outcnt < OUTSIZE)
                out_buf[outcnt++] = match[--stack];
            g.out_tot += outcnt;
            if (g.decode == 1)
                writen(g.outd, out_buf, outcnt);
            outcnt = 0;
        }
        do {
            out_buf[outcnt++] = match[--stack];
        } while (stack);
    }

    // write any remaining buffered output
    g.out_tot += outcnt;
    if (outcnt && g.decode == 1)
        writen(g.outd, out_buf, outcnt);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3ff60, %rsp          # imm = 0x3FF60
movq $0x0, 0x21b62(%rip) # 0x2b8c8
cmpq $0x0, 0x21b42(%rip)     # 0x2b8b0
jne 0x9da2
cmpl $0x0, 0x21b41(%rip)     # 0x2b8b8
jne 0x9d84
callq 0xcd80
cmpq $0x0, %rax
jne 0x9da2
movq 0x19a0d(%rip), %rdx     # 0x23798
movl $0x21, %edi
leaq 0x138d2(%rip), %rsi     # 0x1d669
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x122d0
movq 0x21b07(%rip), %rax     # 0x2b8b0
addq $-0x1, %rax
movq %rax, 0x21afc(%rip)     # 0x2b8b0
movq 0x21aed(%rip), %rax     # 0x2b8a8
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x21adf(%rip)     # 0x2b8a8
movzbl (%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
andl $0x60, %eax
cmpl $0x0, %eax
je 0x9df8
movq 0x199b7(%rip), %rdx     # 0x23798
movl $0x21, %edi
leaq 0x13892(%rip), %rsi     # 0x1d67f
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x122d0
movl -0x2c(%rbp), %eax
andl $0x1f, %eax
movl %eax, -0x28(%rbp)
cmpl $0x9, -0x28(%rbp)
jb 0x9e0d
cmpl $0x10, -0x28(%rbp)
jbe 0x9e2b
movq 0x19984(%rip), %rdx     # 0x23798
movl $0x21, %edi
leaq 0x13879(%rip), %rsi     # 0x1d699
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x122d0
cmpl $0x9, -0x28(%rbp)
jne 0x9e38
movl $0xa, -0x28(%rbp)
movl -0x2c(%rbp), %eax
andl $0x80, %eax
movl %eax, -0x2c(%rbp)
movq 0x21a76(%rip), %rax     # 0x2b8c0
subq 0x21a5f(%rip), %rax     # 0x2b8b0
movq %rax, -0x20(%rbp)
movl $0x9, -0x4(%rbp)
movl $0x1ff, -0x8(%rbp)      # imm = 0x1FF
movl -0x2c(%rbp), %edx
movl $0xff, %eax
movl $0x100, %ecx            # imm = 0x100
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x30(%rbp)
cmpq $0x0, 0x21a2f(%rip)     # 0x2b8b0
jne 0x9e9c
cmpl $0x0, 0x21a2e(%rip)     # 0x2b8b8
jne 0x9e97
callq 0xcd80
cmpq $0x0, %rax
jne 0x9e9c
jmp 0xa4ef
movq 0x21a0d(%rip), %rax     # 0x2b8b0
addq $-0x1, %rax
movq %rax, 0x21a02(%rip)     # 0x2b8b0
movq 0x219f3(%rip), %rax     # 0x2b8a8
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x219e5(%rip)     # 0x2b8a8
movzbl (%rax), %eax
movl %eax, %eax
movq %rax, -0x10(%rbp)
cmpq $0x0, 0x219dc(%rip)     # 0x2b8b0
jne 0x9f08
cmpl $0x0, 0x219db(%rip)     # 0x2b8b8
jne 0x9eea
callq 0xcd80
cmpq $0x0, %rax
jne 0x9f08
movq 0x198a7(%rip), %rdx     # 0x23798
movl $0x21, %edi
leaq 0x1376c(%rip), %rsi     # 0x1d669
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x122d0
movq 0x219a1(%rip), %rax     # 0x2b8b0
addq $-0x1, %rax
movq %rax, 0x21996(%rip)     # 0x2b8b0
movq 0x21987(%rip), %rax     # 0x2b8a8
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x21979(%rip)     # 0x2b8a8
movzbl (%rax), %eax
shll $0x8, %eax
movl %eax, %eax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl -0x8(%rbp), %ecx
andq %rcx, %rax
movl %eax, -0x34(%rbp)
movl %eax, -0x38(%rbp)
movl -0x4(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, %ecx
shrq %cl, %rax
movq %rax, -0x10(%rbp)
movl $0x10, %eax
subl -0x4(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0xff, -0x34(%rbp)
jbe 0x9f91
movq 0x1981e(%rip), %rdx     # 0x23798
movl $0x21, %edi
leaq 0x1372d(%rip), %rsi     # 0x1d6b3
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x122d0
movl -0x38(%rbp), %eax
movb %al, 0x29996(%rip)      # 0x33930
movl $0x1, -0x40(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x8(%rbp), %eax
jb 0xa0e0
movl -0x4(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0xa0e0
movq 0x218f9(%rip), %rax     # 0x2b8c0
subq 0x218e2(%rip), %rax     # 0x2b8b0
subq -0x20(%rbp), %rax
movl -0x4(%rbp), %ecx
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, -0x3ff54(%rbp)
cmpl $0x0, -0x3ff54(%rbp)
je 0xa0a5
movl -0x4(%rbp), %eax
subl -0x3ff54(%rbp), %eax
movl %eax, -0x3ff54(%rbp)
cmpq $0x0, 0x218aa(%rip)     # 0x2b8b0
jne 0xa021
cmpl $0x0, 0x218a9(%rip)     # 0x2b8b8
jne 0xa01c
callq 0xcd80
cmpq $0x0, %rax
jne 0xa021
jmp 0xa4b8
jmp 0xa023
movl -0x3ff54(%rbp), %eax
cmpq 0x21880(%rip), %rax     # 0x2b8b0
jbe 0xa073
movq 0x21877(%rip), %rcx     # 0x2b8b0
movl -0x3ff54(%rbp), %eax
subq %rcx, %rax
movl %eax, -0x3ff54(%rbp)
callq 0xcd80
cmpq $0x0, %rax
jne 0xa071
movq 0x1973e(%rip), %rdx     # 0x23798
movl $0x21, %edi
leaq 0x13603(%rip), %rsi     # 0x1d669
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x122d0
jmp 0xa023
movl -0x3ff54(%rbp), %eax
movl %eax, %ecx
movq 0x2182e(%rip), %rax     # 0x2b8b0
subq %rcx, %rax
movq %rax, 0x21824(%rip)     # 0x2b8b0
movl -0x3ff54(%rbp), %ecx
movq 0x2180f(%rip), %rax     # 0x2b8a8
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x21803(%rip)     # 0x2b8a8
movq $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq 0x21805(%rip), %rax     # 0x2b8c0
subq 0x217ee(%rip), %rax     # 0x2b8b0
movq %rax, -0x20(%rbp)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
movl -0x8(%rbp), %eax
shll %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
cmpq $0x0, 0x217c8(%rip)     # 0x2b8b0
jne 0xa103
cmpl $0x0, 0x217c7(%rip)     # 0x2b8b8
jne 0xa0fe
callq 0xcd80
cmpq $0x0, %rax
jne 0xa103
jmp 0xa4b8
movq 0x217a6(%rip), %rax     # 0x2b8b0
addq $-0x1, %rax
movq %rax, 0x2179b(%rip)     # 0x2b8b0
movq 0x2178c(%rip), %rax     # 0x2b8a8
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x2177e(%rip)     # 0x2b8a8
movzbl (%rax), %eax
movl %eax, %eax
movl -0x14(%rbp), %ecx
shlq %cl, %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x4(%rbp), %eax
jae 0xa1cd
cmpq $0x0, 0x2175a(%rip)     # 0x2b8b0
jne 0xa18a
cmpl $0x0, 0x21759(%rip)     # 0x2b8b8
jne 0xa16c
callq 0xcd80
cmpq $0x0, %rax
jne 0xa18a
movq 0x19625(%rip), %rdx     # 0x23798
movl $0x21, %edi
leaq 0x134ea(%rip), %rsi     # 0x1d669
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x122d0
movq 0x2171f(%rip), %rax     # 0x2b8b0
addq $-0x1, %rax
movq %rax, 0x21714(%rip)     # 0x2b8b0
movq 0x21705(%rip), %rax     # 0x2b8a8
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x216f7(%rip)     # 0x2b8a8
movzbl (%rax), %eax
movl %eax, %eax
movl -0x14(%rbp), %ecx
shlq %cl, %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl -0x8(%rbp), %ecx
andq %rcx, %rax
movl %eax, -0x24(%rbp)
movl -0x4(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, %ecx
shrq %cl, %rax
movq %rax, -0x10(%rbp)
movl -0x4(%rbp), %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
cmpl $0x100, -0x24(%rbp)     # imm = 0x100
jne 0xa307
cmpl $0x0, -0x2c(%rbp)
je 0xa307
movq 0x216ad(%rip), %rax     # 0x2b8c0
subq 0x21696(%rip), %rax     # 0x2b8b0
subq -0x20(%rbp), %rax
movl -0x4(%rbp), %ecx
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, -0x3ff58(%rbp)
cmpl $0x0, -0x3ff58(%rbp)
je 0xa2cc
movl -0x4(%rbp), %eax
subl -0x3ff58(%rbp), %eax
movl %eax, -0x3ff58(%rbp)
movl -0x3ff58(%rbp), %eax
cmpq 0x21659(%rip), %rax     # 0x2b8b0
jbe 0xa29a
movq 0x21650(%rip), %rcx     # 0x2b8b0
movl -0x3ff58(%rbp), %eax
subq %rcx, %rax
movl %eax, -0x3ff58(%rbp)
callq 0xcd80
cmpq $0x0, %rax
jne 0xa298
movq 0x19517(%rip), %rdx     # 0x23798
movl $0x21, %edi
leaq 0x133dc(%rip), %rsi     # 0x1d669
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x122d0
jmp 0xa24a
movl -0x3ff58(%rbp), %eax
movl %eax, %ecx
movq 0x21607(%rip), %rax     # 0x2b8b0
subq %rcx, %rax
movq %rax, 0x215fd(%rip)     # 0x2b8b0
movl -0x3ff58(%rbp), %ecx
movq 0x215e8(%rip), %rax     # 0x2b8a8
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x215dc(%rip)     # 0x2b8a8
movq $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq 0x215de(%rip), %rax     # 0x2b8c0
subq 0x215c7(%rip), %rax     # 0x2b8b0
movq %rax, -0x20(%rbp)
movl $0x9, -0x4(%rbp)
movl $0x1ff, -0x8(%rbp)      # imm = 0x1FF
movl $0xff, -0x30(%rbp)
jmp 0x9fa8
movl -0x24(%rbp), %eax
movl %eax, -0x3ff5c(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x30(%rbp), %eax
jbe 0xa36a
movl -0x24(%rbp), %eax
movl -0x30(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0xa32d
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
jbe 0xa34b
movq 0x19464(%rip), %rdx     # 0x23798
movl $0x21, %edi
leaq 0x13373(%rip), %rsi     # 0x1d6b3
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x122d0
movl -0x38(%rbp), %eax
movb %al, %cl
movl -0x3c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x3c(%rbp)
movl %eax, %eax
movb %cl, -0x3ff50(%rbp,%rax)
movl -0x34(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0xa36c
cmpl $0x100, -0x24(%rbp)     # imm = 0x100
jb 0xa3a3
movl -0x24(%rbp), %eax
movb -0x30040(%rbp,%rax), %cl
movl -0x3c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x3c(%rbp)
movl %eax, %eax
movb %cl, -0x3ff50(%rbp,%rax)
movl -0x24(%rbp), %eax
movzwl -0x20040(%rbp,%rax,2), %eax
movl %eax, -0x24(%rbp)
jmp 0xa36c
movl -0x24(%rbp), %eax
movb %al, %cl
movl -0x3c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x3c(%rbp)
movl %eax, %eax
movb %cl, -0x3ff50(%rbp,%rax)
movl -0x24(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x8(%rbp), %eax
jae 0xa3f3
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x34(%rbp), %eax
movw %ax, %cx
movl -0x30(%rbp), %eax
movw %cx, -0x20040(%rbp,%rax,2)
movl -0x38(%rbp), %eax
movb %al, %cl
movl -0x30(%rbp), %eax
movb %cl, -0x30040(%rbp,%rax)
movl -0x3ff5c(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x3c(%rbp), %eax
movl $0x8000, %ecx           # imm = 0x8000
subl -0x40(%rbp), %ecx
cmpl %ecx, %eax
jbe 0xa480
jmp 0xa40d
cmpl $0x8000, -0x40(%rbp)    # imm = 0x8000
jae 0xa443
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
movl %eax, %eax
movb -0x3ff50(%rbp,%rax), %dl
movl -0x40(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x40(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0x294f2(%rip), %rax     # 0x33930
movb %dl, (%rax,%rcx)
jmp 0xa40d
movl -0x40(%rbp), %eax
addq 0x2147b(%rip), %rax     # 0x2b8c8
movq %rax, 0x21474(%rip)     # 0x2b8c8
cmpl $0x1, 0x193ad(%rip)     # 0x23808
jne 0xa474
movl 0x19331(%rip), %edi     # 0x23794
movl -0x40(%rbp), %eax
movl %eax, %edx
leaq 0x294c1(%rip), %rsi     # 0x33930
callq 0xe2c0
movl $0x0, -0x40(%rbp)
jmp 0xa3fc
jmp 0xa482
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
movl %eax, %eax
movb -0x3ff50(%rbp,%rax), %dl
movl -0x40(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x40(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0x29486(%rip), %rax     # 0x33930
movb %dl, (%rax,%rcx)
cmpl $0x0, -0x3c(%rbp)
jne 0xa482
jmp 0x9fa8
movl -0x40(%rbp), %eax
addq 0x21406(%rip), %rax     # 0x2b8c8
movq %rax, 0x213ff(%rip)     # 0x2b8c8
cmpl $0x0, -0x40(%rbp)
je 0xa4ef
cmpl $0x1, 0x19332(%rip)     # 0x23808
jne 0xa4ef
movl 0x192b6(%rip), %edi     # 0x23794
movl -0x40(%rbp), %eax
movl %eax, %edx
leaq 0x29446(%rip), %rsi     # 0x33930
callq 0xe2c0
addq $0x3ff60, %rsp          # imm = 0x3FF60
popq %rbp
retq
nopl (%rax,%rax)