// File: /workspace/github_cpp_makefile_star2_O1/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:
cmpl $0x0, 0xd4(%rdi)
js 0x162e2
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %r14d
movq %rdi, %rbx
movl 0xcc(%rdi), %ecx
cmpl %esi, %ecx
jge 0x162d4
movslq 0x28(%rbx), %rax
movq %rax, -0x48(%rbp)
movl 0x4c(%rbx), %eax
movl %eax, -0x34(%rbp)
movl 0x50(%rbx), %eax
movl %eax, -0x30(%rbp)
movl 0x58(%rbx), %r15d
movl 0x20(%rbx), %eax
movl %eax, -0x2c(%rbp)
movq 0x18(%rbx), %rax
movq %rax, -0x40(%rbp)
addl %r15d, %r15d
addl 0x6c(%rbx), %r15d
movq 0xd8(%rbx), %r13
movl 0xc8(%rbx), %eax
sarl $0x2, %eax
movslq %eax, %r12
testl %ecx, %ecx
js 0x1628d
cmpl 0x24(%rbx), %ecx
jge 0x1628d
movslq %ecx, %rdx
imulq -0x48(%rbp), %rdx
addq -0x40(%rbp), %rdx
movslq 0xd4(%rbx), %rax
imulq %r12, %rax
leaq (,%rax,4), %rcx
addq %r13, %rcx
movl %r15d, (%rsp)
movq %rbx, %rdi
movl -0x2c(%rbp), %esi
movl -0x34(%rbp), %r8d
movl -0x30(%rbp), %r9d
callq 0x15a91
movl 0xcc(%rbx), %ecx
cmpl 0xd0(%rbx), %ecx
je 0x162bf
incl %ecx
movl %ecx, 0xcc(%rbx)
movl 0xd4(%rbx), %eax
incl %eax
cltd
idivl 0xb4(%rbx)
movl %edx, 0xd4(%rbx)
cmpl %r14d, %ecx
jl 0x1624b
jmp 0x162d4
movl $0xffffffff, 0xd4(%rbx) # imm = 0xFFFFFFFF
movq $0x0, 0xcc(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq