// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
testl %edx, %edx
je 0x249f2
cmpl $0x2, %edx
jne 0x24b01
movq 0x3ba7e(%rip), %rax     # 0x60458
movq %rbx, %rdi
movq %r14, %rsi
movl $0x2, %edx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
movq %rbx, %rdi
callq 0x6af7
movq %rax, %r15
movq %rbx, %rdi
callq 0x66b6
movq 0x48(%rbx), %r12
movq %rsp, %rdx
movl $0x9, %ecx
movq %rdx, %rdi
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
movzbl (%r15), %ecx
movd 0x2(%rdx), %xmm0
movdqa %xmm0, %xmm1
psrlw $0x8, %xmm1
pand 0x1b13c(%rip), %xmm1    # 0x3fb70
movd %ecx, %xmm2
pshuflw $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0,4,5,6,7]
pmullw %xmm2, %xmm1
pand 0x1a617(%rip), %xmm1    # 0x3f060
movdqa %xmm0, %xmm3
psrlw $0x5, %xmm3
pand 0x1a616(%rip), %xmm3    # 0x3f070
pmullw %xmm2, %xmm3
psrlw $0x3, %xmm3
pand 0x1a635(%rip), %xmm3    # 0x3f0a0
pand 0x1a63d(%rip), %xmm0    # 0x3f0b0
pmullw %xmm2, %xmm0
psrlw $0x8, %xmm0
por %xmm1, %xmm0
por %xmm3, %xmm0
movd %xmm0, 0x2(%rdx)
movzwl 0xa(%rdx), %esi
movl %esi, %edi
shrl $0x8, %edi
andl $-0x8, %edi
imull %ecx, %edi
andl $0xf800, %edi           # imm = 0xF800
movl %esi, %r8d
shrl $0x5, %r8d
andl $0x3f, %r8d
imull %ecx, %r8d
shrl $0x3, %r8d
andl $-0x20, %r8d
andl $0x1f, %esi
imull %ecx, %esi
shrl $0x8, %esi
orl %edi, %esi
orl %r8d, %esi
movw %si, 0xa(%rdx)
addl $-0x64, %ecx
movswl 0x12(%rax), %eax
imull %ecx, %eax
cltq
imulq $0x1a6d01a7, %rax, %rax # imm = 0x1A6D01A7
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x24, %rax
addl %ecx, %eax
movw %ax, 0x12(%rdx)
movq %rdx, 0x48(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x3b95b(%rip)          # 0x60458
movq %r12, 0x48(%rbx)
movb $0x1, %al
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq