// File: /workspace/github_c_makefile_star2_O0/algorithm-archivists[P]GathVL/src/objects/../../include/stb_image_resize.h
// Function: stbir__buffer_loop_downsample(stbir__info*)
static void stbir__buffer_loop_downsample(stbir__info* stbir_info)
{
    int y;
    float scale_ratio = stbir_info->vertical_scale;
    int output_h = stbir_info->output_h;
    float in_pixels_radius = stbir__filter_info_table[stbir_info->vertical_filter].support(scale_ratio) / scale_ratio;
    int pixel_margin = stbir_info->vertical_filter_pixel_margin;
    int max_y = stbir_info->input_h + pixel_margin;

    STBIR_ASSERT(!stbir__use_height_upsampling(stbir_info));

    for (y = -pixel_margin; y < max_y; y++)
    {
        float out_center_of_in; // Center of the current out scanline in the in scanline space
        int out_first_scanline, out_last_scanline;

        stbir__calculate_sample_range_downsample(y, in_pixels_radius, scale_ratio, stbir_info->vertical_shift, &out_first_scanline, &out_last_scanline, &out_center_of_in);

        STBIR_ASSERT(out_last_scanline - out_first_scanline + 1 <= stbir_info->ring_buffer_num_entries);

        if (out_last_scanline < 0 || out_first_scanline >= output_h)
            continue;

        stbir__empty_ring_buffer(stbir_info, out_first_scanline);

        stbir__decode_and_resample_downsample(stbir_info, y);

        // Load in new ones.
        if (stbir_info->ring_buffer_begin_index < 0)
            stbir__add_empty_ring_buffer_entry(stbir_info, out_first_scanline);

        while (out_last_scanline > stbir_info->ring_buffer_last_scanline)
            stbir__add_empty_ring_buffer_entry(stbir_info, stbir_info->ring_buffer_last_scanline + 1);

        // Now the horizontal buffer is ready to write to all ring buffer rows.
        stbir__resample_vertical_downsample(stbir_info, y);
    }

    stbir__empty_ring_buffer(stbir_info, stbir_info->output_h);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movss 0x48(%rax), %xmm0
movss %xmm0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x60(%rax), %eax
movl %eax, %ecx
leaq 0x1dc4c(%rip), %rax     # 0x4f5a0
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movss -0x10(%rbp), %xmm0
callq *%rax
divss -0x10(%rbp), %xmm0
movss %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0xbc(%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30f00
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x319a1
jmp 0x319a3
jmp 0x319c2
leaq 0xbacb(%rip), %rdi      # 0x3d475
leaq 0xaf68(%rip), %rsi      # 0x3c919
movl $0x878, %edx            # imm = 0x878
leaq 0xbae2(%rip), %rcx      # 0x3d49f
callq 0x50f0
xorl %eax, %eax
subl -0x1c(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x31ab7
movl -0xc(%rbp), %edi
movss -0x18(%rbp), %xmm0
movss -0x10(%rbp), %xmm1
movq -0x8(%rbp), %rax
movss 0x40(%rax), %xmm2
leaq -0x28(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
leaq -0x24(%rbp), %rcx
callq 0x31f40
movl -0x2c(%rbp), %eax
subl -0x28(%rbp), %eax
addl $0x1, %eax
movq -0x8(%rbp), %rcx
cmpl 0xcc(%rcx), %eax
jg 0x31a14
jmp 0x31a33
leaq 0xbab6(%rip), %rdi      # 0x3d4d1
leaq 0xaef7(%rip), %rsi      # 0x3c919
movl $0x881, %edx            # imm = 0x881
leaq 0xba71(%rip), %rcx      # 0x3d49f
callq 0x50f0
cmpl $0x0, -0x2c(%rbp)
jl 0x31a41
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x31a43
jmp 0x31aa9
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x35430
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x355e0
movq -0x8(%rbp), %rax
cmpl $0x0, 0xd8(%rax)
jge 0x31a74
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x33e80
jmp 0x31a76
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xd4(%rcx), %eax
jle 0x31a9d
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0xd4(%rax), %esi
addl $0x1, %esi
callq 0x33e80
jmp 0x31a76
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x35670
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x319ca
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x24(%rax), %esi
callq 0x35430
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)