// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/zlib1.3.1/inffast.c
// Function: inflate_fast
void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
    struct inflate_state FAR *state;
    z_const unsigned char FAR *in;      /* local strm->next_in */
    z_const unsigned char FAR *last;    /* have enough input while in < last */
    unsigned char FAR *out;     /* local strm->next_out */
    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
    unsigned char FAR *end;     /* while out < end, enough space available */
#ifdef INFLATE_STRICT
    unsigned dmax;              /* maximum distance from zlib header */
#endif
    unsigned wsize;             /* window size or zero if not using window */
    unsigned whave;             /* valid bytes in the window */
    unsigned wnext;             /* window write index */
    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
    unsigned long hold;         /* local strm->hold */
    unsigned bits;              /* local strm->bits */
    code const FAR *lcode;      /* local strm->lencode */
    code const FAR *dcode;      /* local strm->distcode */
    unsigned lmask;             /* mask for first level of length codes */
    unsigned dmask;             /* mask for first level of distance codes */
    code const *here;           /* retrieved table entry */
    unsigned op;                /* code bits, operation, extra bits, or */
                                /*  window position, window bytes to copy */
    unsigned len;               /* match length, unused bytes */
    unsigned dist;              /* match distance */
    unsigned char FAR *from;    /* where to copy match from */

    /* copy state to local variables */
    state = (struct inflate_state FAR *)strm->state;
    in = strm->next_in;
    last = in + (strm->avail_in - 5);
    out = strm->next_out;
    beg = out - (start - strm->avail_out);
    end = out + (strm->avail_out - 257);
#ifdef INFLATE_STRICT
    dmax = state->dmax;
#endif
    wsize = state->wsize;
    whave = state->whave;
    wnext = state->wnext;
    window = state->window;
    hold = state->hold;
    bits = state->bits;
    lcode = state->lencode;
    dcode = state->distcode;
    lmask = (1U << state->lenbits) - 1;
    dmask = (1U << state->distbits) - 1;

    /* decode literals and length/distances until end-of-block or not enough
       input data or output space */
    do {
        if (bits < 15) {
            hold += (unsigned long)(*in++) << bits;
            bits += 8;
            hold += (unsigned long)(*in++) << bits;
            bits += 8;
        }
        here = lcode + (hold & lmask);
      dolen:
        op = (unsigned)(here->bits);
        hold >>= op;
        bits -= op;
        op = (unsigned)(here->op);
        if (op == 0) {                          /* literal */
            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
                    "inflate:         literal '%c'\n" :
                    "inflate:         literal 0x%02x\n", here->val));
            *out++ = (unsigned char)(here->val);
        }
        else if (op & 16) {                     /* length base */
            len = (unsigned)(here->val);
            op &= 15;                           /* number of extra bits */
            if (op) {
                if (bits < op) {
                    hold += (unsigned long)(*in++) << bits;
                    bits += 8;
                }
                len += (unsigned)hold & ((1U << op) - 1);
                hold >>= op;
                bits -= op;
            }
            Tracevv((stderr, "inflate:         length %u\n", len));
            if (bits < 15) {
                hold += (unsigned long)(*in++) << bits;
                bits += 8;
                hold += (unsigned long)(*in++) << bits;
                bits += 8;
            }
            here = dcode + (hold & dmask);
          dodist:
            op = (unsigned)(here->bits);
            hold >>= op;
            bits -= op;
            op = (unsigned)(here->op);
            if (op & 16) {                      /* distance base */
                dist = (unsigned)(here->val);
                op &= 15;                       /* number of extra bits */
                if (bits < op) {
                    hold += (unsigned long)(*in++) << bits;
                    bits += 8;
                    if (bits < op) {
                        hold += (unsigned long)(*in++) << bits;
                        bits += 8;
                    }
                }
                dist += (unsigned)hold & ((1U << op) - 1);
#ifdef INFLATE_STRICT
                if (dist > dmax) {
                    strm->msg = (char *)"invalid distance too far back";
                    state->mode = BAD;
                    break;
                }
#endif
                hold >>= op;
                bits -= op;
                Tracevv((stderr, "inflate:         distance %u\n", dist));
                op = (unsigned)(out - beg);     /* max distance in output */
                if (dist > op) {                /* see if copy from window */
                    op = dist - op;             /* distance back in window */
                    if (op > whave) {
                        if (state->sane) {
                            strm->msg =
                                (char *)"invalid distance too far back";
                            state->mode = BAD;
                            break;
                        }
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
                        if (len <= op - whave) {
                            do {
                                *out++ = 0;
                            } while (--len);
                            continue;
                        }
                        len -= op - whave;
                        do {
                            *out++ = 0;
                        } while (--op > whave);
                        if (op == 0) {
                            from = out - dist;
                            do {
                                *out++ = *from++;
                            } while (--len);
                            continue;
                        }
#endif
                    }
                    from = window;
                    if (wnext == 0) {           /* very common case */
                        from += wsize - op;
                        if (op < len) {         /* some from window */
                            len -= op;
                            do {
                                *out++ = *from++;
                            } while (--op);
                            from = out - dist;  /* rest from output */
                        }
                    }
                    else if (wnext < op) {      /* wrap around window */
                        from += wsize + wnext - op;
                        op -= wnext;
                        if (op < len) {         /* some from end of window */
                            len -= op;
                            do {
                                *out++ = *from++;
                            } while (--op);
                            from = window;
                            if (wnext < len) {  /* some from start of window */
                                op = wnext;
                                len -= op;
                                do {
                                    *out++ = *from++;
                                } while (--op);
                                from = out - dist;      /* rest from output */
                            }
                        }
                    }
                    else {                      /* contiguous in window */
                        from += wnext - op;
                        if (op < len) {         /* some from window */
                            len -= op;
                            do {
                                *out++ = *from++;
                            } while (--op);
                            from = out - dist;  /* rest from output */
                        }
                    }
                    while (len > 2) {
                        *out++ = *from++;
                        *out++ = *from++;
                        *out++ = *from++;
                        len -= 3;
                    }
                    if (len) {
                        *out++ = *from++;
                        if (len > 1)
                            *out++ = *from++;
                    }
                }
                else {
                    from = out - dist;          /* copy direct from output */
                    do {                        /* minimum length is three */
                        *out++ = *from++;
                        *out++ = *from++;
                        *out++ = *from++;
                        len -= 3;
                    } while (len > 2);
                    if (len) {
                        *out++ = *from++;
                        if (len > 1)
                            *out++ = *from++;
                    }
                }
            }
            else if ((op & 64) == 0) {          /* 2nd level distance code */
                here = dcode + here->val + (hold & ((1U << op) - 1));
                goto dodist;
            }
            else {
                strm->msg = (char *)"invalid distance code";
                state->mode = BAD;
                break;
            }
        }
        else if ((op & 64) == 0) {              /* 2nd level length code */
            here = lcode + here->val + (hold & ((1U << op) - 1));
            goto dolen;
        }
        else if (op & 32) {                     /* end-of-block */
            Tracevv((stderr, "inflate:         end of block\n"));
            state->mode = TYPE;
            break;
        }
        else {
            strm->msg = (char *)"invalid literal/length code";
            state->mode = BAD;
            break;
        }
    } while (in < last && out < end);

    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
    len = bits >> 3;
    in -= len;
    bits -= len << 3;
    hold &= (1U << bits) - 1;

    /* update state and return */
    strm->next_in = in;
    strm->next_out = out;
    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
    strm->avail_out = (unsigned)(out < end ?
                                 257 + (end - out) : 257 - (out - end));
    state->hold = hold;
    state->bits = bits;
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x38(%rdi), %r8
movq (%rdi), %rbx
movl 0x8(%rdi), %r10d
addl $-0x5, %r10d
addq %rbx, %r10
movq 0x18(%rdi), %r11
movl 0x20(%rdi), %r9d
subl %r9d, %esi
movq %r11, %rax
subq %rsi, %rax
movq %rax, -0x8(%rsp)
addl $0xfffffeff, %r9d       # imm = 0xFFFFFEFF
addq %r11, %r9
movl 0x3c(%r8), %edx
movl 0x40(%r8), %eax
movl %eax, -0x1c(%rsp)
movl 0x44(%r8), %esi
movq %rsi, -0x28(%rsp)
movq 0x48(%r8), %rax
movq %rax, -0x30(%rsp)
movq 0x50(%r8), %r15
movb 0x78(%r8), %cl
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
shll %cl, %r14d
movb 0x7c(%r8), %cl
shll %cl, %r12d
movl 0x58(%r8), %eax
notl %r14d
notl %r12d
movq 0x68(%r8), %r13
movq 0x70(%r8), %rcx
movq %rcx, -0x18(%rsp)
movq %rdx, -0x10(%rsp)
leal (%rsi,%rdx), %ecx
movl %ecx, -0x20(%rsp)
cmpl $0xe, %eax
ja 0x4ed88
movzbl (%rbx), %edx
movl %eax, %ecx
shlq %cl, %rdx
addq %r15, %rdx
movzbl 0x1(%rbx), %r15d
leal 0x8(%rax), %ecx
shlq %cl, %r15
addq $0x2, %rbx
addq %rdx, %r15
orl $0x10, %eax
movl %r15d, %ecx
andl %r14d, %ecx
leaq (,%rcx,4), %rsi
addq %r13, %rsi
movzbl 0x1(%rsi), %ecx
shrq %cl, %r15
subl %ecx, %eax
movb (%rsi), %cl
testb %cl, %cl
je 0x4edd7
testb $0x10, %cl
jne 0x4edf7
testb $0x40, %cl
jne 0x4f135
movzwl 0x2(%rsi), %edx
leaq (,%rdx,4), %rdx
addq %r13, %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
shll %cl, %esi
notl %esi
andl %r15d, %esi
leaq (%rdx,%rsi,4), %rsi
jmp 0x4ed99
movb 0x2(%rsi), %cl
movb %cl, (%r11)
incq %r11
cmpq %r10, %rbx
jae 0x4f161
cmpq %r9, %r11
jb 0x4ed63
jmp 0x4f161
movzbl %cl, %edx
movzwl 0x2(%rsi), %ebp
andl $0xf, %edx
je 0x4ee2d
cmpl %edx, %eax
jae 0x4ee18
movzbl (%rbx), %esi
movl %eax, %ecx
shlq %cl, %rsi
incq %rbx
addq %rsi, %r15
addl $0x8, %eax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %edx, %ecx
shll %cl, %esi
notl %esi
andl %r15d, %esi
addl %esi, %ebp
shrq %cl, %r15
subl %edx, %eax
cmpl $0xe, %eax
movq %r14, -0x38(%rsp)
movq %rbp, -0x40(%rsp)
ja 0x4ee5c
movzbl (%rbx), %edx
movl %eax, %ecx
shlq %cl, %rdx
addq %r15, %rdx
movzbl 0x1(%rbx), %r15d
leal 0x8(%rax), %ecx
shlq %cl, %r15
addq $0x2, %rbx
addq %rdx, %r15
orl $0x10, %eax
movl %r15d, %ecx
andl %r12d, %ecx
movq -0x18(%rsp), %rdx
leaq (%rdx,%rcx,4), %rbp
movzbl 0x1(%rbp), %ecx
shrq %cl, %r15
subl %ecx, %eax
movzbl (%rbp), %edx
movq %r15, %r14
movl %eax, %esi
testb $0x10, %dl
jne 0x4eebc
testb $0x40, %dl
jne 0x4f148
movzwl 0x2(%rbp), %eax
movq -0x18(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %edx, %ecx
shll %cl, %r15d
notl %r15d
andl %r14d, %r15d
leaq (%rax,%r15,4), %rbp
movzbl 0x1(%rbp), %ecx
shrq %cl, %r14
subl %ecx, %esi
movzbl (%rbp), %edx
jmp 0x4ee7d
andl $0xf, %edx
cmpl %edx, %esi
jae 0x4eeee
movzbl (%rbx), %r15d
movl %esi, %ecx
shlq %cl, %r15
addq %r14, %r15
leal 0x8(%rsi), %eax
cmpl %edx, %eax
jae 0x4eef5
movzbl 0x1(%rbx), %r14d
movl %eax, %ecx
shlq %cl, %r14
addq $0x2, %rbx
addq %r14, %r15
addl $0x10, %esi
movl %esi, %eax
jmp 0x4eef8
movl %esi, %eax
movq %r14, %r15
jmp 0x4eef8
incq %rbx
movq -0x28(%rsp), %r14
movzwl 0x2(%rbp), %ebp
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %edx, %ecx
shll %cl, %esi
notl %esi
andl %r15d, %esi
addl %ebp, %esi
shrq %cl, %r15
subl %edx, %eax
movl %r11d, %ecx
subl -0x8(%rsp), %ecx
movl %esi, %ebp
subl %ecx, %ebp
jbe 0x4efba
cmpl -0x1c(%rsp), %ebp
jbe 0x4ef3b
cmpl $0x0, 0x1be8(%r8)
jne 0x4f1ad
testq %r14, %r14
je 0x4f03f
cmpl %r14d, %ebp
movq -0x30(%rsp), %rcx
jbe 0x4f075
movl -0x20(%rsp), %edx
subl %ebp, %edx
addq %rcx, %rdx
subl %r14d, %ebp
movq -0x40(%rsp), %r14
movl %r14d, %ecx
subl %ebp, %ecx
jbe 0x4f0b4
movq %r12, -0x40(%rsp)
movl %ebp, %r14d
xorl %ebp, %ebp
movb (%rdx,%rbp), %r12b
movb %r12b, (%r11,%rbp)
incq %rbp
cmpl %ebp, %r14d
jne 0x4ef78
addq %rbp, %r11
movq -0x28(%rsp), %r14
cmpl %r14d, %ecx
jbe 0x4f12b
xorl %edx, %edx
movq -0x30(%rsp), %r12
movb (%r12,%rdx), %bpl
movb %bpl, (%r11)
incq %r11
incq %rdx
cmpl %edx, %r14d
jne 0x4efa0
subl %r14d, %ecx
jmp 0x4f0a5
movl %esi, %ecx
movq %r11, %rsi
subq %rcx, %rsi
negq %rcx
addq $0x2, %rsi
xorl %edx, %edx
movq -0x40(%rsp), %r14
movl %r14d, %ebp
movb -0x2(%rsi,%rdx), %r14b
movb %r14b, (%r11,%rdx)
movb -0x1(%rsi,%rdx), %r14b
movb %r14b, 0x1(%r11,%rdx)
movb (%rsi,%rdx), %r14b
movb %r14b, 0x2(%r11,%rdx)
addl $-0x3, %ebp
addq $0x3, %rdx
cmpl $0x2, %ebp
ja 0x4efd3
movq -0x40(%rsp), %r14
negl %r14d
leaq (%r14,%rdx), %rsi
testl %esi, %esi
je 0x4f037
leaq (%r14,%rdx), %rsi
addq $0x2, %rsi
leaq (%r11,%rcx), %r14
addq $0x2, %r14
movb -0x2(%r14,%rdx), %bpl
movb %bpl, (%r11,%rdx)
testl %esi, %esi
je 0x4f10e
addq %rdx, %r11
incq %r11
jmp 0x4f121
addq %rdx, %r11
jmp 0x4f121
movq -0x10(%rsp), %rdx
subl %ebp, %edx
addq -0x30(%rsp), %rdx
movq -0x40(%rsp), %r14
movl %r14d, %ecx
subl %ebp, %ecx
jbe 0x4f0b4
movq %r12, -0x40(%rsp)
movl %ebp, %r14d
xorl %ebp, %ebp
movb (%rdx,%rbp), %r12b
movb %r12b, (%r11)
incq %r11
incq %rbp
cmpl %ebp, %r14d
jne 0x4f061
jmp 0x4f0a5
movl %r14d, %edx
subl %ebp, %edx
addq %rcx, %rdx
movq -0x40(%rsp), %r14
movl %r14d, %ecx
subl %ebp, %ecx
jbe 0x4f0b4
movq %r12, -0x40(%rsp)
movl %ebp, %r14d
xorl %ebp, %ebp
movb (%rdx,%rbp), %r12b
movb %r12b, (%r11)
incq %r11
incq %rbp
cmpl %ebp, %r14d
jne 0x4f093
movl %esi, %esi
movq %r11, %rdx
subq %rsi, %rdx
movq -0x40(%rsp), %r12
jmp 0x4f0b7
movl %r14d, %ecx
cmpl $0x3, %ecx
movq -0x38(%rsp), %r14
jb 0x4f0e7
movb (%rdx), %sil
movb %sil, (%r11)
movb 0x1(%rdx), %sil
movb %sil, 0x1(%r11)
movb 0x2(%rdx), %sil
addq $0x3, %rdx
movb %sil, 0x2(%r11)
addq $0x3, %r11
addl $-0x3, %ecx
cmpl $0x2, %ecx
ja 0x4f0c1
testl %ecx, %ecx
je 0x4ede0
movb (%rdx), %sil
movb %sil, (%r11)
cmpl $0x2, %ecx
jne 0x4eddd
movb 0x1(%rdx), %cl
movb %cl, 0x1(%r11)
addq $0x2, %r11
jmp 0x4ede0
leaq (%r11,%rdx), %rsi
movb 0x1(%rcx,%rsi), %cl
addq %rdx, %r11
addq $0x2, %r11
movb %cl, -0x1(%r11)
movq -0x38(%rsp), %r14
jmp 0x4ede0
movq -0x30(%rsp), %rdx
jmp 0x4f0ad
movl $0x3f3f, %edx           # imm = 0x3F3F
testb $0x20, %cl
jne 0x4f15d
leaq 0x16388(%rip), %rcx     # 0x654ce
jmp 0x4f154
movl %esi, %eax
movq %r14, %r15
leaq 0x16396(%rip), %rcx     # 0x654ea
movq %rcx, 0x30(%rdi)
movl $0x3f51, %edx           # imm = 0x3F51
movl %edx, 0x8(%r8)
movl %eax, %ecx
shrl $0x3, %ecx
subq %rcx, %rbx
movq %rbx, (%rdi)
movq %r11, 0x18(%rdi)
subl %ebx, %r10d
addl $0x5, %r10d
andl $0x7, %eax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %eax, %ecx
shll %cl, %edx
movl %r10d, 0x8(%rdi)
subl %r11d, %r9d
notl %edx
andl %edx, %r15d
addl $0x101, %r9d            # imm = 0x101
movl %r9d, 0x20(%rdi)
movq %r15, 0x50(%r8)
movl %eax, 0x58(%r8)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1634c(%rip), %rcx     # 0x65500
jmp 0x4f154
nop