// File: /workspace/github_c_makefile_star2_O3/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 0x3eea
movq 0x20(%rbx), %rdi
movq %rdi, 0x5c029(%rip)     # 0x5fea0
testq %rdi, %rdi
je 0x3f06
movl $0x10, %esi
callq 0x6a5b
movl %eax, %ebp
movq 0x5c00d(%rip), %rdi     # 0x5fea0
movq 0x5bffe(%rip), %rdx     # 0x5fe98
movl $0xb, %esi
callq *0x30(%rdi)
movb 0x48(%rbx), %al
testb %bpl, %bpl
je 0x3f32
testb $0x2, %al
jne 0x40ef
testb $0x2, 0x38(%rbx)
jne 0x3f84
testb $0x1, %al
jne 0x3f67
movq 0x5bfd1(%rip), %rdi     # 0x5fea0
movl $0x3, %esi
xorl %edx, %edx
callq 0x5018
testb $0x2, 0x48(%rbx)
je 0x3f67
jmp 0x40ef
leaq 0x20(%rbx), %rcx
xorl %edx, %edx
movq %rdx, 0x40(%rbx)
andb $-0x9, %al
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movb %al, 0x48(%rbx)
movq %rdx, 0x5bf9a(%rip)     # 0x5fea0
cmpq $0x0, 0x28(%rbx)
je 0x40fa
testb $0x2, 0x48(%rbx)
jne 0x40fa
movq %rbx, %rdi
callq 0x41a6
testb $0x2, 0x48(%rbx)
jne 0x40ef
jmp 0x40fa
testb $0x2, %al
jne 0x40ef
testb $0x1, %al
jne 0x3f61
testb $0x2, 0x38(%rbx)
jne 0x3f61
movq 0x5bf55(%rip), %rdi     # 0x5fea0
movl $0x3, %esi
xorl %edx, %edx
callq 0x5018
testb $0x2, 0x48(%rbx)
jne 0x40ef
testb $0x2, 0x38(%rbx)
jne 0x3f84
movq 0x5bf32(%rip), %rdi     # 0x5fea0
movl $0x6, %esi
xorl %edx, %edx
callq 0x5018
testb $0x2, 0x48(%rbx)
jne 0x40ef
movq 0x5bf15(%rip), %rdi     # 0x5fea0
movl $0x7, %esi
xorl %edx, %edx
callq 0x5018
movb 0x48(%rbx), %al
testb $0x2, %al
jne 0x40ef
testb $0x2, %al
jne 0x40ef
movq 0x5beef(%rip), %rdi     # 0x5fea0
callq 0x4ed1
movq %rax, %r15
movq 0x5bee0(%rip), %rdi     # 0x5fea0
movl $0x20, %esi
callq 0x6a5b
testb %al, %al
jne 0x402a
movq 0x5becb(%rip), %r14     # 0x5fea0
testq %r15, %r15
je 0x4002
testq %r14, %r14
jne 0x4014
jmp 0x402a
movq %rax, %r14
movq %rax, %rdi
movl $0x20, %esi
callq 0x6a5b
testb %al, %al
jne 0x402a
movq %r14, %rdi
callq 0x4ed1
testq %rax, %rax
jne 0x4011
movq %r14, %rdi
callq 0x4ab5
testq %rax, %rax
jne 0x3fe1
jmp 0x402a
movq %rax, %r15
movq %r15, %rdi
callq 0x2b1e
testb %al, %al
je 0x402a
movq %r14, %rdi
callq 0x26b1
jmp 0x4072
movq 0x30(%rbx), %rdi
cmpq 0x5be6b(%rip), %rdi     # 0x5fea0
je 0x4072
movl $0xd, %esi
xorl %edx, %edx
callq 0x5018
testb $0x2, 0x48(%rbx)
jne 0x40ef
movq 0x20(%rbx), %rdi
movl $0xc, %esi
xorl %edx, %edx
callq 0x5018
testb $0x2, 0x48(%rbx)
jne 0x40ef
movq 0x5be32(%rip), %rax     # 0x5fea0
movq %rax, 0x30(%rbx)
testb $0x2, 0x48(%rbx)
jne 0x40ef
movq 0x5be21(%rip), %r14     # 0x5fea0
movq %r14, %rdi
callq 0x6994
testq %r14, %r14
setne %cl
andb %cl, %al
cmpb $0x1, %al
jne 0x40b5
movq %r14, %rdi
callq 0x4ab5
movq %rax, %r14
movq %rax, %rdi
callq 0x6994
testq %r14, %r14
setne %cl
testb %al, %al
je 0x40b5
testq %r14, %r14
jne 0x4093
testb %cl, %cl
je 0x40e0
movq %r14, %rdi
callq 0x696c
testb %al, %al
je 0x40e0
testb $0x2, 0x38(%rbx)
je 0x40e0
movq %r14, %rdi
movl $0xa, %esi
xorl %edx, %edx
callq 0x5018
testb $0x2, 0x48(%rbx)
jne 0x40ef
xorl %eax, %eax
movq %rax, 0x20(%rbx)
movq %rax, 0x40(%rbx)
jmp 0x3f06
movq $0x0, 0x5bda6(%rip) # 0x5fea0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq