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

    scg_app_t app;
    scg_app_init(&app, config);

    srand(scg_get_performance_counter());

    starfield_t starfield;
    init(&starfield, &app, STARFIELD_NUM_STARS, STARFIELD_NUM_LAYERS,
         STARFIELD_SCROLL_SPEED);

    while (scg_app_process_events(&app)) {
        update(&starfield, &app);

        draw(app.draw_target, &starfield);

        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)
xorl %r14d, %r14d
movb %r14b, 0x4c(%rsp)
movl $0x1010101, 0x4d(%rsp)  # imm = 0x1010101
movb %r14b, 0x54(%rsp)
movl $0x40, 0x58(%rsp)
leaq 0x1476(%rip), %rax      # 0x65ac
movq %rax, 0x40(%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 0x3de3
callq 0x2320
movl %eax, %edi
callq 0x2260
movq 0x38(%rbx), %rax
movl (%rax), %ecx
movl %ecx, 0x30(%rsp)
movl 0x4(%rax), %r12d
movl $0x4e20, %edi           # imm = 0x4E20
callq 0x2310
movq %rax, %rbx
movw $0x1, %r13w
xorl %r15d, %r15d
movl %r14d, %eax
xorl %edx, %edx
movw $0xa, %cx
divw %cx
cmpq $0x4e20, %r15           # imm = 0x4E20
je 0x5213
movl %eax, %ebp
callq 0x2080
cltd
idivl 0x30(%rsp)
cvtsi2ss %edx, %xmm0
movss %xmm0, (%rbx,%r15)
callq 0x2080
cltd
idivl %r12d
cvtsi2ss %edx, %xmm0
movss %xmm0, 0x4(%rbx,%r15)
pushq $0xa
popq %rcx
cmpq $0x14, %r15
sete %al
je 0x51ea
imull $0xa, %ebp, %ecx
movl %r13d, %edx
subl %ecx, %edx
movzwl %dx, %ecx
cvtsi2ss %ecx, %xmm0
movl %ecx, 0x8(%rbx,%r15)
divss 0xe19(%rip), %xmm0      # 0x6014
movss %xmm0, 0xc(%rbx,%r15)
movb %al, 0x10(%rbx,%r15)
incl %r13d
incl %r14d
addq $0x14, %r15
jmp 0x5194
leaq 0x60(%rsp), %r14
pushq $0x1
popq %rbp
pushq $0x2
popq %r15
movq %r14, %rdi
callq 0x4878
testb %al, %al
je 0x5351
movq 0x98(%rsp), %r12
movl (%r12), %r13d
movl 0x4(%r12), %eax
movss 0x64(%rsp), %xmm1
incl %eax
cvtsi2ss %eax, %xmm2
xorl %r14d, %r14d
movss %xmm1, 0x30(%rsp)
movss %xmm2, 0x34(%rsp)
cmpq $0x4e20, %r14           # imm = 0x4E20
je 0x52c8
cmpb $0x0, 0x10(%rbx,%r14)
movss 0xdc6(%rip), %xmm0      # 0x6038
jne 0x5283
movss 0xc(%rbx,%r14), %xmm0
mulss 0xdb9(%rip), %xmm0      # 0x603c
mulss %xmm1, %xmm0
addss 0x4(%rbx,%r14), %xmm0
movss %xmm0, 0x4(%rbx,%r14)
ucomiss %xmm2, %xmm0
jbe 0x52c2
callq 0x2080
movss 0x34(%rsp), %xmm2
movss 0x30(%rsp), %xmm1
cltd
idivl %r13d
cvtsi2ss %edx, %xmm0
movss %xmm0, (%rbx,%r14)
movl $0xc0800000, 0x4(%rbx,%r14) # imm = 0xC0800000
addq $0x14, %r14
jmp 0x525b
movl $0x2, 0x18(%r12)
movq %r12, %rdi
movl $0xff000000, %esi       # imm = 0xFF000000
callq 0x2c76
pushq $0x10
popq %r14
cmpq $0x4e30, %r14           # imm = 0x4E30
je 0x533f
movss -0x4(%rbx,%r14), %xmm0
mulss 0xd12(%rip), %xmm0      # 0x600c
cvttss2si %xmm0, %r9d
cvttss2si -0x10(%rbx,%r14), %esi
cvttss2si -0xc(%rbx,%r14), %edx
shll $0x18, %r9d
orl $0xffffff, %r9d         # imm = 0xFFFFFF
cmpb $0x1, (%rbx,%r14)
jne 0x532e
movq %r12, %rdi
movl %ebp, %ecx
movl %r15d, %r8d
callq 0x3493
jmp 0x5339
movq %r12, %rdi
movl %r9d, %ecx
callq 0x2b6d
addq $0x14, %r14
jmp 0x52e2
leaq 0x60(%rsp), %r14
movq %r14, %rdi
callq 0x493f
jmp 0x521f
leaq 0x60(%rsp), %rdi
callq 0x4c17
xorl %eax, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq