// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_lmeter.c
// Function: lv_lmeter_create
lv_obj_t * lv_lmeter_create(lv_obj_t * par, const lv_obj_t * copy)
{
    LV_LOG_TRACE("line meter create started");

    /*Create the ancestor of line meter*/
    lv_obj_t * new_lmeter = lv_obj_create(par, copy);
    LV_ASSERT_MEM(new_lmeter);
    if(new_lmeter == NULL) return NULL;

    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_lmeter);

    /*Allocate the line meter type specific extended data*/
    lv_lmeter_ext_t * ext = lv_obj_allocate_ext_attr(new_lmeter, sizeof(lv_lmeter_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;

    /*Initialize the allocated 'ext' */
    ext->min_value   = 0;
    ext->max_value   = 100;
    ext->cur_value   = 0;
    ext->line_cnt    = 21;  /*Odd scale number looks better*/
    ext->scale_angle = 240; /*(scale_num - 1) * N looks better */
    ext->angle_ofs = 0;

    /*The signal and design functions are not copied so set them here*/
    lv_obj_set_signal_cb(new_lmeter, lv_lmeter_signal);
    lv_obj_set_design_cb(new_lmeter, lv_lmeter_design);

    /*Init the new line meter line meter*/
    if(copy == NULL) {
        lv_obj_set_size(new_lmeter, LV_DPI, LV_DPI);

        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_lmeter_set_style(new_lmeter, LV_LMETER_STYLE_MAIN, th->style.lmeter);
        } else {
            lv_lmeter_set_style(new_lmeter, LV_LMETER_STYLE_MAIN, &lv_style_pretty_color);
        }
    }
    /*Copy an existing line meter*/
    else {
        lv_lmeter_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        ext->scale_angle           = copy_ext->scale_angle;
        ext->line_cnt              = copy_ext->line_cnt;
        ext->min_value             = copy_ext->min_value;
        ext->max_value             = copy_ext->max_value;
        ext->cur_value             = copy_ext->cur_value;

        /*Refresh the style with new signal function*/
        lv_obj_refresh_style(new_lmeter);
    }

    LV_LOG_INFO("line meter created");

    return new_lmeter;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
callq 0x42c9
movq %rax, %rbx
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x22a2e
testq %rbx, %rbx
je 0x22a3f
cmpq $0x0, 0x3babb(%rip)     # 0x5e460
jne 0x229b6
movq %rbx, %rdi
callq 0x66db
movq %rax, 0x3baaa(%rip)     # 0x5e460
pushq $0xc
popq %rsi
movq %rbx, %rdi
callq 0x6146
movq %rax, %r15
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x22a4a
testq %r15, %r15
je 0x22a3f
movl $0x640000, 0x8(%r15)    # imm = 0x640000
movabsq $0x15000000f0, %rax     # imm = 0x15000000F0
movq %rax, (%r15)
leaq 0x9b(%rip), %rsi        # 0x22a8c
movq %rbx, %rdi
callq 0x60e6
leaq 0x108(%rip), %rsi       # 0x22b08
movq %rbx, %rdi
callq 0x6116
testq %r14, %r14
je 0x22a5b
movq %r14, %rdi
callq 0x6747
movzwl (%rax), %ecx
movw %cx, (%r15)
movq 0x4(%rax), %rax
movq %rax, 0x4(%r15)
movq %rbx, %rdi
callq 0x5ae7
jmp 0x22a41
leaq 0x1860b(%rip), %rdi     # 0x3b040
movq %rbx, %rsi
callq 0x7b01
jmp 0x22a3d
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x185ef(%rip), %rdi     # 0x3b040
movq %r15, %rsi
callq 0x7b01
jmp 0x22a59
pushq $0x64
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
callq 0x520e
callq 0x2be75
testq %rax, %rax
je 0x22a7b
movq 0xd0(%rax), %rsi
jmp 0x22a82
leaq 0x3b56e(%rip), %rsi     # 0x5dff0
movq %rbx, %rdi
callq 0x5a3d
jmp 0x22a41