// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_core/lv_refr.c
// Function: lv_disp_refr_task
void lv_disp_refr_task(lv_task_t * task)
{
    LV_LOG_TRACE("lv_refr_task: started");

    uint32_t start = lv_tick_get();

    disp_refr = task->user_data;

    lv_refr_join_area();

    lv_refr_areas();

    /*If refresh happened ...*/
    if(disp_refr->inv_p != 0) {
        /*In true double buffered mode copy the refreshed areas to the new VDB to keep it up to
         * date*/
        if(lv_disp_is_true_double_buf(disp_refr)) {
            lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr);

            /*Flush the content of the VDB*/
            lv_refr_vdb_flush();

            /* With true double buffering the flushing should be only the address change of the
             * current frame buffer. Wait until the address change is ready and copy the changed
             * content to the other frame buffer (new active VDB) to keep the buffers synchronized*/
            while(vdb->flushing)
                ;

            uint8_t * buf_act = (uint8_t *)vdb->buf_act;
            uint8_t * buf_ina = (uint8_t *)vdb->buf_act == vdb->buf1 ? vdb->buf2 : vdb->buf1;

            lv_coord_t hres = lv_disp_get_hor_res(disp_refr);
            uint16_t a;
            for(a = 0; a < disp_refr->inv_p; a++) {
                if(disp_refr->inv_area_joined[a] == 0) {
                    lv_coord_t y;
                    uint32_t start_offs =
                        (hres * disp_refr->inv_areas[a].y1 + disp_refr->inv_areas[a].x1) * sizeof(lv_color_t);
                    uint32_t line_length = lv_area_get_width(&disp_refr->inv_areas[a]) * sizeof(lv_color_t);

                    for(y = disp_refr->inv_areas[a].y1; y <= disp_refr->inv_areas[a].y2; y++) {
                        memcpy(buf_act + start_offs, buf_ina + start_offs, line_length);
                        start_offs += hres * sizeof(lv_color_t);
                    }
                }
            }
        } /*End of true double buffer handling*/

        /*Clean up*/
        memset(disp_refr->inv_areas, 0, sizeof(disp_refr->inv_areas));
        memset(disp_refr->inv_area_joined, 0, sizeof(disp_refr->inv_area_joined));
        disp_refr->inv_p = 0;

        /*Call monitor cb if present*/
        if(disp_refr->driver.monitor_cb) {
            disp_refr->driver.monitor_cb(&disp_refr->driver, lv_tick_elaps(start), px_num);
        }
    }

    lv_draw_free_buf();

    LV_LOG_TRACE("lv_refr_task: ready");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r14
callq 0x883e
movl %eax, 0x1c(%rsp)
movq 0x10(%r14), %rax
movq %rax, 0x59249(%rip)     # 0x5fec0
movzwl 0x198(%rax), %ecx
testl $0x3ff, %ecx            # imm = 0x3FF
je 0x6da2
xorl %ebx, %ebx
leaq 0x8(%rsp), %r14
cmpb $0x0, 0x178(%rax,%rbx)
jne 0x6d82
movq 0x5921a(%rip), %rax     # 0x5fec0
movzwl 0x198(%rax), %ecx
testl $0x3ff, %ecx            # imm = 0x3FF
je 0x6d82
xorl %r12d, %r12d
cmpq %rbx, %r12
je 0x6d62
cmpb $0x0, 0x178(%rax,%r12)
jne 0x6d62
leaq (%rax,%rbx,8), %rdi
addq $0x78, %rdi
leaq (%rax,%r12,8), %rsi
addq $0x78, %rsi
callq 0x28725
testb %al, %al
je 0x6d62
movq 0x591cc(%rip), %rax     # 0x5fec0
leaq (%rax,%rbx,8), %rsi
addq $0x78, %rsi
leaq (%rax,%r12,8), %rdx
addq $0x78, %rdx
movq %r14, %rdi
callq 0x286bc
movq %r14, %rdi
callq 0x28643
movl %eax, %ebp
movq 0x591a3(%rip), %rax     # 0x5fec0
leaq (%rax,%rbx,8), %rdi
addq $0x78, %rdi
callq 0x28643
movl %eax, %r15d
movq 0x5918c(%rip), %rax     # 0x5fec0
leaq (%rax,%r12,8), %rdi
addq $0x78, %rdi
callq 0x28643
addl %r15d, %eax
cmpl %eax, %ebp
jae 0x6d62
movq 0x59171(%rip), %rax     # 0x5fec0
movq 0x8(%rsp), %rcx
movq %rcx, 0x78(%rax,%rbx,8)
movb $0x1, 0x178(%rax,%r12)
incq %r12
movq 0x59154(%rip), %rax     # 0x5fec0
movzwl 0x198(%rax), %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
cmpq %rcx, %r12
jb 0x6cbc
incq %rbx
movq 0x59134(%rip), %rax     # 0x5fec0
movzwl 0x198(%rax), %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
cmpq %rcx, %rbx
jb 0x6c91
movl $0x0, 0x5911c(%rip)     # 0x5fec8
movq 0x5910d(%rip), %rdi     # 0x5fec0
movzwl 0x198(%rdi), %eax
testl $0x3ff, %eax            # imm = 0x3FF
je 0x6fff
xorl %r14d, %r14d
cmpb $0x0, 0x178(%rdi,%r14)
jne 0x6fe0
leaq (%rdi,%r14,8), %r15
addq $0x78, %r15
callq 0x86bd
movl %eax, %ebp
movq 0x590d3(%rip), %rdi     # 0x5fec0
callq 0x8660
movq %rax, %r12
testb %bpl, %bpl
je 0x6e31
xorl %ebx, %ebx
movw %bx, 0x1c(%r12)
movq 0x590b7(%rip), %rdi     # 0x5fec0
callq 0x8564
decl %eax
movw %ax, 0x20(%r12)
movw %bx, 0x1e(%r12)
movq 0x5909d(%rip), %rdi     # 0x5fec0
callq 0x8586
movl %eax, %esi
decl %esi
jmp 0x6fb1
movq %r14, 0x10(%rsp)
movzwl 0x4(%r15), %r13d
movzwl 0x6(%r15), %ebx
subw (%r15), %r13w
movl %ebx, %r14d
subw 0x2(%r15), %r14w
movq 0x5906d(%rip), %rdi     # 0x5fec0
callq 0x8586
cmpw %ax, %bx
jge 0x6e64
movzwl 0x6(%r15), %esi
jmp 0x6e74
movq 0x59055(%rip), %rdi     # 0x5fec0
callq 0x8586
movl %eax, %esi
decl %esi
leaq 0x8(%rsp), %rbx
incl %r13d
incl %r14d
movl 0x18(%r12), %eax
movswl %r13w, %ecx
xorl %edx, %edx
divl %ecx
movswl %r14w, %r13d
cmpl %r13d, %eax
cmovll %eax, %r13d
movq 0x59022(%rip), %rax     # 0x5fec0
cmpq $0x0, 0x20(%rax)
je 0x6f0c
movl %esi, (%rsp)
movl $0x0, 0x8(%rsp)
movw $0x0, 0xc(%rsp)
movl %r13d, %ebp
movl %ebp, %r14d
leal -0x1(%r14), %ebp
movw %bp, 0xe(%rsp)
movq 0x58ff3(%rip), %rdi     # 0x5fec0
movq %rbx, %rsi
callq *0x20(%rdi)
movswl 0xe(%rsp), %eax
movzwl 0xa(%rsp), %ecx
movl %eax, %edx
subw %cx, %dx
incl %edx
movswl %dx, %ecx
cmpl %ecx, %r13d
jge 0x6ef4
movl %ebp, %r14d
testw %bp, %bp
jg 0x6eba
incl %eax
testw %r14w, %r14w
cmovgl %eax, %r13d
movq 0x10(%rsp), %r14
movl (%rsp), %esi
jle 0x6fbf
movswl 0x2(%r15), %eax
movswl %si, %r14d
leal (%rax,%r13), %ecx
decl %ecx
cmpl %r14d, %ecx
jle 0x6f24
xorl %ebx, %ebx
jmp 0x6f8c
movl %eax, %ebp
addl %r13d, %ebp
movq %r13, (%rsp)
movzwl (%r15), %edx
movw %dx, 0x1c(%r12)
movzwl 0x4(%r15), %edx
movw %dx, 0x20(%r12)
movw %ax, 0x1e(%r12)
movswl %cx, %eax
cmpl %r14d, %eax
cmovgl %esi, %ecx
movl %ecx, %ebx
movw %cx, 0x22(%r12)
movq %r15, %rdi
movq %r12, %r13
movq %r15, %r12
movl %esi, %r15d
callq 0x7323
movl %r15d, %esi
movq %r12, %r15
movq %r13, %r12
movq (%rsp), %r13
movl %ebp, %eax
movswl %bp, %edx
leal (%rdx,%r13), %ecx
decl %ecx
movl %edx, %ebp
addl %r13d, %ebp
cmpl %r14d, %ecx
jle 0x6f2d
cmpw %bx, %si
movq 0x10(%rsp), %r14
je 0x6fbf
movzwl (%r15), %ecx
movw %cx, 0x1c(%r12)
movzwl 0x4(%r15), %ecx
movw %cx, 0x20(%r12)
movw %ax, 0x1e(%r12)
movw %si, 0x22(%r12)
movq %r15, %rdi
callq 0x7323
movq 0x58efa(%rip), %rax     # 0x5fec0
cmpq $0x0, 0x30(%rax)
je 0x6fe0
leaq (%rax,%r14,8), %rdi
addq $0x78, %rdi
callq 0x28643
addl %eax, 0x58ee8(%rip)     # 0x5fec8
incq %r14
movq 0x58ed6(%rip), %rdi     # 0x5fec0
movzwl 0x198(%rdi), %eax
andl $0x3ff, %eax            # imm = 0x3FF
cmpq %rax, %r14
jb 0x6dc8
movq 0x58eba(%rip), %rdi     # 0x5fec0
movzwl 0x198(%rdi), %eax
testl $0x3ff, %eax            # imm = 0x3FF
je 0x7170
callq 0x86bd
testb %al, %al
je 0x7130
movq 0x58e94(%rip), %rdi     # 0x5fec0
callq 0x8660
movq %rax, %r14
callq 0x72bd
testb $0x1, 0x24(%r14)
jne 0x7039
movq (%r14), %rcx
movq 0x10(%r14), %rax
movq %rax, 0x30(%rsp)
cmpq %rcx, %rax
jne 0x7055
movq 0x8(%r14), %rcx
movq %rcx, 0x28(%rsp)
movq 0x58e5f(%rip), %rdi     # 0x5fec0
callq 0x8564
movq 0x58e53(%rip), %rbp     # 0x5fec0
movzwl 0x198(%rbp), %ecx
testl $0x3ff, %ecx            # imm = 0x3FF
je 0x7130
movswq %ax, %rax
movq %rax, 0x20(%rsp)
leaq (%rax,%rax), %r12
movq $0x0, (%rsp)
movq 0x30(%rsp), %r14
movq 0x28(%rsp), %r13
movq (%rsp), %rax
cmpb $0x0, 0x178(%rbp,%rax)
jne 0x7110
movq (%rsp), %rax
movzwl 0x7a(%rbp,%rax,8), %ebx
cmpw 0x7e(%rbp,%rax,8), %bx
jg 0x7110
movq (%rsp), %r9
movzwl 0x7c(%rbp,%r9,8), %eax
movswq 0x78(%rbp,%r9,8), %rcx
subl %ecx, %eax
incl %eax
cwtl
addl %eax, %eax
movq %rax, 0x10(%rsp)
movswq 0x7a(%rbp,%r9,8), %r15
imulq 0x20(%rsp), %r15
addq %rcx, %r15
addq %r15, %r15
movl %r15d, %r15d
leaq (%r14,%r15), %rdi
leaq (%r15,%r13), %rsi
movq 0x10(%rsp), %rdx
callq 0x20f0
addq %r12, %r15
incl %ebx
movq (%rsp), %rax
cmpw 0x7e(%rbp,%rax,8), %bx
jle 0x70eb
movq (%rsp), %rdi
incq %rdi
movzwl 0x198(%rbp), %eax
andl $0x3ff, %eax            # imm = 0x3FF
movq %rdi, (%rsp)
cmpq %rax, %rdi
jb 0x709f
movq 0x58d89(%rip), %r14     # 0x5fec0
leaq 0x78(%r14), %rdi
movl $0x120, %edx            # imm = 0x120
xorl %esi, %esi
callq 0x20a0
andw $0xfc00, 0x198(%r14)    # imm = 0xFC00
movq 0x30(%r14), %rbx
testq %rbx, %rbx
je 0x7170
movl 0x1c(%rsp), %edi
callq 0x8855
movl 0x58d5f(%rip), %edx     # 0x5fec8
movq %r14, %rdi
movl %eax, %esi
callq *%rbx
callq 0x36407
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq