// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_gauge.c
// Function: lv_gauge_draw_needle
static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * mask)
{
    lv_style_t style_needle;
    lv_gauge_ext_t * ext     = lv_obj_get_ext_attr(gauge);
    const lv_style_t * style = lv_gauge_get_style(gauge, LV_GAUGE_STYLE_MAIN);
    lv_opa_t opa_scale       = lv_obj_get_opa_scale(gauge);

    lv_coord_t r      = lv_obj_get_width(gauge) / 2 - style->body.padding.left;
    lv_coord_t x_ofs  = lv_obj_get_width(gauge) / 2 + gauge->coords.x1;
    lv_coord_t y_ofs  = lv_obj_get_height(gauge) / 2 + gauge->coords.y1;
    uint16_t angle    = lv_lmeter_get_scale_angle(gauge);
    int16_t angle_ofs = 90 + (360 - angle) / 2;
    int16_t min       = lv_gauge_get_min_value(gauge);
    int16_t max       = lv_gauge_get_max_value(gauge);
    lv_point_t p_mid;
    lv_point_t p_end;
    lv_point_t p_end_low;
    lv_point_t p_end_high;
    uint8_t i;

    lv_style_copy(&style_needle, style);

    p_mid.x = x_ofs;
    p_mid.y = y_ofs;
    for(i = 0; i < ext->needle_count; i++) {
        /*Calculate the end point of a needle*/
        int16_t needle_angle =
            (ext->values[i] - min) * angle * (1 << LV_GAUGE_INTERPOLATE_SHIFT) / (max - min);

        int16_t needle_angle_low  = (needle_angle >> LV_GAUGE_INTERPOLATE_SHIFT) + angle_ofs;
        int16_t needle_angle_high = needle_angle_low + 1;

        p_end_low.y = (lv_trigo_sin(needle_angle_low) * r) / LV_TRIGO_SIN_MAX + y_ofs;
        p_end_low.x = (lv_trigo_sin(needle_angle_low + 90) * r) / LV_TRIGO_SIN_MAX + x_ofs;

        p_end_high.y = (lv_trigo_sin(needle_angle_high) * r) / LV_TRIGO_SIN_MAX + y_ofs;
        p_end_high.x = (lv_trigo_sin(needle_angle_high + 90) * r) / LV_TRIGO_SIN_MAX + x_ofs;

        uint16_t rem  = needle_angle & ((1 << LV_GAUGE_INTERPOLATE_SHIFT) - 1);
        int16_t x_mod = ((LV_MATH_ABS(p_end_high.x - p_end_low.x)) * rem) >> LV_GAUGE_INTERPOLATE_SHIFT;
        int16_t y_mod = ((LV_MATH_ABS(p_end_high.y - p_end_low.y)) * rem) >> LV_GAUGE_INTERPOLATE_SHIFT;

        if(p_end_high.x < p_end_low.x) x_mod = -x_mod;
        if(p_end_high.y < p_end_low.y) y_mod = -y_mod;

        p_end.x = p_end_low.x + x_mod;
        p_end.y = p_end_low.y + y_mod;

        /*Draw the needle with the corresponding color*/
        if(ext->needle_colors == NULL)
            style_needle.line.color = LV_GAUGE_DEF_NEEDLE_COLOR;
        else
            style_needle.line.color = ext->needle_colors[i];

        lv_draw_line(&p_mid, &p_end, mask, &style_needle, opa_scale);
    }

    /*Draw the needle middle area*/
    lv_style_t style_neddle_mid;
    lv_style_copy(&style_neddle_mid, &lv_style_plain);
    style_neddle_mid.body.main_color = style->body.border.color;
    style_neddle_mid.body.grad_color = style->body.border.color;
    style_neddle_mid.body.radius     = LV_RADIUS_CIRCLE;

    lv_area_t nm_cord;
    nm_cord.x1 = x_ofs - style->body.radius;
    nm_cord.y1 = y_ofs - style->body.radius;
    nm_cord.x2 = x_ofs + style->body.radius;
    nm_cord.y2 = y_ofs + style->body.radius;

    lv_draw_rect(&nm_cord, mask, &style_neddle_mid, lv_obj_get_opa_scale(gauge));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x297f0
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa710
movb %al, -0x69(%rbp)
movq -0x8(%rbp), %rdi
callq 0x8310
cwtl
movl $0x2, %ecx
cltd
idivl %ecx
movq -0x68(%rbp), %rcx
movswl 0x1a(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0x6c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x8310
cwtl
movl $0x2, %ecx
cltd
idivl %ecx
movq -0x8(%rbp), %rcx
movswl 0x20(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x6e(%rbp)
movq -0x8(%rbp), %rdi
callq 0x8350
cwtl
movl $0x2, %ecx
cltd
idivl %ecx
movq -0x8(%rbp), %rcx
movswl 0x22(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3c1e0
movw %ax, -0x72(%rbp)
movzwl -0x72(%rbp), %ecx
movl $0x168, %eax            # imm = 0x168
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
addl $0x5a, %eax
movw %ax, -0x74(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28e00
movw %ax, -0x76(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28f00
movw %ax, -0x78(%rbp)
movq -0x68(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0xc550
movw -0x6e(%rbp), %ax
movw %ax, -0x7c(%rbp)
movw -0x70(%rbp), %ax
movw %ax, -0x7a(%rbp)
movb $0x0, -0x89(%rbp)
movzbl -0x89(%rbp), %eax
movq -0x60(%rbp), %rcx
movzbl 0x20(%rcx), %ecx
cmpl %ecx, %eax
jge 0x29727
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movzbl -0x89(%rbp), %ecx
movswl (%rax,%rcx,2), %eax
movswl -0x76(%rbp), %ecx
subl %ecx, %eax
movzwl -0x72(%rbp), %ecx
imull %ecx, %eax
shll $0x5, %eax
movswl -0x78(%rbp), %ecx
movswl -0x76(%rbp), %edx
subl %edx, %ecx
cltd
idivl %ecx
movw %ax, -0x8c(%rbp)
movswl -0x8c(%rbp), %eax
sarl $0x5, %eax
movswl -0x74(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x8e(%rbp)
movswl -0x8e(%rbp), %eax
addl $0x1, %eax
movw %ax, -0x90(%rbp)
movswl -0x8e(%rbp), %edi
callq 0x47220
cwtl
movswl -0x6c(%rbp), %ecx
imull %ecx, %eax
movl $0x7fff, %ecx           # imm = 0x7FFF
cltd
idivl %ecx
movswl -0x70(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x82(%rbp)
movswl -0x8e(%rbp), %eax
addl $0x5a, %eax
movswl %ax, %edi
callq 0x47220
cwtl
movswl -0x6c(%rbp), %ecx
imull %ecx, %eax
movl $0x7fff, %ecx           # imm = 0x7FFF
cltd
idivl %ecx
movswl -0x6e(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x84(%rbp)
movswl -0x90(%rbp), %edi
callq 0x47220
cwtl
movswl -0x6c(%rbp), %ecx
imull %ecx, %eax
movl $0x7fff, %ecx           # imm = 0x7FFF
cltd
idivl %ecx
movswl -0x70(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x86(%rbp)
movswl -0x90(%rbp), %eax
addl $0x5a, %eax
movswl %ax, %edi
callq 0x47220
cwtl
movswl -0x6c(%rbp), %ecx
imull %ecx, %eax
movl $0x7fff, %ecx           # imm = 0x7FFF
cltd
idivl %ecx
movswl -0x6e(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x88(%rbp)
movswl -0x8c(%rbp), %eax
andl $0x1f, %eax
movw %ax, -0x92(%rbp)
movswl -0x88(%rbp), %eax
movswl -0x84(%rbp), %ecx
subl %ecx, %eax
cmpl $0x0, %eax
jle 0x29584
movswl -0x88(%rbp), %eax
movswl -0x84(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0xec(%rbp)
jmp 0x2959e
movswl -0x88(%rbp), %ecx
movswl -0x84(%rbp), %eax
subl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0xec(%rbp)
movl -0xec(%rbp), %eax
movzwl -0x92(%rbp), %ecx
imull %ecx, %eax
sarl $0x5, %eax
movw %ax, -0x94(%rbp)
movswl -0x86(%rbp), %eax
movswl -0x82(%rbp), %ecx
subl %ecx, %eax
cmpl $0x0, %eax
jle 0x295e5
movswl -0x86(%rbp), %eax
movswl -0x82(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0xf0(%rbp)
jmp 0x295ff
movswl -0x86(%rbp), %ecx
movswl -0x82(%rbp), %eax
subl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0xf0(%rbp)
movl -0xf0(%rbp), %eax
movzwl -0x92(%rbp), %ecx
imull %ecx, %eax
sarl $0x5, %eax
movw %ax, -0x96(%rbp)
movswl -0x88(%rbp), %eax
movswl -0x84(%rbp), %ecx
cmpl %ecx, %eax
jge 0x2963d
movswl -0x94(%rbp), %ecx
xorl %eax, %eax
subl %ecx, %eax
movw %ax, -0x94(%rbp)
movswl -0x86(%rbp), %eax
movswl -0x82(%rbp), %ecx
cmpl %ecx, %eax
jge 0x29661
movswl -0x96(%rbp), %ecx
xorl %eax, %eax
subl %ecx, %eax
movw %ax, -0x96(%rbp)
movswl -0x84(%rbp), %eax
movswl -0x94(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x80(%rbp)
movswl -0x82(%rbp), %eax
movswl -0x96(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x7e(%rbp)
movq -0x60(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x296e3
movw -0x98(%rbp), %ax
andw $-0x20, %ax
orw $0x0, %ax
movw %ax, -0x98(%rbp)
movw -0x98(%rbp), %ax
andw $0xf81f, %ax            # imm = 0xF81F
orw $0x0, %ax
movw %ax, -0x98(%rbp)
movw -0x98(%rbp), %ax
andw $0x7ff, %ax             # imm = 0x7FF
orw $0xf800, %ax            # imm = 0xF800
movw %ax, -0x98(%rbp)
movw -0x98(%rbp), %ax
movw %ax, -0x1c(%rbp)
jmp 0x296fa
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movzbl -0x89(%rbp), %ecx
movw (%rax,%rcx,2), %ax
movw %ax, -0x1c(%rbp)
movq -0x10(%rbp), %rdx
leaq -0x7c(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x58(%rbp), %rcx
movzbl -0x69(%rbp), %r8d
callq 0x5fcd0
movb -0x89(%rbp), %al
addb $0x1, %al
movb %al, -0x89(%rbp)
jmp 0x29420
leaq -0xe0(%rbp), %rdi
leaq 0x5f8b3(%rip), %rsi     # 0x88fe8
callq 0xc550
movq -0x68(%rbp), %rax
movw 0xa(%rax), %ax
movw %ax, -0xde(%rbp)
movq -0x68(%rbp), %rax
movw 0xa(%rax), %ax
movw %ax, -0xdc(%rbp)
movw $0x7c18, -0xda(%rbp)    # imm = 0x7C18
movswl -0x6e(%rbp), %eax
movq -0x68(%rbp), %rcx
movswl 0x6(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0xe8(%rbp)
movswl -0x70(%rbp), %eax
movq -0x68(%rbp), %rcx
movswl 0x6(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0xe6(%rbp)
movswl -0x6e(%rbp), %eax
movq -0x68(%rbp), %rcx
movswl 0x6(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0xe4(%rbp)
movswl -0x70(%rbp), %eax
movq -0x68(%rbp), %rcx
movswl 0x6(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0xe2(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa710
movq -0xf8(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
leaq -0xe0(%rbp), %rdx
movzbl %al, %ecx
callq 0x5a9e0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nop