// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_core/lv_indev.c
// Function: indev_drag_throw
static void indev_drag_throw(lv_indev_proc_t * proc)
{
    if(proc->types.pointer.drag_in_prog == 0) return;

    lv_obj_t * drag_obj = proc->types.pointer.last_obj;

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

    if(drag_obj == NULL) {
        return;
    }

    /*Return if the drag throw is not enabled*/
    if(lv_obj_get_drag_throw(drag_obj) == false) {
        proc->types.pointer.drag_in_prog = 0;
        drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_END, indev_act);
        lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL);
        if(indev_reset_check(proc)) return;

        lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL);
        return;
    }

    lv_drag_dir_t allowed_dirs = lv_obj_get_drag_dir(drag_obj);

    /*Reduce the vectors*/
    proc->types.pointer.drag_throw_vect.x =
        proc->types.pointer.drag_throw_vect.x * (100 - indev_act->driver.drag_throw) / 100;
    proc->types.pointer.drag_throw_vect.y =
        proc->types.pointer.drag_throw_vect.y * (100 - indev_act->driver.drag_throw) / 100;

    if(proc->types.pointer.drag_throw_vect.x != 0 || proc->types.pointer.drag_throw_vect.y != 0) {
        /*Get the coordinates and modify them*/
        lv_area_t coords_ori;
        lv_obj_get_coords(drag_obj, &coords_ori);
        lv_coord_t act_x = lv_obj_get_x(drag_obj) + proc->types.pointer.drag_throw_vect.x;
        lv_coord_t act_y = lv_obj_get_y(drag_obj) + proc->types.pointer.drag_throw_vect.y;

        if(allowed_dirs == LV_DRAG_DIR_ALL)
            lv_obj_set_pos(drag_obj, act_x, act_y);
        else if(allowed_dirs & LV_DRAG_DIR_HOR)
            lv_obj_set_x(drag_obj, act_x);
        else if(allowed_dirs & LV_DRAG_DIR_VER)
            lv_obj_set_y(drag_obj, act_y);

        lv_area_t coord_new;
        lv_obj_get_coords(drag_obj, &coord_new);

        /*If non of the coordinates are changed then do not continue throwing*/
        if((coords_ori.x1 == coord_new.x1 || proc->types.pointer.drag_throw_vect.x == 0) &&
           (coords_ori.y1 == coord_new.y1 || proc->types.pointer.drag_throw_vect.y == 0)) {
            proc->types.pointer.drag_in_prog      = 0;
            proc->types.pointer.vect.x            = 0;
            proc->types.pointer.vect.y            = 0;
            proc->types.pointer.drag_throw_vect.x = 0;
            proc->types.pointer.drag_throw_vect.y = 0;
            drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_END, indev_act);
            if(indev_reset_check(proc)) return;
            lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL);
            if(indev_reset_check(proc)) return;
        }
    }
    /*If the types.pointer.vectors become 0 -> types.pointer.drag_in_prog = 0 and send a drag end
       signal*/
    else {
        proc->types.pointer.drag_in_prog = 0;
        drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_END, indev_act);
        if(indev_reset_check(proc)) return;
        lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL);
        if(indev_reset_check(proc)) return;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movb 0x38(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5bb4
jmp 0x5ed3
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa610
andb $0x1, %al
movzbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x27(%rbp)
je 0x5be3
cmpq $0x0, -0x10(%rbp)
setne %al
movb %al, -0x27(%rbp)
movb -0x27(%rbp), %al
testb $0x1, %al
jne 0x5bec
jmp 0x5bfb
movq -0x10(%rbp), %rdi
callq 0x71b0
movq %rax, -0x10(%rbp)
jmp 0x5bc0
cmpq $0x0, -0x10(%rbp)
jne 0x5c07
jmp 0x5ed3
movq -0x10(%rbp), %rdi
callq 0xa5b0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5c81
movq -0x8(%rbp), %rax
movb 0x38(%rax), %cl
andb $-0x3, %cl
orb $0x0, %cl
movb %cl, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rdi
movq 0x8332b(%rip), %rdx     # 0x88f68
movl $0xf, %esi
callq *%rax
movq -0x10(%rbp), %rdi
movl $0x9, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x5c65
jmp 0x5c6a
jmp 0x5ed3
movq -0x10(%rbp), %rdi
movl $0x9, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
jmp 0x5ed3
movq -0x10(%rbp), %rdi
callq 0xa560
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rax
movswl 0x18(%rax), %eax
movq 0x832cc(%rip), %rcx     # 0x88f68
movzbl 0x29(%rcx), %edx
movl $0x64, %ecx
subl %edx, %ecx
imull %ecx, %eax
movl $0x64, %ecx
cltd
idivl %ecx
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x18(%rax)
movq -0x8(%rbp), %rax
movswl 0x1a(%rax), %eax
movq 0x8329c(%rip), %rcx     # 0x88f68
movzbl 0x29(%rcx), %edx
movl $0x64, %ecx
subl %edx, %ecx
imull %ecx, %eax
movl $0x64, %ecx
cltd
idivl %ecx
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x1a(%rax)
movq -0x8(%rbp), %rax
movswl 0x18(%rax), %eax
cmpl $0x0, %eax
jne 0x5d0b
movq -0x8(%rbp), %rax
movswl 0x1a(%rax), %eax
cmpl $0x0, %eax
je 0x5e73
movq -0x10(%rbp), %rdi
leaq -0x1a(%rbp), %rsi
callq 0x7fb0
movq -0x10(%rbp), %rdi
callq 0x7350
cwtl
movq -0x8(%rbp), %rcx
movswl 0x18(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x73c0
cwtl
movq -0x8(%rbp), %rcx
movswl 0x1a(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x1e(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x3, %eax
jne 0x5d67
movq -0x10(%rbp), %rdi
movw -0x1c(%rbp), %ax
movswl %ax, %esi
movswl -0x1e(%rbp), %edx
callq 0x71f0
jmp 0x5d9f
movzbl -0x11(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x5d82
movq -0x10(%rbp), %rdi
movswl -0x1c(%rbp), %esi
callq 0x80b0
jmp 0x5d9d
movzbl -0x11(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x5d9b
movq -0x10(%rbp), %rdi
movswl -0x1e(%rbp), %esi
callq 0x8120
jmp 0x5d9d
jmp 0x5d9f
movq -0x10(%rbp), %rdi
leaq -0x26(%rbp), %rsi
callq 0x7fb0
movswl -0x1a(%rbp), %eax
movswl -0x26(%rbp), %ecx
cmpl %ecx, %eax
je 0x5dc9
movq -0x8(%rbp), %rax
movswl 0x18(%rax), %eax
cmpl $0x0, %eax
jne 0x5e71
movswl -0x18(%rbp), %eax
movswl -0x24(%rbp), %ecx
cmpl %ecx, %eax
je 0x5de6
movq -0x8(%rbp), %rax
movswl 0x1a(%rax), %eax
cmpl $0x0, %eax
jne 0x5e71
movq -0x8(%rbp), %rax
movb 0x38(%rax), %cl
andb $-0x3, %cl
orb $0x0, %cl
movb %cl, 0x38(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x10(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x12(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x1a(%rax)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rdi
movq 0x83137(%rip), %rdx     # 0x88f68
movl $0xf, %esi
callq *%rax
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x5e47
jmp 0x5e4c
jmp 0x5ed3
movq -0x10(%rbp), %rdi
movl $0x9, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x5e6d
jmp 0x5e6f
jmp 0x5ed3
jmp 0x5e71
jmp 0x5ed3
movq -0x8(%rbp), %rax
movb 0x38(%rax), %cl
andb $-0x3, %cl
orb $0x0, %cl
movb %cl, 0x38(%rax)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rdi
movq 0x830d2(%rip), %rdx     # 0x88f68
movl $0xf, %esi
callq *%rax
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x5eac
jmp 0x5eae
jmp 0x5ed3
movq -0x10(%rbp), %rdi
movl $0x9, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7990
movq -0x8(%rbp), %rdi
callq 0x5ee0
testb $0x1, %al
jne 0x5ecf
jmp 0x5ed1
jmp 0x5ed3
jmp 0x5ed3
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)