// File: /workspace/github_c_makefile_star2_O0/kaugm[P]mmwm/mmwm.c
// Function: mousemotion
void mousemotion(const Arg *arg)
{
    xcb_get_geometry_reply_t  *geometry;
    xcb_query_pointer_reply_t *pointer;
    xcb_grab_pointer_reply_t  *grab_reply;
    int mx, my, winx, winy, winw, winh, xw, yh;

    if (!M_CURRENT || M_CURRENT->isfullscreen)
        return;
    geometry = get_geometry(M_CURRENT->win);
    winx = geometry->x;     winy = geometry->y;
    winw = geometry->width; winh = geometry->height;
    free(geometry);

    pointer = xcb_query_pointer_reply(dis,
                                      xcb_query_pointer(dis, screen->root), 0);
    if (!pointer)
        return;
    mx = pointer->root_x;
    my = pointer->root_y;

    grab_reply = xcb_grab_pointer_reply(dis, xcb_grab_pointer(dis, 0,
        screen->root,
        BUTTONMASK|XCB_EVENT_MASK_BUTTON_MOTION|XCB_EVENT_MASK_POINTER_MOTION,
        XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_NONE, XCB_NONE,
        XCB_CURRENT_TIME), NULL);

    if (!grab_reply || grab_reply->status != XCB_GRAB_STATUS_SUCCESS) {
        free(grab_reply);
        return;
    } else {
        free(grab_reply);
    }

    if (M_CURRENT->ismaximized)
        setmaximize(M_CURRENT, False);
    if (!M_CURRENT->isfloating)
        float_client(M_CURRENT);
    update_current(M_CURRENT);

    xcb_generic_event_t *e = NULL;
    xcb_motion_notify_event_t *ev = NULL;
    bool ungrab = false;
    do {
        xcb_flush(dis);
        while (!(e = xcb_wait_for_event(dis)))
            xcb_flush(dis);
        switch (e->response_type & ~0x80) {
            case XCB_CONFIGURE_REQUEST:
            case XCB_MAP_REQUEST:
                events[e->response_type & ~0x80](e);
                break;
            case XCB_MOTION_NOTIFY:
                ev = (xcb_motion_notify_event_t *)e;
                xw = (arg->i == MOVE ? winx : winw) + ev->root_x - mx;
                yh = (arg->i == MOVE ? winy : winh) + ev->root_y - my;
                if (arg->i == RESIZE) xcb_resize(dis, M_CURRENT->win,
                                      xw > MINWSZ ? xw : winw,
                                      yh > MINWSZ ? yh : winh);
                else if (arg->i == MOVE) xcb_move(dis, M_CURRENT->win, xw, yh, &M_CURRENT->position_info);
                xcb_flush(dis);
                break;
            case XCB_KEY_PRESS:
            case XCB_KEY_RELEASE:
            case XCB_BUTTON_PRESS:
            case XCB_BUTTON_RELEASE:
                ungrab = true;
        }
        if (e)
            free(e);
    } while (!ungrab && M_CURRENT);
    DEBUG("xcb: ungrab");
    xcb_ungrab_pointer(dis, XCB_CURRENT_TIME);

    free(pointer);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq 0x4e0a(%rip), %rax      # 0xd7d0
cmpq $0x0, 0x30(%rax)
je 0x89de
movq 0x4dfc(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rax
testb $0x1, 0x1b(%rax)
je 0x89e3
jmp 0x8d9b
movq 0x4de6(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rax
movl 0x20(%rax), %edi
callq 0x8e40
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movswl 0xc(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movswl 0xe(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x10(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x12(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3050
movq 0x4d6a(%rip), %rax      # 0xd7a0
movq %rax, -0x68(%rbp)
movq 0x4d5f(%rip), %rdi      # 0xd7a0
movq 0x4d78(%rip), %rax      # 0xd7c0
movl (%rax), %esi
callq 0x3330
movq -0x68(%rbp), %rdi
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x3350
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x8a72
jmp 0x8d9b
movq -0x18(%rbp), %rax
movswl 0x10(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
movswl 0x12(%rax), %eax
movl %eax, -0x28(%rbp)
movq 0x4d11(%rip), %rax      # 0xd7a0
movq %rax, -0x70(%rbp)
movq 0x4d06(%rip), %rdi      # 0xd7a0
movq 0x4d1f(%rip), %rax      # 0xd7c0
movl (%rax), %edx
xorl %esi, %esi
movl $0x204c, %ecx           # imm = 0x204C
movl $0x1, %r9d
movl %r9d, %r8d
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x32f0
movq -0x70(%rbp), %rdi
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x3440
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x8afa
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0x8b08
movq -0x20(%rbp), %rdi
callq 0x3050
jmp 0x8d9b
movq -0x20(%rbp), %rdi
callq 0x3050
movq 0x4cb8(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rax
testb $0x1, 0x1c(%rax)
je 0x8b34
movq 0x4ca7(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rdi
xorl %esi, %esi
callq 0x8320
movq 0x4c95(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rax
testb $0x1, 0x1a(%rax)
jne 0x8b55
movq 0x4c84(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rdi
callq 0x8eb0
movq 0x4c74(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rdi
callq 0x4010
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movb $0x0, -0x59(%rbp)
movq 0x4c20(%rip), %rdi      # 0xd7a0
callq 0x3190
movq 0x4c14(%rip), %rdi      # 0xd7a0
callq 0x34e0
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x8ba4
jmp 0x8bb2
movq 0x4bf5(%rip), %rdi      # 0xd7a0
callq 0x3190
jmp 0x8b85
movq -0x50(%rbp), %rax
movzbl (%rax), %eax
andl $0x7f, %eax
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, -0x78(%rbp)
subl $0x15, %eax
ja 0x8d3e
movq -0x78(%rbp), %rax
leaq 0x1447(%rip), %rcx      # 0xa020
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x50(%rbp), %rax
movzbl (%rax), %eax
andl $0xffffff7f, %eax       # imm = 0xFFFFFF7F
movslq %eax, %rcx
leaq 0x4c58(%rip), %rax      # 0xd850
movq (%rax,%rcx,8), %rax
movq -0x50(%rbp), %rdi
callq *%rax
jmp 0x8d3e
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x8c20
movl -0x2c(%rbp), %eax
movl %eax, -0x7c(%rbp)
jmp 0x8c26
movl -0x34(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq -0x58(%rbp), %rcx
movswl 0x14(%rcx), %ecx
addl %ecx, %eax
subl -0x24(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x8c4a
movl -0x30(%rbp), %eax
movl %eax, -0x80(%rbp)
jmp 0x8c50
movl -0x38(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
movq -0x58(%rbp), %rcx
movswl 0x16(%rcx), %ecx
addl %ecx, %eax
subl -0x28(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x8cf2
movq 0x4b29(%rip), %rax      # 0xd7a0
movq %rax, -0x90(%rbp)
movq 0x4b4b(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rax
movl 0x20(%rax), %eax
movl %eax, -0x84(%rbp)
cmpl $0x32, -0x3c(%rbp)
jle 0x8ca3
movl -0x3c(%rbp), %eax
movl %eax, -0x94(%rbp)
jmp 0x8cac
movl -0x34(%rbp), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movl %eax, -0x98(%rbp)
cmpl $0x32, -0x40(%rbp)
jle 0x8cc9
movl -0x40(%rbp), %eax
movl %eax, -0x9c(%rbp)
jmp 0x8cd2
movl -0x38(%rbp), %eax
movl %eax, -0x9c(%rbp)
movl -0x98(%rbp), %edx
movl -0x84(%rbp), %esi
movq -0x90(%rbp), %rdi
movl -0x9c(%rbp), %ecx
callq 0x8f40
jmp 0x8d2c
movq -0x8(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x8d2a
movq 0x4a9e(%rip), %rdi      # 0xd7a0
movq 0x4ac7(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rax
movl 0x20(%rax), %esi
movl -0x3c(%rbp), %edx
movl -0x40(%rbp), %ecx
movq 0x4ab3(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %r8
addq $0x30, %r8
callq 0x5410
jmp 0x8d2c
movq 0x4a6d(%rip), %rdi      # 0xd7a0
callq 0x3190
jmp 0x8d3e
movb $0x1, -0x59(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x8d4e
movq -0x50(%rbp), %rdi
callq 0x3050
jmp 0x8d50
xorl %eax, %eax
testb $0x1, -0x59(%rbp)
movb %al, -0x9d(%rbp)
jne 0x8d73
movq 0x4a6b(%rip), %rax      # 0xd7d0
cmpq $0x0, 0x30(%rax)
setne %al
movb %al, -0x9d(%rbp)
movb -0x9d(%rbp), %al
testb $0x1, %al
jne 0x8b79
movq 0x4a18(%rip), %rdi      # 0xd7a0
xorl %esi, %esi
callq 0x31d0
movl %eax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3050
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)