// File: /workspace/github_c_makefile_star2_O1/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_layout_row_template_end
NK_API void
nk_layout_row_template_end(struct nk_context *ctx)
{
    struct nk_window *win;
    struct nk_panel *layout;

    int i = 0;
    int variable_count = 0;
    int min_variable_count = 0;
    float min_fixed_width = 0.0f;
    float total_fixed_width = 0.0f;
    float max_variable_width = 0.0f;

    NK_ASSERT(ctx);
    NK_ASSERT(ctx->current);
    NK_ASSERT(ctx->current->layout);
    if (!ctx || !ctx->current || !ctx->current->layout)
        return;

    win = ctx->current;
    layout = win->layout;
    NK_ASSERT(layout->row.type == NK_LAYOUT_TEMPLATE);
    if (layout->row.type != NK_LAYOUT_TEMPLATE) return;
    for (i = 0; i < layout->row.columns; ++i) {
        float width = layout->row.templates[i];
        if (width >= 0.0f) {
            total_fixed_width += width;
            min_fixed_width += width;
        } else if (width < -1.0f) {
            width = -width;
            total_fixed_width += width;
            max_variable_width = NK_MAX(max_variable_width, width);
            variable_count++;
        } else {
            min_variable_count++;
            variable_count++;
        }
    }
    if (variable_count) {
        float space = nk_layout_row_calculate_usable_space(&ctx->style, layout->type,
                            layout->bounds.w, layout->row.columns);
        float var_width = (NK_MAX(space-min_fixed_width,0.0f)) / (float)variable_count;
        int enough_space = var_width >= max_variable_width;
        if (!enough_space)
            var_width = (NK_MAX(space-total_fixed_width,0)) / (float)min_variable_count;
        for (i = 0; i < layout->row.columns; ++i) {
            float *width = &layout->row.templates[i];
            *width = (*width >= 0.0f)? *width: (*width < -1.0f && !enough_space)? -(*width): var_width;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
testq %rdi, %rdi
jne 0x41ef7
movq 0x4611e(%rip), %r14     # 0x87ff0
movq (%r14), %rdi
leaq 0x2feb0(%rip), %rsi     # 0x71d8c
leaq 0x2fec7(%rip), %rdx     # 0x71daa
movl $0x5626, %ecx           # imm = 0x5626
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
cmpq $0x0, 0x4780(%rbx)
jne 0x41f2d
movq 0x460e8(%rip), %r14     # 0x87ff0
movq (%r14), %rdi
leaq 0x2fe7a(%rip), %rsi     # 0x71d8c
leaq 0x2fe91(%rip), %rdx     # 0x71daa
movl $0x5627, %ecx           # imm = 0x5627
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
movq 0x4780(%rbx), %rax
cmpq $0x0, 0xa8(%rax)
jne 0x41f6a
movq 0x460ab(%rip), %r14     # 0x87ff0
movq (%r14), %rdi
leaq 0x2fe3d(%rip), %rsi     # 0x71d8c
leaq 0x2fe54(%rip), %rdx     # 0x71daa
movl $0x5628, %ecx           # imm = 0x5628
xorl %eax, %eax
callq 0x12d80
movq (%r14), %rdi
callq 0x13780
testq %rbx, %rbx
je 0x42101
movq 0x4780(%rbx), %rax
testq %rax, %rax
je 0x42101
movq 0xa8(%rax), %r14
testq %r14, %r14
je 0x42101
cmpl $0x8, 0x70(%r14)
je 0x41fc6
movq 0x4604f(%rip), %r15     # 0x87ff0
movq (%r15), %rdi
leaq 0x2fde1(%rip), %rsi     # 0x71d8c
leaq 0x2fdf8(%rip), %rdx     # 0x71daa
movl $0x562e, %ecx           # imm = 0x562E
xorl %eax, %eax
callq 0x12d80
movq (%r15), %rdi
callq 0x13780
cmpl $0x8, 0x70(%r14)
jne 0x42101
movslq 0x80(%r14), %rax
testq %rax, %rax
jle 0x42043
xorps %xmm3, %xmm3
xorl %edx, %edx
movss 0x2c8da(%rip), %xmm4    # 0x6e8c4
movaps 0x2c57f(%rip), %xmm5    # 0x6e570
xorl %ecx, %ecx
xorl %esi, %esi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movss 0xb4(%r14,%rdx,4), %xmm6
ucomiss %xmm3, %xmm6
jae 0x42024
ucomiss %xmm6, %xmm4
jbe 0x4202e
subss %xmm6, %xmm1
xorps %xmm5, %xmm6
maxss %xmm0, %xmm6
incl %ecx
movaps %xmm6, %xmm0
jmp 0x42032
addss %xmm6, %xmm1
addss %xmm6, %xmm2
jmp 0x42032
incl %esi
incl %ecx
incq %rdx
cmpq %rdx, %rax
jne 0x41ffe
xorps %xmm3, %xmm3
cvtsi2ss %esi, %xmm3
jmp 0x42051
xorl %ecx, %ecx
xorps %xmm2, %xmm2
xorps %xmm1, %xmm1
xorps %xmm0, %xmm0
xorps %xmm3, %xmm3
testl %ecx, %ecx
je 0x42101
cmpl $0x2, %eax
movl $0x1, %edx
cmovgel %eax, %edx
decl %edx
xorps %xmm4, %xmm4
cvtsi2ss %edx, %xmm4
movss 0x10(%r14), %xmm5
mulss 0x24b4(%rbx), %xmm4
subss %xmm4, %xmm5
movaps %xmm5, %xmm4
subss %xmm2, %xmm4
xorps %xmm6, %xmm6
xorps %xmm2, %xmm2
maxss %xmm4, %xmm2
xorps %xmm4, %xmm4
cvtsi2ss %ecx, %xmm4
divss %xmm4, %xmm2
ucomiss %xmm0, %xmm2
movaps %xmm2, %xmm4
jae 0x420b2
subss %xmm1, %xmm5
maxss %xmm5, %xmm6
divss %xmm3, %xmm6
movaps %xmm6, %xmm4
testl %eax, %eax
jle 0x42101
xorl %ecx, %ecx
xorps %xmm1, %xmm1
movss 0x2c801(%rip), %xmm3    # 0x6e8c4
movaps 0x2c4a6(%rip), %xmm5    # 0x6e570
movss 0xb4(%r14,%rcx,4), %xmm6
ucomiss %xmm1, %xmm6
jae 0x420ec
ucomiss %xmm0, %xmm2
movaps %xmm4, %xmm7
jae 0x420ef
ucomiss %xmm6, %xmm3
movaps %xmm4, %xmm7
jbe 0x420ef
xorps %xmm5, %xmm6
movaps %xmm6, %xmm7
movss %xmm7, 0xb4(%r14,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x420ca
popq %rbx
popq %r14
popq %r15
retq