// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_img.c
// Function: lv_img_design
static bool lv_img_design(lv_obj_t * img, const lv_area_t * mask, lv_design_mode_t mode)
{
    const lv_style_t * style = lv_obj_get_style(img);
    lv_img_ext_t * ext       = lv_obj_get_ext_attr(img);

    if(mode == LV_DESIGN_COVER_CHK) {
        bool cover = false;
        if(ext->src_type == LV_IMG_SRC_UNKNOWN || ext->src_type == LV_IMG_SRC_SYMBOL) return false;

        if(ext->cf == LV_IMG_CF_TRUE_COLOR || ext->cf == LV_IMG_CF_RAW) cover = lv_area_is_in(mask, &img->coords);

        return cover;
    } else if(mode == LV_DESIGN_DRAW_MAIN) {
        if(ext->h == 0 || ext->w == 0) return true;
        lv_area_t coords;
        lv_opa_t opa_scale = lv_obj_get_opa_scale(img);

        lv_obj_get_coords(img, &coords);

        if(ext->src_type == LV_IMG_SRC_FILE || ext->src_type == LV_IMG_SRC_VARIABLE) {
            coords.x1 -= ext->offset.x;
            coords.y1 -= ext->offset.y;

            LV_LOG_TRACE("lv_img_design: start to draw image");
            lv_area_t cords_tmp;
            cords_tmp.y1 = coords.y1;
            cords_tmp.y2 = coords.y1 + ext->h - 1;

            for(; cords_tmp.y1 <= coords.y2; cords_tmp.y1 += ext->h, cords_tmp.y2 += ext->h) {
                cords_tmp.x1 = coords.x1;
                cords_tmp.x2 = coords.x1 + ext->w - 1;
                for(; cords_tmp.x1 <= coords.x2; cords_tmp.x1 += ext->w, cords_tmp.x2 += ext->w) {
                    lv_draw_img(&cords_tmp, mask, ext->src, style, opa_scale);
                }
            }
        } else if(ext->src_type == LV_IMG_SRC_SYMBOL) {
            LV_LOG_TRACE("lv_img_design: start to draw symbol");
            lv_style_t style_mod;
            lv_style_copy(&style_mod, style);
            style_mod.text.color = style->image.color;
            lv_draw_label(&coords, mask, &style_mod, opa_scale, ext->src, LV_TXT_FLAG_NONE, NULL, NULL, NULL, lv_obj_get_base_dir(img));
        } else {
            /*Trigger the error handler of image drawer*/
            LV_LOG_WARN("lv_img_design: image source type is unknown");
            lv_draw_img(&img->coords, mask, NULL, style, opa_scale);
        }
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r13
callq 0x6316
movq %rax, %r15
movq %r13, %rdi
callq 0x6747
movq %rax, %r12
movb $0x1, %bl
testl %ebp, %ebp
je 0x21c9e
cmpl $0x2, %ebp
jne 0x21d8e
movzbl 0x10(%r12), %eax
testb $0x2, %al
jne 0x21d8c
shrl $0x3, %eax
cmpl $0x4, %eax
je 0x21c81
cmpl $0x1, %eax
jne 0x21d8c
addq $0x20, %r13
movq %r14, %rdi
movq %r13, %rsi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x26931
cmpw $0x0, 0xe(%r12)
je 0x21d8e
cmpw $0x0, 0xc(%r12)
je 0x21d8e
movq %r13, %rdi
callq 0x6649
movl %eax, %ebp
leaq 0x28(%rsp), %rsi
movq %r13, %rdi
callq 0x50e5
movzbl 0x10(%r12), %eax
andl $0x3, %eax
cmpl $0x2, %eax
jae 0x21d9f
movq 0x8(%r12), %xmm0
movd 0x28(%rsp), %xmm1
psubw %xmm0, %xmm1
movd %xmm1, 0x28(%rsp)
pextrw $0x1, %xmm1, %eax
leaq 0x30(%rsp), %r13
movw %ax, 0x2(%r13)
movzwl 0xe(%r12), %ecx
addw %ax, %cx
decl %ecx
movzbl %bpl, %ebp
movw %cx, 0x36(%rsp)
cmpw 0x2e(%rsp), %ax
jg 0x21d8e
movzwl 0x28(%rsp), %eax
movw %ax, 0x30(%rsp)
movzwl 0xc(%r12), %ecx
addw %ax, %cx
decl %ecx
movw %cx, 0x34(%rsp)
cmpw 0x2c(%rsp), %ax
jg 0x21d72
movq (%r12), %rdx
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rcx
movl %ebp, %r8d
callq 0x3818c
movzwl 0xc(%r12), %ecx
movzwl 0x30(%rsp), %eax
addw %cx, %ax
movw %ax, 0x30(%rsp)
addw 0x34(%rsp), %cx
jmp 0x21d37
movzwl 0xe(%r12), %ecx
movzwl 0x32(%rsp), %eax
addw %cx, %ax
movw %ax, 0x32(%rsp)
addw 0x36(%rsp), %cx
jmp 0x21d16
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jne 0x21dfc
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x74d4
movzwl 0x38(%r15), %eax
leaq 0x30(%rsp), %rcx
movw %ax, 0x20(%rcx)
movq (%r12), %r15
movq %r13, %rdi
callq 0x47b9
movzbl %al, %eax
movl %eax, 0x18(%rsp)
pxor %xmm0, %xmm0
movdqu %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
movzbl %bpl, %ecx
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
leaq 0x30(%rsp), %rdx
movq %r15, %r8
xorl %r9d, %r9d
callq 0x3699c
jmp 0x21d8e
addq $0x20, %r13
movzbl %bpl, %r8d
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x3818c
jmp 0x21d8e