// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_led.c
// Function: lv_led_design
static bool lv_led_design(lv_obj_t * led, const lv_area_t * mask, lv_design_mode_t mode)
{
    if(mode == LV_DESIGN_COVER_CHK) {
        /*Return false if the object is not covers the mask area*/
        return ancestor_design_f(led, mask, mode);
    } else if(mode == LV_DESIGN_DRAW_MAIN) {
        /*Make darker colors in a temporary style according to the brightness*/
        lv_led_ext_t * ext       = lv_obj_get_ext_attr(led);
        const lv_style_t * style = lv_obj_get_style(led);

        /* Store the real pointer because of 'lv_group'
         * If the object is in focus 'lv_obj_get_style()' will give a pointer to tmp style
         * and to the real object style. It is important because of style change tricks below*/
        const lv_style_t * style_ori_p = led->style_p;

        /*Create a temporal style*/
        lv_style_t leds_tmp;
        memcpy(&leds_tmp, style, sizeof(leds_tmp));

        /*Mix. the color with black proportionally with brightness*/
        leds_tmp.body.main_color   = lv_color_mix(leds_tmp.body.main_color, LV_COLOR_BLACK, ext->bright);
        leds_tmp.body.grad_color   = lv_color_mix(leds_tmp.body.grad_color, LV_COLOR_BLACK, ext->bright);
        leds_tmp.body.border.color = lv_color_mix(leds_tmp.body.border.color, LV_COLOR_BLACK, ext->bright);

        /*Set the current swidth according to brightness proportionally between LV_LED_BRIGHT_OFF
         * and LV_LED_BRIGHT_ON*/
        uint16_t bright_tmp = ext->bright;
        leds_tmp.body.shadow.width =
            ((bright_tmp - LV_LED_BRIGHT_OFF) * style->body.shadow.width) / (LV_LED_BRIGHT_ON - LV_LED_BRIGHT_OFF);

        led->style_p = &leds_tmp;
        ancestor_design_f(led, mask, mode);
        led->style_p = style_ori_p; /*Restore the ORIGINAL style pointer*/
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %eax
cmpl $0x2, %eax
jne 0x3b1f0
movq 0x4e350(%rip), %rax     # 0x89528
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movzbl -0x19(%rbp), %edx
callq *%rax
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x3b3e7
movzbl -0x19(%rbp), %eax
cmpl $0x0, %eax
jne 0x3b3e1
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa080
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rsi
leaq -0x80(%rbp), %rdi
movl $0x48, %edx
callq 0x20e0
movw -0x84(%rbp), %ax
andw $-0x20, %ax
orw $0x0, %ax
movw %ax, -0x84(%rbp)
movw -0x84(%rbp), %ax
andw $0xf81f, %ax            # imm = 0xF81F
orw $0x0, %ax
movw %ax, -0x84(%rbp)
movw -0x84(%rbp), %ax
andw $0x7ff, %ax             # imm = 0x7FF
orw $0x0, %ax
movw %ax, -0x84(%rbp)
movq -0x28(%rbp), %rax
movb (%rax), %al
movw -0x7e(%rbp), %cx
movzwl %cx, %edi
movzwl -0x84(%rbp), %esi
movzbl %al, %edx
callq 0x3b5d0
movw %ax, -0x82(%rbp)
movw -0x82(%rbp), %ax
movw %ax, -0x7e(%rbp)
movw -0x88(%rbp), %ax
andw $-0x20, %ax
orw $0x0, %ax
movw %ax, -0x88(%rbp)
movw -0x88(%rbp), %ax
andw $0xf81f, %ax            # imm = 0xF81F
orw $0x0, %ax
movw %ax, -0x88(%rbp)
movw -0x88(%rbp), %ax
andw $0x7ff, %ax             # imm = 0x7FF
orw $0x0, %ax
movw %ax, -0x88(%rbp)
movq -0x28(%rbp), %rax
movb (%rax), %al
movw -0x7c(%rbp), %cx
movzwl %cx, %edi
movzwl -0x88(%rbp), %esi
movzbl %al, %edx
callq 0x3b5d0
movw %ax, -0x86(%rbp)
movw -0x86(%rbp), %ax
movw %ax, -0x7c(%rbp)
movw -0x8c(%rbp), %ax
andw $-0x20, %ax
orw $0x0, %ax
movw %ax, -0x8c(%rbp)
movw -0x8c(%rbp), %ax
andw $0xf81f, %ax            # imm = 0xF81F
orw $0x0, %ax
movw %ax, -0x8c(%rbp)
movw -0x8c(%rbp), %ax
andw $0x7ff, %ax             # imm = 0x7FF
orw $0x0, %ax
movw %ax, -0x8c(%rbp)
movq -0x28(%rbp), %rax
movb (%rax), %al
movw -0x76(%rbp), %cx
movzwl %cx, %edi
movzwl -0x8c(%rbp), %esi
movzbl %al, %edx
callq 0x3b5d0
movw %ax, -0x8a(%rbp)
movw -0x8a(%rbp), %ax
movw %ax, -0x76(%rbp)
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
movw %ax, -0x8e(%rbp)
movzwl -0x8e(%rbp), %eax
subl $0x64, %eax
movq -0x30(%rbp), %rcx
movswl 0x12(%rcx), %ecx
imull %ecx, %eax
movl $0x9b, %ecx
cltd
idivl %ecx
movw %ax, -0x6e(%rbp)
movq -0x10(%rbp), %rax
leaq -0x80(%rbp), %rcx
movq %rcx, 0x48(%rax)
movq 0x4e161(%rip), %rax     # 0x89528
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movzbl -0x19(%rbp), %edx
callq *%rax
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
jmp 0x3b3e3
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)