// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/tweak_values.cpp
// Function: Util::tweak(char const*, Span*, float)
b8 tweak(const char *name, Span *value, f32 modifier) {
    if (!debug_values_are_on()) return false;
    const char *buffer = Util::format_int(" %s: %.4f, %.4f", name, value->min, value->max);
    debug_value_logic(name, buffer);

    if (name == global_tweak.hot) {
        Vec2 delta = {};
        if (Input::down(TWEAK_STEP)) {
            Vec2i int_delta = moved_over_boundry();
            delta = V2(int_delta.x, int_delta.y);
            if (Input::down(TWEAK_SMOOTH))
                delta *= 0.1;
            if (delta.x) {
                value->min += delta.x;
                precise_snap(&value->min);
            }

            if (delta.y) {
                value->min += delta.y;
                precise_snap(&value->min);
            }
        } else {
            delta = hadamard(V2(1, -1), scaled_mouse_movements());
            value->min += delta.x * modifier;
            value->max += delta.y * modifier;
        }
        return delta.x != 0 || delta.y != 0;
    }
    return false;
}

// Assembly:
cmpb $0x0, 0x41a66(%rip)     # 0x4a370
je 0x895b
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movss %xmm0, -0x20(%rbp)
cvtss2sd (%rsi), %xmm0
cvtss2sd 0x4(%rsi), %xmm1
leaq 0x23f6d(%rip), %rdi     # 0x2c89f
movq %r14, %rsi
movb $0x2, %al
callq 0x9642
movq %r14, %rdi
movq %rax, %rsi
callq 0x21c65
leaq 0x424aa(%rip), %rax     # 0x4adf8
cmpq %r14, 0x20(%rax)
je 0x895e
xorl %eax, %eax
jmp 0x8a8f
xorl %eax, %eax
retq
leaq 0x5701b(%rip), %rax     # 0x5f980
movl (%rax), %edi
pushq $0xf
popq %rsi
callq 0xa2f1
testb %al, %al
je 0x89be
callq 0x21d7d
cvtsi2ss %eax, %xmm0
movaps %xmm0, -0x20(%rbp)
shrq $0x20, %rax
cvtsi2ss %eax, %xmm0
movaps %xmm0, -0x30(%rbp)
leaq 0x56fe9(%rip), %rax     # 0x5f97c
movl (%rax), %edi
pushq $0xf
popq %rsi
callq 0xa2f1
testb %al, %al
je 0x89fc
movss 0x22887(%rip), %xmm0    # 0x2b230
movaps -0x20(%rbp), %xmm2
mulss %xmm0, %xmm2
movaps -0x30(%rbp), %xmm1
mulss %xmm0, %xmm1
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
jmp 0x8a04
callq 0x21d38
movaps %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps 0x2266f(%rip), %xmm4    # 0x2b040
xorps %xmm0, %xmm4
movaps %xmm2, %xmm1
movss -0x20(%rbp), %xmm3
mulss %xmm3, %xmm1
addss (%rbx), %xmm1
movss %xmm1, (%rbx)
movss 0x4(%rbx), %xmm1
mulss %xmm3, %xmm0
subss %xmm0, %xmm1
movss %xmm1, 0x4(%rbx)
jmp 0x8a7b
movaps -0x20(%rbp), %xmm2
unpcklps -0x30(%rbp), %xmm2      # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm2
movaps %xmm2, -0x20(%rbp)
jne 0x8a12
jnp 0x8a3d
movss (%rbx), %xmm0
addss %xmm2, %xmm0
movss %xmm0, (%rbx)
movss 0x225de(%rip), %xmm0    # 0x2b004
movss 0x22802(%rip), %xmm1    # 0x2b230
movq %rbx, %rdi
callq 0x21e00
xorps %xmm0, %xmm0
movaps -0x20(%rbp), %xmm2
movaps %xmm2, %xmm4
shufps $0x55, %xmm2, %xmm4     # xmm4 = xmm4[1,1],xmm2[1,1]
ucomiss %xmm0, %xmm4
jne 0x8a4b
jnp 0x8a7b
movss (%rbx), %xmm0
addss %xmm4, %xmm0
movss %xmm0, (%rbx)
movss 0x225a5(%rip), %xmm0    # 0x2b004
movss 0x227c9(%rip), %xmm1    # 0x2b230
movq %rbx, %rdi
movaps %xmm4, -0x30(%rbp)
callq 0x21e00
movaps -0x30(%rbp), %xmm4
movaps -0x20(%rbp), %xmm2
xorps %xmm0, %xmm0
cmpneqps %xmm0, %xmm4
cmpneqps %xmm0, %xmm2
orps %xmm4, %xmm2
movd %xmm2, %eax
andb $0x1, %al
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq