// File: /workspace/github_c_makefile_star2_O0/algorithm-archivists[P]GathVL/src/objects/../../include/stb_image_resize.h
// Function: stbir__normalize_downsample_coefficients(stbir__contributors*, float*, stbir_filter, float, int, int)
static void stbir__normalize_downsample_coefficients(stbir__contributors* contributors, float* coefficients, stbir_filter filter, float scale_ratio, int input_size, int output_size)
{
    int num_contributors = stbir__get_contributors(scale_ratio, filter, input_size, output_size);
    int num_coefficients = stbir__get_coefficient_width(filter, scale_ratio);
    int i, j;
    int skip;

    for (i = 0; i < output_size; i++)
    {
        float scale;
        float total = 0;

        for (j = 0; j < num_contributors; j++)
        {
            if (i >= contributors[j].n0 && i <= contributors[j].n1)
            {
                float coefficient = *stbir__get_coefficient(coefficients, filter, scale_ratio, j, i - contributors[j].n0);
                total += coefficient;
            }
            else if (i < contributors[j].n0)
                break;
        }

        STBIR_ASSERT(total > 0.9f);
        STBIR_ASSERT(total < 1.1f);

        scale = 1 / total;

        for (j = 0; j < num_contributors; j++)
        {
            if (i >= contributors[j].n0 && i <= contributors[j].n1)
                *stbir__get_coefficient(coefficients, filter, scale_ratio, j, i - contributors[j].n0) *= scale;
            else if (i < contributors[j].n0)
                break;
        }
    }

    // Optimize: Skip zero coefficients and contributions outside of image bounds.
    // Do this after normalizing because normalization depends on the n0/n1 values.
    for (j = 0; j < num_contributors; j++)
    {
        int range, max, width;

        skip = 0;
        while (*stbir__get_coefficient(coefficients, filter, scale_ratio, j, skip) == 0)
            skip++;

        contributors[j].n0 += skip;

        while (contributors[j].n0 < 0)
        {
            contributors[j].n0++;
            skip++;
        }

        range = contributors[j].n1 - contributors[j].n0 + 1;
        max = stbir__min(num_coefficients, range);

        width = stbir__get_coefficient_width(filter, scale_ratio);
        for (i = 0; i < max; i++)
        {
            if (i + skip >= width)
                break;

            *stbir__get_coefficient(coefficients, filter, scale_ratio, j, i) = *stbir__get_coefficient(coefficients, filter, scale_ratio, j, i + skip);
        }

        continue;
    }

    // Using min to avoid writing into invalid pixels.
    for (i = 0; i < num_contributors; i++)
        contributors[i].n1 = stbir__min(contributors[i].n1, output_size - 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movss %xmm0, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movss -0x18(%rbp), %xmm0
movl -0x14(%rbp), %edi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0x30e20
movl %eax, -0x24(%rbp)
movl -0x14(%rbp), %edi
movss -0x18(%rbp), %xmm0
callq 0x31400
movl %eax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x3247d
xorps %xmm0, %xmm0
movss %xmm0, -0x3c(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x32365
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl (%rcx,%rdx,8), %eax
jl 0x32341
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl 0x4(%rcx,%rdx,8), %eax
jg 0x32341
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movss -0x18(%rbp), %xmm0
movl -0x30(%rbp), %edx
movl -0x2c(%rbp), %ecx
movq -0x8(%rbp), %rax
movslq -0x30(%rbp), %r8
subl (%rax,%r8,8), %ecx
callq 0x31ef0
movss (%rax), %xmm0
movss %xmm0, -0x40(%rbp)
movss -0x40(%rbp), %xmm0
addss -0x3c(%rbp), %xmm0
movss %xmm0, -0x3c(%rbp)
jmp 0x32355
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl (%rcx,%rdx,8), %eax
jge 0x32353
jmp 0x32365
jmp 0x32355
jmp 0x32357
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x322d7
movss -0x3c(%rbp), %xmm0
movss 0x9092(%rip), %xmm1     # 0x3b404
ucomiss %xmm1, %xmm0
jbe 0x32379
jmp 0x32398
leaq 0xac89(%rip), %rdi      # 0x3d009
leaq 0xa592(%rip), %rsi      # 0x3c919
movl $0x472, %edx            # imm = 0x472
leaq 0xac83(%rip), %rcx      # 0x3d016
callq 0x50f0
movss 0x9060(%rip), %xmm0     # 0x3b400
ucomiss -0x3c(%rbp), %xmm0
jbe 0x323a8
jmp 0x323c7
leaq 0xacd4(%rip), %rdi      # 0x3d083
leaq 0xa563(%rip), %rsi      # 0x3c919
movl $0x473, %edx            # imm = 0x473
leaq 0xac54(%rip), %rcx      # 0x3d016
callq 0x50f0
movss 0x8fd9(%rip), %xmm0     # 0x3b3a8
divss -0x3c(%rbp), %xmm0
movss %xmm0, -0x38(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x3246d
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl (%rcx,%rdx,8), %eax
jl 0x32449
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl 0x4(%rcx,%rdx,8), %eax
jg 0x32449
movss -0x38(%rbp), %xmm0
movss %xmm0, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movss -0x18(%rbp), %xmm0
movl -0x30(%rbp), %edx
movl -0x2c(%rbp), %ecx
movq -0x8(%rbp), %rax
movslq -0x30(%rbp), %r8
subl (%rax,%r8,8), %ecx
callq 0x31ef0
movss -0x50(%rbp), %xmm0
mulss (%rax), %xmm0
movss %xmm0, (%rax)
jmp 0x3245d
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x30(%rbp), %rdx
cmpl (%rcx,%rdx,8), %eax
jge 0x3245b
jmp 0x3246d
jmp 0x3245d
jmp 0x3245f
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x323e0
jmp 0x3246f
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x322bc
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x325b7
movl $0x0, -0x34(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movss -0x18(%rbp), %xmm0
movl -0x30(%rbp), %edx
movl -0x34(%rbp), %ecx
callq 0x31ef0
movss (%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x324c7
jp 0x324c7
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x32497
movl -0x34(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0x30(%rbp), %rcx
addl (%rax,%rcx,8), %edx
movl %edx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movslq -0x30(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,8)
jge 0x32502
movq -0x8(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,8), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x324d8
movq -0x8(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %eax
movq -0x8(%rbp), %rcx
movslq -0x30(%rbp), %rdx
subl (%rcx,%rdx,8), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x28(%rbp), %edi
movl -0x44(%rbp), %esi
callq 0x32600
movl %eax, -0x48(%rbp)
movl -0x14(%rbp), %edi
movss -0x18(%rbp), %xmm0
callq 0x31400
movl %eax, -0x4c(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x325a7
movl -0x2c(%rbp), %eax
addl -0x34(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jl 0x32559
jmp 0x325a7
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movss -0x18(%rbp), %xmm0
movl -0x30(%rbp), %edx
movl -0x2c(%rbp), %ecx
addl -0x34(%rbp), %ecx
callq 0x31ef0
movss (%rax), %xmm0
movss %xmm0, -0x54(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movss -0x18(%rbp), %xmm0
movl -0x30(%rbp), %edx
movl -0x2c(%rbp), %ecx
callq 0x31ef0
movss -0x54(%rbp), %xmm0
movss %xmm0, (%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x32544
jmp 0x325a9
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x32484
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x325f6
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %edi
movl -0x20(%rbp), %esi
subl $0x1, %esi
callq 0x32600
movl %eax, %edx
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl %edx, 0x4(%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x325be
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)