// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/audio.c
// Function: main
int main(int arcg, char *argv[]) {
    scg_config_t config = scg_config_new_default();
    config.video.title = "SCG Example: Audio";
    config.audio.enabled = true;

    scg_app_t app;
    scg_app_init(&app, config);

    scg_sound_t *music =
        scg_sound_new_from_wav(app.audio, "assets/arcade-music-loop.wav", true);
    if (music == NULL) {
        return -1;
    }
    scg_sound_play(music);

    while (scg_app_process_events(&app)) {
        float32_t play_position = scg_sound_get_position(music);
        draw(app.draw_target, play_position);

        scg_app_present(&app);
    }

    scg_app_free(&app);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movabsq $0x1e000000280, %rax    # imm = 0x1E000000280
movq %rax, 0x38(%rsp)
movl $0x1, 0x48(%rsp)
movb $0x0, 0x4c(%rsp)
movl $0x1010101, 0x4d(%rsp)  # imm = 0x1010101
movl $0x40, 0x58(%rsp)
leaq 0x106c(%rip), %rax      # 0x65dc
movq %rax, 0x40(%rsp)
movb $0x1, 0x54(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x20(%rsp)
movups 0x38(%rsp), %xmm0
movups 0x48(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x3f6d
movq 0x50(%rbx), %rdi
leaq 0x1040(%rip), %rsi      # 0x65ef
movl $0x1, %edx
callq 0x3db3
testq %rax, %rax
je 0x5731
movq %rax, %rbx
cmpb $0x0, 0x48(%rax)
jne 0x55cf
movb $0x1, 0x48(%rbx)
leaq 0x60(%rsp), %rdi
callq 0x4a46
testb %al, %al
je 0x5723
movq %rbx, 0x30(%rsp)
xorps %xmm1, %xmm1
cmpb $0x1, 0x48(%rbx)
jne 0x5609
movl 0x28(%rbx), %eax
movl 0x38(%rbx), %ecx
xorps %xmm1, %xmm1
cvtsi2ss %rcx, %xmm1
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
divss %xmm0, %xmm1
movss %xmm1, 0x28(%rsp)
movq 0x98(%rsp), %r12
movl (%r12), %ebp
movl 0x4(%r12), %ebx
movl %ebx, %eax
imull %ebp, %eax
testl %eax, %eax
jle 0x563e
movq 0x10(%r12), %rdi
movl %eax, %edx
shlq $0x2, %rdx
movl $0xff, %esi
callq 0x2100
movl %ebp, %edx
shrl $0x1f, %edx
addl %ebp, %edx
sarl %edx
movl %ebx, %r14d
shrl $0x1f, %r14d
addl %ebx, %r14d
sarl %r14d
leal -0x14(%r14), %ecx
movq %r12, %rdi
leaq 0x1b9d(%rip), %rsi      # 0x71ff
movl $0x1, %r8d
movl $0xff000000, %r9d       # imm = 0xFF000000
callq 0x3a63
addl $-0x14, %ebp
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
movss 0x28(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %r15d
addl $0x14, %r14d
movq %r12, %rdi
movl $0xa, %esi
movq %r14, 0x28(%rsp)
movl %r14d, %edx
movl %ebp, %ecx
movl $0xa, %r8d
movl $0xff000000, %r9d       # imm = 0xFF000000
callq 0x356b
movl %r15d, %ebx
negl %ebx
xorl %r13d, %r13d
testl %r15d, %r15d
js 0x56f4
movq 0x28(%rsp), %rax
leal (%rax,%r13), %ebp
movl $0xa, %r14d
movq %r12, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl $0xff000000, %ecx       # imm = 0xFF000000
callq 0x2b68
leal (%rbx,%r14), %eax
incl %eax
movl %r14d, %ecx
incl %ecx
movl %ecx, %r14d
cmpl $0xb, %eax
jne 0x56cf
leal 0x1(%r13), %eax
cmpl $0xa, %r13d
movl %eax, %r13d
jne 0x56bb
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x4b6f
movq %rbx, %rdi
callq 0x4a46
testb %al, %al
movq 0x30(%rsp), %rbx
jne 0x55e6
leaq 0x60(%rsp), %rdi
callq 0x5042
xorl %eax, %eax
jmp 0x5736
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq