// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_calendar.c
// Function: lv_calendar_create
lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy)
{
    LV_LOG_TRACE("calendar create started");

    /*Create the ancestor of calendar*/
    lv_obj_t * new_calendar = lv_obj_create(par, copy);
    LV_ASSERT_MEM(new_calendar);
    if(new_calendar == NULL) return NULL;

    /*Allocate the calendar type specific extended data*/
    lv_calendar_ext_t * ext = lv_obj_allocate_ext_attr(new_calendar, sizeof(lv_calendar_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;
    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_calendar);
    if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_calendar);

    /*Initialize the allocated 'ext' */
    ext->today.year  = 2018;
    ext->today.month = 1;
    ext->today.day   = 1;

    ext->showed_date.year  = 2018;
    ext->showed_date.month = 1;
    ext->showed_date.day   = 1;

    ext->pressed_date.year  = 0;
    ext->pressed_date.month = 0;
    ext->pressed_date.day   = 0;

    ext->highlighted_dates      = NULL;
    ext->highlighted_dates_num  = 0;
    ext->day_names              = NULL;
    ext->month_names            = NULL;
    ext->style_header           = &lv_style_plain_color;
    ext->style_header_pr        = &lv_style_pretty_color;
    ext->style_highlighted_days = &lv_style_plain_color;
    ext->style_inactive_days    = &lv_style_btn_ina;
    ext->style_week_box         = &lv_style_plain_color;
    ext->style_today_box        = &lv_style_pretty_color;
    ext->style_day_names        = &lv_style_pretty;

    /*The signal and design functions are not copied so set them here*/
    lv_obj_set_signal_cb(new_calendar, lv_calendar_signal);
    lv_obj_set_design_cb(new_calendar, lv_calendar_design);

    /*Init the new calendar calendar*/
    if(copy == NULL) {
        lv_obj_set_size(new_calendar, LV_DPI * 2, LV_DPI * 2);
        lv_obj_set_style(new_calendar, &lv_style_pretty);

        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_BG, th->style.calendar.bg);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_HEADER, th->style.calendar.header);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_HEADER_PR, th->style.calendar.header_pr);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_DAY_NAMES, th->style.calendar.day_names);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_WEEK_BOX, th->style.calendar.week_box);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_TODAY_BOX, th->style.calendar.today_box);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_HIGHLIGHTED_DAYS,
                                  th->style.calendar.highlighted_days);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_INACTIVE_DAYS, th->style.calendar.inactive_days);
        } else {
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_BG, &lv_style_pretty);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_HEADER, ext->style_header);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_HEADER_PR, ext->style_header_pr);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_DAY_NAMES, ext->style_day_names);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_WEEK_BOX, ext->style_week_box);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_TODAY_BOX, ext->style_today_box);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_HIGHLIGHTED_DAYS, ext->style_highlighted_days);
            lv_calendar_set_style(new_calendar, LV_CALENDAR_STYLE_INACTIVE_DAYS, ext->style_inactive_days);
        }
    }
    /*Copy an existing calendar*/
    else {
        lv_calendar_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        ext->today.year              = copy_ext->today.year;
        ext->today.month             = copy_ext->today.month;
        ext->today.day               = copy_ext->today.day;

        ext->showed_date.year  = copy_ext->showed_date.year;
        ext->showed_date.month = copy_ext->showed_date.month;
        ext->showed_date.day   = copy_ext->showed_date.day;

        ext->highlighted_dates     = copy_ext->highlighted_dates;
        ext->highlighted_dates_num = copy_ext->highlighted_dates_num;
        ext->day_names             = copy_ext->day_names;

        ext->month_names            = copy_ext->month_names;
        ext->style_header           = copy_ext->style_header;
        ext->style_header_pr        = copy_ext->style_header_pr;
        ext->style_highlighted_days = copy_ext->style_highlighted_days;
        ext->style_inactive_days    = copy_ext->style_inactive_days;
        ext->style_week_box         = copy_ext->style_week_box;
        ext->style_today_box        = copy_ext->style_today_box;
        ext->style_day_names        = copy_ext->style_day_names;
        /*Refresh the style with new signal function*/
        lv_obj_refresh_style(new_calendar);
    }

    LV_LOG_INFO("calendar created");

    return new_calendar;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
callq 0x454f
movq %rax, %rbx
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x139d5
testq %rbx, %rbx
je 0x139e6
movq %rbx, %rdi
movl $0x60, %esi
callq 0x64db
movq %rax, %r14
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x139f1
testq %r14, %r14
je 0x139e6
cmpq $0x0, 0x4cabe(%rip)     # 0x60370
jne 0x138c3
movq %rbx, %rdi
callq 0x6a8b
movq %rax, 0x4caad(%rip)     # 0x60370
cmpq $0x0, 0x4caad(%rip)     # 0x60378
jne 0x138dc
movq %rbx, %rdi
callq 0x6aaf
movq %rax, 0x4ca9c(%rip)     # 0x60378
movabsq $0x10107e2010107e2, %rax # imm = 0x10107E2010107E2
movq %rax, (%r14)
xorl %eax, %eax
movq %rax, 0x8(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x12(%r14)
movq %rax, 0x20(%r14)
leaq 0x4c65e(%rip), %rax     # 0x5ff60
movq %rax, 0x28(%r14)
leaq 0x4c6e3(%rip), %rcx     # 0x5fff0
movq %rcx, 0x30(%r14)
movq %rax, 0x40(%r14)
leaq 0x4c914(%rip), %rdx     # 0x60230
movq %rdx, 0x48(%r14)
movq %rax, 0x50(%r14)
movq %rcx, 0x58(%r14)
leaq 0x4c679(%rip), %rax     # 0x5ffa8
movq %rax, 0x38(%r14)
leaq 0x219(%rip), %rsi       # 0x13b53
movq %rbx, %rdi
callq 0x647b
leaq 0x728(%rip), %rsi       # 0x14071
movq %rbx, %rdi
callq 0x64ab
testq %r15, %r15
je 0x13a02
movq %r15, %rdi
callq 0x6af7
movzwl (%rax), %ecx
movw %cx, (%r14)
movb 0x2(%rax), %cl
movb %cl, 0x2(%r14)
movb 0x3(%rax), %cl
movb %cl, 0x3(%r14)
movzwl 0x4(%rax), %ecx
movw %cx, 0x4(%r14)
movb 0x6(%rax), %cl
movb %cl, 0x6(%r14)
movb 0x7(%rax), %cl
movb %cl, 0x7(%r14)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%r14)
movzwl 0x12(%rax), %ecx
movw %cx, 0x12(%r14)
movups 0x18(%rax), %xmm0
movups %xmm0, 0x18(%r14)
movups 0x28(%rax), %xmm0
movups %xmm0, 0x28(%r14)
movups 0x48(%rax), %xmm0
movups %xmm0, 0x48(%r14)
movq 0x58(%rax), %rcx
movq %rcx, 0x58(%r14)
movups 0x38(%rax), %xmm0
movups %xmm0, 0x38(%r14)
movq %rbx, %rdi
callq 0x5e54
jmp 0x139e8
leaq 0x2b6f4(%rip), %rdi     # 0x3f0d0
movq %rbx, %rsi
callq 0x8294
jmp 0x139e4
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2b6d8(%rip), %rdi     # 0x3f0d0
movq %r14, %rsi
callq 0x8294
jmp 0x13a00
movq %rbx, %rdi
movl $0xc8, %esi
movl $0xc8, %edx
callq 0x5557
leaq 0x4c58d(%rip), %rsi     # 0x5ffa8
movq %rbx, %rdi
callq 0x5d9f
callq 0x2e91c
testq %rax, %rax
je 0x13ac6
movq %rax, %r15
movq 0x118(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x14a2a
movq 0x120(%r15), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x14a2a
movq 0x128(%r15), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x14a2a
movq 0x130(%r15), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x14a2a
movq 0x148(%r15), %rdx
movq %rbx, %rdi
movl $0x6, %esi
callq 0x14a2a
movq 0x150(%r15), %rdx
movq %rbx, %rdi
movl $0x7, %esi
callq 0x14a2a
movq 0x138(%r15), %rdx
movq %rbx, %rdi
movl $0x4, %esi
callq 0x14a2a
movq 0x140(%r15), %rdx
jmp 0x13b41
leaq 0x4c4db(%rip), %rdx     # 0x5ffa8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x14a2a
movq 0x28(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x14a2a
movq 0x30(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x14a2a
movq 0x38(%r14), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x14a2a
movq 0x50(%r14), %rdx
movq %rbx, %rdi
movl $0x6, %esi
callq 0x14a2a
movq 0x58(%r14), %rdx
movq %rbx, %rdi
movl $0x7, %esi
callq 0x14a2a
movq 0x40(%r14), %rdx
movq %rbx, %rdi
movl $0x4, %esi
callq 0x14a2a
movq 0x48(%r14), %rdx
movq %rbx, %rdi
movl $0x5, %esi
callq 0x14a2a
jmp 0x139e8