// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_imgbtn.c
// Function: lv_imgbtn_design
static bool lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * mask, lv_design_mode_t mode)
{
    /*Return false if the object is not covers the mask_p area*/
    if(mode == LV_DESIGN_COVER_CHK) {
        lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
        bool cover            = false;
        if(ext->act_cf == LV_IMG_CF_TRUE_COLOR || ext->act_cf == LV_IMG_CF_RAW) {
            cover = lv_area_is_in(mask, &imgbtn->coords);
        }

        return cover;
    }
    /*Draw the object*/
    else if(mode == LV_DESIGN_DRAW_MAIN) {
        /*Just draw an image*/
        lv_imgbtn_ext_t * ext    = lv_obj_get_ext_attr(imgbtn);
        lv_btn_state_t state     = lv_imgbtn_get_state(imgbtn);
        const lv_style_t * style = lv_imgbtn_get_style(imgbtn, state);
        lv_opa_t opa_scale       = lv_obj_get_opa_scale(imgbtn);



#if LV_IMGBTN_TILED == 0
        const void * src = ext->img_src[state];
        if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) {
            lv_draw_label(&imgbtn->coords, mask, style, opa_scale, src, LV_TXT_FLAG_NONE, NULL, NULL, NULL, lv_obj_get_base_dir(imgbtn));
        } else {
            lv_draw_img(&imgbtn->coords, mask, src, style, opa_scale);
        }
#else
        const void * src;
        src = ext->img_src_left[state];
        if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) {
            LV_LOG_WARN("lv_imgbtn_design: SYMBOLS are not supported in tiled mode")
            return true;
        }

        lv_img_header_t header;
        lv_area_t coords;
        lv_coord_t left_w = 0;
        lv_coord_t right_w = 0;

        if(src) {
            lv_img_decoder_get_info(src, &header);
            left_w = header.w;
            coords.x1 = imgbtn->coords.x1;
            coords.y1 = imgbtn->coords.y1;
            coords.x2 = coords.x1 + header.w - 1;
            coords.y2 = coords.y1 + header.h - 1;
            lv_draw_img(&coords, mask, src, style, opa_scale);
        }

        src = ext->img_src_right[state];
        if(src) {
            lv_img_decoder_get_info(src, &header);
            right_w = header.w;
            coords.x1 = imgbtn->coords.x2 - header.w + 1;
            coords.y1 = imgbtn->coords.y1;
            coords.x2 = imgbtn->coords.x2;
            coords.y2 = imgbtn->coords.y1 + header.h - 1;
            lv_draw_img(&coords, mask, src, style, opa_scale);
        }

        src = ext->img_src_mid[state];
        if(src) {
            lv_coord_t obj_w = lv_obj_get_width(imgbtn);
            lv_coord_t i;
            lv_img_decoder_get_info(src, &header);

            coords.x1 = imgbtn->coords.x1 + left_w;
            coords.y1 = imgbtn->coords.y1;
            coords.x2 = coords.x1 + header.w - 1;
            coords.y2 = imgbtn->coords.y1 + header.h - 1;

            for(i = 0; i < obj_w - right_w - left_w; i += header.w) {
                lv_draw_img(&coords, mask, src, style, opa_scale);
                coords.x1 = coords.x2 + 1;
                coords.x2 += header.w;
            }
        }

#endif

    }
    /*Post draw when the children are drawn*/
    else if(mode == LV_DESIGN_DRAW_POST) {
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %eax
cmpl $0x2, %eax
jne 0x3ab5f
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x28(%rbp)
movb $0x0, -0x29(%rbp)
movq -0x28(%rbp), %rax
movzbl 0x60(%rax), %eax
cmpl $0x4, %eax
je 0x3ab3c
movq -0x28(%rbp), %rax
movzbl 0x60(%rax), %eax
cmpl $0x1, %eax
jne 0x3ab52
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x20, %rsi
callq 0x42ae0
andb $0x1, %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x3ac6e
movzbl -0x19(%rbp), %eax
cmpl $0x0, %eax
jne 0x3ac5b
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3af50
movb %al, -0x39(%rbp)
movq -0x10(%rbp), %rdi
movzbl -0x39(%rbp), %esi
callq 0x3af00
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa710
movb %al, -0x49(%rbp)
movq -0x38(%rbp), %rax
movzbl -0x39(%rbp), %ecx
movq 0x38(%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x63110
movzbl %al, %eax
cmpl $0x2, %eax
jne 0x3ac3b
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x80(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x70(%rbp)
movb -0x49(%rbp), %al
movb %al, -0x61(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7180
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
movb -0x61(%rbp), %cl
movq -0x60(%rbp), %r8
xorl %r9d, %r9d
xorl %r10d, %r10d
movzbl %cl, %ecx
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movzbl %al, %eax
movl %eax, 0x18(%rsp)
callq 0x5f210
jmp 0x3ac59
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
movq -0x18(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq -0x48(%rbp), %rcx
movzbl -0x49(%rbp), %r8d
callq 0x61d50
jmp 0x3ac68
movzbl -0x19(%rbp), %eax
cmpl $0x1, %eax
jne 0x3ac66
jmp 0x3ac66
jmp 0x3ac68
jmp 0x3ac6a
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)