// File: lunasorcery[P]brailify/./stb/stb_image_resize.h
// Function: stbir__resample_vertical_upsample(stbir__info*, int, int, int, float)
static void stbir__resample_vertical_upsample(stbir__info* stbir_info, int n, int in_first_scanline, int in_last_scanline, float in_center_of_out)
{
    int x, k;
    int output_w = stbir_info->output_w;
    stbir__contributors* vertical_contributors = stbir_info->vertical_contributors;
    float* vertical_coefficients = stbir_info->vertical_coefficients;
    int channels = stbir_info->channels;
    int alpha_channel = stbir_info->alpha_channel;
    int type = stbir_info->type;
    int colorspace = stbir_info->colorspace;
    int kernel_pixel_width = stbir_info->vertical_filter_pixel_width;
    void* output_data = stbir_info->output_data;
    float* encode_buffer = stbir_info->encode_buffer;
    int decode = STBIR__DECODE(type, colorspace);
    int coefficient_width = stbir_info->vertical_coefficient_width;
    int coefficient_counter;
    int contributor = n;

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

    int n0,n1, output_row_start;
    int coefficient_group = coefficient_width * contributor;

    n0 = vertical_contributors[contributor].n0;
    n1 = vertical_contributors[contributor].n1;

    output_row_start = n * stbir_info->output_stride_bytes;

    STBIR_ASSERT(stbir__use_height_upsampling(stbir_info));

    memset(encode_buffer, 0, output_w * sizeof(float) * channels);

    // I tried reblocking this for better cache usage of encode_buffer
    // (using x_outer, k, x_inner), but it lost speed. -- stb

    coefficient_counter = 0;
    switch (channels) {
        case 1:
            for (k = n0; k <= n1; k++)
            {
                int coefficient_index = coefficient_counter++;
                float* ring_buffer_entry = stbir__get_ring_buffer_scanline(k, ring_buffer, ring_buffer_begin_index, ring_buffer_first_scanline, kernel_pixel_width, ring_buffer_length);
                float coefficient = vertical_coefficients[coefficient_group + coefficient_index];
                for (x = 0; x < output_w; ++x)
                {
                    int in_pixel_index = x * 1;
                    encode_buffer[in_pixel_index + 0] += ring_buffer_entry[in_pixel_index + 0] * coefficient;
                }
            }
            break;
        case 2:
            for (k = n0; k <= n1; k++)
            {
                int coefficient_index = coefficient_counter++;
                float* ring_buffer_entry = stbir__get_ring_buffer_scanline(k, ring_buffer, ring_buffer_begin_index, ring_buffer_first_scanline, kernel_pixel_width, ring_buffer_length);
                float coefficient = vertical_coefficients[coefficient_group + coefficient_index];
                for (x = 0; x < output_w; ++x)
                {
                    int in_pixel_index = x * 2;
                    encode_buffer[in_pixel_index + 0] += ring_buffer_entry[in_pixel_index + 0] * coefficient;
                    encode_buffer[in_pixel_index + 1] += ring_buffer_entry[in_pixel_index + 1] * coefficient;
                }
            }
            break;
        case 3:
            for (k = n0; k <= n1; k++)
            {
                int coefficient_index = coefficient_counter++;
                float* ring_buffer_entry = stbir__get_ring_buffer_scanline(k, ring_buffer, ring_buffer_begin_index, ring_buffer_first_scanline, kernel_pixel_width, ring_buffer_length);
                float coefficient = vertical_coefficients[coefficient_group + coefficient_index];
                for (x = 0; x < output_w; ++x)
                {
                    int in_pixel_index = x * 3;
                    encode_buffer[in_pixel_index + 0] += ring_buffer_entry[in_pixel_index + 0] * coefficient;
                    encode_buffer[in_pixel_index + 1] += ring_buffer_entry[in_pixel_index + 1] * coefficient;
                    encode_buffer[in_pixel_index + 2] += ring_buffer_entry[in_pixel_index + 2] * coefficient;
                }
            }
            break;
        case 4:
            for (k = n0; k <= n1; k++)
            {
                int coefficient_index = coefficient_counter++;
                float* ring_buffer_entry = stbir__get_ring_buffer_scanline(k, ring_buffer, ring_buffer_begin_index, ring_buffer_first_scanline, kernel_pixel_width, ring_buffer_length);
                float coefficient = vertical_coefficients[coefficient_group + coefficient_index];
                for (x = 0; x < output_w; ++x)
                {
                    int in_pixel_index = x * 4;
                    encode_buffer[in_pixel_index + 0] += ring_buffer_entry[in_pixel_index + 0] * coefficient;
                    encode_buffer[in_pixel_index + 1] += ring_buffer_entry[in_pixel_index + 1] * coefficient;
                    encode_buffer[in_pixel_index + 2] += ring_buffer_entry[in_pixel_index + 2] * coefficient;
                    encode_buffer[in_pixel_index + 3] += ring_buffer_entry[in_pixel_index + 3] * coefficient;
                }
            }
            break;
        default:
            for (k = n0; k <= n1; k++)
            {
                int coefficient_index = coefficient_counter++;
                float* ring_buffer_entry = stbir__get_ring_buffer_scanline(k, ring_buffer, ring_buffer_begin_index, ring_buffer_first_scanline, kernel_pixel_width, ring_buffer_length);
                float coefficient = vertical_coefficients[coefficient_group + coefficient_index];
                for (x = 0; x < output_w; ++x)
                {
                    int in_pixel_index = x * channels;
                    int c;
                    for (c = 0; c < channels; c++)
                        encode_buffer[in_pixel_index + c] += ring_buffer_entry[in_pixel_index + c] * coefficient;
                }
            }
            break;
    }
    stbir__encode_scanline(stbir_info, output_w, (char *) output_data + output_row_start, encode_buffer, channels, alpha_channel, decode);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movss %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movl 0x4c(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movl 0x50(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rax
movl 0x6c(%rax), %eax
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movl 0xb4(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0xe0(%rax), %rax
movq %rax, -0x60(%rbp)
movl -0x44(%rbp), %eax
shll %eax
addl -0x48(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rax
movl 0xac(%rax), %eax
movl %eax, -0x68(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movl 0xd4(%rax), %eax
movl %eax, -0x7c(%rbp)
movq -0x8(%rbp), %rax
movl 0xcc(%rax), %eax
movl %eax, -0x80(%rbp)
movq -0x8(%rbp), %rax
movl 0xd0(%rax), %eax
movl %eax, -0x84(%rbp)
movq -0x8(%rbp), %rax
movslq 0xc8(%rax), %rax
shrq $0x2, %rax
movl %eax, -0x88(%rbp)
movl -0x68(%rbp), %eax
imull -0x70(%rbp), %eax
movl %eax, -0x98(%rbp)
movq -0x30(%rbp), %rax
movslq -0x70(%rbp), %rcx
movl (%rax,%rcx,8), %eax
movl %eax, -0x8c(%rbp)
movq -0x30(%rbp), %rax
movslq -0x70(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %eax
movl %eax, -0x90(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
imull 0x28(%rcx), %eax
movl %eax, -0x94(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1a730
cmpl $0x0, %eax
je 0x1c0c2
jmp 0x1c0e1
leaq 0x5c39(%rip), %rdi      # 0x21d02
leaq 0x509a(%rip), %rsi      # 0x2116a
movl $0x760, %edx            # imm = 0x760
leaq 0x5b89(%rip), %rcx      # 0x21c65
callq 0x1090
movq -0x60(%rbp), %rdi
movslq -0x24(%rbp), %rdx
movslq -0x3c(%rbp), %rax
imulq %rax, %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x1070
movl $0x0, -0x6c(%rbp)
movl -0x3c(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x120(%rbp)
subl $0x3, %eax
ja 0x1c677
movq -0x120(%rbp), %rax
leaq 0x4150(%rip), %rcx      # 0x20278
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x8c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x90(%rbp), %eax
jg 0x1c216
movl -0x6c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x6c(%rbp)
movl %eax, -0x9c(%rbp)
movl -0x20(%rbp), %edi
movq -0x78(%rbp), %rsi
movl -0x7c(%rbp), %edx
movl -0x80(%rbp), %ecx
movl -0x4c(%rbp), %r8d
movl -0x88(%rbp), %r9d
callq 0x1e3e0
movq %rax, -0xa8(%rbp)
movq -0x38(%rbp), %rax
movl -0x98(%rbp), %ecx
addl -0x9c(%rbp), %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0xac(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x1c206
movl -0x1c(%rbp), %eax
shll $0x0, %eax
movl %eax, -0xb0(%rbp)
movq -0xa8(%rbp), %rax
movl -0xb0(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss -0xac(%rbp), %xmm2
movq -0x60(%rbp), %rax
movl -0xb0(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1c1a5
jmp 0x1c208
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1c13a
jmp 0x1c794
movl -0x8c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x90(%rbp), %eax
jg 0x1c348
movl -0x6c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x6c(%rbp)
movl %eax, -0xb4(%rbp)
movl -0x20(%rbp), %edi
movq -0x78(%rbp), %rsi
movl -0x7c(%rbp), %edx
movl -0x80(%rbp), %ecx
movl -0x4c(%rbp), %r8d
movl -0x88(%rbp), %r9d
callq 0x1e3e0
movq %rax, -0xc0(%rbp)
movq -0x38(%rbp), %rax
movl -0x98(%rbp), %ecx
addl -0xb4(%rbp), %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0xc4(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x1c338
movl -0x1c(%rbp), %eax
shll %eax
movl %eax, -0xc8(%rbp)
movq -0xc0(%rbp), %rax
movl -0xc8(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss -0xc4(%rbp), %xmm2
movq -0x60(%rbp), %rax
movl -0xc8(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movq -0xc0(%rbp), %rax
movl -0xc8(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss -0xc4(%rbp), %xmm2
movq -0x60(%rbp), %rax
movl -0xc8(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1c28f
jmp 0x1c33a
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1c224
jmp 0x1c794
movl -0x8c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x90(%rbp), %eax
jg 0x1c4bb
movl -0x6c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x6c(%rbp)
movl %eax, -0xcc(%rbp)
movl -0x20(%rbp), %edi
movq -0x78(%rbp), %rsi
movl -0x7c(%rbp), %edx
movl -0x80(%rbp), %ecx
movl -0x4c(%rbp), %r8d
movl -0x88(%rbp), %r9d
callq 0x1e3e0
movq %rax, -0xd8(%rbp)
movq -0x38(%rbp), %rax
movl -0x98(%rbp), %ecx
addl -0xcc(%rbp), %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0xdc(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x1c4ab
imull $0x3, -0x1c(%rbp), %eax
movl %eax, -0xe0(%rbp)
movq -0xd8(%rbp), %rax
movl -0xe0(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss -0xdc(%rbp), %xmm2
movq -0x60(%rbp), %rax
movl -0xe0(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movq -0xd8(%rbp), %rax
movl -0xe0(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss -0xdc(%rbp), %xmm2
movq -0x60(%rbp), %rax
movl -0xe0(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movq -0xd8(%rbp), %rax
movl -0xe0(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss -0xdc(%rbp), %xmm2
movq -0x60(%rbp), %rax
movl -0xe0(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1c3c1
jmp 0x1c4ad
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1c356
jmp 0x1c794
movl -0x8c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x90(%rbp), %eax
jg 0x1c672
movl -0x6c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x6c(%rbp)
movl %eax, -0xe4(%rbp)
movl -0x20(%rbp), %edi
movq -0x78(%rbp), %rsi
movl -0x7c(%rbp), %edx
movl -0x80(%rbp), %ecx
movl -0x4c(%rbp), %r8d
movl -0x88(%rbp), %r9d
callq 0x1e3e0
movq %rax, -0xf0(%rbp)
movq -0x38(%rbp), %rax
movl -0x98(%rbp), %ecx
addl -0xe4(%rbp), %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0xf4(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x1c662
movl -0x1c(%rbp), %eax
shll $0x2, %eax
movl %eax, -0xf8(%rbp)
movq -0xf0(%rbp), %rax
movl -0xf8(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss -0xf4(%rbp), %xmm2
movq -0x60(%rbp), %rax
movl -0xf8(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movq -0xf0(%rbp), %rax
movl -0xf8(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss -0xf4(%rbp), %xmm2
movq -0x60(%rbp), %rax
movl -0xf8(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movq -0xf0(%rbp), %rax
movl -0xf8(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss -0xf4(%rbp), %xmm2
movq -0x60(%rbp), %rax
movl -0xf8(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movq -0xf0(%rbp), %rax
movl -0xf8(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss -0xf4(%rbp), %xmm2
movq -0x60(%rbp), %rax
movl -0xf8(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1c534
jmp 0x1c664
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1c4c9
jmp 0x1c794
movl -0x8c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x90(%rbp), %eax
jg 0x1c792
movl -0x6c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x6c(%rbp)
movl %eax, -0xfc(%rbp)
movl -0x20(%rbp), %edi
movq -0x78(%rbp), %rsi
movl -0x7c(%rbp), %edx
movl -0x80(%rbp), %ecx
movl -0x4c(%rbp), %r8d
movl -0x88(%rbp), %r9d
callq 0x1e3e0
movq %rax, -0x108(%rbp)
movq -0x38(%rbp), %rax
movl -0x98(%rbp), %ecx
addl -0xfc(%rbp), %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x10c(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x1c782
movl -0x1c(%rbp), %eax
imull -0x3c(%rbp), %eax
movl %eax, -0x110(%rbp)
movl $0x0, -0x114(%rbp)
movl -0x114(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x1c772
movq -0x108(%rbp), %rax
movl -0x110(%rbp), %ecx
addl -0x114(%rbp), %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss -0x10c(%rbp), %xmm2
movq -0x60(%rbp), %rax
movl -0x110(%rbp), %ecx
addl -0x114(%rbp), %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x114(%rbp)
jmp 0x1c70e
jmp 0x1c774
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1c6eb
jmp 0x1c784
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1c680
jmp 0x1c794
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
movq -0x58(%rbp), %rdx
movslq -0x94(%rbp), %rax
addq %rax, %rdx
movq -0x60(%rbp), %rcx
movl -0x3c(%rbp), %r8d
movl -0x40(%rbp), %r9d
movl -0x64(%rbp), %eax
movl %eax, (%rsp)
callq 0x1e430
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopl (%rax)