// File: /workspace/github_c_makefile_star2_O0/mchackorg[P]mcwm/mcwm.c
// Function: focusnext
void focusnext(bool reverse)
{
    struct client *client = NULL;

#if DEBUG
    if (NULL != focuswin)
    {
        PDEBUG("Focus now in win %d\n", focuswin->id);
    }
#endif

    if (NULL == wslist[curws])
    {
        PDEBUG("No windows to focus on in this workspace.\n");
        return;
    }

    if (MCWM_TABBING != mode)
    {
        /*
         * Remember what we last focused on. We need this when the
         * MODKEY is released and we move the last focused window in
         * the tabbing order list.
         */
        lastfocuswin = focuswin;
        mode = MCWM_TABBING;

        PDEBUG("Began tabbing.\n");
    }

    /* If we currently have no focus focus first in list. */
    if (NULL == focuswin || NULL == focuswin->wsitem[curws])
    {
        PDEBUG("Focusing first in list: %p\n", wslist[curws]);
        client = wslist[curws]->data;

        if (NULL != focuswin && NULL == focuswin->wsitem[curws])
        {
            PDEBUG("XXX Our focused window %d isn't on this workspace!\n",
                   focuswin->id);
        }
    }
    else
    {
        if (reverse)
        {
            if (NULL == focuswin->wsitem[curws]->prev)
            {
                /*
                 * We were at the head of list. Focusing on last
                 * window in list unless we were already there.
                 */
                struct item *last = wslist[curws];
                while (NULL != last->next)
                    last = last->next;
                if (focuswin->wsitem[curws] != last->data)
                {
                    PDEBUG("Beginning of list. Focusing last in list: %p\n",
                           last);
                    client = last->data;
                }
            }
            else
            {
                /* Otherwise, focus the next in list. */
                PDEBUG("Tabbing. Focusing next: %p.\n",
                       focuswin->wsitem[curws]->prev);
                client = focuswin->wsitem[curws]->prev->data;
            }
        }
        else
        {
            if (NULL == focuswin->wsitem[curws]->next)
            {
                /*
                 * We were at the end of list. Focusing on first window in
                 * list unless we were already there.
                 */
                if (focuswin->wsitem[curws] != wslist[curws]->data)
                {
                    PDEBUG("End of list. Focusing first in list: %p\n",
                           wslist[curws]);
                    client = wslist[curws]->data;
                }
            }
            else
            {
                /* Otherwise, focus the next in list. */
                PDEBUG("Tabbing. Focusing next: %p.\n",
                       focuswin->wsitem[curws]->next);
                client = focuswin->wsitem[curws]->next->data;
            }
        }
    }

    if (NULL != client)
    {
        /*
         * Raise window if it's occluded, then warp pointer into it and
         * set keyboard focus to it.
         */
        uint32_t values[] = { XCB_STACK_MODE_TOP_IF };

        xcb_configure_window(conn, client->id, XCB_CONFIG_WINDOW_STACK_MODE,
                             values);
        xcb_warp_pointer(conn, XCB_NONE, client->id, 0, 0, 0, 0,
                         client->width / 2, client->height / 2);
        setfocus(client);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %dil, %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movq $0x0, -0x10(%rbp)
movl 0x5472(%rip), %eax      # 0xc3f0
movl %eax, %edx
xorl %eax, %eax
leaq 0x5487(%rip), %rcx      # 0xc410
cmpq (%rcx,%rdx,8), %rax
jne 0x6f94
jmp 0x71d9
movl $0x4, %eax
cmpl 0x5469(%rip), %eax      # 0xc408
je 0x6fb9
movq 0x5518(%rip), %rax      # 0xc4c0
movq %rax, 0x5519(%rip)      # 0xc4c8
movl $0x4, 0x544f(%rip)      # 0xc408
xorl %eax, %eax
cmpq 0x54fe(%rip), %rax      # 0xc4c0
je 0x6fdc
movq 0x54f5(%rip), %rcx      # 0xc4c0
movl 0x541f(%rip), %eax      # 0xc3f0
movl %eax, %edx
xorl %eax, %eax
cmpq 0x48(%rcx,%rdx,8), %rax
jne 0x7020
movl 0x540e(%rip), %eax      # 0xc3f0
movl %eax, %ecx
leaq 0x5425(%rip), %rax      # 0xc410
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
xorl %eax, %eax
cmpq 0x54c1(%rip), %rax      # 0xc4c0
je 0x701b
movq 0x54b8(%rip), %rcx      # 0xc4c0
movl 0x53e2(%rip), %eax      # 0xc3f0
movl %eax, %edx
xorl %eax, %eax
cmpq 0x48(%rcx,%rdx,8), %rax
jne 0x701b
jmp 0x701b
jmp 0x713d
testb $0x1, -0x1(%rbp)
je 0x70bc
movq 0x548f(%rip), %rax      # 0xc4c0
movl 0x53b9(%rip), %ecx      # 0xc3f0
movq 0x48(%rax,%rcx,8), %rcx
xorl %eax, %eax
cmpq 0x8(%rcx), %rax
jne 0x709d
movl 0x53a6(%rip), %eax      # 0xc3f0
movl %eax, %ecx
leaq 0x53bd(%rip), %rax      # 0xc410
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq 0x10(%rcx), %rax
je 0x7075
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x705b
movq 0x5444(%rip), %rax      # 0xc4c0
movl 0x536e(%rip), %ecx      # 0xc3f0
movq 0x48(%rax,%rcx,8), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
je 0x709b
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x70ba
movq 0x541c(%rip), %rax      # 0xc4c0
movl 0x5346(%rip), %ecx      # 0xc3f0
movq 0x48(%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x713b
movq 0x53fd(%rip), %rax      # 0xc4c0
movl 0x5327(%rip), %ecx      # 0xc3f0
movq 0x48(%rax,%rcx,8), %rcx
xorl %eax, %eax
cmpq 0x10(%rcx), %rax
jne 0x711c
movq 0x53e3(%rip), %rax      # 0xc4c0
movl 0x530d(%rip), %ecx      # 0xc3f0
movq 0x48(%rax,%rcx,8), %rax
movl 0x5302(%rip), %ecx      # 0xc3f0
movl %ecx, %edx
leaq 0x5319(%rip), %rcx      # 0xc410
movq (%rcx,%rdx,8), %rcx
cmpq (%rcx), %rax
je 0x711a
movl 0x52ea(%rip), %eax      # 0xc3f0
movl %eax, %ecx
leaq 0x5301(%rip), %rax      # 0xc410
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x7139
movq 0x539d(%rip), %rax      # 0xc4c0
movl 0x52c7(%rip), %ecx      # 0xc3f0
movq 0x48(%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x713b
jmp 0x713d
xorl %eax, %eax
cmpq -0x10(%rbp), %rax
je 0x71d9
movl 0x2545(%rip), %eax      # 0x9694
movl %eax, -0x1c(%rbp)
movq 0x5337(%rip), %rdi      # 0xc490
movq -0x10(%rbp), %rax
movl (%rax), %esi
leaq -0x1c(%rbp), %rcx
movl $0x40, %edx
callq 0x2200
movl %eax, -0x20(%rbp)
movq 0x5319(%rip), %rdi      # 0xc490
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movzwl 0xa(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movw %ax, %r10w
movq -0x10(%rbp), %rax
movzwl 0xc(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl -0x28(%rbp), %edx
xorl %r9d, %r9d
movl %r9d, %esi
movl %r9d, %ecx
movl %r9d, %r8d
movl $0x0, (%rsp)
movswl %r10w, %r10d
movl %r10d, 0x8(%rsp)
cwtl
movl %eax, 0x10(%rsp)
callq 0x2050
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rdi
callq 0x51b0
addq $0x40, %rsp
popq %rbp
retq
nop