// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_gauge.c
// Function: lv_gauge_draw_scale
static void lv_gauge_draw_scale(lv_obj_t * gauge, const lv_area_t * mask)
{
    char scale_txt[16];

    lv_gauge_ext_t * ext     = lv_obj_get_ext_attr(gauge);
    const lv_style_t * style = lv_obj_get_style(gauge);
    lv_opa_t opa_scale       = lv_obj_get_opa_scale(gauge);
    lv_coord_t r             = lv_obj_get_width(gauge) / 2 - (3 * style->body.padding.left) - style->body.padding.inner;
    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;
    int16_t scale_angle      = lv_lmeter_get_scale_angle(gauge);
    uint16_t label_num       = ext->label_count;
    int16_t angle_ofs        = 90 + (360 - scale_angle) / 2;
    int16_t min              = lv_gauge_get_min_value(gauge);
    int16_t max              = lv_gauge_get_max_value(gauge);

    uint8_t i;
    for(i = 0; i < label_num; i++) {
        /*Calculate the position a scale label*/
        int16_t angle = (i * scale_angle) / (label_num - 1) + angle_ofs;

        lv_coord_t y = (int32_t)((int32_t)lv_trigo_sin(angle) * r) / LV_TRIGO_SIN_MAX;
        y += y_ofs;

        lv_coord_t x = (int32_t)((int32_t)lv_trigo_sin(angle + 90) * r) / LV_TRIGO_SIN_MAX;
        x += x_ofs;

        int16_t scale_act = (int32_t)((int32_t)(max - min) * i) / (label_num - 1);
        scale_act += min;
        lv_utils_num_to_str(scale_act, scale_txt);

        lv_area_t label_cord;
        lv_point_t label_size;
        lv_txt_get_size(&label_size, scale_txt, style->text.font, style->text.letter_space, style->text.line_space,
                        LV_COORD_MAX, LV_TXT_FLAG_NONE);

        /*Draw the label*/
        label_cord.x1 = x - label_size.x / 2;
        label_cord.y1 = y - label_size.y / 2;
        label_cord.x2 = label_cord.x1 + label_size.x;
        label_cord.y2 = label_cord.y1 + label_size.y;

        lv_draw_label(&label_cord, mask, style, opa_scale, scale_txt, LV_TXT_FLAG_NONE, NULL, NULL, NULL, lv_obj_get_base_dir(gauge));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa080
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa710
movb %al, -0x31(%rbp)
movq -0x8(%rbp), %rdi
callq 0x8310
cwtl
movl $0x2, %ecx
cltd
idivl %ecx
movq -0x30(%rbp), %rcx
movswl 0x1a(%rcx), %ecx
imull $0x3, %ecx, %ecx
subl %ecx, %eax
movq -0x30(%rbp), %rcx
movswl 0x1e(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0x34(%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, -0x36(%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, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3c1e0
movw %ax, -0x3a(%rbp)
movq -0x28(%rbp), %rax
movzbl 0x21(%rax), %eax
movw %ax, -0x3c(%rbp)
movswl -0x3a(%rbp), %ecx
movl $0x168, %eax            # imm = 0x168
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
addl $0x5a, %eax
movw %ax, -0x3e(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28e00
movw %ax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28f00
movw %ax, -0x42(%rbp)
movb $0x0, -0x43(%rbp)
movzbl -0x43(%rbp), %eax
movzwl -0x3c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x29313
movzbl -0x43(%rbp), %eax
movswl -0x3a(%rbp), %ecx
imull %ecx, %eax
movzwl -0x3c(%rbp), %ecx
subl $0x1, %ecx
cltd
idivl %ecx
movswl -0x3e(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x46(%rbp)
movswl -0x46(%rbp), %edi
callq 0x47220
cwtl
movswl -0x34(%rbp), %ecx
imull %ecx, %eax
movl $0x7fff, %ecx           # imm = 0x7FFF
cltd
idivl %ecx
movw %ax, -0x48(%rbp)
movswl -0x38(%rbp), %ecx
movswl -0x48(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x48(%rbp)
movswl -0x46(%rbp), %eax
addl $0x5a, %eax
movswl %ax, %edi
callq 0x47220
cwtl
movswl -0x34(%rbp), %ecx
imull %ecx, %eax
movl $0x7fff, %ecx           # imm = 0x7FFF
cltd
idivl %ecx
movw %ax, -0x4a(%rbp)
movswl -0x36(%rbp), %ecx
movswl -0x4a(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x4a(%rbp)
movswl -0x42(%rbp), %eax
movswl -0x40(%rbp), %ecx
subl %ecx, %eax
movzbl -0x43(%rbp), %ecx
imull %ecx, %eax
movzwl -0x3c(%rbp), %ecx
subl $0x1, %ecx
cltd
idivl %ecx
movw %ax, -0x4c(%rbp)
movswl -0x40(%rbp), %ecx
movswl -0x4c(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x4c(%rbp)
movswl -0x4c(%rbp), %edi
leaq -0x20(%rbp), %rsi
callq 0x475d0
leaq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rdx
movq -0x30(%rbp), %rax
movw 0x30(%rax), %cx
movq -0x30(%rbp), %rax
leaq -0x58(%rbp), %rdi
movl $0x7c18, %r9d           # imm = 0x7C18
xorl %r8d, %r8d
movswl %cx, %ecx
movswl 0x32(%rax), %r8d
movl $0x0, (%rsp)
callq 0x46820
movswl -0x4a(%rbp), %eax
movl %eax, -0x80(%rbp)
movswl -0x58(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x80(%rbp), %eax
subl %ecx, %eax
movw %ax, -0x54(%rbp)
movswl -0x48(%rbp), %eax
movl %eax, -0x7c(%rbp)
movswl -0x56(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x7c(%rbp), %eax
subl %ecx, %eax
movw %ax, -0x52(%rbp)
movswl -0x54(%rbp), %eax
movswl -0x58(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x50(%rbp)
movswl -0x52(%rbp), %eax
movswl -0x56(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x4e(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movb -0x31(%rbp), %al
movb %al, -0x61(%rbp)
leaq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7180
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
movb -0x61(%rbp), %cl
movq -0x60(%rbp), %r8
leaq -0x54(%rbp), %rdi
xorl %r9d, %r9d
xorl %r10d, %r10d
movzbl %cl, %ecx
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movzbl %al, %eax
movl %eax, 0x18(%rsp)
callq 0x5f210
movb -0x43(%rbp), %al
addb $0x1, %al
movb %al, -0x43(%rbp)
jmp 0x29147
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)