// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x5c(%rax), %edi
movq -0x8(%rbp), %rax
movss 0x44(%rax), %xmm0
callq 0x30cf0
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x60(%rax), %edi
movq -0x8(%rbp), %rax
movss 0x48(%rax), %xmm0
callq 0x30d20
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movss 0x44(%rax), %xmm0
movq -0x8(%rbp), %rax
movl 0x5c(%rax), %edi
movq -0x8(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x8(%rbp), %rax
movl 0x20(%rax), %edx
callq 0x30e20
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xc0(%rax)
movq -0x8(%rbp), %rax
movss 0x48(%rax), %xmm0
movq -0x8(%rbp), %rax
movl 0x60(%rax), %edi
movq -0x8(%rbp), %rax
movl 0xc(%rax), %esi
movq -0x8(%rbp), %rax
movl 0x24(%rax), %edx
callq 0x30e20
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xc4(%rax)
movl -0x10(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xcc(%rax)
movq -0x8(%rbp), %rax
movslq 0xc0(%rax), %rax
shlq $0x3, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xf0(%rax)
movq -0x8(%rbp), %rdi
callq 0x30e80
cltq
shlq $0x2, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xf4(%rax)
movq -0x8(%rbp), %rax
movslq 0xc4(%rax), %rax
shlq $0x3, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xf8(%rax)
movq -0x8(%rbp), %rdi
callq 0x30ec0
cltq
shlq $0x2, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xfc(%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl -0xc(%rbp), %ecx
shll %ecx
addl %ecx, %eax
movq -0x8(%rbp), %rcx
imull 0x4c(%rcx), %eax
cltq
shlq $0x2, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x100(%rax)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x8(%rbp), %rcx
imull 0x4c(%rcx), %eax
cltq
shlq $0x2, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x104(%rax)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x8(%rbp), %rcx
imull 0x4c(%rcx), %eax
movq -0x8(%rbp), %rcx
imull 0xcc(%rcx), %eax
cltq
shlq $0x2, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x108(%rax)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x8(%rbp), %rcx
imull 0x4c(%rcx), %eax
cltq
shlq $0x2, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10c(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x5c(%rax)
je 0x304b8
jmp 0x304d7
leaq 0xc43d(%rip), %rdi      # 0x3c8fc
leaq 0xc453(%rip), %rsi      # 0x3c919
movl $0x8d7, %edx            # imm = 0x8D7
leaq 0xc474(%rip), %rcx      # 0x3c946
callq 0x50f0
movq -0x8(%rbp), %rax
movl 0x5c(%rax), %eax
cmpq $0x6, %rax
jae 0x304e6
jmp 0x30505
leaq 0xc48d(%rip), %rdi      # 0x3c97a
leaq 0xc425(%rip), %rsi      # 0x3c919
movl $0x8d8, %edx            # imm = 0x8D8
leaq 0xc446(%rip), %rcx      # 0x3c946
callq 0x50f0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x60(%rax)
je 0x30511
jmp 0x30530
leaq 0xc4c7(%rip), %rdi      # 0x3c9df
leaq 0xc3fa(%rip), %rsi      # 0x3c919
movl $0x8d9, %edx            # imm = 0x8D9
leaq 0xc41b(%rip), %rcx      # 0x3c946
callq 0x50f0
movq -0x8(%rbp), %rax
movl 0x60(%rax), %eax
cmpq $0x6, %rax
jae 0x3053f
jmp 0x3055e
leaq 0xc4b4(%rip), %rdi      # 0x3c9fa
leaq 0xc3cc(%rip), %rsi      # 0x3c919
movl $0x8da, %edx            # imm = 0x8DA
leaq 0xc3ed(%rip), %rcx      # 0x3c946
callq 0x50f0
movq -0x8(%rbp), %rdi
callq 0x30f00
cmpl $0x0, %eax
je 0x3057c
movq -0x8(%rbp), %rax
movl $0x0, 0x104(%rax)
jmp 0x3058a
movq -0x8(%rbp), %rax
movl $0x0, 0x10c(%rax)
movq -0x8(%rbp), %rax
movl 0xf0(%rax), %eax
movq -0x8(%rbp), %rcx
addl 0xf4(%rcx), %eax
movq -0x8(%rbp), %rcx
addl 0xf8(%rcx), %eax
movq -0x8(%rbp), %rcx
addl 0xfc(%rcx), %eax
movq -0x8(%rbp), %rcx
addl 0x100(%rcx), %eax
movq -0x8(%rbp), %rcx
addl 0x104(%rcx), %eax
movq -0x8(%rbp), %rcx
addl 0x108(%rcx), %eax
movq -0x8(%rbp), %rcx
addl 0x10c(%rcx), %eax
addq $0x10, %rsp
popq %rbp
retq