// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw_basic.c
// Function: sw_color_fill
static void sw_color_fill(lv_color_t * mem, lv_coord_t mem_width, const lv_area_t * fill_area, lv_color_t color,
                          lv_opa_t opa)
{
    /*Set all row in vdb to the given color*/
    lv_coord_t row;
    lv_coord_t col;

    lv_disp_t * disp = lv_refr_get_disp_refreshing();
    if(disp->driver.set_px_cb) {
        for(col = fill_area->x1; col <= fill_area->x2; col++) {
            for(row = fill_area->y1; row <= fill_area->y2; row++) {
                disp->driver.set_px_cb(&disp->driver, (uint8_t *)mem, mem_width, col, row, color, opa);
            }
        }
    } else {
        mem += fill_area->y1 * mem_width; /*Go to the first row*/

        /*Run simpler function without opacity*/
        if(opa == LV_OPA_COVER) {

            /*Fill the first row with 'color'*/
            for(col = fill_area->x1; col <= fill_area->x2; col++) {
                mem[col] = color;
            }

            /*Copy the first row to all other rows*/
            lv_color_t * mem_first = &mem[fill_area->x1];
            lv_coord_t copy_size   = (fill_area->x2 - fill_area->x1 + 1) * sizeof(lv_color_t);
            mem += mem_width;

            for(row = fill_area->y1 + 1; row <= fill_area->y2; row++) {
                memcpy(&mem[fill_area->x1], mem_first, copy_size);
                mem += mem_width;
            }
        }
        /*Calculate with alpha too*/
        else {
            bool scr_transp = false;
#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP
            scr_transp = disp->driver.screen_transp;
#endif

            lv_color_t bg_tmp  = LV_COLOR_BLACK;
            lv_color_t opa_tmp = lv_color_mix(color, bg_tmp, opa);
            for(row = fill_area->y1; row <= fill_area->y2; row++) {
                for(col = fill_area->x1; col <= fill_area->x2; col++) {
                    if(scr_transp == false) {
                        /*If the bg color changed recalculate the result color*/
                        if(mem[col].full != bg_tmp.full) {
                            bg_tmp  = mem[col];
                            opa_tmp = lv_color_mix(color, bg_tmp, opa);
                        }

                        mem[col] = opa_tmp;

                    } else {
#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP
                        mem[col] = color_mix_2_alpha(mem[col], mem[col].ch.alpha, color, opa);
#endif
                    }
                }
                mem += mem_width;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %ecx, -0x48(%rbp)
movl %esi, %ecx
movl -0x48(%rbp), %esi
movb %r8b, %al
movw %si, -0x2(%rbp)
movq %rdi, -0x10(%rbp)
movw %cx, -0x12(%rbp)
movq %rdx, -0x20(%rbp)
movb %al, -0x21(%rbp)
callq 0xafe0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x590a5
movq -0x20(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x26(%rbp)
movswl -0x26(%rbp), %eax
movq -0x20(%rbp), %rcx
movswl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jg 0x590a0
movq -0x20(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x24(%rbp)
movswl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
movswl 0x6(%rcx), %ecx
cmpl %ecx, %eax
jg 0x5908d
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movw -0x12(%rbp), %dx
movw -0x26(%rbp), %cx
movw -0x24(%rbp), %r8w
movb -0x21(%rbp), %r10b
movswl %dx, %edx
movswl %cx, %ecx
movswl %r8w, %r8d
movzwl -0x2(%rbp), %r9d
movzbl %r10b, %r10d
movl %r10d, (%rsp)
callq *%rax
movw -0x24(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x24(%rbp)
jmp 0x59035
jmp 0x5908f
movw -0x26(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x26(%rbp)
jmp 0x59019
jmp 0x592cd
movq -0x20(%rbp), %rax
movswl 0x2(%rax), %ecx
movswl -0x12(%rbp), %eax
imull %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0xff, %eax
jne 0x591bd
movq -0x20(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x26(%rbp)
movswl -0x26(%rbp), %eax
movq -0x20(%rbp), %rcx
movswl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jg 0x5910e
movq -0x10(%rbp), %rax
movswq -0x26(%rbp), %rcx
movw -0x2(%rbp), %dx
movw %dx, (%rax,%rcx,2)
movw -0x26(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x26(%rbp)
jmp 0x590df
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movswq (%rcx), %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movswl 0x4(%rax), %eax
movq -0x20(%rbp), %rcx
movswl (%rcx), %ecx
subl %ecx, %eax
addl $0x1, %eax
cltq
shlq %rax
movw %ax, -0x3a(%rbp)
movswl -0x12(%rbp), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rax
movswl 0x2(%rax), %eax
addl $0x1, %eax
movw %ax, -0x24(%rbp)
movswl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
movswl 0x6(%rcx), %ecx
cmpl %ecx, %eax
jg 0x591b8
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movswq (%rax), %rax
shlq %rax
addq %rax, %rdi
movq -0x38(%rbp), %rsi
movswq -0x3a(%rbp), %rdx
callq 0x20e0
movswl -0x12(%rbp), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movw -0x24(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x24(%rbp)
jmp 0x59165
jmp 0x592cb
movb $0x0, -0x3b(%rbp)
leaq -0x3e(%rbp), %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x2090
movb -0x21(%rbp), %al
movw -0x2(%rbp), %cx
movzwl %cx, %edi
movzwl -0x3e(%rbp), %esi
movzbl %al, %edx
callq 0x58d80
movw %ax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x24(%rbp)
movswl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
movswl 0x6(%rcx), %ecx
cmpl %ecx, %eax
jg 0x592c9
movq -0x20(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x26(%rbp)
movswl -0x26(%rbp), %eax
movq -0x20(%rbp), %rcx
movswl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jg 0x592a3
movb -0x3b(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5928e
movq -0x10(%rbp), %rax
movswq -0x26(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
movzwl -0x3e(%rbp), %ecx
cmpl %ecx, %eax
je 0x5927b
movq -0x10(%rbp), %rax
movswq -0x26(%rbp), %rcx
movw (%rax,%rcx,2), %ax
movw %ax, -0x3e(%rbp)
movb -0x21(%rbp), %al
movw -0x2(%rbp), %cx
movzwl %cx, %edi
movzwl -0x3e(%rbp), %esi
movzbl %al, %edx
callq 0x58d80
movw %ax, -0x42(%rbp)
movw -0x42(%rbp), %ax
movw %ax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movswq -0x26(%rbp), %rcx
movw -0x40(%rbp), %dx
movw %dx, (%rax,%rcx,2)
jmp 0x59290
jmp 0x59290
jmp 0x59292
movw -0x26(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x26(%rbp)
jmp 0x59216
movswl -0x12(%rbp), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movw -0x24(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x24(%rbp)
jmp 0x591f7
jmp 0x592cb
jmp 0x592cd
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)