// File: 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
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x5c(%rax), %edi
movq -0x8(%rbp), %rax
movss 0x44(%rax), %xmm0
callq 0x1a520
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x60(%rax), %edi
movq -0x8(%rbp), %rax
movss 0x48(%rax), %xmm0
callq 0x1a550
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 0x1a650
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 0x1a650
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xc4(%rax)
movq -0x8(%rbp), %rax
movslq 0xc0(%rax), %rax
shlq $0x3, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xe8(%rax)
movq -0x8(%rbp), %rdi
callq 0x1a6b0
cltq
shlq $0x2, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xec(%rax)
movq -0x8(%rbp), %rax
movslq 0xc4(%rax), %rax
shlq $0x3, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xf0(%rax)
movq -0x8(%rbp), %rdi
callq 0x1a6f0
cltq
shlq $0x2, %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xf4(%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, 0xf8(%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, 0xfc(%rax)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x8(%rbp), %rcx
imull 0x4c(%rcx), %eax
imull -0x10(%rbp), %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
cmpl $0x0, 0x5c(%rax)
je 0x19cd1
jmp 0x19cf0
leaq 0x7475(%rip), %rdi      # 0x2114d
leaq 0x748b(%rip), %rsi      # 0x2116a
movl $0x8d0, %edx            # imm = 0x8D0
leaq 0x7498(%rip), %rcx      # 0x21183
callq 0x1090
movq -0x8(%rbp), %rax
movl 0x5c(%rax), %eax
cmpq $0x6, %rax
jae 0x19cff
jmp 0x19d1e
leaq 0x74b1(%rip), %rdi      # 0x211b7
leaq 0x745d(%rip), %rsi      # 0x2116a
movl $0x8d1, %edx            # imm = 0x8D1
leaq 0x746a(%rip), %rcx      # 0x21183
callq 0x1090
movq -0x8(%rbp), %rax
cmpl $0x0, 0x60(%rax)
je 0x19d2a
jmp 0x19d49
leaq 0x74eb(%rip), %rdi      # 0x2121c
leaq 0x7432(%rip), %rsi      # 0x2116a
movl $0x8d2, %edx            # imm = 0x8D2
leaq 0x743f(%rip), %rcx      # 0x21183
callq 0x1090
movq -0x8(%rbp), %rax
movl 0x60(%rax), %eax
cmpq $0x6, %rax
jae 0x19d58
jmp 0x19d77
leaq 0x74d8(%rip), %rdi      # 0x21237
leaq 0x7404(%rip), %rsi      # 0x2116a
movl $0x8d3, %edx            # imm = 0x8D3
leaq 0x7411(%rip), %rcx      # 0x21183
callq 0x1090
movq -0x8(%rbp), %rdi
callq 0x1a730
cmpl $0x0, %eax
je 0x19d95
movq -0x8(%rbp), %rax
movl $0x0, 0xfc(%rax)
jmp 0x19da3
movq -0x8(%rbp), %rax
movl $0x0, 0x104(%rax)
movq -0x8(%rbp), %rax
movl 0xe8(%rax), %eax
movq -0x8(%rbp), %rcx
addl 0xec(%rcx), %eax
movq -0x8(%rbp), %rcx
addl 0xf0(%rcx), %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
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)