// File: /workspace/github_c_makefile_star2_O3/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 0x454f
movq %rax, %rbx
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x150cf
testq %rbx, %rbx
je 0x150e0
movq %rbx, %rdi
movl $0x68, %esi
callq 0x64db
movq %rax, %r15
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x150f4
testq %r15, %r15
je 0x150e0
movq %r15, %rdi
movl $0x10, %esi
callq 0x2a290
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)
movups %xmm0, 0x48(%r15)
movw $0x0, 0x58(%r15)
movw $0xffff, %ax            # imm = 0xFFFF
movw %ax, 0x42(%r15)
movw %ax, 0x32(%r15)
movw %ax, 0x52(%r15)
cmpq $0x0, 0x4b372(%rip)     # 0x60380
jne 0x1501f
movq %rbx, %rdi
callq 0x6aaf
movq %rax, 0x4b361(%rip)     # 0x60380
cmpq $0x0, 0x4b361(%rip)     # 0x60388
jne 0x15038
movq %rbx, %rdi
callq 0x6a8b
movq %rax, 0x4b350(%rip)     # 0x60388
leaq 0xfc(%rip), %rsi        # 0x1513b
movq %rbx, %rdi
callq 0x647b
leaq 0x18e(%rip), %rsi       # 0x151dc
movq %rbx, %rdi
callq 0x64ab
testq %r14, %r14
je 0x15105
leaq 0x38(%r15), %r12
leaq 0x28(%r15), %r13
movq %r15, %rbp
addq $0x48, %rbp
movq %r14, %rdi
callq 0x6af7
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 0x5e54
jmp 0x150e2
leaq 0x29ffa(%rip), %rdi     # 0x3f0d0
movq %rbx, %rsi
callq 0x8294
jmp 0x150de
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x29fd5(%rip), %rdi     # 0x3f0d0
movq %r15, %rsi
callq 0x8294
jmp 0x15103
movq %rbx, %rdi
movl $0x12c, %esi            # imm = 0x12C
movl $0xc8, %edx
callq 0x5557
callq 0x2e91c
testq %rax, %rax
je 0x1512a
movq 0x110(%rax), %rsi
jmp 0x15131
leaq 0x4ae77(%rip), %rsi     # 0x5ffa8
movq %rbx, %rdi
callq 0x5d9f
jmp 0x150e2