// File: /workspace/github_cpp_makefile_star2_O2/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), %ebp
addl $-0x5, %ebp
addq %rbx, %rbp
movq 0x18(%rdi), %r11
movl 0x20(%rdi), %r9d
subl %r9d, %esi
movq %r11, %rax
subq %rsi, %rax
movq %rax, -0x18(%rsp)
addl $0xfffffeff, %r9d       # imm = 0xFFFFFEFF
addq %r11, %r9
movl 0x3c(%r8), %edx
movl 0x40(%r8), %eax
movl %eax, -0x2c(%rsp)
movl 0x44(%r8), %esi
movb 0x78(%r8), %cl
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl %r10d, %eax
shll %cl, %eax
movq 0x48(%r8), %rcx
movq %rcx, -0x48(%rsp)
movq 0x50(%r8), %r14
movb 0x7c(%r8), %cl
movl %r10d, %r15d
shll %cl, %r15d
notl %eax
movq %rax, -0x8(%rsp)
notl %r15d
movq %r15, -0x10(%rsp)
movl 0x58(%r8), %eax
movq 0x68(%r8), %r15
movq 0x70(%r8), %r13
movq %rdx, -0x20(%rsp)
movq %rsi, -0x28(%rsp)
leal (%rsi,%rdx), %ecx
movl %ecx, -0x30(%rsp)
cmpl $0xe, %eax
ja 0x4462d
movzbl (%rbx), %edx
movl %eax, %ecx
shlq %cl, %rdx
addq %r14, %rdx
movzbl 0x1(%rbx), %r14d
leal 0x8(%rax), %ecx
shlq %cl, %r14
addq $0x2, %rbx
addq %rdx, %r14
orl $0x10, %eax
movl %r14d, %ecx
andl -0x8(%rsp), %ecx
leaq (%r15,%rcx,4), %rsi
movzbl 0x1(%rsi), %ecx
shrq %cl, %r14
subl %ecx, %eax
movzbl (%rsi), %edx
testl %edx, %edx
je 0x44672
testb $0x10, %dl
jne 0x44680
testb $0x40, %dl
jne 0x449c5
movzwl 0x2(%rsi), %esi
movl %r10d, %r12d
movl %edx, %ecx
shll %cl, %r12d
leaq (%r15,%rsi,4), %rcx
notl %r12d
andl %r14d, %r12d
leaq (%rcx,%r12,4), %rsi
jmp 0x44638
movb 0x2(%rsi), %cl
movb %cl, (%r11)
incq %r11
jmp 0x449ab
movzwl 0x2(%rsi), %r12d
andl $0xf, %edx
je 0x446b3
cmpl %edx, %eax
jae 0x4469f
movzbl (%rbx), %esi
movl %eax, %ecx
shlq %cl, %rsi
incq %rbx
addq %rsi, %r14
addl $0x8, %eax
movl %r10d, %esi
movl %edx, %ecx
shll %cl, %esi
notl %esi
andl %r14d, %esi
addl %esi, %r12d
shrq %cl, %r14
subl %edx, %eax
cmpl $0xe, %eax
movq %rbp, -0x50(%rsp)
movq %r12, -0x40(%rsp)
movq %rdi, -0x58(%rsp)
ja 0x446e7
movzbl (%rbx), %edx
movl %eax, %ecx
shlq %cl, %rdx
addq %r14, %rdx
movzbl 0x1(%rbx), %r14d
leal 0x8(%rax), %ecx
shlq %cl, %r14
addq $0x2, %rbx
addq %rdx, %r14
orl $0x10, %eax
movl %r14d, %ecx
andl -0x10(%rsp), %ecx
leaq (,%rcx,4), %r12
addq %r13, %r12
movl %eax, %esi
movq %r14, %rbp
movzbl 0x1(%r12), %ecx
shrq %cl, %rbp
subl %ecx, %esi
movzbl (%r12), %edx
testb $0x10, %dl
jne 0x44741
testb $0x40, %dl
jne 0x449d8
movzwl 0x2(%r12), %eax
movl %r10d, %r14d
movl %edx, %ecx
shll %cl, %r14d
leaq (,%rax,4), %rax
addq %r13, %rax
notl %r14d
andl %ebp, %r14d
leaq (%rax,%r14,4), %r12
jmp 0x446fe
andl $0xf, %edx
cmpl %edx, %esi
jae 0x44772
movzbl (%rbx), %r14d
movl %esi, %ecx
shlq %cl, %r14
addq %rbp, %r14
leal 0x8(%rsi), %eax
cmpl %edx, %eax
jae 0x44779
movzbl 0x1(%rbx), %ebp
movl %eax, %ecx
shlq %cl, %rbp
addq $0x2, %rbx
addq %rbp, %r14
addl $0x10, %esi
movl %esi, %eax
jmp 0x4477c
movl %esi, %eax
movq %rbp, %r14
jmp 0x4477c
incq %rbx
movzwl 0x2(%r12), %esi
movl %r10d, %ebp
movl %edx, %ecx
shll %cl, %ebp
notl %ebp
andl %r14d, %ebp
addl %esi, %ebp
shrq %cl, %r14
subl %edx, %eax
movl %r11d, %edx
subl -0x18(%rsp), %edx
movl %ebp, %edi
subl %edx, %ebp
jbe 0x4483c
cmpl -0x2c(%rsp), %ebp
jbe 0x447ba
cmpl $0x0, 0x1be8(%r8)
jne 0x44a41
movq %rdi, -0x38(%rsp)
movl %ebp, %r12d
movq -0x28(%rsp), %rcx
testq %rcx, %rcx
je 0x448c4
cmpl %ecx, %ebp
jbe 0x448f0
movl -0x30(%rsp), %edx
movl %edx, %esi
subl %ebp, %esi
addq -0x48(%rsp), %rsi
subl %ecx, %ebp
movq -0x40(%rsp), %rcx
movl %ecx, %edx
subl %ebp, %edx
jbe 0x44921
movl %ebp, %r12d
xorl %ebp, %ebp
movb (%rsi,%rbp), %cl
movb %cl, (%r11,%rbp)
incq %rbp
cmpl %ebp, %r12d
jne 0x447fb
addq %rbp, %r11
movq -0x28(%rsp), %r12
cmpl %r12d, %edx
jbe 0x449bb
xorl %esi, %esi
movq -0x48(%rsp), %rbp
movb (%rbp,%rsi), %cl
movb %cl, (%r11)
incq %r11
incq %rsi
cmpl %esi, %r12d
jne 0x44822
subl %r12d, %edx
jmp 0x44917
movq %r11, %rsi
subq %rdi, %rsi
negq %rdi
addq $0x2, %rsi
xorl %edx, %edx
movq -0x40(%rsp), %r12
movl %r12d, %ebp
movb -0x2(%rsi,%rdx), %cl
movb %cl, (%r11,%rdx)
movb -0x1(%rsi,%rdx), %cl
movb %cl, 0x1(%r11,%rdx)
movb (%rsi,%rdx), %cl
movb %cl, 0x2(%r11,%rdx)
addl $-0x3, %ebp
addq $0x3, %rdx
cmpl $0x2, %ebp
ja 0x44853
negl %r12d
leaq (%r12,%rdx), %rcx
testl %ecx, %ecx
je 0x448bc
leaq (%r12,%rdx), %rcx
addq $0x2, %rcx
movq %rdi, %r12
leaq (%r11,%rdi), %rsi
addq $0x2, %rsi
movb -0x2(%rsi,%rdx), %sil
movb %sil, (%r11,%rdx)
testl %ecx, %ecx
movq -0x58(%rsp), %rdi
movq -0x50(%rsp), %rbp
je 0x4497c
addq %rdx, %r11
incq %r11
jmp 0x449ab
addq %rdx, %r11
jmp 0x449a1
movq -0x20(%rsp), %rsi
subl %ebp, %esi
addq -0x48(%rsp), %rsi
movq -0x40(%rsp), %rcx
movl %ecx, %edx
subl %ebp, %edx
jbe 0x44921
xorl %ebp, %ebp
movb (%rsi,%rbp), %cl
movb %cl, (%r11)
incq %r11
incq %rbp
cmpl %ebp, %r12d
jne 0x448dd
jmp 0x44917
movl %ecx, %esi
subl %ebp, %esi
addq -0x48(%rsp), %rsi
movq -0x40(%rsp), %rcx
movl %ecx, %edx
subl %ebp, %edx
jbe 0x44921
xorl %ebp, %ebp
movb (%rsi,%rbp), %cl
movb %cl, (%r11)
incq %r11
incq %rbp
cmpl %ebp, %r12d
jne 0x44906
movq %r11, %rsi
subq -0x38(%rsp), %rsi
jmp 0x44923
movl %ecx, %edx
xorl %ecx, %ecx
movl %edx, %ebp
cmpl $0x3, %ebp
jb 0x44951
movb (%rsi,%rcx), %r12b
movb %r12b, (%r11,%rcx)
movb 0x1(%rsi,%rcx), %r12b
movb %r12b, 0x1(%r11,%rcx)
movb 0x2(%rsi,%rcx), %r12b
movb %r12b, 0x2(%r11,%rcx)
addl $-0x3, %ebp
addq $0x3, %rcx
jmp 0x44927
negl %edx
leaq (%rdx,%rcx), %r12
testl %r12d, %r12d
je 0x44977
addq %rcx, %rdx
addq $0x2, %rdx
movb (%rsi,%rcx), %bpl
movb %bpl, (%r11,%rcx)
testl %edx, %edx
je 0x44992
addq %rcx, %r11
incq %r11
jmp 0x449a1
addq %rcx, %r11
jmp 0x449a1
leaq (%r11,%rdx), %rcx
movb 0x1(%r12,%rcx), %cl
addq %rdx, %r11
addq $0x2, %r11
movb %cl, -0x1(%r11)
jmp 0x449ab
movb 0x1(%rsi,%rcx), %dl
addq %rcx, %r11
addq $0x2, %r11
movb %dl, -0x1(%r11)
movq -0x58(%rsp), %rdi
movq -0x50(%rsp), %rbp
cmpq %rbp, %rbx
jae 0x449fb
cmpq %r9, %r11
jb 0x44608
jmp 0x449fb
movq -0x48(%rsp), %rsi
jmp 0x44923
movl $0x3f3f, %ecx           # imm = 0x3F3F
testb $0x20, %dl
jne 0x449f7
leaq 0x15c08(%rip), %rcx     # 0x5a5de
jmp 0x449ee
leaq 0x15c1b(%rip), %rcx     # 0x5a5fa
movl %esi, %eax
movq %rbp, %r14
movq -0x58(%rsp), %rdi
movq -0x50(%rsp), %rbp
movq %rcx, 0x30(%rdi)
movl $0x3f51, %ecx           # imm = 0x3F51
movl %ecx, 0x8(%r8)
movl %eax, %ecx
shrl $0x3, %ecx
subq %rcx, %rbx
movq %rbx, (%rdi)
movq %r11, 0x18(%rdi)
subl %ebx, %ebp
addl $0x5, %ebp
andl $0x7, %eax
movl %eax, %ecx
shll %cl, %r10d
movl %ebp, 0x8(%rdi)
subl %r11d, %r9d
notl %r10d
andl %r10d, %r14d
addl $0x101, %r9d            # imm = 0x101
movl %r9d, 0x20(%rdi)
movq %r14, 0x50(%r8)
movl %eax, 0x58(%r8)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x58(%rsp), %rdi
movq -0x50(%rsp), %rbp
leaq 0x15bbe(%rip), %rcx     # 0x5a610
jmp 0x449ee