// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/zlib-1.3.0.1/deflate.c
// Function: deflateSetDictionary
int ZEXPORT deflateSetDictionary(z_streamp strm, const Bytef *dictionary,
                                 uInt  dictLength) {
    deflate_state *s;
    uInt str, n;
    int wrap;
    unsigned avail;
    z_const unsigned char *next;

    if (deflateStateCheck(strm) || dictionary == Z_NULL)
        return Z_STREAM_ERROR;
    s = strm->state;
    wrap = s->wrap;
    if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead)
        return Z_STREAM_ERROR;

    /* when using zlib wrappers, compute Adler-32 for provided dictionary */
    if (wrap == 1)
        strm->adler = adler32(strm->adler, dictionary, dictLength);
    s->wrap = 0;                    /* avoid computing Adler-32 in read_buf */

    /* if dictionary would fill window, just replace the history */
    if (dictLength >= s->w_size) {
        if (wrap == 0) {            /* already empty otherwise */
            CLEAR_HASH(s);
            s->strstart = 0;
            s->block_start = 0L;
            s->insert = 0;
        }
        dictionary += dictLength - s->w_size;  /* use the tail */
        dictLength = s->w_size;
    }

    /* insert dictionary into window and hash */
    avail = strm->avail_in;
    next = strm->next_in;
    strm->avail_in = dictLength;
    strm->next_in = (z_const Bytef *)dictionary;
    fill_window(s);
    while (s->lookahead >= MIN_MATCH) {
        str = s->strstart;
        n = s->lookahead - (MIN_MATCH-1);
        do {
            UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
#ifndef FASTEST
            s->prev[str & s->w_mask] = s->head[s->ins_h];
#endif
            s->head[s->ins_h] = (Pos)str;
            str++;
        } while (--n);
        s->strstart = str;
        s->lookahead = MIN_MATCH-1;
        fill_window(s);
    }
    s->strstart += s->lookahead;
    s->block_start = (long)s->strstart;
    s->insert = s->lookahead;
    s->lookahead = 0;
    s->match_length = s->prev_length = MIN_MATCH-1;
    s->match_available = 0;
    strm->next_in = next;
    strm->avail_in = avail;
    s->wrap = wrap;
    return Z_OK;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movl %edx, 0x2c(%rsp)
movq 0x38(%rsp), %rdi
callq 0xd0920
cmpl $0x0, %eax
jne 0xd05b9
cmpq $0x0, 0x30(%rsp)
jne 0xd05c6
movl $0xfffffffe, 0x44(%rsp) # imm = 0xFFFFFFFE
jmp 0xd090a
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movl 0x30(%rax), %eax
movl %eax, 0x14(%rsp)
cmpl $0x2, 0x14(%rsp)
je 0xd0607
cmpl $0x1, 0x14(%rsp)
jne 0xd05f9
movq 0x20(%rsp), %rax
cmpl $0x2a, 0x8(%rax)
jne 0xd0607
movq 0x20(%rsp), %rax
cmpl $0x0, 0xb4(%rax)
je 0xd0614
movl $0xfffffffe, 0x44(%rsp) # imm = 0xFFFFFFFE
jmp 0xd090a
cmpl $0x1, 0x14(%rsp)
jne 0xd063e
movq 0x38(%rsp), %rax
movq 0x60(%rax), %rdi
movq 0x30(%rsp), %rsi
movl 0x2c(%rsp), %edx
callq 0x107d60
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x60(%rax)
movq 0x20(%rsp), %rax
movl $0x0, 0x30(%rax)
movl 0x2c(%rsp), %eax
movq 0x20(%rsp), %rcx
cmpl 0x50(%rcx), %eax
jb 0xd06fe
cmpl $0x0, 0x14(%rsp)
jne 0xd06d7
jmp 0xd0665
movq 0x20(%rsp), %rax
movq 0x78(%rax), %rax
movq 0x20(%rsp), %rcx
movl 0x84(%rcx), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movw $0x0, (%rax,%rcx,2)
movq 0x20(%rsp), %rax
movq 0x78(%rax), %rdi
movq 0x20(%rsp), %rax
movl 0x84(%rax), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
shlq %rdx
xorl %esi, %esi
callq 0xb2d0
movq 0x20(%rsp), %rax
movl $0x0, 0xac(%rax)
movq 0x20(%rsp), %rax
movq $0x0, 0x98(%rax)
movq 0x20(%rsp), %rax
movl $0x0, 0x172c(%rax)
movl 0x2c(%rsp), %ecx
movq 0x20(%rsp), %rax
subl 0x50(%rax), %ecx
movq 0x30(%rsp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x30(%rsp)
movq 0x20(%rsp), %rax
movl 0x50(%rax), %eax
movl %eax, 0x2c(%rsp)
movq 0x38(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl 0x2c(%rsp), %ecx
movq 0x38(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rdi
callq 0xd09f0
movq 0x20(%rsp), %rax
cmpl $0x3, 0xb4(%rax)
jb 0xd0856
movq 0x20(%rsp), %rax
movl 0xac(%rax), %eax
movl %eax, 0x1c(%rsp)
movq 0x20(%rsp), %rax
movl 0xb4(%rax), %eax
subl $0x2, %eax
movl %eax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movl 0x80(%rax), %eax
movq 0x20(%rsp), %rcx
movl 0x90(%rcx), %ecx
shll %cl, %eax
movl %eax, %ecx
movq 0x20(%rsp), %rax
movq 0x60(%rax), %rax
movl 0x1c(%rsp), %edx
addl $0x3, %edx
subl $0x1, %edx
movl %edx, %edx
movzbl (%rax,%rdx), %eax
xorl %eax, %ecx
movq 0x20(%rsp), %rax
andl 0x8c(%rax), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x80(%rax)
movq 0x20(%rsp), %rax
movq 0x78(%rax), %rax
movq 0x20(%rsp), %rcx
movl 0x80(%rcx), %ecx
movw (%rax,%rcx,2), %dx
movq 0x20(%rsp), %rax
movq 0x70(%rax), %rax
movl 0x1c(%rsp), %ecx
movq 0x20(%rsp), %rsi
andl 0x58(%rsi), %ecx
movl %ecx, %ecx
movw %dx, (%rax,%rcx,2)
movl 0x1c(%rsp), %eax
movw %ax, %dx
movq 0x20(%rsp), %rax
movq 0x78(%rax), %rax
movq 0x20(%rsp), %rcx
movl 0x80(%rcx), %ecx
movw %dx, (%rax,%rcx,2)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
movl 0x18(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x18(%rsp)
cmpl $0x0, %eax
jne 0xd076d
movl 0x1c(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0xac(%rax)
movq 0x20(%rsp), %rax
movl $0x2, 0xb4(%rax)
movq 0x20(%rsp), %rdi
callq 0xd09f0
jmp 0xd073a
movq 0x20(%rsp), %rax
movl 0xb4(%rax), %ecx
movq 0x20(%rsp), %rax
addl 0xac(%rax), %ecx
movl %ecx, 0xac(%rax)
movq 0x20(%rsp), %rax
movl 0xac(%rax), %eax
movl %eax, %ecx
movq 0x20(%rsp), %rax
movq %rcx, 0x98(%rax)
movq 0x20(%rsp), %rax
movl 0xb4(%rax), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x172c(%rax)
movq 0x20(%rsp), %rax
movl $0x0, 0xb4(%rax)
movq 0x20(%rsp), %rax
movl $0x2, 0xb8(%rax)
movq 0x20(%rsp), %rax
movl $0x2, 0xa0(%rax)
movq 0x20(%rsp), %rax
movl $0x0, 0xa8(%rax)
movq 0x8(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, (%rax)
movl 0x10(%rsp), %ecx
movq 0x38(%rsp), %rax
movl %ecx, 0x8(%rax)
movl 0x14(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x30(%rax)
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)