// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/tweak_values.cpp
// Function: Util::tweak(char const*, Vec2*, float)
b8 tweak(const char *name, Vec2 *value, f32 modifier) {
    if (!debug_values_are_on()) return false;
    const char *buffer = Util::format_int(" %s: %.4f, %.4f", name, value->x, value->y);
    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->x += delta.x;
                precise_snap(&value->x);
            }

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

// Assembly:
cmpb $0x0, 0x41c0c(%rip)     # 0x4a370
je 0x87b5
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 0x24113(%rip), %rdi     # 0x2c89f
movq %r14, %rsi
movb $0x2, %al
callq 0x9642
movq %r14, %rdi
movq %rax, %rsi
callq 0x21c65
leaq 0x42650(%rip), %rax     # 0x4adf8
cmpq %r14, 0x20(%rax)
je 0x87b8
xorl %eax, %eax
jmp 0x88f0
xorl %eax, %eax
retq
leaq 0x571c1(%rip), %rax     # 0x5f980
movl (%rax), %edi
pushq $0xf
popq %rsi
callq 0xa2f1
testb %al, %al
je 0x8818
callq 0x21d7d
cvtsi2ss %eax, %xmm0
movaps %xmm0, -0x20(%rbp)
shrq $0x20, %rax
cvtsi2ss %eax, %xmm0
movaps %xmm0, -0x30(%rbp)
leaq 0x5718f(%rip), %rax     # 0x5f97c
movl (%rax), %edi
pushq $0xf
popq %rsi
callq 0xa2f1
testb %al, %al
je 0x8859
movss 0x22a2d(%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 0x8861
callq 0x21d38
movaps %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps 0x22815(%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 0x88dc
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 0x886f
jnp 0x889a
movss (%rbx), %xmm0
addss %xmm2, %xmm0
movss %xmm0, (%rbx)
movss 0x22781(%rip), %xmm0    # 0x2b004
movss 0x229a5(%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 0x88a8
jnp 0x88dc
addq $0x4, %rbx
movss (%rbx), %xmm0
addss %xmm4, %xmm0
movss %xmm0, (%rbx)
movss 0x22744(%rip), %xmm0    # 0x2b004
movss 0x22968(%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