// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_gauge.c
// Function: lv_gauge_design
static bool lv_gauge_design(lv_obj_t * gauge, 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) {
        return false;
    }
    /*Draw the object*/
    else if(mode == LV_DESIGN_DRAW_MAIN) {

        /* 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 = gauge->style_p;
        const lv_style_t * style       = lv_obj_get_style(gauge);
        lv_gauge_ext_t * ext           = lv_obj_get_ext_attr(gauge);

        lv_gauge_draw_scale(gauge, mask);

        /*Draw the ancestor line meter with max value to show the rainbow like line colors*/
        uint16_t line_cnt_tmp = ext->lmeter.line_cnt;
        ancestor_design(gauge, mask, mode); /*To draw lines*/

        /*Temporally modify the line meter to draw longer lines where labels are*/
        lv_style_t style_tmp;
        lv_style_copy(&style_tmp, style);
        ext->lmeter.line_cnt         = ext->label_count;                 /*Only to labels*/
        style_tmp.body.padding.left  = style_tmp.body.padding.left * 2;  /*Longer lines*/
        style_tmp.body.padding.right = style_tmp.body.padding.right * 2; /*Longer lines*/
        gauge->style_p               = &style_tmp;

        ancestor_design(gauge, mask, mode); /*To draw lines*/

        ext->lmeter.line_cnt = line_cnt_tmp; /*Restore the parameters*/
        gauge->style_p       = style_ori_p;  /*Restore the ORIGINAL style pointer*/

        lv_gauge_draw_needle(gauge, mask);

    }
    /*Post draw when the children are drawn*/
    else if(mode == LV_DESIGN_DRAW_POST) {
        ancestor_design(gauge, mask, mode);
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movl %edx, %ebx
movq %rsi, 0x50(%rsp)
movq %rdi, 0x48(%rsp)
cmpl $0x2, %edx
je 0x18086
cmpb $0x1, %bl
je 0x18073
movzbl %bl, %eax
testl %eax, %eax
jne 0x18086
movl %ebx, 0xa8(%rsp)
movq 0x48(%rsp), %r13
movq 0x48(%r13), %rax
movq %rax, 0x88(%rsp)
movq %r13, %rdi
callq 0x6316
movq %rax, 0xb0(%rsp)
movq %r13, %rdi
callq 0x6747
movq %rax, 0x78(%rsp)
movq %r13, %rdi
callq 0x6747
movq %rax, %r14
movq %r13, %rdi
callq 0x6316
movq %rax, %rbx
movq %r13, %rdi
callq 0x6649
movl %eax, %ebp
movq %r13, %rdi
callq 0x5308
cwtd
movw $0x2, %r12w
idivw %r12w
movzwl 0x1a(%rbx), %ecx
imull $-0x3, %ecx, %r15d
addl %eax, %r15d
movq %rbx, 0x98(%rsp)
subw 0x1e(%rbx), %r15w
movq %r13, %rdi
callq 0x5308
cwtd
idivw %r12w
addw 0x20(%r13), %ax
movl %eax, 0x44(%rsp)
movq %r13, %rdi
callq 0x5332
cwtd
idivw %r12w
addw 0x22(%r13), %ax
movl %eax, 0x40(%rsp)
movq %r13, %rdi
callq 0x23056
movzbl 0x21(%r14), %r12d
movswl %ax, %ecx
movl $0x168, %eax            # imm = 0x168
movl %ecx, 0x80(%rsp)
subl %ecx, %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
movl %eax, %ebx
movq %r13, %rdi
callq 0x22fd2
movl %eax, %r14d
movq %r13, %rdi
callq 0x22ffe
leal -0x1(%r12), %ecx
movl %ecx, 0x3c(%rsp)
addl $0x5a, %ebx
movq %rbx, 0xa0(%rsp)
movswl %r15w, %ecx
movl %ecx, 0x38(%rsp)
cwtl
movswl %r14w, %ecx
movl %ecx, 0x34(%rsp)
subl %ecx, %eax
movl %eax, 0x90(%rsp)
xorl %eax, %eax
movzbl %bpl, %ecx
movl %ecx, 0x30(%rsp)
xorl %r13d, %r13d
movl 0x3c(%rsp), %r15d
subl $0x1, %r12d
jb 0x17c75
movl %eax, 0x60(%rsp)
movl 0x60(%rsp), %eax
cltd
idivl %r15d
movl %eax, %r14d
movq 0xa0(%rsp), %rbp
leal (%r14,%rbp), %eax
movswl %ax, %edi
callq 0x28d8c
cwtl
movl 0x38(%rsp), %ebx
imull %ebx, %eax
cltd
movl $0x7fff, %ecx           # imm = 0x7FFF
idivl %ecx
movl %eax, 0x2c(%rsp)
leal (%r14,%rbp), %eax
addl $0x5a, %eax
movswl %ax, %edi
callq 0x28d8c
cwtl
imull %ebx, %eax
cltd
movl $0x7fff, %ecx           # imm = 0x7FFF
idivl %ecx
movl %eax, %r14d
movl %r13d, %eax
cltd
idivl %r15d
addl 0x34(%rsp), %eax
movswl %ax, %edi
leaq 0x160(%rsp), %rbx
movq %rbx, %rsi
callq 0x28f4c
movq 0x98(%rsp), %rbp
movq 0x28(%rbp), %rdx
movswl 0x30(%rbp), %ecx
movswl 0x32(%rbp), %r8d
andl $0x0, (%rsp)
leaq 0xd0(%rsp), %rdi
movq %rbx, %rsi
movl $0x7c18, %r9d           # imm = 0x7C18
callq 0x28723
movzwl 0xd0(%rsp), %ecx
movl %ecx, %eax
cwtd
movw $0xfffe, %r8w           # imm = 0xFFFE
idivw %r8w
movl %eax, %esi
addl 0x44(%rsp), %esi
addl %r14d, %esi
movw %si, 0x118(%rsp)
movzwl 0xd2(%rsp), %edi
movl %edi, %eax
cwtd
idivw %r8w
addl 0x40(%rsp), %eax
addl 0x2c(%rsp), %eax
movw %ax, 0x11a(%rsp)
addl %ecx, %esi
movw %si, 0x11c(%rsp)
addl %edi, %eax
movw %ax, 0x11e(%rsp)
movq 0x48(%rsp), %rdi
callq 0x47b9
movzbl %al, %eax
movl %eax, 0x18(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
leaq 0x118(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq %rbp, %rdx
movl 0x30(%rsp), %ecx
movq %rbx, %r8
xorl %r9d, %r9d
callq 0x3699c
movl 0x60(%rsp), %eax
addl 0x90(%rsp), %r13d
addl 0x80(%rsp), %eax
jmp 0x17b1a
movq 0x78(%rsp), %r13
movzwl 0x4(%r13), %ebx
xorl %r12d, %r12d
movq 0x48(%rsp), %r15
movq %r15, %rdi
movq 0x50(%rsp), %r14
movq %r14, %rsi
xorl %edx, %edx
callq *0x4670e(%rip)          # 0x5e3a8
leaq 0xd0(%rsp), %rbp
movq %rbp, %rdi
movq 0xb0(%rsp), %rsi
callq 0x74d4
movzbl 0x21(%r13), %eax
movw %ax, 0x4(%r13)
movd 0xea(%rsp), %xmm0
paddw %xmm0, %xmm0
movd %xmm0, 0xea(%rsp)
movq %rbp, 0x48(%r15)
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x466c4(%rip)          # 0x5e3a8
movw %bx, 0x4(%r13)
movq 0x88(%rsp), %rax
movq %rax, 0x48(%r15)
movq %r15, %rdi
callq 0x6747
movq %rax, 0x80(%rsp)
movq %r15, %rdi
callq 0x6316
movq %rax, %rbx
movq %rax, 0x78(%rsp)
movq %r15, %rdi
callq 0x6649
movb %al, 0xa0(%rsp)
movq %r15, %rdi
callq 0x5308
movw $0x2, %cx
cwtd
idivw %cx
subw 0x1a(%rbx), %ax
movw %ax, 0x2c(%rsp)
movq %r15, %rdi
callq 0x5308
movl %eax, %ebp
movss 0x20(%r15), %xmm0
movaps %xmm0, 0x60(%rsp)
movq %r15, %rdi
callq 0x5332
movd %ebp, %xmm0
pinsrw $0x1, %eax, %xmm0
movdqa %xmm0, %xmm1
psrlw $0xf, %xmm1
paddw %xmm0, %xmm1
psraw $0x1, %xmm1
movdqa 0x60(%rsp), %xmm2
pinsrw $0x1, 0x22(%r15), %xmm2
paddw %xmm1, %xmm2
movdqa %xmm2, 0x60(%rsp)
pshufd $0x50, %xmm2, %xmm0     # xmm0 = xmm2[0,0,1,1]
movdqa %xmm0, 0xb0(%rsp)
movd %xmm2, 0x98(%rsp)
pextrw $0x1, %xmm2, %eax
movl %eax, 0x3c(%rsp)
movq %r15, %rdi
callq 0x23056
movzwl %ax, %r13d
movl $0x168, %eax            # imm = 0x168
subl %r13d, %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %ebx
movq %r15, %rdi
callq 0x22fd2
movl %eax, %ebp
movq %r15, %rdi
callq 0x22ffe
movl %eax, %r14d
leaq 0x160(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x74d4
leaq 0xac(%rsp), %rax
movaps 0x60(%rsp), %xmm0
movss %xmm0, (%rax)
movswl %bp, %eax
shll $0x5, %r13d
movl %r13d, 0x38(%rsp)
movswl %r14w, %ecx
movl %eax, 0x34(%rsp)
subl %eax, %ecx
movl %ecx, 0x30(%rsp)
addl $0x5a, %ebx
movq %rbx, 0x90(%rsp)
movswl 0x2c(%rsp), %eax
movl %eax, 0x88(%rsp)
movq 0x80(%rsp), %r13
movl 0x3c(%rsp), %r15d
movzbl 0x20(%r13), %eax
cmpq %rax, %r12
jae 0x17fe7
movq 0x10(%r13), %rax
movswl (%rax,%r12,2), %eax
subl 0x34(%rsp), %eax
imull 0x38(%rsp), %eax
cltd
idivl 0x30(%rsp)
movl %eax, 0x2c(%rsp)
movq %r12, 0x60(%rsp)
movswl %ax, %r12d
sarl $0x5, %r12d
movq 0x90(%rsp), %r14
leal (%r14,%r12), %eax
leal (%r14,%r12), %ebp
incl %ebp
movswl %ax, %edi
callq 0x28d8c
cwtl
movl 0x88(%rsp), %ebx
imull %ebx, %eax
cltd
movl $0x7fff, %ecx           # imm = 0x7FFF
idivl %ecx
addl %r15d, %eax
movl %eax, 0x44(%rsp)
leal (%r14,%r12), %eax
addl $0x5a, %eax
movswl %ax, %edi
callq 0x28d8c
cwtl
imull %ebx, %eax
cltd
movl $0x7fff, %ecx           # imm = 0x7FFF
idivl %ecx
movl 0x98(%rsp), %r13d
addl %r13d, %eax
movl %eax, 0x40(%rsp)
movswl %bp, %edi
callq 0x28d8c
cwtl
imull %ebx, %eax
cltd
movl $0x7fff, %ecx           # imm = 0x7FFF
idivl %ecx
movl %eax, %ebp
addl %r15d, %ebp
leal (%r14,%r12), %eax
addl $0x5b, %eax
movswl %ax, %edi
callq 0x28d8c
cwtl
imull %ebx, %eax
cltd
movl $0x7fff, %ecx           # imm = 0x7FFF
idivl %ecx
addl %r13d, %eax
movl 0x2c(%rsp), %edi
andl $0x1f, %edi
movl 0x40(%rsp), %r14d
movswl %r14w, %ecx
cwtl
movl %eax, %esi
subl %ecx, %esi
movl %esi, %edx
negl %edx
cmovsl %esi, %edx
movl $0xffff, %r10d          # imm = 0xFFFF
andl %r10d, %edx
imull %edi, %edx
movl %edi, %r11d
shrl $0x5, %edx
movl 0x44(%rsp), %ebx
movswl %bx, %esi
movswl %bp, %edi
movl %edi, %r8d
subl %esi, %r8d
movl %r8d, %r9d
negl %r9d
cmovsl %r8d, %r9d
andl %r10d, %r9d
imull %r11d, %r9d
shrl $0x5, %r9d
movl %edx, %r8d
negl %r8d
movl %r9d, %r10d
negl %r10d
cmpw %cx, %ax
cmovgel %edx, %r8d
addl %r14d, %r8d
movq 0x80(%rsp), %r13
cmpw %si, %di
movw %r8w, 0x5c(%rsp)
cmovgel %r9d, %r10d
addl %ebx, %r10d
movw %r10w, 0x5e(%rsp)
movq 0x18(%r13), %rax
testq %rax, %rax
je 0x17fa6
movq 0x60(%rsp), %r12
movzwl (%rax,%r12,2), %eax
jmp 0x17faf
movw $0xf800, %ax            # imm = 0xF800
movq 0x60(%rsp), %r12
movw %ax, 0x19c(%rsp)
movzbl 0xa0(%rsp), %r8d
leaq 0xac(%rsp), %rdi
leaq 0x5c(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0x160(%rsp), %rcx
callq 0x37138
incq %r12
jmp 0x17e3f
leaq 0x45f2a(%rip), %rsi     # 0x5df18
leaq 0x118(%rsp), %rbx
movq %rbx, %rdi
callq 0x74d4
movq 0x78(%rsp), %rcx
movzwl 0xa(%rcx), %eax
movw %ax, 0x2(%rbx)
movw %ax, 0x4(%rbx)
movw $0x7c18, 0x6(%rbx)      # imm = 0x7C18
movzwl 0x6(%rcx), %eax
movd %eax, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
movdqa 0xb0(%rsp), %xmm2
movdqa %xmm2, %xmm1
psubw %xmm0, %xmm1
paddw %xmm0, %xmm2
pshufd $0x55, %xmm2, %xmm0     # xmm0 = xmm2[1,1,1,1]
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
leaq 0xc8(%rsp), %r14
movq %xmm1, (%r14)
movq 0x48(%rsp), %rdi
callq 0x6649
movzbl %al, %ecx
movq %r14, %rdi
movq 0x50(%rsp), %rsi
movq %rbx, %rdx
callq 0x336d4
movl 0xa8(%rsp), %ebx
jmp 0x18086
pushq $0x1
popq %rdx
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq *0x46322(%rip)          # 0x5e3a8
cmpb $0x2, %bl
setne %al
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq