// File: /workspace/github_c_makefile_star2_O0/kaugm[P]mmwm/mmwm.c
// Function: update_current
void update_current(client *newfocus)   // newfocus may be NULL
{
    if(!M_HEAD) {                // empty desktop. no clients
        nada();
        return;
    }

    if(!newfocus) {
        if(M_PREVFOCUS)
            M_CURRENT = M_PREVFOCUS;
        else
            M_CURRENT = M_HEAD;
        M_PREVFOCUS = M_GETPREV(M_CURRENT);             // get previous client in list, may be NULL
    }
    else {
        if(newfocus == M_PREVFOCUS) {
            M_CURRENT = M_PREVFOCUS;
            M_PREVFOCUS = M_GETPREV(M_CURRENT);         // get previous client in list, may be NULL
        }
        else {
            M_PREVFOCUS = M_CURRENT;
            M_CURRENT = newfocus;
        }
    }

    if(!M_CURRENT) {  // there is really really really nothing to focus.
        nada();
        return;
    }

	/* Setting window borders: xcb_border_width -----> client_borders(c) */
    for (client *c = M_HEAD; c; c = M_GETNEXT(c)) {
        if (!c->isfullscreen) {
            xcb_change_window_attributes(dis, c->win, XCB_CW_BORDER_PIXEL,
                                    (c == M_CURRENT ? &win_focus : &win_unfocus));
            xcb_border_width(dis, c->win, client_borders(c));
        }
    }

    tile();

    for (client *c = M_HEAD; c; c = M_GETNEXT(c)) {
        if (c->isfullscreen) {
//            xcb_border_width(dis, c->win, 0);
            xcb_lower_window(dis, c->win);
//            xcb_move_resize(dis, c->win, 0, 0,
//                            screen->width_in_pixels, screen->height_in_pixels, &c->position_info);
            break;
        }
    }

    client *rl = NULL;
    for (client *c = M_HEAD; c; c = M_GETNEXT(c)) {
        if (c->ismaximized || c->isfloating || c->istransient || c->type != ewmh->_NET_WM_WINDOW_TYPE_NORMAL) {
            if (c == M_CURRENT) {
                rl = c;
                continue;
            }
        }
        xcb_raise_window(dis, c->win);
    }
    if(rl)
        xcb_raise_window(dis, rl->win);

    if (check_head(&aliens)) {
        alien *a;
        for (a=(alien *)get_head(&aliens); a; a=(alien *)get_next(&a->link)) {
            if (M_CURRENT->isfullscreen
             && a->type != ewmh->_NET_WM_WINDOW_TYPE_NOTIFICATION)
                continue;
            xcb_raise_window(dis, a->win);
        }
    }

    if (M_CURRENT) {
        if (M_CURRENT->setfocus) {
            xcb_change_property(dis, XCB_PROP_MODE_REPLACE, screen->root,
                                ewmh->_NET_ACTIVE_WINDOW, XCB_ATOM_WINDOW, 32, 1,
                                &M_CURRENT->win);
            xcb_set_input_focus(dis, XCB_INPUT_FOCUS_POINTER_ROOT, M_CURRENT->win,
                                XCB_CURRENT_TIME);
            DEBUG("xcb_set_input_focus();");
        }
        else {
            sendevent(M_CURRENT->win, wmatoms[WM_TAKE_FOCUS]);
            DEBUG("send WM_TAKE_FOCUS");
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq 0x97ad(%rip), %rax      # 0xd7d0
cmpq $0x0, 0x18(%rax)
jne 0x4034
callq 0x5720
jmp 0x43db
cmpq $0x0, -0x8(%rbp)
jne 0x4097
movq 0x978e(%rip), %rax      # 0xd7d0
cmpq $0x0, 0x38(%rax)
je 0x4061
movq 0x9780(%rip), %rax      # 0xd7d0
movq 0x38(%rax), %rcx
movq 0x9775(%rip), %rax      # 0xd7d0
movq %rcx, 0x30(%rax)
jmp 0x4077
movq 0x9768(%rip), %rax      # 0xd7d0
movq 0x18(%rax), %rcx
movq 0x975d(%rip), %rax      # 0xd7d0
movq %rcx, 0x30(%rax)
movq 0x9752(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rdi
callq 0x5790
movq %rax, %rcx
movq 0x973f(%rip), %rax      # 0xd7d0
movq %rcx, 0x38(%rax)
jmp 0x4105
movq -0x8(%rbp), %rax
movq 0x972e(%rip), %rcx      # 0xd7d0
cmpq 0x38(%rcx), %rax
jne 0x40de
movq 0x9721(%rip), %rax      # 0xd7d0
movq 0x38(%rax), %rcx
movq 0x9716(%rip), %rax      # 0xd7d0
movq %rcx, 0x30(%rax)
movq 0x970b(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rdi
callq 0x5790
movq %rax, %rcx
movq 0x96f8(%rip), %rax      # 0xd7d0
movq %rcx, 0x38(%rax)
jmp 0x4103
movq 0x96eb(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rcx
movq 0x96e0(%rip), %rax      # 0xd7d0
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rcx
movq 0x96d1(%rip), %rax      # 0xd7d0
movq %rcx, 0x30(%rax)
jmp 0x4105
movq 0x96c4(%rip), %rax      # 0xd7d0
cmpq $0x0, 0x30(%rax)
jne 0x411d
callq 0x5720
jmp 0x43db
movq 0x96ac(%rip), %rax      # 0xd7d0
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x41c0
movq -0x10(%rbp), %rax
testb $0x1, 0x1b(%rax)
jne 0x41ac
movq 0x9658(%rip), %rdi      # 0xd7a0
movq -0x10(%rbp), %rax
movl 0x20(%rax), %esi
movq -0x10(%rbp), %rdx
movq 0x9676(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %r8
leaq 0x96bf(%rip), %rcx      # 0xd824
leaq 0x96b4(%rip), %rax      # 0xd820
cmpq %r8, %rdx
cmoveq %rax, %rcx
movl $0x8, %edx
callq 0x30f0
movl %eax, -0x14(%rbp)
movq 0x9619(%rip), %rax      # 0xd7a0
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rdi
callq 0x57c0
movq -0x50(%rbp), %rdi
movl -0x44(%rbp), %esi
movl %eax, %edx
callq 0x3c90
jmp 0x41ae
movq -0x10(%rbp), %rdi
callq 0x5490
movq %rax, -0x10(%rbp)
jmp 0x412c
callq 0x57f0
movq 0x9604(%rip), %rax      # 0xd7d0
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x420b
movq -0x20(%rbp), %rax
testb $0x1, 0x1b(%rax)
je 0x41fa
movq 0x95b4(%rip), %rdi      # 0xd7a0
movq -0x20(%rbp), %rax
movl 0x20(%rax), %esi
callq 0x5850
jmp 0x420b
jmp 0x41fc
movq -0x20(%rbp), %rdi
callq 0x5490
movq %rax, -0x20(%rbp)
jmp 0x41d4
movq $0x0, -0x28(%rbp)
movq 0x95b6(%rip), %rax      # 0xd7d0
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x429c
movq -0x30(%rbp), %rax
testb $0x1, 0x1c(%rax)
jne 0x425d
movq -0x30(%rbp), %rax
testb $0x1, 0x1a(%rax)
jne 0x425d
movq -0x30(%rbp), %rax
testb $0x1, 0x19(%rax)
jne 0x425d
movq -0x30(%rbp), %rax
movl 0x24(%rax), %eax
movq 0x9563(%rip), %rcx      # 0xd7b8
cmpl 0x104(%rcx), %eax
je 0x427a
movq -0x30(%rbp), %rax
movq 0x9568(%rip), %rcx      # 0xd7d0
cmpq 0x30(%rcx), %rax
jne 0x4278
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x428d
jmp 0x427a
movq 0x951f(%rip), %rdi      # 0xd7a0
movq -0x30(%rbp), %rax
movl 0x20(%rax), %esi
callq 0x5890
movq -0x30(%rbp), %rdi
callq 0x5490
movq %rax, -0x30(%rbp)
jmp 0x4222
cmpq $0x0, -0x28(%rbp)
je 0x42b6
movq 0x94f6(%rip), %rdi      # 0xd7a0
movq -0x28(%rbp), %rax
movl 0x20(%rax), %esi
callq 0x5890
leaq 0x9523(%rip), %rdi      # 0xd7e0
callq 0x58d0
testb $0x1, %al
jne 0x42c8
jmp 0x432c
leaq 0x9511(%rip), %rdi      # 0xd7e0
callq 0x54c0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x432a
movq 0x94ea(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rax
testb $0x1, 0x1b(%rax)
je 0x4308
movq -0x38(%rbp), %rax
movl 0x1c(%rax), %eax
movq 0x94ba(%rip), %rcx      # 0xd7b8
cmpl 0xf8(%rcx), %eax
je 0x4308
jmp 0x431b
movq 0x9491(%rip), %rdi      # 0xd7a0
movq -0x38(%rbp), %rax
movl 0x18(%rax), %esi
callq 0x5890
movq -0x38(%rbp), %rdi
callq 0x5490
movq %rax, -0x38(%rbp)
jmp 0x42d8
jmp 0x432c
movq 0x949d(%rip), %rax      # 0xd7d0
cmpq $0x0, 0x30(%rax)
je 0x43db
movq 0x948b(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rax
testb $0x1, 0x44(%rax)
je 0x43c0
movq 0x944a(%rip), %rdi      # 0xd7a0
movq 0x9463(%rip), %rax      # 0xd7c0
movl (%rax), %edx
movq 0x9452(%rip), %rax      # 0xd7b8
movl 0x40(%rax), %ecx
movq 0x9460(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rax
addq $0x20, %rax
xorl %esi, %esi
movl $0x21, %r8d
movl $0x20, %r9d
movl $0x1, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x35d0
movl %eax, -0x3c(%rbp)
movq 0x93ff(%rip), %rdi      # 0xd7a0
movq 0x9428(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rax
movl 0x20(%rax), %edx
movl $0x1, %esi
xorl %ecx, %ecx
callq 0x3590
movl %eax, -0x40(%rbp)
jmp 0x43d9
movq 0x9409(%rip), %rax      # 0xd7d0
movq 0x30(%rax), %rax
movl 0x20(%rax), %edi
movl 0x9468(%rip), %esi      # 0xd83c
callq 0x5910
jmp 0x43db
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)