// File: /workspace/github_c_makefile_star2_O1/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 0x105b(%rip), %rax      # 0x659c
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 0x3ea1
callq 0x2320
movl %eax, %edi
callq 0x2260
movq 0x38(%rbx), %rax
movl (%rax), %ebp
movl 0x4(%rax), %r15d
movl $0x4e20, %edi           # imm = 0x4E20
callq 0x2310
movq %rax, %rbx
movl $0x1, %r12d
xorl %r13d, %r13d
callq 0x2080
cltd
idivl %ebp
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movss %xmm0, (%rbx,%r13)
callq 0x2080
cltd
idivl %r15d
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movss %xmm0, 0x4(%rbx,%r13)
movl $0xa, %ecx
cmpq $0x14, %r13
sete %al
je 0x55f0
movl %r14d, %ecx
movl $0xcccccccd, %edx       # imm = 0xCCCCCCCD
imulq %rdx, %rcx
shrq $0x23, %rcx
addl %ecx, %ecx
leal (%rcx,%rcx,4), %edx
movl %r12d, %ecx
subl %edx, %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movl %ecx, 0x8(%rbx,%r13)
divss 0xa10(%rip), %xmm0      # 0x6014
movss %xmm0, 0xc(%rbx,%r13)
movb %al, 0x10(%rbx,%r13)
addq $0x14, %r13
incl %r12d
incl %r14d
cmpq $0x4e20, %r13           # imm = 0x4E20
jne 0x559c
leaq 0x60(%rsp), %rdi
callq 0x49fc
testb %al, %al
je 0x5785
leaq 0x60(%rsp), %r14
movq 0x98(%rsp), %r15
movl (%r15), %ebp
movl 0x4(%r15), %eax
movss 0x64(%rsp), %xmm1
incl %eax
xorps %xmm2, %xmm2
cvtsi2ss %eax, %xmm2
movl $0x10, %r12d
movss %xmm1, 0x34(%rsp)
movss %xmm2, 0x30(%rsp)
cmpb $0x0, (%rbx,%r12)
movss 0x9bd(%rip), %xmm0      # 0x6038
jne 0x568c
movss -0x4(%rbx,%r12), %xmm0
mulss 0x9b0(%rip), %xmm0      # 0x603c
mulss %xmm1, %xmm0
addss -0xc(%rbx,%r12), %xmm0
movss %xmm0, -0xc(%rbx,%r12)
ucomiss %xmm2, %xmm0
jbe 0x56ce
callq 0x2080
movss 0x30(%rsp), %xmm2
movss 0x34(%rsp), %xmm1
cltd
idivl %ebp
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movss %xmm0, -0x10(%rbx,%r12)
movl $0xc0800000, -0xc(%rbx,%r12) # imm = 0xC0800000
addq $0x14, %r12
cmpq $0x4e30, %r12           # imm = 0x4E30
jne 0x566e
movl $0x2, 0x18(%r15)
movl 0x4(%r15), %ecx
imull (%r15), %ecx
testl %ecx, %ecx
jle 0x5706
movq 0x10(%r15), %rax
movl %ecx, %ecx
xorl %edx, %edx
movl $0xff000000, (%rax,%rdx,4) # imm = 0xFF000000
incq %rdx
cmpq %rdx, %rcx
jne 0x56f7
movl $0x10, %r12d
movss -0x4(%rbx,%r12), %xmm0
mulss 0x8f1(%rip), %xmm0      # 0x600c
cvttss2si %xmm0, %r9d
cvttss2si -0x10(%rbx,%r12), %esi
cvttss2si -0xc(%rbx,%r12), %edx
shll $0x18, %r9d
orl $0xffffff, %r9d         # imm = 0xFFFFFF
cmpb $0x1, (%rbx,%r12)
jne 0x5755
movq %r15, %rdi
movl $0x1, %ecx
movl $0x2, %r8d
callq 0x3518
jmp 0x5760
movq %r15, %rdi
movl %r9d, %ecx
callq 0x2b88
addq $0x14, %r12
cmpq $0x4e30, %r12           # imm = 0x4E30
jne 0x570c
movq %r14, %rdi
callq 0x4b48
movq %r14, %rdi
callq 0x49fc
testb %al, %al
jne 0x563e
leaq 0x60(%rsp), %rdi
callq 0x5017
xorl %eax, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq