// File: sisong[P]ApkDiffPatch/zlib1.3.1/inflate.c
// Function: inflateCopy
int ZEXPORT inflateCopy(z_streamp dest, z_streamp source) {
    struct inflate_state FAR *state;
    struct inflate_state FAR *copy;
    unsigned char FAR *window;
    unsigned wsize;

    /* check input */
    if (inflateStateCheck(source) || dest == Z_NULL)
        return Z_STREAM_ERROR;
    state = (struct inflate_state FAR *)source->state;

    /* allocate space */
    copy = (struct inflate_state FAR *)
           ZALLOC(source, 1, sizeof(struct inflate_state));
    if (copy == Z_NULL) return Z_MEM_ERROR;
    window = Z_NULL;
    if (state->window != Z_NULL) {
        window = (unsigned char FAR *)
                 ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
        if (window == Z_NULL) {
            ZFREE(source, copy);
            return Z_MEM_ERROR;
        }
    }

    /* copy state */
    zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
    zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
    copy->strm = dest;
    if (state->lencode >= state->codes &&
        state->lencode <= state->codes + ENOUGH - 1) {
        copy->lencode = copy->codes + (state->lencode - state->codes);
        copy->distcode = copy->codes + (state->distcode - state->codes);
    }
    copy->next = copy->codes + (state->next - state->codes);
    if (window != Z_NULL) {
        wsize = 1U << state->wbits;
        zmemcpy(window, state->window, wsize);
    }
    copy->window = window;
    dest->state = (struct internal_state FAR *)copy;
    return Z_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9ada0
cmpl $0x0, %eax
jne 0x9e185
cmpq $0x0, -0x10(%rbp)
jne 0x9e191
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x9e394
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x50(%rcx), %rdi
movl $0x1, %esi
movl $0x1bf8, %edx           # imm = 0x1BF8
callq *%rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x9e1d0
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x9e394
movq $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x9e237
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x50(%rcx), %rdi
movq -0x20(%rbp), %rcx
movl 0x38(%rcx), %ecx
movl $0x1, %esi
shll %cl, %esi
movl $0x1, %edx
callq *%rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x9e235
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x50(%rcx), %rdi
movq -0x28(%rbp), %rsi
callq *%rax
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x9e394
jmp 0x9e237
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x70, %edx
callq 0x4320
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x1bf8, %edx           # imm = 0x1BF8
callq 0x4320
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x20(%rbp), %rcx
addq $0x558, %rcx            # imm = 0x558
cmpq %rcx, %rax
jb 0x9e30d
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x20(%rbp), %rcx
addq $0x558, %rcx            # imm = 0x558
addq $0x1690, %rcx           # imm = 0x1690
addq $-0x4, %rcx
cmpq %rcx, %rax
ja 0x9e30d
movq -0x28(%rbp), %rcx
addq $0x558, %rcx            # imm = 0x558
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rax
movq -0x20(%rbp), %rdx
addq $0x558, %rdx            # imm = 0x558
subq %rdx, %rax
sarq $0x2, %rax
shlq $0x2, %rax
addq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x28(%rbp), %rcx
addq $0x558, %rcx            # imm = 0x558
movq -0x20(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x20(%rbp), %rdx
addq $0x558, %rdx            # imm = 0x558
subq %rdx, %rax
sarq $0x2, %rax
shlq $0x2, %rax
addq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x28(%rbp), %rcx
addq $0x558, %rcx            # imm = 0x558
movq -0x20(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x20(%rbp), %rdx
addq $0x558, %rdx            # imm = 0x558
subq %rdx, %rax
sarq $0x2, %rax
shlq $0x2, %rax
addq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x90(%rax)
cmpq $0x0, -0x30(%rbp)
je 0x9e375
movq -0x20(%rbp), %rax
movl 0x38(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rsi
movl -0x34(%rbp), %eax
movl %eax, %edx
callq 0x4320
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)