// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x66b0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x20c30
movq -0x20(%rbp), %rsi
leaq 0x4741b(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x20c2e
cmpq $0x0, -0x20(%rbp)
jne 0x20c44
movq $0x0, -0x8(%rbp)
jmp 0x2109f
movq -0x20(%rbp), %rdi
movl $0x60, %esi
callq 0x9d60
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x20c75
movq -0x28(%rbp), %rsi
leaq 0x473d6(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x20c73
cmpq $0x0, -0x28(%rbp)
jne 0x20c89
movq $0x0, -0x8(%rbp)
jmp 0x2109f
cmpq $0x0, 0x687af(%rip)     # 0x89440
jne 0x20ca3
movq -0x20(%rbp), %rdi
callq 0xa830
movq %rax, 0x6879d(%rip)     # 0x89440
cmpq $0x0, 0x6879d(%rip)     # 0x89448
jne 0x20cbd
movq -0x20(%rbp), %rdi
callq 0xa870
movq %rax, 0x6878b(%rip)     # 0x89448
movq -0x28(%rbp), %rax
movw $0x7e2, (%rax)          # imm = 0x7E2
movq -0x28(%rbp), %rax
movb $0x1, 0x2(%rax)
movq -0x28(%rbp), %rax
movb $0x1, 0x3(%rax)
movq -0x28(%rbp), %rax
movw $0x7e2, 0x4(%rax)       # imm = 0x7E2
movq -0x28(%rbp), %rax
movb $0x1, 0x6(%rax)
movq -0x28(%rbp), %rax
movb $0x1, 0x7(%rax)
movq -0x28(%rbp), %rax
movw $0x0, 0x14(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x16(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x17(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x28(%rbp), %rax
movw $0x0, 0x12(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x28(%rbp), %rax
leaq 0x682ed(%rip), %rcx     # 0x89030
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rax
leaq 0x6836e(%rip), %rcx     # 0x890c0
movq %rcx, 0x30(%rax)
movq -0x28(%rbp), %rax
leaq 0x682cf(%rip), %rcx     # 0x89030
movq %rcx, 0x40(%rax)
movq -0x28(%rbp), %rax
leaq 0x68590(%rip), %rcx     # 0x89300
movq %rcx, 0x48(%rax)
movq -0x28(%rbp), %rax
leaq 0x682b1(%rip), %rcx     # 0x89030
movq %rcx, 0x50(%rax)
movq -0x28(%rbp), %rax
leaq 0x68332(%rip), %rcx     # 0x890c0
movq %rcx, 0x58(%rax)
movq -0x28(%rbp), %rax
leaq 0x682db(%rip), %rcx     # 0x89078
movq %rcx, 0x38(%rax)
movq -0x20(%rbp), %rdi
leaq 0x304(%rip), %rsi       # 0x210b0
callq 0x9cc0
movq -0x20(%rbp), %rdi
leaq 0x6e4(%rip), %rsi       # 0x214a0
callq 0x9d10
cmpq $0x0, -0x18(%rbp)
jne 0x20f7b
movq -0x20(%rbp), %rdi
movl $0xc8, %edx
movl %edx, %esi
callq 0x8180
movq -0x20(%rbp), %rdi
leaq 0x68291(%rip), %rsi     # 0x89078
callq 0x9150
callq 0x4cfc0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x20eca
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x118(%rax), %rdx
xorl %esi, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rdx
movl $0x1, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x128(%rax), %rdx
movl $0x2, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x130(%rax), %rdx
movl $0x3, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x148(%rax), %rdx
movl $0x6, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x150(%rax), %rdx
movl $0x7, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x138(%rax), %rdx
movl $0x4, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x140(%rax), %rdx
movl $0x5, %esi
callq 0x21570
jmp 0x20f76
movq -0x20(%rbp), %rdi
xorl %esi, %esi
leaq 0x681a1(%rip), %rdx     # 0x89078
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdx
movl $0x1, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rdx
movl $0x2, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rdx
movl $0x3, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x50(%rax), %rdx
movl $0x6, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x58(%rax), %rdx
movl $0x7, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rdx
movl $0x4, %esi
callq 0x21570
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rdx
movl $0x5, %esi
callq 0x21570
jmp 0x21097
movq -0x18(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movw (%rax), %cx
movq -0x28(%rbp), %rax
movw %cx, (%rax)
movq -0x38(%rbp), %rax
movb 0x2(%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x38(%rbp), %rax
movb 0x3(%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x38(%rbp), %rax
movw 0x4(%rax), %cx
movq -0x28(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x38(%rbp), %rax
movb 0x6(%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x6(%rax)
movq -0x38(%rbp), %rax
movb 0x7(%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x7(%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movw 0x12(%rax), %cx
movq -0x28(%rbp), %rax
movw %cx, 0x12(%rax)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x38(%rbp), %rax
movq 0x50(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x38(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x20(%rbp), %rdi
callq 0x9250
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)