// File: sisong[P]ApkDiffPatch/zlib1.3.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:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9ada0
cmpl $0x0, %eax
je 0x9de56
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x9e031
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x9de82
movq -0x38(%rbp), %rax
cmpl $0x8, 0x58(%rax)
jae 0x9de82
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0x9e031
movq -0x38(%rbp), %rax
cmpl $0x3f53, 0x8(%rax)      # imm = 0x3F53
je 0x9df42
movq -0x38(%rbp), %rax
movl $0x3f53, 0x8(%rax)      # imm = 0x3F53
movq -0x38(%rbp), %rax
movl 0x58(%rax), %ecx
andl $0x7, %ecx
movq -0x38(%rbp), %rax
movq 0x50(%rax), %rdx
movl %ecx, %ecx
shrq %cl, %rdx
movq %rdx, %rcx
movq %rcx, 0x50(%rax)
movq -0x38(%rbp), %rax
movl 0x58(%rax), %edx
andl $0x7, %edx
movq -0x38(%rbp), %rax
movl 0x58(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x58(%rax)
movl $0x0, -0x14(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x8, 0x58(%rax)
jb 0x9df1d
movq -0x38(%rbp), %rax
movq 0x50(%rax), %rax
movb %al, %cl
movl -0x14(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x14(%rbp)
movl %eax, %eax
movb %cl, -0x2c(%rbp,%rax)
movq -0x38(%rbp), %rax
movq 0x50(%rax), %rcx
shrq $0x8, %rcx
movq %rcx, 0x50(%rax)
movq -0x38(%rbp), %rax
movl 0x58(%rax), %ecx
subl $0x8, %ecx
movl %ecx, 0x58(%rax)
jmp 0x9ded9
movq -0x38(%rbp), %rax
movl $0x0, 0x8c(%rax)
movq -0x38(%rbp), %rdi
addq $0x8c, %rdi
leaq -0x2c(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x9e040
movq -0x38(%rbp), %rdi
addq $0x8c, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x9e040
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
movl -0x14(%rbp), %edx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl %edx, %edx
addq %rdx, %rcx
movq %rcx, (%rax)
movl -0x14(%rbp), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
cmpl $0x4, 0x8c(%rax)
je 0x9dfae
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x9e031
movq -0x38(%rbp), %rax
cmpl $-0x1, 0x18(%rax)
jne 0x9dfc5
movq -0x38(%rbp), %rax
movl $0x0, 0x10(%rax)
jmp 0x9dfd2
movq -0x38(%rbp), %rax
movl 0x10(%rax), %ecx
andl $-0x5, %ecx
movl %ecx, 0x10(%rax)
movq -0x38(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9ae20
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movl -0x18(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x38(%rbp), %rax
movl $0x3f3f, 0x8(%rax)      # imm = 0x3F3F
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)