// File: lunasorcery[P]brailify/./stb/stb_image_resize.h
// Function: stbir__empty_ring_buffer(stbir__info*, int)
static void stbir__empty_ring_buffer(stbir__info* stbir_info, int first_necessary_scanline)
{
    int output_stride_bytes = stbir_info->output_stride_bytes;
    int channels = stbir_info->channels;
    int alpha_channel = stbir_info->alpha_channel;
    int type = stbir_info->type;
    int colorspace = stbir_info->colorspace;
    int output_w = stbir_info->output_w;
    void* output_data = stbir_info->output_data;
    int decode = STBIR__DECODE(type, colorspace);

    float* ring_buffer = stbir_info->ring_buffer;
    int ring_buffer_length = stbir_info->ring_buffer_length_bytes/sizeof(float);

    if (stbir_info->ring_buffer_begin_index >= 0)
    {
        // Get rid of whatever we don't need anymore.
        while (first_necessary_scanline > stbir_info->ring_buffer_first_scanline)
        {
            if (stbir_info->ring_buffer_first_scanline >= 0 && stbir_info->ring_buffer_first_scanline < stbir_info->output_h)
            {
                int output_row_start = stbir_info->ring_buffer_first_scanline * output_stride_bytes;
                float* ring_buffer_entry = stbir__get_ring_buffer_entry(ring_buffer, stbir_info->ring_buffer_begin_index, ring_buffer_length);
                stbir__encode_scanline(stbir_info, output_w, (char *) output_data + output_row_start, ring_buffer_entry, channels, alpha_channel, decode);
                STBIR_PROGRESS_REPORT((float)stbir_info->ring_buffer_first_scanline / stbir_info->output_h);
            }

            if (stbir_info->ring_buffer_first_scanline == stbir_info->ring_buffer_last_scanline)
            {
                // We just popped the last scanline off the ring buffer.
                // Reset it to the empty state.
                stbir_info->ring_buffer_begin_index = -1;
                stbir_info->ring_buffer_first_scanline = 0;
                stbir_info->ring_buffer_last_scanline = 0;
                break;
            }
            else
            {
                stbir_info->ring_buffer_first_scanline++;
                stbir_info->ring_buffer_begin_index = (stbir_info->ring_buffer_begin_index + 1) % stbir_info->vertical_filter_pixel_width;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x4c(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x50(%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl 0x6c(%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x1c(%rbp), %eax
shll %eax
addl -0x20(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movslq 0xc8(%rax), %rax
shrq $0x2, %rax
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0xd4(%rax)
jl 0x1ef2b
jmp 0x1ee26
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xcc(%rcx), %eax
jle 0x1ef29
movq -0x8(%rbp), %rax
cmpl $0x0, 0xcc(%rax)
jl 0x1eead
movq -0x8(%rbp), %rax
movl 0xcc(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x24(%rcx), %eax
jge 0x1eead
movq -0x8(%rbp), %rax
movl 0xcc(%rax), %eax
imull -0x10(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0xd4(%rax), %esi
movl -0x44(%rbp), %edx
callq 0x1e3b0
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
movq -0x30(%rbp), %rdx
movslq -0x48(%rbp), %rax
addq %rax, %rdx
movq -0x50(%rbp), %rcx
movl -0x14(%rbp), %r8d
movl -0x18(%rbp), %r9d
movl -0x34(%rbp), %eax
movl %eax, (%rsp)
callq 0x1e430
movq -0x8(%rbp), %rax
movl 0xcc(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0xd0(%rcx), %eax
jne 0x1eeef
movq -0x8(%rbp), %rax
movl $0xffffffff, 0xd4(%rax) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movl $0x0, 0xcc(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0xd0(%rax)
jmp 0x1ef29
movq -0x8(%rbp), %rax
movl 0xcc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xcc(%rax)
movq -0x8(%rbp), %rax
movl 0xd4(%rax), %eax
addl $0x1, %eax
movq -0x8(%rbp), %rcx
cltd
idivl 0xb4(%rcx)
movq -0x8(%rbp), %rax
movl %edx, 0xd4(%rax)
jmp 0x1ee26
jmp 0x1ef2b
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)