// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/zlib-1.3.0.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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x20(%rsp), %rdi
callq 0xd9d70
cmpl $0x0, %eax
jne 0xde245
cmpq $0x0, 0x28(%rsp)
jne 0xde252
movl $0xfffffffe, 0x34(%rsp) # imm = 0xFFFFFFFE
jmp 0xde488
movq 0x20(%rsp), %rax
movq 0x38(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x50(%rcx), %rdi
movl $0x1, %esi
movl $0x1bf8, %edx           # imm = 0x1BF8
callq *%rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0xde298
movl $0xfffffffc, 0x34(%rsp) # imm = 0xFFFFFFFC
jmp 0xde488
movq $0x0, 0x8(%rsp)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x48(%rax)
je 0xde30a
movq 0x20(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x50(%rcx), %rdi
movq 0x18(%rsp), %rcx
movl 0x38(%rcx), %ecx
movl $0x1, %esi
shll %cl, %esi
movl $0x1, %edx
callq *%rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0xde308
movq 0x20(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x50(%rcx), %rdi
movq 0x10(%rsp), %rsi
callq *%rax
movl $0xfffffffc, 0x34(%rsp) # imm = 0xFFFFFFFC
jmp 0xde488
jmp 0xde30a
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl $0x70, %edx
callq 0xb500
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl $0x1bf8, %edx           # imm = 0x1BF8
callq 0xb500
movq 0x28(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, (%rax)
movq 0x18(%rsp), %rax
movq 0x68(%rax), %rax
movq 0x18(%rsp), %rcx
addq $0x558, %rcx            # imm = 0x558
cmpq %rcx, %rax
jb 0xde3f2
movq 0x18(%rsp), %rax
movq 0x68(%rax), %rax
movq 0x18(%rsp), %rcx
addq $0x558, %rcx            # imm = 0x558
addq $0x1690, %rcx           # imm = 0x1690
addq $-0x4, %rcx
cmpq %rcx, %rax
ja 0xde3f2
movq 0x10(%rsp), %rcx
addq $0x558, %rcx            # imm = 0x558
movq 0x18(%rsp), %rax
movq 0x68(%rax), %rax
movq 0x18(%rsp), %rdx
addq $0x558, %rdx            # imm = 0x558
subq %rdx, %rax
sarq $0x2, %rax
shlq $0x2, %rax
addq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x68(%rax)
movq 0x10(%rsp), %rcx
addq $0x558, %rcx            # imm = 0x558
movq 0x18(%rsp), %rax
movq 0x70(%rax), %rax
movq 0x18(%rsp), %rdx
addq $0x558, %rdx            # imm = 0x558
subq %rdx, %rax
sarq $0x2, %rax
shlq $0x2, %rax
addq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x70(%rax)
movq 0x10(%rsp), %rcx
addq $0x558, %rcx            # imm = 0x558
movq 0x18(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x18(%rsp), %rdx
addq $0x558, %rdx            # imm = 0x558
subq %rdx, %rax
sarq $0x2, %rax
shlq $0x2, %rax
addq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x90(%rax)
cmpq $0x0, 0x8(%rsp)
je 0xde464
movq 0x18(%rsp), %rax
movl 0x38(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x4(%rsp)
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rsi
movl 0x4(%rsp), %eax
movl %eax, %edx
callq 0xb500
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x48(%rax)
movq 0x10(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x38(%rax)
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)