// File: /workspace/github_c_makefile_star2_O0/adelciotto[P]scg/examples/../scg.h
// Function: scg_tween_update
void scg_tween_update(scg_tween_t *tween, float32_t *out,
                      float32_t current_time) {
    if (!tween->playing) {
        return;
    }

    scg_tween_definition_t definition = tween->definition;
    float32_t time;
    if (tween->paused) {
        time = (tween->pause_time - tween->start_time) / definition.duration;
    } else {
        time = (current_time - tween->start_time) / definition.duration;
    }

    if (definition.duration == 0.0f || time > 1.0f) {
        time = 1.0f;
    }

    for (int i = 0; i < definition.num_values; i++) {
        float32_t start = definition.start_end_values[i].x;
        float32_t end = definition.start_end_values[i].y;

        out[i] = start + definition.func(time) * (end - start);
    }

    if (time == 1.0f) {
        if (definition.yoyo) {
            for (int i = 0; i < definition.num_values; i++) {
                float32_t start = definition.start_end_values[i].x;
                float32_t end = definition.start_end_values[i].y;
                tween->definition.start_end_values[i] =
                    scg_vec2f_new(end, start);
            }

            tween->yoyo_in_progress = !tween->yoyo_in_progress;
        }

        if (definition.loop || tween->yoyo_in_progress) {
            tween->start_time = current_time;
        } else {
            tween->playing = false;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movss %xmm0, -0x14(%rbp)
movq -0x8(%rbp), %rax
testb $0x1, 0x2c(%rax)
jne 0x63c4
jmp 0x6597
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x18(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
testb $0x1, 0x2d(%rax)
je 0x6410
movq -0x8(%rbp), %rax
movss 0x30(%rax), %xmm0
movq -0x8(%rbp), %rax
subss 0x28(%rax), %xmm0
divss -0x30(%rbp), %xmm0
movss %xmm0, -0x3c(%rbp)
jmp 0x6428
movss -0x14(%rbp), %xmm0
movq -0x8(%rbp), %rax
subss 0x28(%rax), %xmm0
divss -0x30(%rbp), %xmm0
movss %xmm0, -0x3c(%rbp)
movss -0x30(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x6439
jp 0x6439
jmp 0x644b
movss -0x3c(%rbp), %xmm0
movss 0xbc2(%rip), %xmm1      # 0x7008
ucomiss %xmm1, %xmm0
jbe 0x6458
movss 0xbb5(%rip), %xmm0      # 0x7008
movss %xmm0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x64d0
movq -0x38(%rbp), %rax
movslq -0x40(%rbp), %rcx
movss (%rax,%rcx,8), %xmm0
movss %xmm0, -0x44(%rbp)
movq -0x38(%rbp), %rax
movslq -0x40(%rbp), %rcx
movss 0x4(%rax,%rcx,8), %xmm0
movss %xmm0, -0x48(%rbp)
movss -0x44(%rbp), %xmm0
movss %xmm0, -0x60(%rbp)
movq -0x20(%rbp), %rax
movss -0x3c(%rbp), %xmm0
callq *%rax
movss -0x60(%rbp), %xmm1
movss -0x48(%rbp), %xmm2
subss -0x44(%rbp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x645f
movss -0x3c(%rbp), %xmm0
movss 0xb2b(%rip), %xmm1      # 0x7008
ucomiss %xmm1, %xmm0
jne 0x6597
jp 0x6597
testb $0x1, -0x27(%rbp)
je 0x656d
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x6559
movq -0x38(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movss (%rax,%rcx,8), %xmm0
movss %xmm0, -0x50(%rbp)
movq -0x38(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movss 0x4(%rax,%rcx,8), %xmm0
movss %xmm0, -0x54(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x4c(%rbp), %rcx
movss -0x54(%rbp), %xmm0
movss %xmm0, -0x5c(%rbp)
movss -0x50(%rbp), %xmm0
movss %xmm0, -0x58(%rbp)
movq -0x5c(%rbp), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x64f9
movq -0x8(%rbp), %rax
movb 0x2e(%rax), %cl
xorb $-0x1, %cl
movq -0x8(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x2e(%rax)
testb $0x1, -0x28(%rbp)
jne 0x657d
movq -0x8(%rbp), %rax
testb $0x1, 0x2e(%rax)
je 0x658d
movss -0x14(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x28(%rax)
jmp 0x6595
movq -0x8(%rbp), %rax
movb $0x0, 0x2c(%rax)
jmp 0x6597
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)