// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_arc.c
// Function: lv_arc_design
static bool lv_arc_design(lv_obj_t * arc, 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) {
        lv_arc_ext_t * ext       = lv_obj_get_ext_attr(arc);
        const lv_style_t * style = lv_arc_get_style(arc, LV_ARC_STYLE_MAIN);

        lv_coord_t r       = (LV_MATH_MIN(lv_obj_get_width(arc), lv_obj_get_height(arc))) / 2;
        lv_coord_t x       = arc->coords.x1 + lv_obj_get_width(arc) / 2;
        lv_coord_t y       = arc->coords.y1 + lv_obj_get_height(arc) / 2;
        lv_opa_t opa_scale = lv_obj_get_opa_scale(arc);
        lv_draw_arc(x, y, r, mask, ext->angle_start, ext->angle_end, style, opa_scale);

        /*Draw circle on the ends if enabled */
        if(style->line.rounded) {
            lv_coord_t thick_half = style->line.width / 2;
            lv_coord_t cir_x      = ((r - thick_half) * lv_trigo_sin(ext->angle_start) >> LV_TRIGO_SHIFT);
            lv_coord_t cir_y      = ((r - thick_half) * lv_trigo_sin(ext->angle_start + 90) >> LV_TRIGO_SHIFT);

            lv_style_t cir_style;
            lv_style_copy(&cir_style, &lv_style_plain);
            cir_style.body.grad_color = style->line.color;
            cir_style.body.main_color = cir_style.body.grad_color;
            cir_style.body.radius     = LV_RADIUS_CIRCLE;
            lv_area_t cir_area;
            cir_area.x1 = cir_x + x - thick_half;
            cir_area.y1 = cir_y + y - thick_half;
            cir_area.x2 = cir_x + x + thick_half;
            cir_area.y2 = cir_y + y + thick_half;

            lv_draw_rect(&cir_area, mask, &cir_style, opa_scale);

            cir_x = ((r - thick_half) * lv_trigo_sin(ext->angle_end) >> LV_TRIGO_SHIFT);
            cir_y = ((r - thick_half) * lv_trigo_sin(ext->angle_end + 90) >> LV_TRIGO_SHIFT);

            cir_area.x1 = cir_x + x - thick_half;
            cir_area.y1 = cir_y + y - thick_half;
            cir_area.x2 = cir_x + x + thick_half;
            cir_area.y2 = cir_y + y + thick_half;

            lv_draw_rect(&cir_area, mask, &cir_style, opa_scale);
        }

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

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %edx, 0x1c(%rsp)
testl %edx, %edx
jne 0x83a9
movq %rsi, %r15
movq %rdi, %r14
callq 0x6747
movq %rax, 0x28(%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x84b6
movq %rax, 0x20(%rsp)
movq %r14, %rdi
callq 0x5308
movl %eax, %ebp
movq %r14, %rdi
callq 0x5332
cmpw %ax, %bp
movq %r15, 0x10(%rsp)
movq %r14, %rdi
jge 0x81f0
callq 0x5308
jmp 0x81f5
callq 0x5332
cwtd
movw $0x2, %bx
idivw %bx
movl %eax, %r15d
movzwl 0x20(%r14), %r13d
movq %r14, %rdi
callq 0x5308
cwtd
idivw %bx
movl %eax, %ebp
addw %r13w, %bp
movzwl 0x22(%r14), %r12d
movq %r14, %rdi
callq 0x5332
cwtd
idivw %bx
movl %eax, %r13d
addw %r12w, %r13w
movq %r14, %rdi
callq 0x6649
movq 0x28(%rsp), %rbx
movzwl (%rbx), %r8d
movzwl 0x2(%rbx), %r9d
movzbl %al, %eax
movzwl %r15w, %edx
movl %ebp, 0xc(%rsp)
movswl %bp, %edi
movswl %r13w, %esi
movq 0x10(%rsp), %rcx
movq %rax, 0x30(%rsp)
pushq %rax
movq 0x28(%rsp), %rbp
pushq %rbp
callq 0x38b64
popq %rax
popq %rcx
testb $0x1, 0x41(%rbp)
je 0x83a9
movzwl 0x3e(%rbp), %eax
cwtd
movw $0x2, %cx
idivw %cx
movl %eax, %r14d
subl %r14d, %r15d
movswl %r15w, %ebp
movswl (%rbx), %edi
callq 0x28d8c
movswl %ax, %r15d
imull %ebp, %r15d
movl %ebp, 0x18(%rsp)
movzwl (%rbx), %eax
addl $0x5a, %eax
movswl %ax, %edi
callq 0x28d8c
movswl %ax, %r12d
imull %ebp, %r12d
leaq 0x55c54(%rip), %rsi     # 0x5df18
leaq 0x40(%rsp), %rbp
movq %rbp, %rdi
callq 0x74d4
movq 0x20(%rsp), %rax
movzwl 0x3c(%rax), %eax
movw %ax, 0x4(%rbp)
movw %ax, 0x2(%rbp)
movw $0x7c18, 0x6(%rbp)      # imm = 0x7C18
shrl $0xf, %r15d
addl 0xc(%rsp), %r15d
movl %r15d, %eax
subl %r14d, %eax
leaq 0x38(%rsp), %rdi
movw %ax, (%rdi)
shrl $0xf, %r12d
addl %r13d, %r12d
movl %r12d, %eax
subl %r14d, %eax
movw %ax, 0x2(%rdi)
addl %r14d, %r15d
movw %r15w, 0x4(%rdi)
addl %r14d, %r12d
movw %r12w, 0x6(%rdi)
movq 0x10(%rsp), %rsi
movq %rbp, %rdx
movq 0x30(%rsp), %rbx
movl %ebx, %ecx
callq 0x336d4
movq 0x28(%rsp), %rbp
movswl 0x2(%rbp), %edi
callq 0x28d8c
movswl %ax, %r15d
movl 0x18(%rsp), %r12d
imull %r12d, %r15d
movzwl 0x2(%rbp), %eax
addl $0x5a, %eax
movswl %ax, %edi
callq 0x28d8c
cwtl
imull %r12d, %eax
shrl $0xf, %r15d
addl 0xc(%rsp), %r15d
movl %r15d, %ecx
subl %r14d, %ecx
leaq 0x38(%rsp), %rdi
movw %cx, (%rdi)
shrl $0xf, %eax
addl %r13d, %eax
movl %eax, %ecx
subl %r14d, %ecx
movw %cx, 0x2(%rdi)
addl %r14d, %r15d
movw %r15w, 0x4(%rdi)
addl %r14d, %eax
movw %ax, 0x6(%rdi)
movq 0x10(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movl %ebx, %ecx
callq 0x336d4
cmpb $0x2, 0x1c(%rsp)
setne %al
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq