// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/zlib-1.3.0.1/gzread.c
// Function: gzungetc
int ZEXPORT gzungetc(int c, gzFile file) {
    gz_statep state;

    /* get internal structure */
    if (file == NULL)
        return -1;
    state = (gz_statep)file;

    /* in case this was just opened, set up the input buffer */
    if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
        (void)gz_look(state);

    /* check that we're reading and that there's no (serious) error */
    if (state->mode != GZ_READ ||
        (state->err != Z_OK && state->err != Z_BUF_ERROR))
        return -1;

    /* process a skip request */
    if (state->seek) {
        state->seek = 0;
        if (gz_skip(state, state->skip) == -1)
            return -1;
    }

    /* can't push EOF */
    if (c < 0)
        return -1;

    /* if output buffer empty, put byte at end (allows more pushing) */
    if (state->x.have == 0) {
        state->x.have = 1;
        state->x.next = state->out + (state->size << 1) - 1;
        state->x.next[0] = (unsigned char)c;
        state->x.pos--;
        state->past = 0;
        return c;
    }

    /* if no room, give up (must have already done a gzungetc()) */
    if (state->x.have == (state->size << 1)) {
        gz_error(state, Z_DATA_ERROR, "out of room to push characters");
        return -1;
    }

    /* slide output data if needed and insert byte before existing data */
    if (state->x.next == state->out) {
        unsigned char *src = state->out + state->x.have;
        unsigned char *dest = state->out + (state->size << 1);
        while (src > state->out)
            *--dest = *--src;
        state->x.next = dest;
    }
    state->x.have++;
    state->x.next--;
    state->x.next[0] = (unsigned char)c;
    state->x.pos--;
    state->past = 0;
    return c;
}

// Assembly:
subq $0x28, %rsp
movl %edi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0xcdc02
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0xcde49
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
cmpl $0x1c4f, 0x18(%rax)     # imm = 0x1C4F
jne 0xcdc39
movq 0x10(%rsp), %rax
cmpl $0x0, 0x44(%rax)
jne 0xcdc39
movq 0x10(%rsp), %rax
cmpl $0x0, (%rax)
jne 0xcdc39
movq 0x10(%rsp), %rdi
callq 0xcde60
movq 0x10(%rsp), %rax
cmpl $0x1c4f, 0x18(%rax)     # imm = 0x1C4F
jne 0xcdc5d
movq 0x10(%rsp), %rax
cmpl $0x0, 0x74(%rax)
je 0xcdc6a
movq 0x10(%rsp), %rax
cmpl $-0x5, 0x74(%rax)
je 0xcdc6a
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0xcde49
movq 0x10(%rsp), %rax
cmpl $0x0, 0x70(%rax)
je 0xcdca8
movq 0x10(%rsp), %rax
movl $0x0, 0x70(%rax)
movq 0x10(%rsp), %rdi
movq 0x10(%rsp), %rax
movq 0x68(%rax), %rsi
callq 0xce130
cmpl $-0x1, %eax
jne 0xcdca6
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0xcde49
jmp 0xcdca8
cmpl $0x0, 0x20(%rsp)
jge 0xcdcbc
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0xcde49
movq 0x10(%rsp), %rax
cmpl $0x0, (%rax)
jne 0xcdd31
movq 0x10(%rsp), %rax
movl $0x1, (%rax)
movq 0x10(%rsp), %rax
movq 0x38(%rax), %rcx
movq 0x10(%rsp), %rax
movl 0x28(%rax), %eax
shll %eax
movl %eax, %eax
addq %rax, %rcx
addq $-0x1, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x8(%rax)
movl 0x20(%rsp), %eax
movb %al, %cl
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movb %cl, (%rax)
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
movq 0x10(%rsp), %rax
movl $0x0, 0x54(%rax)
movl 0x20(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0xcde49
movq 0x10(%rsp), %rax
movl (%rax), %eax
movq 0x10(%rsp), %rcx
movl 0x28(%rcx), %ecx
shll %ecx
cmpl %ecx, %eax
jne 0xcdd69
movq 0x10(%rsp), %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
leaq 0xa8510(%rip), %rdx     # 0x176267
callq 0xcd150
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0xcde49
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rsp), %rcx
cmpq 0x38(%rcx), %rax
jne 0xcddf6
movq 0x10(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rsp), %rcx
movl (%rcx), %ecx
addq %rcx, %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rsp), %rcx
movl 0x28(%rcx), %ecx
shll %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, (%rsp)
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
cmpq 0x38(%rcx), %rax
jbe 0xcdde9
movq 0x8(%rsp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rsp)
movb -0x1(%rax), %cl
movq (%rsp), %rax
movq %rax, %rdx
addq $-0x1, %rdx
movq %rdx, (%rsp)
movb %cl, -0x1(%rax)
jmp 0xcddb1
movq (%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movl 0x20(%rsp), %eax
movb %al, %cl
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movb %cl, (%rax)
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
movq 0x10(%rsp), %rax
movl $0x0, 0x54(%rax)
movl 0x20(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)