// File: /workspace/github_c_makefile_star2_O1/algorithm-archivists[P]GathVL/src/objects/../../include/stb_image_resize.h
// Function: stbir__calculate_memory(stbir__info*)
static stbir_uint32 stbir__calculate_memory(stbir__info *info)
{
    int pixel_margin = stbir__get_filter_pixel_margin(info->horizontal_filter, info->horizontal_scale);
    int filter_height = stbir__get_filter_pixel_width(info->vertical_filter, info->vertical_scale);

    info->horizontal_num_contributors = stbir__get_contributors(info->horizontal_scale, info->horizontal_filter, info->input_w, info->output_w);
    info->vertical_num_contributors   = stbir__get_contributors(info->vertical_scale  , info->vertical_filter  , info->input_h, info->output_h);

    // One extra entry because floating point precision problems sometimes cause an extra to be necessary.
    info->ring_buffer_num_entries = filter_height + 1;

    info->horizontal_contributors_size = info->horizontal_num_contributors * sizeof(stbir__contributors);
    info->horizontal_coefficients_size = stbir__get_total_horizontal_coefficients(info) * sizeof(float);
    info->vertical_contributors_size = info->vertical_num_contributors * sizeof(stbir__contributors);
    info->vertical_coefficients_size = stbir__get_total_vertical_coefficients(info) * sizeof(float);
    info->decode_buffer_size = (info->input_w + pixel_margin * 2) * info->channels * sizeof(float);
    info->horizontal_buffer_size = info->output_w * info->channels * sizeof(float);
    info->ring_buffer_size = info->output_w * info->channels * info->ring_buffer_num_entries * sizeof(float);
    info->encode_buffer_size = info->output_w * info->channels * sizeof(float);

    STBIR_ASSERT(info->horizontal_filter != 0);
    STBIR_ASSERT(info->horizontal_filter < STBIR__ARRAY_SIZE(stbir__filter_info_table)); // this now happens too late
    STBIR_ASSERT(info->vertical_filter != 0);
    STBIR_ASSERT(info->vertical_filter < STBIR__ARRAY_SIZE(stbir__filter_info_table)); // this now happens too late

    if (stbir__use_height_upsampling(info))
        // The horizontal buffer is for when we're downsampling the height and we
        // can't output the result of sampling the decode buffer directly into the
        // ring buffers.
        info->horizontal_buffer_size = 0;
    else
        // The encode buffer is to retain precision in the height upsampling method
        // and isn't used when height downsampling.
        info->encode_buffer_size = 0;

    return info->horizontal_contributors_size + info->horizontal_coefficients_size
        + info->vertical_contributors_size + info->vertical_coefficients_size
        + info->decode_buffer_size + info->horizontal_buffer_size
        + info->ring_buffer_size + info->encode_buffer_size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x5c(%rdi), %edi
movss 0x44(%rbx), %xmm0
callq 0x1cd55
movl %eax, %ebp
shrl $0x1f, %ebp
addl %eax, %ebp
movl 0x60(%rbx), %edi
movss 0x48(%rbx), %xmm0
callq 0x1cd55
movl %eax, %r14d
movss 0x44(%rbx), %xmm0
ucomiss 0x6872(%rip), %xmm0     # 0x2337c
ja 0x1cb27
movl 0x8(%rbx), %r15d
movl 0x5c(%rbx), %edi
callq 0x1cd55
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
addl %r15d, %ecx
jmp 0x1cb2a
movl 0x20(%rbx), %ecx
sarl %ebp
movl %ecx, 0xc0(%rbx)
movss 0x48(%rbx), %xmm0
ucomiss 0x683e(%rip), %xmm0     # 0x2337c
ja 0x1cb5b
movl 0xc(%rbx), %r15d
movl 0x60(%rbx), %edi
callq 0x1cd55
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
addl %r15d, %ecx
jmp 0x1cb5e
movl 0x24(%rbx), %ecx
movl %ecx, 0xc4(%rbx)
incl %r14d
movl %r14d, 0xcc(%rbx)
movl 0xc0(%rbx), %r15d
leal (,%r15,8), %eax
movl %eax, 0xf0(%rbx)
movl 0x5c(%rbx), %eax
movss 0x44(%rbx), %xmm1
shlq $0x4, %rax
leaq 0xff3a(%rip), %r14      # 0x2cad0
movss 0x67de(%rip), %xmm0     # 0x2337c
movaps %xmm0, %xmm2
divss %xmm1, %xmm2
cmpnltss %xmm1, %xmm0
movaps %xmm0, %xmm3
andnps %xmm2, %xmm3
andps %xmm1, %xmm0
orps %xmm3, %xmm0
callq *0x8(%rax,%r14)
addss %xmm0, %xmm0
callq 0x52b0
cvttss2si %xmm0, %eax
imull %r15d, %eax
shll $0x2, %eax
movl %eax, 0xf4(%rbx)
movl 0xc4(%rbx), %r15d
leal (,%r15,8), %eax
movl %eax, 0xf8(%rbx)
movl 0x60(%rbx), %eax
movss 0x48(%rbx), %xmm0
shlq $0x4, %rax
movss 0x677e(%rip), %xmm3     # 0x2337c
movaps %xmm3, %xmm1
divss %xmm0, %xmm1
cmpnltss %xmm0, %xmm3
movaps %xmm3, %xmm2
andnps %xmm1, %xmm2
andps %xmm0, %xmm3
orps %xmm2, %xmm3
movaps %xmm3, %xmm0
callq *0x8(%rax,%r14)
addss %xmm0, %xmm0
callq 0x52b0
cvttss2si %xmm0, %eax
imull %r15d, %eax
shll $0x2, %eax
movl %eax, 0xfc(%rbx)
addl %ebp, %ebp
addl 0x8(%rbx), %ebp
movl 0x4c(%rbx), %esi
movl 0x5c(%rbx), %edx
imull %esi, %ebp
shll $0x2, %ebp
movl %ebp, 0x100(%rbx)
imull 0x20(%rbx), %esi
shll $0x2, %esi
movl %esi, 0x104(%rbx)
movl 0xcc(%rbx), %ecx
imull %esi, %ecx
movl %ecx, 0x108(%rbx)
movl %esi, 0x10c(%rbx)
testl %edx, %edx
je 0x1ccd9
cmpl $0x6, %edx
jae 0x1ccf8
movl 0x60(%rbx), %edx
testl %edx, %edx
je 0x1cd17
cmpl $0x6, %edx
jae 0x1cd36
movss 0x48(%rbx), %xmm0
xorl %edx, %edx
ucomiss 0x66e0(%rip), %xmm0     # 0x2337c
setbe %dl
movl $0x0, 0x104(%rbx,%rdx,8)
addl %eax, %ebp
addl %ecx, %ebp
addl 0xf0(%rbx), %ebp
addl 0xf4(%rbx), %ebp
addl 0xf8(%rbx), %ebp
addl 0x104(%rbx), %ebp
addl 0x10c(%rbx), %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x814d(%rip), %rdi      # 0x24e2d
leaq 0x8163(%rip), %rsi      # 0x24e4a
leaq 0x8189(%rip), %rcx      # 0x24e77
movl $0x8d7, %edx            # imm = 0x8D7
callq 0x5130
leaq 0x81ac(%rip), %rdi      # 0x24eab
leaq 0x8144(%rip), %rsi      # 0x24e4a
leaq 0x816a(%rip), %rcx      # 0x24e77
movl $0x8d8, %edx            # imm = 0x8D8
callq 0x5130
leaq 0x81f2(%rip), %rdi      # 0x24f10
leaq 0x8125(%rip), %rsi      # 0x24e4a
leaq 0x814b(%rip), %rcx      # 0x24e77
movl $0x8d9, %edx            # imm = 0x8D9
callq 0x5130
leaq 0x81ee(%rip), %rdi      # 0x24f2b
leaq 0x8106(%rip), %rsi      # 0x24e4a
leaq 0x812c(%rip), %rcx      # 0x24e77
movl $0x8da, %edx            # imm = 0x8DA
callq 0x5130