// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/zlib-1.3.0.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:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0x40(%rsp), %rcx
shrq $0x3, %rcx
addq %rcx, %rax
movq 0x40(%rsp), %rcx
shrq $0x8, %rcx
addq %rcx, %rax
movq 0x40(%rsp), %rcx
shrq $0x9, %rcx
addq %rcx, %rax
addq $0x4, %rax
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq 0x40(%rsp), %rcx
shrq $0x5, %rcx
addq %rcx, %rax
movq 0x40(%rsp), %rcx
shrq $0x7, %rcx
addq %rcx, %rax
movq 0x40(%rsp), %rcx
shrq $0xb, %rcx
addq %rcx, %rax
addq $0x7, %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rdi
callq 0xd0920
cmpl $0x0, %eax
je 0xd2cf6
movq 0x30(%rsp), %rax
cmpq 0x28(%rsp), %rax
jbe 0xd2cd9
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0xd2ce3
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
addq $0x6, %rax
movq %rax, 0x50(%rsp)
jmp 0xd2ef1
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movl 0x30(%rax), %eax
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0xd2d2f
jmp 0xd2d16
movl 0xc(%rsp), %eax
subl $0x1, %eax
je 0xd2d3d
jmp 0xd2d21
movl 0xc(%rsp), %eax
subl $0x2, %eax
je 0xd2d64
jmp 0xd2e4d
movq $0x0, 0x20(%rsp)
jmp 0xd2e56
movq 0x38(%rsp), %rax
movl 0xac(%rax), %edx
xorl %eax, %eax
movl $0x4, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
addl $0x6, %eax
cltq
movq %rax, 0x20(%rsp)
jmp 0xd2e56
movq $0x12, 0x20(%rsp)
movq 0x38(%rsp), %rax
cmpq $0x0, 0x38(%rax)
je 0xd2e4b
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
cmpq $0x0, 0x18(%rax)
je 0xd2da8
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
movl 0x20(%rax), %eax
addl $0x2, %eax
movl %eax, %eax
addq 0x20(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x28(%rax), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0xd2dea
jmp 0xd2dc4
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
movq 0x18(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rsp)
cmpb $0x0, (%rax)
jne 0xd2dc4
jmp 0xd2dea
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x38(%rax), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0xd2e2c
jmp 0xd2e06
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
movq 0x18(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rsp)
cmpb $0x0, (%rax)
jne 0xd2e06
jmp 0xd2e2c
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
cmpl $0x0, 0x44(%rax)
je 0xd2e49
movq 0x20(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x20(%rsp)
jmp 0xd2e4b
jmp 0xd2e56
movq $0x6, 0x20(%rsp)
movq 0x38(%rsp), %rax
cmpl $0xf, 0x54(%rax)
jne 0xd2e6f
movq 0x38(%rsp), %rax
cmpl $0xf, 0x88(%rax)
je 0xd2eb6
movq 0x38(%rsp), %rax
movl 0x54(%rax), %eax
movq 0x38(%rsp), %rcx
cmpl 0x88(%rcx), %eax
ja 0xd2e9d
movq 0x38(%rsp), %rax
cmpl $0x0, 0xc4(%rax)
je 0xd2e9d
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
jmp 0xd2ea6
movq 0x28(%rsp), %rax
movq %rax, (%rsp)
movq (%rsp), %rax
addq 0x20(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0xd2ef1
movq 0x40(%rsp), %rax
movq 0x40(%rsp), %rcx
shrq $0xc, %rcx
addq %rcx, %rax
movq 0x40(%rsp), %rcx
shrq $0xe, %rcx
addq %rcx, %rax
movq 0x40(%rsp), %rcx
shrq $0x19, %rcx
addq %rcx, %rax
addq $0xd, %rax
subq $0x6, %rax
addq 0x20(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq $0x58, %rsp
retq
nopl (%rax,%rax)