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

    scg_app_t app;
    scg_app_init(&app, config);

    srand(scg_get_performance_counter());

    int num_columns = app.draw_target->width / CODE_STRING_CHAR_SIZE;
    int num_rows = app.draw_target->height / CODE_STRING_CHAR_SIZE;
    matrix_t matrix;
    matrix_init(&matrix, num_columns, num_rows);

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

        draw(app.draw_target, &matrix);

        scg_app_present(&app);
    }

    free(matrix.code_strings);
    scg_app_free(&app);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movabsq $0x1e000000280, %rax    # imm = 0x1E000000280
movq %rax, 0x68(%rsp)
movl $0x1, 0x78(%rsp)
xorl %r14d, %r14d
movb %r14b, 0x7c(%rsp)
movl $0x1010101, 0x7d(%rsp)  # imm = 0x1010101
movb %r14b, 0x84(%rsp)
movl $0x40, 0x88(%rsp)
leaq 0x1480(%rip), %rax      # 0x65bc
movq %rax, 0x70(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x20(%rsp)
movups 0x68(%rsp), %xmm0
movups 0x78(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
callq 0x3de3
callq 0x2320
movl %eax, %edi
callq 0x2260
movq 0x38(%rbx), %rax
movl (%rax), %eax
pushq $0x8
popq %rcx
cltd
idivl %ecx
movl %eax, 0x3c(%rsp)
addl %eax, %eax
movslq %eax, %rbx
imulq $0x178, %rbx, %rdi      # imm = 0x178
callq 0x2310
movq %rax, 0x30(%rsp)
testl %ebx, %ebx
cmovlel %r14d, %ebx
movq %rbx, 0x50(%rsp)
imulq $0x178, %rbx, %rbx      # imm = 0x178
cmpq %r14, %rbx
je 0x51d5
movq 0x30(%rsp), %rax
leaq (%rax,%r14), %rdi
movl 0x3c(%rsp), %esi
callq 0x544d
addq $0x178, %r14            # imm = 0x178
jmp 0x51b5
movq 0x30(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x58(%rsp)
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
callq 0x4878
testb %al, %al
je 0x5405
movq 0xc8(%rsp), %r12
cvtsi2ssl 0x4(%r12), %xmm2
movss 0x94(%rsp), %xmm3
movq 0x50(%rsp), %rbx
movq 0x30(%rsp), %r13
movss %xmm2, 0x2c(%rsp)
movss %xmm3, 0x40(%rsp)
subq $0x1, %rbx
jb 0x527a
movss 0x8(%r13), %xmm0
mulss %xmm3, %xmm0
addss 0x4(%r13), %xmm0
movss %xmm0, 0x4(%r13)
movl 0xc(%r13), %eax
shll $0x3, %eax
cvtsi2ss %eax, %xmm1
subss %xmm1, %xmm0
ucomiss %xmm2, %xmm0
jb 0x5271
movq %r13, %rdi
movl 0x3c(%rsp), %esi
callq 0x544d
movss 0x40(%rsp), %xmm3
movss 0x2c(%rsp), %xmm2
addq $0x178, %r13            # imm = 0x178
jmp 0x5229
movq %r12, %rdi
movl $0xff000000, %esi       # imm = 0xFF000000
callq 0x2c76
movq 0x58(%rsp), %rax
movq %rax, 0x40(%rsp)
xorl %eax, %eax
cmpq 0x50(%rsp), %rax
je 0x53f0
movq %rax, 0x60(%rsp)
imulq $0x178, %rax, %rax      # imm = 0x178
movq 0x30(%rsp), %rcx
leaq (%rcx,%rax), %rbp
movl 0xc(%rcx,%rax), %r14d
movss 0x8(%rcx,%rax), %xmm0
cvtsi2ss %r14d, %xmm1
movss %xmm1, 0x4c(%rsp)
divss 0xd67(%rip), %xmm0      # 0x6038
movss 0xd63(%rip), %xmm1      # 0x603c
maxss %xmm0, %xmm1
movss %xmm1, 0x2c(%rsp)
xorl %ebx, %ebx
testl %r14d, %r14d
movl $0x0, %r15d
cmovgl %r14d, %r15d
xorl %r13d, %r13d
cmpq %r13, %r15
je 0x53da
testq %r13, %r13
je 0x531a
cmpq $0x4, %r13
jae 0x532b
movl $0xff800000, %eax       # imm = 0xFF800000
movl $0x8000, %ecx           # imm = 0x8000
movl $0x80, %edi
jmp 0x535c
movl $0xffff0000, %eax       # imm = 0xFFFF0000
movl $0xff00, %ecx           # imm = 0xFF00
movl $0xff, %edi
jmp 0x535c
cvtsi2ss %r13d, %xmm1
divss 0x4c(%rsp), %xmm1
movss 0xcca(%rip), %xmm0      # 0x6008
subss %xmm1, %xmm0
movl $0xff00ff00, %edi       # imm = 0xFF00FF00
callq 0x5517
movl %eax, %ecx
movzbl %al, %edi
andl $0xffff0000, %eax       # imm = 0xFFFF0000
andl $0xff00, %ecx           # imm = 0xFF00
orl %ecx, %edi
orl %eax, %edi
movss 0x2c(%rsp), %xmm0
callq 0x5517
movl %eax, %r8d
movss 0x4(%rbp), %xmm0
movaps %xmm0, %xmm1
mulss 0xcc2(%rip), %xmm1      # 0x6040
cvttss2si %xmm1, %eax
movl %r13d, %ecx
subl %eax, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cltd
idivl %r14d
cvtsi2ss %ebx, %xmm1
subss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movl 0x10(%rbp,%rdx,4), %esi
cvttss2si (%rbp), %edx
movq %r12, %rdi
callq 0x397d
callq 0x2080
cltd
movl $0x3e8, %ecx            # imm = 0x3E8
idivl %ecx
cmpl $0x4, %edx
jg 0x53cf
callq 0x54e6
movq 0x40(%rsp), %rcx
movl %eax, (%rcx,%r13,4)
incq %r13
addl $0x8, %ebx
jmp 0x52f5
movq 0x60(%rsp), %rax
incq %rax
addq $0x178, 0x40(%rsp)      # imm = 0x178
jmp 0x5293
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
callq 0x493f
jmp 0x51eb
movq 0x30(%rsp), %rdi
callq 0x22b0
leaq 0x90(%rsp), %rdi
callq 0x4c17
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq