// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_core/lv_indev.c
// Function: indev_proc_press
static void indev_proc_press(lv_indev_proc_t * proc)
{
    indev_obj_act = proc->types.pointer.act_obj;

    if(proc->wait_until_release != 0) return;

    lv_disp_t * disp = indev_act->driver.disp;
    bool new_obj_searched = false;

    /*If there is no last object then search*/
    if(indev_obj_act == NULL) {
        indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_sys(disp));
        if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_top(disp));
        if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_scr_act(disp));
        new_obj_searched = true;
    }
    /*If there is last object but it is not dragged and not protected also search*/
    else if(proc->types.pointer.drag_in_prog == 0 &&
            lv_obj_is_protected(indev_obj_act, LV_PROTECT_PRESS_LOST) == false) {
        indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_sys(disp));
        if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_top(disp));
        if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_scr_act(disp));
        new_obj_searched = true;
    }
    /*If a dragable or a protected object was the last then keep it*/
    else {
    }

    /*The last object might have drag throw. Stop it manually*/
    if(new_obj_searched && proc->types.pointer.last_obj) {
        proc->types.pointer.drag_throw_vect.x = 0;
        proc->types.pointer.drag_throw_vect.y = 0;
        indev_drag_throw(proc);
    }

    /*If a new object was found reset some variables and send a pressed signal*/
    if(indev_obj_act != proc->types.pointer.act_obj) {
        proc->types.pointer.last_point.x = proc->types.pointer.act_point.x;
        proc->types.pointer.last_point.y = proc->types.pointer.act_point.y;

        /*If a new object found the previous was lost, so send a signal*/
        if(proc->types.pointer.act_obj != NULL) {
            /*Save the obj because in special cases `act_obj` can change in the signal function*/
            lv_obj_t * last_obj = proc->types.pointer.act_obj;

            last_obj->signal_cb(last_obj, LV_SIGNAL_PRESS_LOST, indev_act);
            if(indev_reset_check(proc)) return;
            lv_event_send(last_obj, LV_EVENT_PRESS_LOST, NULL);
            if(indev_reset_check(proc)) return;

        }

        proc->types.pointer.act_obj  = indev_obj_act; /*Save the pressed object*/
        proc->types.pointer.last_obj = indev_obj_act;

        if(indev_obj_act != NULL) {
            /* Save the time when the obj pressed.
             * It is necessary to count the long press time.*/
            proc->pr_timestamp                 = lv_tick_get();
            proc->long_pr_sent                 = 0;
            proc->types.pointer.drag_limit_out = 0;
            proc->types.pointer.drag_in_prog   = 0;
            proc->types.pointer.drag_sum.x     = 0;
            proc->types.pointer.drag_sum.y     = 0;
            proc->types.pointer.vect.x         = 0;
            proc->types.pointer.vect.y         = 0;

            /*Search for 'top' attribute*/
            lv_obj_t * i        = indev_obj_act;
            lv_obj_t * last_top = NULL;
            while(i != NULL) {
                if(i->top) last_top = i;
                i = lv_obj_get_parent(i);
            }

            if(last_top != NULL) {
                /*Move the last_top object to the foreground*/
                lv_obj_move_foreground(last_top);
            }

            /*Send a signal about the press*/
            indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, indev_act);
            if(indev_reset_check(proc)) return;

            lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
            if(indev_reset_check(proc)) return;
        }
    }

    /*Calculate the types.pointer.vector*/
    proc->types.pointer.vect.x = proc->types.pointer.act_point.x - proc->types.pointer.last_point.x;
    proc->types.pointer.vect.y = proc->types.pointer.act_point.y - proc->types.pointer.last_point.y;

    proc->types.pointer.drag_throw_vect.x = (proc->types.pointer.drag_throw_vect.x * 5) >> 3;
    proc->types.pointer.drag_throw_vect.y = (proc->types.pointer.drag_throw_vect.y * 5) >> 3;

    if(proc->types.pointer.drag_throw_vect.x < 0)
        proc->types.pointer.drag_throw_vect.x++;
    else if(proc->types.pointer.drag_throw_vect.x > 0)
        proc->types.pointer.drag_throw_vect.x--;

    if(proc->types.pointer.drag_throw_vect.y < 0)
        proc->types.pointer.drag_throw_vect.y++;
    else if(proc->types.pointer.drag_throw_vect.y > 0)
        proc->types.pointer.drag_throw_vect.y--;

    proc->types.pointer.drag_throw_vect.x += (proc->types.pointer.vect.x * 4) >> 3;
    proc->types.pointer.drag_throw_vect.y += (proc->types.pointer.vect.y * 4) >> 3;

    /*If there is active object and it can be dragged run the drag*/
    if(indev_obj_act != NULL) {
        indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSING, indev_act);
        if(indev_reset_check(proc)) return;
        lv_event_send(indev_obj_act, LV_EVENT_PRESSING, NULL);
        if(indev_reset_check(proc)) return;

        indev_drag(proc);
        if(indev_reset_check(proc)) return;

        /*If there is no drag then check for long press time*/
        if(proc->types.pointer.drag_in_prog == 0 && proc->long_pr_sent == 0) {
            /*Send a signal about the long press if enough time elapsed*/
            if(lv_tick_elaps(proc->pr_timestamp) > indev_act->driver.long_press_time) {
                indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, indev_act);
                if(indev_reset_check(proc)) return;
                lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL);
                if(indev_reset_check(proc)) return;

                /*Mark the signal sending to do not send it again*/
                proc->long_pr_sent = 1;

                /*Save the long press time stamp for the long press repeat handler*/
                proc->longpr_rep_timestamp = lv_tick_get();
            }
        }
        /*Send long press repeated signal*/
        if(proc->types.pointer.drag_in_prog == 0 && proc->long_pr_sent == 1) {
            /*Send a signal about the long press repeat if enough time elapsed*/
            if(lv_tick_elaps(proc->longpr_rep_timestamp) > indev_act->driver.long_press_rep_time) {
                indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS_REP, indev_act);
                if(indev_reset_check(proc)) return;
                lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
                if(indev_reset_check(proc)) return;
                proc->longpr_rep_timestamp = lv_tick_get();
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x84055(%rip)     # 0x88f70
movq -0x8(%rbp), %rax
movb 0x48(%rax), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x4f34
jmp 0x55cf
movq 0x8402d(%rip), %rax     # 0x88f68
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
cmpq $0x0, 0x84021(%rip)     # 0x88f70
jne 0x4fde
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6420
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x5aa0
movq %rax, 0x83ff7(%rip)     # 0x88f70
cmpq $0x0, 0x83fef(%rip)     # 0x88f70
jne 0x4fa7
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x63d0
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x5aa0
movq %rax, 0x83fc9(%rip)     # 0x88f70
cmpq $0x0, 0x83fc1(%rip)     # 0x88f70
jne 0x4fd5
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6340
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x5aa0
movq %rax, 0x83f9b(%rip)     # 0x88f70
movb $0x1, -0x11(%rbp)
jmp 0x509e
movq -0x8(%rbp), %rax
movb 0x38(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x509a
movq 0x83f74(%rip), %rdi     # 0x88f70
movl $0x10, %esi
callq 0xa7d0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x509a
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6420
movq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0x5aa0
movq %rax, 0x83f38(%rip)     # 0x88f70
cmpq $0x0, 0x83f30(%rip)     # 0x88f70
jne 0x5066
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0x63d0
movq -0x58(%rbp), %rdi
movq %rax, %rsi
callq 0x5aa0
movq %rax, 0x83f0a(%rip)     # 0x88f70
cmpq $0x0, 0x83f02(%rip)     # 0x88f70
jne 0x5094
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6340
movq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x5aa0
movq %rax, 0x83edc(%rip)     # 0x88f70
movb $0x1, -0x11(%rbp)
jmp 0x509c
jmp 0x509c
jmp 0x509e
testb $0x1, -0x11(%rbp)
je 0x50cc
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x50cc
movq -0x8(%rbp), %rax
movw $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x1a(%rax)
movq -0x8(%rbp), %rdi
callq 0x5b90
movq 0x83e9d(%rip), %rax     # 0x88f70
movq -0x8(%rbp), %rcx
cmpq 0x20(%rcx), %rax
je 0x52b3
movq -0x8(%rbp), %rax
movw 0x8(%rax), %cx
movq -0x8(%rbp), %rax
movw %cx, 0xc(%rax)
movq -0x8(%rbp), %rax
movw 0xa(%rax), %cx
movq -0x8(%rbp), %rax
movw %cx, 0xe(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x516e
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x20(%rbp), %rdi
movq 0x83e3d(%rip), %rdx     # 0x88f68
movl $0xa, %esi
callq *%rax
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x5141
jmp 0x5146
jmp 0x55cf
movq -0x20(%rbp), %rdi
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x5167
jmp 0x516c
jmp 0x55cf
jmp 0x516e
movq 0x83dfb(%rip), %rcx     # 0x88f70
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
movq 0x83dec(%rip), %rcx     # 0x88f70
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
cmpq $0x0, 0x83ddc(%rip)     # 0x88f70
je 0x52b1
callq 0xdfe0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x8(%rbp), %rax
movb 0x48(%rax), %cl
andb $-0x2, %cl
orb $0x0, %cl
movb %cl, 0x48(%rax)
movq -0x8(%rbp), %rax
movb 0x38(%rax), %cl
andb $-0x2, %cl
orb $0x0, %cl
movb %cl, 0x38(%rax)
movq -0x8(%rbp), %rax
movb 0x38(%rax), %cl
andb $-0x3, %cl
orb $0x0, %cl
movb %cl, 0x38(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x14(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x16(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x10(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x12(%rax)
movq 0x83d69(%rip), %rax     # 0x88f70
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x5245
movq -0x28(%rbp), %rax
movw 0x58(%rax), %ax
shrw $0x5, %ax
andw $0x1, %ax
cmpb $0x0, %al
je 0x5236
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x71b0
movq %rax, -0x28(%rbp)
jmp 0x5213
cmpq $0x0, -0x30(%rbp)
je 0x5255
movq -0x30(%rbp), %rdi
callq 0x7e70
movq 0x83d14(%rip), %rax     # 0x88f70
movq 0x30(%rax), %rax
movq 0x83d09(%rip), %rdi     # 0x88f70
movq 0x83cfa(%rip), %rdx     # 0x88f68
movl $0x8, %esi
callq *%rax
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x5284
jmp 0x5289
jmp 0x55cf
movq 0x83ce0(%rip), %rdi     # 0x88f70
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x52aa
jmp 0x52af
jmp 0x55cf
jmp 0x52b1
jmp 0x52b3
movq -0x8(%rbp), %rax
movswl 0x8(%rax), %eax
movq -0x8(%rbp), %rcx
movswl 0xc(%rcx), %ecx
subl %ecx, %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x10(%rax)
movq -0x8(%rbp), %rax
movswl 0xa(%rax), %eax
movq -0x8(%rbp), %rcx
movswl 0xe(%rcx), %ecx
subl %ecx, %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x12(%rax)
movq -0x8(%rbp), %rax
movswl 0x18(%rax), %eax
imull $0x5, %eax, %eax
sarl $0x3, %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x18(%rax)
movq -0x8(%rbp), %rax
movswl 0x1a(%rax), %eax
imull $0x5, %eax, %eax
sarl $0x3, %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x1a(%rax)
movq -0x8(%rbp), %rax
movswl 0x18(%rax), %eax
cmpl $0x0, %eax
jge 0x533e
movq -0x8(%rbp), %rax
movw 0x18(%rax), %cx
addw $0x1, %cx
movw %cx, 0x18(%rax)
jmp 0x535d
movq -0x8(%rbp), %rax
movswl 0x18(%rax), %eax
cmpl $0x0, %eax
jle 0x535b
movq -0x8(%rbp), %rax
movw 0x18(%rax), %cx
addw $-0x1, %cx
movw %cx, 0x18(%rax)
jmp 0x535d
movq -0x8(%rbp), %rax
movswl 0x1a(%rax), %eax
cmpl $0x0, %eax
jge 0x537c
movq -0x8(%rbp), %rax
movw 0x1a(%rax), %cx
addw $0x1, %cx
movw %cx, 0x1a(%rax)
jmp 0x539b
movq -0x8(%rbp), %rax
movswl 0x1a(%rax), %eax
cmpl $0x0, %eax
jle 0x5399
movq -0x8(%rbp), %rax
movw 0x1a(%rax), %cx
addw $-0x1, %cx
movw %cx, 0x1a(%rax)
jmp 0x539b
movq -0x8(%rbp), %rax
movswl 0x10(%rax), %edx
shll $0x2, %edx
sarl $0x3, %edx
movq -0x8(%rbp), %rax
movswl 0x18(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x18(%rax)
movq -0x8(%rbp), %rax
movswl 0x12(%rax), %edx
shll $0x2, %edx
sarl $0x3, %edx
movq -0x8(%rbp), %rax
movswl 0x1a(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x1a(%rax)
cmpq $0x0, 0x83b95(%rip)     # 0x88f70
je 0x55cf
movq 0x83b88(%rip), %rax     # 0x88f70
movq 0x30(%rax), %rax
movq 0x83b7d(%rip), %rdi     # 0x88f70
movq 0x83b6e(%rip), %rdx     # 0x88f68
movl $0x9, %esi
callq *%rax
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x5410
jmp 0x5415
jmp 0x55cf
movq 0x83b54(%rip), %rdi     # 0x88f70
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x5439
jmp 0x543e
jmp 0x55cf
movq -0x8(%rbp), %rdi
callq 0x5f30
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x5456
jmp 0x545b
jmp 0x55cf
movq -0x8(%rbp), %rax
movb 0x38(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x551f
movq -0x8(%rbp), %rax
movb 0x48(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x551f
movq -0x8(%rbp), %rax
movl 0x40(%rax), %edi
callq 0xe010
movq 0x83ace(%rip), %rcx     # 0x88f68
movzwl 0x2a(%rcx), %ecx
cmpl %ecx, %eax
jbe 0x551d
movq 0x83ac7(%rip), %rax     # 0x88f70
movq 0x30(%rax), %rax
movq 0x83abc(%rip), %rdi     # 0x88f70
movq 0x83aad(%rip), %rdx     # 0x88f68
movl $0xc, %esi
callq *%rax
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x54d1
jmp 0x54d6
jmp 0x55cf
movq 0x83a93(%rip), %rdi     # 0x88f70
movl $0x4, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x54fa
jmp 0x54ff
jmp 0x55cf
movq -0x8(%rbp), %rax
movb 0x48(%rax), %cl
andb $-0x2, %cl
orb $0x1, %cl
movb %cl, 0x48(%rax)
callq 0xdfe0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x44(%rax)
jmp 0x551f
movq -0x8(%rbp), %rax
movb 0x38(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x55cd
movq -0x8(%rbp), %rax
movb 0x48(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x55cd
movq -0x8(%rbp), %rax
movl 0x44(%rax), %edi
callq 0xe010
movq 0x83a0a(%rip), %rcx     # 0x88f68
movzwl 0x2c(%rcx), %ecx
cmpl %ecx, %eax
jbe 0x55cb
movq 0x83a03(%rip), %rax     # 0x88f70
movq 0x30(%rax), %rax
movq 0x839f8(%rip), %rdi     # 0x88f70
movq 0x839e9(%rip), %rdx     # 0x88f68
movl $0xd, %esi
callq *%rax
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x5595
jmp 0x5597
jmp 0x55cf
movq 0x839d2(%rip), %rdi     # 0x88f70
movl $0x5, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x55bb
jmp 0x55bd
jmp 0x55cf
callq 0xdfe0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x44(%rax)
jmp 0x55cd
jmp 0x55cf
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)