// File: /workspace/github_c_makefile_star2_O3/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, 0x45a3e(%rip)     # 0x4f370
je 0x9988
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movss %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
cvtss2sd (%rsi), %xmm0
cvtss2sd 0x4(%rsi), %xmm1
leaq 0x27f68(%rip), %rdi     # 0x318c7
movq %r14, %rsi
movb $0x2, %al
callq 0xa899
movq %r14, %rdi
movq %rax, %rsi
callq 0x23cd0
leaq 0x4646d(%rip), %r15     # 0x4fde8
cmpq %r14, 0x20(%r15)
je 0x998b
xorl %eax, %eax
jmp 0x9b89
xorl %eax, %eax
retq
leaq 0x5afde(%rip), %rax     # 0x64970
movl (%rax), %edi
movl $0xf, %esi
callq 0xb743
testb %al, %al
je 0x99fd
callq 0x23e6c
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movaps %xmm0, -0x40(%rbp)
shrq $0x20, %rax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movaps %xmm0, -0x30(%rbp)
leaq 0x5afa4(%rip), %r14     # 0x6496c
movl (%r14), %edi
movl $0xf, %esi
callq 0xb743
testb %al, %al
je 0x9a7c
movss 0x26847(%rip), %xmm0    # 0x3022c
movaps -0x40(%rbp), %xmm1
mulss %xmm0, %xmm1
movaps -0x30(%rbp), %xmm2
mulss %xmm0, %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
jmp 0x9a84
leaq 0x458d4(%rip), %rax     # 0x4f2d8
xorps %xmm0, %xmm0
cvtsi2ssl 0x7c(%rax), %xmm0
movaps %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
cvtsi2ssl 0x80(%rax), %xmm0
movss %xmm0, -0x1c(%rbp)
leaq 0x5af45(%rip), %rax     # 0x6496c
movl (%rax), %edi
movl $0xf, %esi
callq 0xb743
movaps -0x40(%rbp), %xmm1
leaq 0x4(%r15), %rcx
testb %al, %al
cmoveq %r15, %rcx
movss (%rcx), %xmm2
mulss %xmm2, %xmm1
xorps 0x265f0(%rip), %xmm2    # 0x30040
mulss -0x1c(%rbp), %xmm2
movaps %xmm1, %xmm0
movss -0x30(%rbp), %xmm3
mulss %xmm3, %xmm0
addss (%rbx), %xmm0
movss %xmm0, (%rbx)
mulss %xmm2, %xmm3
addss 0x4(%rbx), %xmm3
movss %xmm3, 0x4(%rbx)
jmp 0x9b75
movaps -0x40(%rbp), %xmm1
unpcklps -0x30(%rbp), %xmm1      # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
movaps %xmm1, -0x40(%rbp)
jne 0x9a92
jnp 0x9afa
movss (%rbx), %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rbx)
movl (%r14), %edi
movl $0xf, %esi
callq 0xb743
xorl %ecx, %ecx
testb %al, %al
sete %cl
leaq 0x26f97(%rip), %rax     # 0x30a50
movss (%rax,%rcx,4), %xmm1
movss %xmm1, -0x30(%rbp)
movss (%rbx), %xmm0
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
addsd 0x26f81(%rip), %xmm0    # 0x30a58
callq 0x2100
xorps %xmm1, %xmm1
cvtss2sd -0x30(%rbp), %xmm1
mulsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movaps -0x40(%rbp), %xmm1
movss %xmm0, (%rbx)
xorps %xmm0, %xmm0
movaps %xmm1, %xmm2
shufps $0x55, %xmm1, %xmm2     # xmm2 = xmm2[1,1],xmm1[1,1]
ucomiss %xmm0, %xmm2
jne 0x9b08
jnp 0x9b75
movss (%rbx), %xmm0
addss %xmm2, %xmm0
movss %xmm0, (%rbx)
movl (%r14), %edi
movl $0xf, %esi
movaps %xmm2, -0x30(%rbp)
callq 0xb743
xorl %ecx, %ecx
testb %al, %al
sete %cl
leaq 0x26f1d(%rip), %rax     # 0x30a50
movss (%rax,%rcx,4), %xmm1
movss %xmm1, -0x1c(%rbp)
movss (%rbx), %xmm0
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
addsd 0x26f07(%rip), %xmm0    # 0x30a58
callq 0x2100
movaps -0x30(%rbp), %xmm2
xorps %xmm1, %xmm1
cvtss2sd -0x1c(%rbp), %xmm1
mulsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movaps -0x40(%rbp), %xmm1
movss %xmm0, (%rbx)
xorps %xmm0, %xmm0
cmpneqps %xmm0, %xmm2
cmpneqps %xmm0, %xmm1
orps %xmm2, %xmm1
movd %xmm1, %eax
andb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq