// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
testl %edx, %edx
je 0x242b1
cmpl $0x2, %ebp
jne 0x243e3
movq 0x3c1bf(%rip), %rax     # 0x60458
movzbl %bpl, %edx
movq %rbx, %rdi
movq %r14, %rsi
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq %rbx, %rdi
callq 0x6ad8
movq %rax, %r15
movq %rbx, %rdi
callq 0x6697
movq 0x48(%rbx), %r12
leaq 0x8(%rsp), %rdx
movl $0x9, %ecx
movq %rdx, %rdi
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
movzbl (%r15), %esi
movzwl 0x2(%rdx), %ecx
movl %ecx, %edi
shrl $0x8, %edi
andl $-0x8, %edi
imull %esi, %edi
andl $0xf800, %edi           # imm = 0xF800
movl %ecx, %r8d
shrl $0x5, %r8d
andl $0x3f, %r8d
imull %esi, %r8d
shrl $0x3, %r8d
andl $-0x20, %r8d
andl $0x1f, %ecx
imull %esi, %ecx
movzbl %ch, %ecx
orl %edi, %ecx
orl %r8d, %ecx
movw %cx, 0x2(%rdx)
movzbl (%r15), %edi
movzwl 0x4(%rdx), %ecx
movl %ecx, %r8d
shrl $0x8, %r8d
andl $-0x8, %r8d
imull %edi, %r8d
movl $0xfffff800, %esi       # imm = 0xFFFFF800
andl %esi, %r8d
movl %ecx, %r9d
shrl $0x5, %r9d
andl $0x3f, %r9d
imull %edi, %r9d
shrl $0x3, %r9d
andl $-0x20, %r9d
andl $0x1f, %ecx
imull %edi, %ecx
movzbl %ch, %ecx
orl %r8d, %ecx
orl %r9d, %ecx
movw %cx, 0x4(%rdx)
movzbl (%r15), %edi
movzwl 0xa(%rdx), %ecx
movl %ecx, %r8d
shrl $0x8, %r8d
andl $-0x8, %r8d
imull %edi, %r8d
andl %esi, %r8d
movl %ecx, %esi
shrl $0x5, %esi
andl $0x3f, %esi
imull %edi, %esi
shrl $0x3, %esi
andl $-0x20, %esi
andl $0x1f, %ecx
imull %edi, %ecx
movzbl %ch, %ecx
orl %r8d, %ecx
orl %esi, %ecx
movw %cx, 0xa(%rdx)
movzbl (%r15), %ecx
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)
movzbl %bpl, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x3c079(%rip)          # 0x60458
movq %r12, 0x48(%rbx)
movb $0x1, %al
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq