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

    /*Create the ancestor basic object*/
    lv_obj_t * new_chart = lv_obj_create(par, copy);
    LV_ASSERT_MEM(new_chart);
    if(new_chart == NULL) return NULL;

    /*Allocate the object type specific extended data*/
    lv_chart_ext_t * ext = lv_obj_allocate_ext_attr(new_chart, sizeof(lv_chart_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;

    lv_ll_init(&ext->series_ll, sizeof(lv_chart_series_t));

    ext->series.num            = 0;
    ext->ymin                  = LV_CHART_YMIN_DEF;
    ext->ymax                  = LV_CHART_YMAX_DEF;
    ext->hdiv_cnt              = LV_CHART_HDIV_DEF;
    ext->vdiv_cnt              = LV_CHART_VDIV_DEF;
    ext->point_cnt             = LV_CHART_PNUM_DEF;
    ext->type                  = LV_CHART_TYPE_LINE;
    ext->update_mode           = LV_CHART_UPDATE_MODE_SHIFT;
    ext->series.opa            = LV_OPA_COVER;
    ext->series.dark           = LV_OPA_50;
    ext->series.width          = 2;
    ext->margin                = 0;
    memset(&ext->x_axis, 0, sizeof(ext->x_axis));
    memset(&ext->y_axis, 0, sizeof(ext->y_axis));
    memset(&ext->secondary_y_axis, 0, sizeof(ext->secondary_y_axis));
    ext->x_axis.major_tick_len = LV_CHART_TICK_LENGTH_AUTO;
    ext->x_axis.minor_tick_len = LV_CHART_TICK_LENGTH_AUTO;
    ext->y_axis.major_tick_len = LV_CHART_TICK_LENGTH_AUTO;
    ext->y_axis.minor_tick_len = LV_CHART_TICK_LENGTH_AUTO;
    ext->secondary_y_axis.major_tick_len = LV_CHART_TICK_LENGTH_AUTO;
    ext->secondary_y_axis.minor_tick_len = LV_CHART_TICK_LENGTH_AUTO;

    if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_cb(new_chart);
    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_chart);

    lv_obj_set_signal_cb(new_chart, lv_chart_signal);
    lv_obj_set_design_cb(new_chart, lv_chart_design);

    /*Init the new chart background object*/
    if(copy == NULL) {
        lv_obj_set_size(new_chart, LV_DPI * 3, LV_DPI * 2);

        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_chart_set_style(new_chart, LV_CHART_STYLE_MAIN, th->style.chart);
        } else {
            lv_chart_set_style(new_chart, LV_CHART_STYLE_MAIN, &lv_style_pretty);
        }

    } else {
        lv_chart_ext_t * ext_copy = lv_obj_get_ext_attr(copy);

        ext->type       = ext_copy->type;
        ext->ymin       = ext_copy->ymin;
        ext->ymax       = ext_copy->ymax;
        ext->hdiv_cnt   = ext_copy->hdiv_cnt;
        ext->vdiv_cnt   = ext_copy->vdiv_cnt;
        ext->point_cnt  = ext_copy->point_cnt;
        ext->series.opa = ext_copy->series.opa;
        ext->margin     = ext_copy->margin;
        memcpy(&ext->x_axis, &ext_copy->x_axis, sizeof(lv_chart_axis_cfg_t));
        memcpy(&ext->y_axis, &ext_copy->y_axis, sizeof(lv_chart_axis_cfg_t));
        memcpy(&ext->secondary_y_axis, &ext_copy->secondary_y_axis, sizeof(lv_chart_axis_cfg_t));

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

    LV_LOG_INFO("chart created");

    return new_chart;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
callq 0x42c9
movq %rax, %rbx
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x140dd
testq %rbx, %rbx
je 0x140ee
pushq $0x68
popq %rsi
movq %rbx, %rdi
callq 0x6146
movq %rax, %r15
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x14102
testq %r15, %r15
je 0x140ee
pushq $0x10
popq %rsi
movq %r15, %rdi
callq 0x27cf0
movabsq $0xa050300640000, %rax  # imm = 0xA050300640000
movq %rax, 0x18(%r15)
movb $0x1, 0x20(%r15)
andb $-0x2, 0x5a(%r15)
movb $0x7f, 0x60(%r15)
movl $0xff000002, 0x5c(%r15) # imm = 0xFF000002
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%r15)
movups %xmm0, 0x28(%r15)
andw $0x0, 0x58(%r15)
movups %xmm0, 0x48(%r15)
orw $-0x1, 0x42(%r15)
orw $-0x1, 0x32(%r15)
orw $-0x1, 0x52(%r15)
cmpq $0x0, 0x4a364(%rip)     # 0x5e380
jne 0x1402d
movq %rbx, %rdi
callq 0x66ff
movq %rax, 0x4a353(%rip)     # 0x5e380
cmpq $0x0, 0x4a353(%rip)     # 0x5e388
jne 0x14046
movq %rbx, %rdi
callq 0x66db
movq %rax, 0x4a342(%rip)     # 0x5e388
leaq 0xfc(%rip), %rsi        # 0x14149
movq %rbx, %rdi
callq 0x60e6
leaq 0x188(%rip), %rsi       # 0x141e4
movq %rbx, %rdi
callq 0x6116
testq %r14, %r14
je 0x14113
leaq 0x38(%r15), %r12
leaq 0x28(%r15), %r13
movq %r15, %rbp
addq $0x48, %rbp
movq %r14, %rdi
callq 0x6747
movb 0x20(%rax), %cl
movb %cl, 0x20(%r15)
movl 0x18(%rax), %ecx
movl %ecx, 0x18(%r15)
movb 0x1c(%rax), %cl
movb %cl, 0x1c(%r15)
movb 0x1d(%rax), %cl
movb %cl, 0x1d(%r15)
movzwl 0x1e(%rax), %ecx
movw %cx, 0x1e(%r15)
movb 0x5f(%rax), %cl
movb %cl, 0x5f(%r15)
movzwl 0x58(%rax), %ecx
movw %cx, 0x58(%r15)
movups 0x38(%rax), %xmm0
movups %xmm0, (%r12)
movups 0x28(%rax), %xmm0
movups %xmm0, (%r13)
movups 0x48(%rax), %xmm0
movups %xmm0, (%rbp)
movq %rbx, %rdi
callq 0x5ae7
jmp 0x140f0
leaq 0x26f5c(%rip), %rdi     # 0x3b040
movq %rbx, %rsi
callq 0x7b01
jmp 0x140ec
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x26f37(%rip), %rdi     # 0x3b040
movq %r15, %rsi
callq 0x7b01
jmp 0x14111
movq %rbx, %rdi
movl $0x12c, %esi            # imm = 0x12C
movl $0xc8, %edx
callq 0x520e
callq 0x2be75
testq %rax, %rax
je 0x14138
movq 0x110(%rax), %rsi
jmp 0x1413f
leaq 0x49e69(%rip), %rsi     # 0x5dfa8
movq %rbx, %rdi
callq 0x5a3d
jmp 0x140f0