// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_calendar.c
// Function: lv_calendar_signal
static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void * param)
{
    lv_res_t res;

    /* Include the ancient signal function */
    res = ancestor_signal(calendar, sign, param);
    if(res != LV_RES_OK) return res;
    if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);

    if(sign == LV_SIGNAL_CLEANUP) {
        /*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
    } else if(sign == LV_SIGNAL_PRESSING) {
        lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
        lv_area_t header_area;
        lv_area_copy(&header_area, &calendar->coords);
        header_area.y2 = header_area.y1 + get_header_height(calendar);

        lv_indev_t * indev = lv_indev_get_act();
        lv_point_t p;
        lv_indev_get_point(indev, &p);

        /*If the header is pressed mark an arrow as pressed*/
        if(lv_area_is_point_on(&header_area, &p)) {
            if(p.x < header_area.x1 + lv_area_get_width(&header_area) / 2) {
                if(ext->btn_pressing != -1) lv_obj_invalidate(calendar);
                ext->btn_pressing = -1;
            } else {
                if(ext->btn_pressing != 1) lv_obj_invalidate(calendar);
                ext->btn_pressing = 1;
            }

            ext->pressed_date.year  = 0;
            ext->pressed_date.month = 0;
            ext->pressed_date.day   = 0;
        }
        /*If a day is pressed save it*/
        else if(calculate_touched_day(calendar, &p)) {
            if(ext->btn_pressing != 0) lv_obj_invalidate(calendar);
            ext->btn_pressing = 0;
        }
        /*ELse set a deafault state*/
        else {
            if(ext->btn_pressing != 0) lv_obj_invalidate(calendar);
            ext->btn_pressing       = 0;
            ext->pressed_date.year  = 0;
            ext->pressed_date.month = 0;
            ext->pressed_date.day   = 0;
        }
    } else if(sign == LV_SIGNAL_PRESS_LOST) {
        lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
        ext->btn_pressing       = 0;
        lv_obj_invalidate(calendar);

    } else if(sign == LV_SIGNAL_RELEASED) {
        lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
        if(ext->btn_pressing < 0) {
            if(ext->showed_date.month <= 1) {
                ext->showed_date.month = 12;
                ext->showed_date.year--;
            } else {
                ext->showed_date.month--;
            }
        } else if(ext->btn_pressing > 0) {
            if(ext->showed_date.month >= 12) {
                ext->showed_date.month = 1;
                ext->showed_date.year++;
            } else {
                ext->showed_date.month++;
            }
        } else if(ext->pressed_date.year != 0) {
            res = lv_event_send(calendar, LV_EVENT_VALUE_CHANGED, NULL);
            if(res != LV_RES_OK) return res;
        }

        ext->btn_pressing = 0;
        lv_obj_invalidate(calendar);
    } else if(sign == LV_SIGNAL_CONTROL) {
        uint8_t c               = *((uint8_t *)param);
        lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
        if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
            if(ext->showed_date.month >= 12) {
                ext->showed_date.month = 1;
                ext->showed_date.year++;
            } else {
                ext->showed_date.month++;
            }
            lv_obj_invalidate(calendar);
        } else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) {
            if(ext->showed_date.month <= 1) {
                ext->showed_date.month = 12;
                ext->showed_date.year--;
            } else {
                ext->showed_date.month--;
            }
            lv_obj_invalidate(calendar);
        }
    }

    return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rdx, -0x20(%rbp)
movq 0x68370(%rip), %rax     # 0x89440
movq -0x10(%rbp), %rdi
movb -0x11(%rbp), %cl
movq -0x20(%rbp), %rdx
movzbl %cl, %esi
callq *%rax
movb %al, -0x21(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x1, %eax
je 0x210f7
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
jmp 0x21489
movzbl -0x11(%rbp), %eax
cmpl $0x7, %eax
jne 0x21118
movq -0x20(%rbp), %rdi
leaq 0x474a4(%rip), %rsi     # 0x685af
callq 0xaa80
movb %al, -0x1(%rbp)
jmp 0x21489
movzbl -0x11(%rbp), %eax
cmpl $0x0, %eax
jne 0x21126
jmp 0x21483
movzbl -0x11(%rbp), %eax
cmpl $0x9, %eax
jne 0x21296
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rsi
addq $0x20, %rsi
leaq -0x38(%rbp), %rdi
callq 0x22a50
movswl -0x36(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x227d0
movw %ax, %cx
movl -0x6c(%rbp), %eax
movswl %cx, %ecx
addl %ecx, %eax
movw %ax, -0x32(%rbp)
callq 0x4b70
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0x4d30
leaq -0x38(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0x42a00
testb $0x1, %al
jne 0x2119c
jmp 0x21224
movswl -0x44(%rbp), %eax
movl %eax, -0x70(%rbp)
movswl -0x38(%rbp), %eax
movl %eax, -0x74(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x22b90
movl -0x74(%rbp), %ecx
cwtl
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movl -0x70(%rbp), %eax
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x211ea
movq -0x30(%rbp), %rax
movsbl 0x10(%rax), %eax
cmpl $-0x1, %eax
je 0x211e0
movq -0x10(%rbp), %rdi
callq 0x7430
movq -0x30(%rbp), %rax
movb $-0x1, 0x10(%rax)
jmp 0x21208
movq -0x30(%rbp), %rax
movsbl 0x10(%rax), %eax
cmpl $0x1, %eax
je 0x21200
movq -0x10(%rbp), %rdi
callq 0x7430
movq -0x30(%rbp), %rax
movb $0x1, 0x10(%rax)
movq -0x30(%rbp), %rax
movw $0x0, 0x14(%rax)
movq -0x30(%rbp), %rax
movb $0x0, 0x16(%rax)
movq -0x30(%rbp), %rax
movb $0x0, 0x17(%rax)
jmp 0x21291
movq -0x10(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0x22bb0
testb $0x1, %al
jne 0x21237
jmp 0x21257
movq -0x30(%rbp), %rax
movsbl 0x10(%rax), %eax
cmpl $0x0, %eax
je 0x2124d
movq -0x10(%rbp), %rdi
callq 0x7430
movq -0x30(%rbp), %rax
movb $0x0, 0x10(%rax)
jmp 0x2128f
movq -0x30(%rbp), %rax
movsbl 0x10(%rax), %eax
cmpl $0x0, %eax
je 0x2126d
movq -0x10(%rbp), %rdi
callq 0x7430
movq -0x30(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x30(%rbp), %rax
movw $0x0, 0x14(%rax)
movq -0x30(%rbp), %rax
movb $0x0, 0x16(%rax)
movq -0x30(%rbp), %rax
movb $0x0, 0x17(%rax)
jmp 0x21291
jmp 0x21481
movzbl -0x11(%rbp), %eax
cmpl $0xa, %eax
jne 0x212c2
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rbp), %rdi
callq 0x7430
jmp 0x2147f
movzbl -0x11(%rbp), %eax
cmpl $0xb, %eax
jne 0x213b4
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movsbl 0x10(%rax), %eax
cmpl $0x0, %eax
jge 0x2131f
movq -0x58(%rbp), %rax
movsbl 0x6(%rax), %eax
cmpl $0x1, %eax
jg 0x21310
movq -0x58(%rbp), %rax
movb $0xc, 0x6(%rax)
movq -0x58(%rbp), %rax
movw 0x4(%rax), %cx
addw $-0x1, %cx
movw %cx, 0x4(%rax)
jmp 0x2131d
movq -0x58(%rbp), %rax
movb 0x6(%rax), %cl
addb $-0x1, %cl
movb %cl, 0x6(%rax)
jmp 0x2139e
movq -0x58(%rbp), %rax
movsbl 0x10(%rax), %eax
cmpl $0x0, %eax
jle 0x21362
movq -0x58(%rbp), %rax
movsbl 0x6(%rax), %eax
cmpl $0xc, %eax
jl 0x21353
movq -0x58(%rbp), %rax
movb $0x1, 0x6(%rax)
movq -0x58(%rbp), %rax
movw 0x4(%rax), %cx
addw $0x1, %cx
movw %cx, 0x4(%rax)
jmp 0x21360
movq -0x58(%rbp), %rax
movb 0x6(%rax), %cl
addb $0x1, %cl
movb %cl, 0x6(%rax)
jmp 0x2139c
movq -0x58(%rbp), %rax
movzwl 0x14(%rax), %eax
cmpl $0x0, %eax
je 0x2139a
movq -0x10(%rbp), %rdi
movl $0xe, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
movb %al, -0x21(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x1, %eax
je 0x21398
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
jmp 0x21489
jmp 0x2139a
jmp 0x2139c
jmp 0x2139e
movq -0x58(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rbp), %rdi
callq 0x7430
jmp 0x2147d
movzbl -0x11(%rbp), %eax
cmpl $0x12, %eax
jne 0x2147b
movq -0x20(%rbp), %rax
movb (%rax), %al
movb %al, -0x59(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x68(%rbp)
movzbl -0x59(%rbp), %eax
cmpl $0x13, %eax
je 0x213e9
movzbl -0x59(%rbp), %eax
cmpl $0x11, %eax
jne 0x21428
movq -0x68(%rbp), %rax
movsbl 0x6(%rax), %eax
cmpl $0xc, %eax
jl 0x21410
movq -0x68(%rbp), %rax
movb $0x1, 0x6(%rax)
movq -0x68(%rbp), %rax
movw 0x4(%rax), %cx
addw $0x1, %cx
movw %cx, 0x4(%rax)
jmp 0x2141d
movq -0x68(%rbp), %rax
movb 0x6(%rax), %cl
addb $0x1, %cl
movb %cl, 0x6(%rax)
movq -0x10(%rbp), %rdi
callq 0x7430
jmp 0x21479
movzbl -0x59(%rbp), %eax
cmpl $0x14, %eax
je 0x2143a
movzbl -0x59(%rbp), %eax
cmpl $0x12, %eax
jne 0x21477
movq -0x68(%rbp), %rax
movsbl 0x6(%rax), %eax
cmpl $0x1, %eax
jg 0x21461
movq -0x68(%rbp), %rax
movb $0xc, 0x6(%rax)
movq -0x68(%rbp), %rax
movw 0x4(%rax), %cx
addw $-0x1, %cx
movw %cx, 0x4(%rax)
jmp 0x2146e
movq -0x68(%rbp), %rax
movb 0x6(%rax), %cl
addb $-0x1, %cl
movb %cl, 0x6(%rax)
movq -0x10(%rbp), %rdi
callq 0x7430
jmp 0x21479
jmp 0x2147b
jmp 0x2147d
jmp 0x2147f
jmp 0x21481
jmp 0x21483
movb -0x21(%rbp), %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)