// File: /workspace/github_cpp_makefile_star2_O3/lunasorcery[P]brailify/./stb/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);

    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 * filter_height * 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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x5c(%rdi), %edi
movss 0x44(%rbx), %xmm0
callq 0x126e5
movl %eax, %r15d
shrl $0x1f, %r15d
addl %eax, %r15d
movl 0x60(%rbx), %edi
movss 0x48(%rbx), %xmm0
callq 0x126e5
movl %eax, %r14d
movss 0x44(%rbx), %xmm0
ucomiss 0x3b83(%rip), %xmm0     # 0x16008
ja 0x124a6
movl 0x8(%rbx), %r13d
movl 0x5c(%rbx), %edi
callq 0x126e5
movl %eax, %r12d
shrl $0x1f, %r12d
addl %eax, %r12d
andl $-0x2, %r12d
addl %r13d, %r12d
jmp 0x124aa
movl 0x20(%rbx), %r12d
sarl %r15d
movl %r12d, 0xc0(%rbx)
movss 0x48(%rbx), %xmm0
ucomiss 0x3b48(%rip), %xmm0     # 0x16008
ja 0x124e4
movl 0xc(%rbx), %r12d
movl 0x60(%rbx), %edi
callq 0x126e5
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
addl %r12d, %ecx
movl 0xc0(%rbx), %r12d
jmp 0x124e7
movl 0x24(%rbx), %ecx
movl %ecx, 0xc4(%rbx)
leal (,%r12,8), %eax
movl %eax, 0xe8(%rbx)
movl 0x5c(%rbx), %eax
movss 0x44(%rbx), %xmm1
shlq $0x4, %rax
leaq 0x9842(%rip), %r13      # 0x1bd50
movss 0x3af2(%rip), %xmm0     # 0x16008
movaps %xmm0, %xmm2
divss %xmm1, %xmm2
cmpnltss %xmm1, %xmm0
movaps %xmm0, %xmm3
andnps %xmm2, %xmm3
andps %xmm1, %xmm0
orps %xmm3, %xmm0
callq *0x8(%rax,%r13)
addss %xmm0, %xmm0
callq 0x1070
cvttss2si %xmm0, %eax
imull %r12d, %eax
shll $0x2, %eax
movl %eax, 0xec(%rbx)
movl 0xc4(%rbx), %r12d
leal (,%r12,8), %eax
movl %eax, 0xf0(%rbx)
movl 0x60(%rbx), %eax
movss 0x48(%rbx), %xmm0
shlq $0x4, %rax
movss 0x3a92(%rip), %xmm3     # 0x16008
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,%r13)
addss %xmm0, %xmm0
callq 0x1070
cvttss2si %xmm0, %ecx
imull %r12d, %ecx
shll $0x2, %ecx
movl %ecx, 0xf4(%rbx)
addl %r15d, %r15d
addl 0x8(%rbx), %r15d
movl 0x4c(%rbx), %esi
movl 0x5c(%rbx), %eax
imull %esi, %r15d
shll $0x2, %r15d
movl %r15d, 0xf8(%rbx)
imull 0x20(%rbx), %esi
leal (,%rsi,4), %edx
movl %edx, 0xfc(%rbx)
imull %esi, %r14d
shll $0x2, %r14d
movl %r14d, 0x100(%rbx)
movl %edx, 0x104(%rbx)
testl %eax, %eax
je 0x12669
cmpl $0x6, %eax
jae 0x12688
movl 0x60(%rbx), %eax
testl %eax, %eax
je 0x126a7
cmpl $0x6, %eax
jae 0x126c6
movss 0x48(%rbx), %xmm0
xorl %eax, %eax
xorl %esi, %esi
ucomiss 0x39e5(%rip), %xmm0     # 0x16008
setbe %sil
movl %edx, %edi
cmovbel %eax, %edi
cmovbel %edx, %eax
movl $0x0, 0xfc(%rbx,%rsi,8)
addl %ecx, %r15d
addl %r14d, %r15d
addl 0xe8(%rbx), %r15d
addl 0xec(%rbx), %r15d
addl 0xf0(%rbx), %r15d
addl %edi, %eax
addl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x51e7(%rip), %rdi      # 0x17857
leaq 0x51fd(%rip), %rsi      # 0x17874
leaq 0x520f(%rip), %rcx      # 0x1788d
movl $0x8d0, %edx            # imm = 0x8D0
callq 0x1080
leaq 0x5232(%rip), %rdi      # 0x178c1
leaq 0x51de(%rip), %rsi      # 0x17874
leaq 0x51f0(%rip), %rcx      # 0x1788d
movl $0x8d1, %edx            # imm = 0x8D1
callq 0x1080
leaq 0x5278(%rip), %rdi      # 0x17926
leaq 0x51bf(%rip), %rsi      # 0x17874
leaq 0x51d1(%rip), %rcx      # 0x1788d
movl $0x8d2, %edx            # imm = 0x8D2
callq 0x1080
leaq 0x5274(%rip), %rdi      # 0x17941
leaq 0x51a0(%rip), %rsi      # 0x17874
leaq 0x51b2(%rip), %rcx      # 0x1788d
movl $0x8d3, %edx            # imm = 0x8D3
callq 0x1080