// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_core/lv_indev.c
// Function: indev_proc_release
static void indev_proc_release(lv_indev_proc_t * proc)
{
    if(proc->wait_until_release != 0) {
        proc->types.pointer.act_obj  = NULL;
        proc->types.pointer.last_obj = NULL;
        proc->pr_timestamp           = 0;
        proc->longpr_rep_timestamp   = 0;
        proc->wait_until_release     = 0;
    }
    indev_obj_act = proc->types.pointer.act_obj;

    /*Forget the act obj and send a released signal */
    if(indev_obj_act) {
        /* If the object was protected against press lost then it possible that
         * the object is already not pressed but still it is the `act_obj`.
         * In this case send the `LV_SIGNAL_RELEASED/CLICKED` instead of `LV_SIGNAL_PRESS_LOST` if
         * the indev is ON the `types.pointer.act_obj` */
        if(lv_obj_is_protected(indev_obj_act, LV_PROTECT_PRESS_LOST)) {
            indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, indev_act);
            if(indev_reset_check(proc)) return;

            if(proc->types.pointer.drag_in_prog == 0) {
                if(proc->long_pr_sent == 0) {
                    lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
                    if(indev_reset_check(proc)) return;
                }

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

            lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
            if(indev_reset_check(proc)) return;
        }
        /* The simple case: `act_obj` was not protected against press lost.
         * If it is already not pressed then `indev_proc_press` would set `indev_obj_act = NULL`*/
        else {
            indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, indev_act);
            if(indev_reset_check(proc)) return;

            if(proc->long_pr_sent == 0 && proc->types.pointer.drag_in_prog == 0) {
                lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
                if(indev_reset_check(proc)) return;
            }

            if(proc->types.pointer.drag_in_prog == 0) {
                lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
                if(indev_reset_check(proc)) return;
            }

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

        if(indev_reset_check(proc)) return;

        /*Handle click focus*/
        bool click_focus_sent = false;
#if LV_USE_GROUP
        lv_group_t * g = lv_obj_get_group(indev_obj_act);

        /*Check, if the parent is in a group and focus on it.*/
        /*Respect the click focus protection*/
        if(lv_obj_is_protected(indev_obj_act, LV_PROTECT_CLICK_FOCUS) == false) {
            lv_obj_t * parent = indev_obj_act;

            while(g == NULL) {
                parent = lv_obj_get_parent(parent);
                if(parent == NULL) break;

                /*Ignore is the protected against click focus*/
                if(lv_obj_is_protected(parent, LV_PROTECT_CLICK_FOCUS)) {
                    parent = NULL;
                    break;
                }
                g = lv_obj_get_group(parent);
            }

            /* If a parent is in a group make it focused.
             * `LV_EVENT_FOCUSED/DEFOCUSED` will be sent by `lv_group_focus_obj`*/
            if(g && parent) {
                if(lv_group_get_click_focus(g)) {
                    click_focus_sent = true;
                    lv_group_focus_obj(parent);
                }
            }
        }
#endif

        /* Send defocus to the lastly "active" object and foucus to the new one.
         * DO not sent the events if they was sent by the click focus*/
        if(proc->types.pointer.last_pressed != indev_obj_act && click_focus_sent == false) {
            lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, NULL);
            if(indev_reset_check(proc)) return;

            lv_event_send(proc->types.pointer.act_obj, LV_EVENT_FOCUSED, NULL);
            if(indev_reset_check(proc)) return;

            proc->types.pointer.last_pressed = indev_obj_act;
        }

        if(indev_reset_check(proc)) return;

        /*Send LV_EVENT_DRAG_THROW_BEGIN if required */
        /*If drag parent is active check recursively the drag_parent attribute*/
        lv_obj_t * drag_obj = indev_obj_act;
        while(lv_obj_get_drag_parent(drag_obj) != false && drag_obj != NULL) {
            drag_obj = lv_obj_get_parent(drag_obj);
        }

        if(drag_obj) {
            if(lv_obj_get_drag_throw(drag_obj) && proc->types.pointer.drag_in_prog) {
                lv_event_send(drag_obj, LV_EVENT_DRAG_THROW_BEGIN, NULL);
                if(indev_reset_check(proc)) return;
            }
        }

        proc->types.pointer.act_obj = NULL;
        proc->pr_timestamp          = 0;
        proc->longpr_rep_timestamp  = 0;
    }

    /*The reset can be set in the signal function.
     * In case of reset query ignore the remaining parts.*/
    if(proc->types.pointer.last_obj != NULL && proc->reset_query == 0) {
        indev_drag_throw(proc);
        if(indev_reset_check(proc)) return;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb 0x48(%rdi), %al
testb $0x8, %al
jne 0x3cca
movq 0x20(%rbx), %rdi
movq %rdi, 0x5a243(%rip)     # 0x5dea0
testq %rdi, %rdi
je 0x3ce6
pushq $0x10
popq %rsi
callq 0x66ab
movl %eax, %ebp
movq 0x5a229(%rip), %rdi     # 0x5dea0
movq 0x5a21a(%rip), %rdx     # 0x5de98
pushq $0xb
popq %rsi
callq *0x30(%rdi)
movb 0x48(%rbx), %al
testb %bpl, %bpl
je 0x3d12
testb $0x2, %al
jne 0x3e9c
testb $0x2, 0x38(%rbx)
jne 0x3d60
testb $0x1, %al
jne 0x3d45
movq 0x5a1ef(%rip), %rdi     # 0x5dea0
pushq $0x3
popq %rsi
xorl %edx, %edx
callq 0x4caf
testb $0x2, 0x48(%rbx)
je 0x3d45
jmp 0x3e9c
andq $0x0, 0x40(%rbx)
leaq 0x20(%rbx), %rcx
andb $-0x9, %al
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movb %al, 0x48(%rbx)
andq $0x0, 0x5a1ba(%rip)     # 0x5dea0
cmpq $0x0, 0x28(%rbx)
je 0x3ea4
testb $0x2, 0x48(%rbx)
jne 0x3ea4
movq %rbx, %rdi
callq 0x3f6a
testb $0x2, 0x48(%rbx)
jne 0x3e9c
jmp 0x3ea4
testb $0x2, %al
jne 0x3e9c
testb $0x1, %al
jne 0x3d3f
testb $0x2, 0x38(%rbx)
jne 0x3d3f
movq 0x5a175(%rip), %rdi     # 0x5dea0
pushq $0x3
popq %rsi
xorl %edx, %edx
callq 0x4caf
testb $0x2, 0x48(%rbx)
jne 0x3e9c
testb $0x2, 0x38(%rbx)
jne 0x3d60
movq 0x5a154(%rip), %rdi     # 0x5dea0
pushq $0x6
popq %rsi
xorl %edx, %edx
callq 0x4caf
testb $0x2, 0x48(%rbx)
jne 0x3e9c
movq 0x5a139(%rip), %rdi     # 0x5dea0
pushq $0x7
popq %rsi
xorl %edx, %edx
callq 0x4caf
movb 0x48(%rbx), %al
testb $0x2, %al
jne 0x3e9c
testb $0x2, %al
jne 0x3e9c
movq 0x5a115(%rip), %rdi     # 0x5dea0
callq 0x4b8e
movq %rax, %r15
movq 0x5a106(%rip), %rdi     # 0x5dea0
pushq $0x20
popq %rsi
callq 0x66ab
testb %al, %al
je 0x3df0
xorl %eax, %eax
movq 0x30(%rbx), %rdi
movq 0x5a0ed(%rip), %r14     # 0x5dea0
cmpq %r14, %rdi
setne %cl
notb %al
testb %cl, %al
jne 0x3e2e
movb 0x48(%rbx), %al
testb $0x2, %al
jne 0x3e9c
movq %r14, %rdi
callq 0x65f2
testb %al, %al
je 0x3e63
testq %r14, %r14
je 0x3e63
movq %r14, %rdi
callq 0x47bc
movq %rax, %r14
jmp 0x3dca
movq 0x5a0a9(%rip), %r14     # 0x5dea0
pushq $0x20
popq %rbp
testq %r15, %r15
jne 0x3eaf
movq %r14, %rdi
callq 0x47bc
testq %rax, %rax
je 0x3da6
movq %rax, %r14
movq %rax, %rdi
movl %ebp, %esi
callq 0x66ab
testb %al, %al
jne 0x3da6
movq %r14, %rdi
callq 0x4b8e
movq %rax, %r15
jmp 0x3dfa
pushq $0xd
popq %rsi
xorl %edx, %edx
callq 0x4caf
testb $0x2, 0x48(%rbx)
jne 0x3e9c
movq 0x20(%rbx), %rdi
pushq $0xc
popq %rsi
xorl %edx, %edx
callq 0x4caf
movb 0x48(%rbx), %al
testb $0x2, %al
jne 0x3e9c
movq 0x5a046(%rip), %r14     # 0x5dea0
movq %r14, 0x30(%rbx)
jmp 0x3dc2
testq %r14, %r14
je 0x3e8d
movq %r14, %rdi
callq 0x65ca
testb %al, %al
je 0x3e8d
testb $0x2, 0x38(%rbx)
je 0x3e8d
pushq $0xa
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x4caf
testb $0x2, 0x48(%rbx)
jne 0x3e9c
andq $0x0, 0x20(%rbx)
andq $0x0, 0x40(%rbx)
jmp 0x3ce6
andq $0x0, 0x59ffc(%rip)     # 0x5dea0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
testq %r14, %r14
je 0x3da6
movq %r15, %rdi
callq 0x2abd
testb %al, %al
je 0x3da6
movq %r14, %rdi
callq 0x267a
movb $0x1, %al
jmp 0x3da8