// File: sisong[P]ApkDiffPatch/zlib1.3.1/deflate.c
// Function: deflateBound
uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen) {
    deflate_state *s;
    uLong fixedlen, storelen, wraplen;

    /* upper bound for fixed blocks with 9-bit literals and length 255
       (memLevel == 2, which is the lowest that may not use stored blocks) --
       ~13% overhead plus a small constant */
    fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) +
               (sourceLen >> 9) + 4;

    /* upper bound for stored blocks with length 127 (memLevel == 1) --
       ~4% overhead plus a small constant */
    storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) +
               (sourceLen >> 11) + 7;

    /* if can't get parameters, return larger bound plus a zlib wrapper */
    if (deflateStateCheck(strm))
        return (fixedlen > storelen ? fixedlen : storelen) + 6;

    /* compute wrapper length */
    s = strm->state;
    switch (s->wrap) {
    case 0:                                 /* raw deflate */
        wraplen = 0;
        break;
    case 1:                                 /* zlib wrapper */
        wraplen = 6 + (s->strstart ? 4 : 0);
        break;
#ifdef GZIP
    case 2:                                 /* gzip wrapper */
        wraplen = 18;
        if (s->gzhead != Z_NULL) {          /* user-supplied gzip header */
            Bytef *str;
            if (s->gzhead->extra != Z_NULL)
                wraplen += 2 + s->gzhead->extra_len;
            str = s->gzhead->name;
            if (str != Z_NULL)
                do {
                    wraplen++;
                } while (*str++);
            str = s->gzhead->comment;
            if (str != Z_NULL)
                do {
                    wraplen++;
                } while (*str++);
            if (s->gzhead->hcrc)
                wraplen += 2;
        }
        break;
#endif
    default:                                /* for compiler happiness */
        wraplen = 6;
    }

    /* if not default parameters, return one of the conservative bounds */
    if (s->w_bits != 15 || s->hash_bits != 8 + 7)
        return (s->w_bits <= s->hash_bits && s->level ? fixedlen : storelen) +
               wraplen;

    /* default settings: return tight bound for that case -- ~0.03% overhead
       plus a small constant */
    return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
           (sourceLen >> 25) + 13 - 6 + wraplen;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
shrq $0x3, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
shrq $0x8, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
shrq $0x9, %rcx
addq %rcx, %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
shrq $0x5, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
shrq $0x7, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
shrq $0xb, %rcx
addq %rcx, %rax
addq $0x7, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x93560
cmpl $0x0, %eax
je 0x956a5
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jbe 0x9568c
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x95694
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x8(%rbp)
jmp 0x95870
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x4c(%rbp)
testl %eax, %eax
je 0x956d8
jmp 0x956c1
movl -0x4c(%rbp), %eax
subl $0x1, %eax
je 0x956e5
jmp 0x956cb
movl -0x4c(%rbp), %eax
subl $0x2, %eax
je 0x9570a
jmp 0x957dc
movq $0x0, -0x38(%rbp)
jmp 0x957e4
movq -0x20(%rbp), %rax
movl 0xac(%rax), %edx
xorl %eax, %eax
movl $0x4, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
addl $0x6, %eax
cltq
movq %rax, -0x38(%rbp)
jmp 0x957e4
movq $0x12, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x957da
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
cmpq $0x0, 0x18(%rax)
je 0x95748
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movl 0x20(%rax), %eax
addl $0x2, %eax
movl %eax, %eax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x95783
jmp 0x95761
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
cmpb $0x0, (%rax)
jne 0x95761
jmp 0x95783
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x957be
jmp 0x9579c
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
cmpb $0x0, (%rax)
jne 0x9579c
jmp 0x957be
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
cmpl $0x0, 0x44(%rax)
je 0x957d8
movq -0x38(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x38(%rbp)
jmp 0x957da
jmp 0x957e4
movq $0x6, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpl $0xf, 0x54(%rax)
jne 0x957fb
movq -0x20(%rbp), %rax
cmpl $0xf, 0x88(%rax)
je 0x9583b
movq -0x20(%rbp), %rax
movl 0x54(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x88(%rcx), %eax
ja 0x95825
movq -0x20(%rbp), %rax
cmpl $0x0, 0xc4(%rax)
je 0x95825
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x9582d
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x95870
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
shrq $0xc, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
shrq $0xe, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
shrq $0x19, %rcx
addq %rcx, %rax
addq $0xd, %rax
subq $0x6, %rax
addq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)