// File: /workspace/github_c_makefile_star2_O2/algorithm-archivists[P]GathVL/src/objects/../../include/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->ring_buffer_num_entries;
            }
        }
    }
}

// Assembly:
movl 0xd8(%rdi), %edx
testl %edx, %edx
js 0x1826f
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movslq 0x28(%rdi), %rax
movq %rax, 0x20(%rsp)
movl 0x4c(%rdi), %eax
movl %eax, 0x1c(%rsp)
movl 0x50(%rdi), %eax
movl %eax, 0x18(%rsp)
movl 0x58(%rdi), %r13d
movl 0x20(%rdi), %eax
movl %eax, 0x14(%rsp)
movq 0x18(%rdi), %r14
addl %r13d, %r13d
addl 0x6c(%rdi), %r13d
movq 0xe0(%rdi), %r15
movl 0xc8(%rdi), %r12d
sarl $0x2, %r12d
movl 0xd0(%rdi), %ecx
cmpl %ebp, %ecx
jge 0x18261
testl %ecx, %ecx
js 0x1822b
cmpl 0x24(%rbx), %ecx
jge 0x1822b
movslq %ecx, %rax
imulq 0x20(%rsp), %rax
addq %r14, %rax
imull %r12d, %edx
movslq %edx, %rcx
leaq (%r15,%rcx,4), %rcx
movl %r13d, (%rsp)
movq %rbx, %rdi
movl 0x14(%rsp), %esi
movq %rax, %rdx
movl 0x1c(%rsp), %r8d
movl 0x18(%rsp), %r9d
callq 0x17ab0
movl 0xd0(%rbx), %ecx
cmpl 0xd4(%rbx), %ecx
je 0x18252
incl %ecx
movl %ecx, 0xd0(%rbx)
movl 0xd8(%rbx), %eax
incl %eax
cltd
idivl 0xcc(%rbx)
movl %edx, 0xd8(%rbx)
jmp 0x181e4
orl $-0x1, 0xd8(%rbx)
andq $0x0, 0xd0(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq