// File: /workspace/github_c_makefile_star2_O0/snej[P]zdelta/deflate.c
// Function: deflate_stored
local block_state deflate_stored(s, flush)
    deflate_state *s;
    int flush;
{
    /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
     * to pending_buf_size, and each stored block has a 5 byte header:
     */
    ulg max_block_size = 0xffff;
    ulg max_start;

    if (max_block_size > s->pending_buf_size - 5) {
        max_block_size = s->pending_buf_size - 5;
    }

    /* Copy as much as possible from input to output: */
    for (;;) {
        /* Fill the window as much as possible: */
        if (s->lookahead <= 1) {

            Assert(s->strstart < s->w_size+MAX_DIST(s) ||
		   s->block_start >= (long)s->w_size, "slide too late");

            fill_window(s);
            if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;

            if (s->lookahead == 0) break; /* flush the current block */
        }
	Assert(s->block_start >= 0L, "block gone");

	s->strstart += s->lookahead;
	s->lookahead = 0;

	/* Emit a stored block if pending_buf will be full: */
 	max_start = s->block_start + max_block_size;
        if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
	    /* strstart == 0 is possible when wraparound on 16-bit machine */
	    s->lookahead = (uInt)(s->strstart - max_start);
	    s->strstart = (uInt)max_start;
            FLUSH_BLOCK(s, 0);
	}
	/* Flush if we may have to slide, otherwise block_start may become
         * negative and the data will be gone:
         */
        if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
            FLUSH_BLOCK(s, 0);
	}
    }
    FLUSH_BLOCK(s, flush == ZD_FINISH);
    return flush == ZD_FINISH ? finish_done : block_done;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq $0xffff, -0x20(%rbp)    # imm = 0xFFFF
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
subq $0x5, %rcx
cmpq %rcx, %rax
jbe 0x33ac
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
subq $0x5, %rax
movq %rax, -0x20(%rbp)
jmp 0x33ae
movq -0x10(%rbp), %rax
cmpl $0x1, 0xbc(%rax)
ja 0x33f7
movq -0x10(%rbp), %rdi
callq 0x5140
movq -0x10(%rbp), %rax
cmpl $0x0, 0xbc(%rax)
jne 0x33e3
cmpl $0x0, -0x14(%rbp)
jne 0x33e3
movl $0x0, -0x4(%rbp)
jmp 0x36b5
movq -0x10(%rbp), %rax
cmpl $0x0, 0xbc(%rax)
jne 0x33f5
jmp 0x35ee
jmp 0x33f7
movq -0x10(%rbp), %rax
movl 0xbc(%rax), %ecx
movq -0x10(%rbp), %rax
addl 0xb4(%rax), %ecx
movl %ecx, 0xb4(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0xbc(%rax)
movq -0x10(%rbp), %rax
movq 0xa0(%rax), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xb4(%rax)
je 0x3453
movq -0x10(%rbp), %rax
movl 0xb4(%rax), %eax
cmpq -0x28(%rbp), %rax
jb 0x351d
movq -0x10(%rbp), %rax
movl 0xb4(%rax), %eax
subq -0x28(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xbc(%rax)
movq -0x28(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xb4(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
jl 0x34b1
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xa0(%rcx), %rcx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
jmp 0x34b9
xorl %eax, %eax
movq %rax, -0x38(%rbp)
jmp 0x34b9
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0xb4(%rax), %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
subq 0xa0(%rax), %rdx
xorl %ecx, %ecx
callq 0x7ce0
movq -0x10(%rbp), %rax
movl 0xb4(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x3280
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x20(%rax)
jne 0x351b
movl $0x0, -0x4(%rbp)
jmp 0x36b5
jmp 0x351d
movq -0x10(%rbp), %rax
movl 0xb4(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0xa0(%rcx), %rcx
subl %ecx, %eax
movq -0x10(%rbp), %rcx
movl 0x38(%rcx), %ecx
subl $0x1006, %ecx           # imm = 0x1006
cmpl %ecx, %eax
jb 0x35e9
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
jl 0x357d
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xa0(%rcx), %rcx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
jmp 0x3585
xorl %eax, %eax
movq %rax, -0x48(%rbp)
jmp 0x3585
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0xb4(%rax), %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
subq 0xa0(%rax), %rdx
xorl %ecx, %ecx
callq 0x7ce0
movq -0x10(%rbp), %rax
movl 0xb4(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x3280
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x20(%rax)
jne 0x35e7
movl $0x0, -0x4(%rbp)
jmp 0x36b5
jmp 0x35e9
jmp 0x33ae
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
jl 0x3622
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xa0(%rcx), %rcx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
jmp 0x362a
xorl %eax, %eax
movq %rax, -0x58(%rbp)
jmp 0x362a
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0xb4(%rax), %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
subq 0xa0(%rax), %rdx
cmpl $0x4, -0x14(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %ecx
callq 0x7ce0
movq -0x10(%rbp), %rax
movl 0xb4(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x3280
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x20(%rax)
jne 0x369f
movl -0x14(%rbp), %edx
xorl %eax, %eax
movl $0x2, %ecx
cmpl $0x4, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x36b5
movl -0x14(%rbp), %edx
movl $0x1, %eax
movl $0x3, %ecx
cmpl $0x4, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop