// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/zlib-1.3.0.1/inflate.c
// Function: inflateSync
int ZEXPORT inflateSync(z_streamp strm) {
    unsigned len;               /* number of bytes to look at or looked at */
    int flags;                  /* temporary to save header status */
    unsigned long in, out;      /* temporary to save total_in and total_out */
    unsigned char buf[4];       /* to restore bit buffer to byte string */
    struct inflate_state FAR *state;

    /* check parameters */
    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
    state = (struct inflate_state FAR *)strm->state;
    if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;

    /* if first time, start search in bit buffer */
    if (state->mode != SYNC) {
        state->mode = SYNC;
        state->hold >>= state->bits & 7;
        state->bits -= state->bits & 7;
        len = 0;
        while (state->bits >= 8) {
            buf[len++] = (unsigned char)(state->hold);
            state->hold >>= 8;
            state->bits -= 8;
        }
        state->have = 0;
        syncsearch(&(state->have), buf, len);
    }

    /* search available input */
    len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
    strm->avail_in -= len;
    strm->next_in += len;
    strm->total_in += len;

    /* return no joy or set up to restart inflate() on a new block */
    if (state->have != 4) return Z_DATA_ERROR;
    if (state->flags == -1)
        state->wrap = 0;    /* if no header yet, treat as raw */
    else
        state->wrap &= ~4;  /* no point in computing a check value now */
    flags = state->flags;
    in = strm->total_in;  out = strm->total_out;
    inflateReset(strm);
    strm->total_in = in;  strm->total_out = out;
    state->flags = flags;
    state->mode = TYPE;
    return Z_OK;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq 0x28(%rsp), %rdi
callq 0xd9d70
cmpl $0x0, %eax
je 0xddee5
movl $0xfffffffe, 0x34(%rsp) # imm = 0xFFFFFFFE
jmp 0xde0de
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rax
movq %rax, (%rsp)
movq 0x28(%rsp), %rax
cmpl $0x0, 0x8(%rax)
jne 0xddf14
movq (%rsp), %rax
cmpl $0x8, 0x58(%rax)
jae 0xddf14
movl $0xfffffffb, 0x34(%rsp) # imm = 0xFFFFFFFB
jmp 0xde0de
movq (%rsp), %rax
cmpl $0x3f53, 0x8(%rax)      # imm = 0x3F53
je 0xddfd9
movq (%rsp), %rax
movl $0x3f53, 0x8(%rax)      # imm = 0x3F53
movq (%rsp), %rax
movl 0x58(%rax), %ecx
andl $0x7, %ecx
movq (%rsp), %rax
movq 0x50(%rax), %rdx
movl %ecx, %ecx
shrq %cl, %rdx
movq %rdx, %rcx
movq %rcx, 0x50(%rax)
movq (%rsp), %rax
movl 0x58(%rax), %edx
andl $0x7, %edx
movq (%rsp), %rax
movl 0x58(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x58(%rax)
movl $0x0, 0x24(%rsp)
movq (%rsp), %rax
cmpl $0x8, 0x58(%rax)
jb 0xddfb2
movq (%rsp), %rax
movq 0x50(%rax), %rax
movb %al, %cl
movl 0x24(%rsp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x24(%rsp)
movl %eax, %eax
movb %cl, 0xc(%rsp,%rax)
movq (%rsp), %rax
movq 0x50(%rax), %rcx
shrq $0x8, %rcx
movq %rcx, 0x50(%rax)
movq (%rsp), %rax
movl 0x58(%rax), %ecx
subl $0x8, %ecx
movl %ecx, 0x58(%rax)
jmp 0xddf6c
movq (%rsp), %rax
movl $0x0, 0x8c(%rax)
movq (%rsp), %rdi
addq $0x8c, %rdi
leaq 0xc(%rsp), %rsi
movl 0x24(%rsp), %edx
callq 0xde0f0
movq (%rsp), %rdi
addq $0x8c, %rdi
movq 0x28(%rsp), %rax
movq (%rax), %rsi
movq 0x28(%rsp), %rax
movl 0x8(%rax), %edx
callq 0xde0f0
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %edx
movq 0x28(%rsp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
movl 0x24(%rsp), %edx
movq 0x28(%rsp), %rax
movq (%rax), %rcx
movl %edx, %edx
addq %rdx, %rcx
movq %rcx, (%rax)
movl 0x24(%rsp), %eax
movl %eax, %ecx
movq 0x28(%rsp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq (%rsp), %rax
cmpl $0x4, 0x8c(%rax)
je 0xde04f
movl $0xfffffffd, 0x34(%rsp) # imm = 0xFFFFFFFD
jmp 0xde0de
movq (%rsp), %rax
cmpl $-0x1, 0x18(%rax)
jne 0xde066
movq (%rsp), %rax
movl $0x0, 0x10(%rax)
jmp 0xde073
movq (%rsp), %rax
movl 0x10(%rax), %ecx
andl $-0x5, %ecx
movl %ecx, 0x10(%rax)
movq (%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rdi
callq 0xd9e00
movq 0x18(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x10(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x28(%rax)
movl 0x20(%rsp), %ecx
movq (%rsp), %rax
movl %ecx, 0x18(%rax)
movq (%rsp), %rax
movl $0x3f3f, 0x8(%rax)      # imm = 0x3F3F
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw (%rax,%rax)