// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: check_if_window_is_alien
static bool check_if_window_is_alien(xcb_window_t win, bool *isFloating, xcb_atom_t *wtype)
{
    xcb_get_window_attributes_reply_t *attr[1];
    xcb_window_t windows[] = {win};
    bool isAlien = False;

    if (isFloating) *isFloating = False;
    if (wtype) *wtype = ewmh->_NET_WM_WINDOW_TYPE_NORMAL;

    xcb_get_attributes(windows, attr, 1);
    if (!attr[0])   /* dead on arrival */
        return True;

    if (attr[0]->override_redirect) {
        free(attr[0]);
        return True;
    }
    else
        free(attr[0]);

    /*
     * check if window type is not _NET_WM_WINDOW_TYPE_NORMAL.
     * if yes, then we add it to alien list and map it.
     */
    xcb_ewmh_get_atoms_reply_t type;
    xcb_atom_t atype = 0;
    if (xcb_ewmh_get_wm_window_type_reply(ewmh,
                                xcb_ewmh_get_wm_window_type(ewmh,
                                win), &type, NULL) == 1) {
        if (wtype) *wtype = type.atoms[0];
        for (unsigned int i = 0; i < type.atoms_len; i++) {
print_window_type(win, type.atoms[i]);
            if (type.atoms[i] == ewmh->_NET_WM_WINDOW_TYPE_NORMAL) {
                isAlien = False;
                break;
            }
            if (type.atoms[i] == ewmh->_NET_WM_WINDOW_TYPE_DIALOG) {
                if (wtype)      *wtype = type.atoms[i];
                if (isFloating) *isFloating = True;
                isAlien = False;
                break;
            }
            else {
                if (atype == 0)
                    atype = type.atoms[i];
                isAlien = True;
            }
        }
        xcb_ewmh_get_atoms_reply_wipe(&type);
    }
    if (isAlien)
        create_alien(win, atype);

    return isAlien;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movl %edi, %ebp
movl %edi, 0xc(%rsp)
testq %rsi, %rsi
je 0x5b7c
movb $0x0, (%rbx)
testq %r14, %r14
je 0x5b91
movq 0x4be0(%rip), %rax      # 0xa768
movl 0x104(%rax), %eax
movl %eax, (%r14)
leaq 0xc(%rsp), %rdi
leaq 0x28(%rsp), %r15
movq %r15, %rsi
callq 0x6991
movq (%r15), %rdi
movb $0x1, %r15b
testq %rdi, %rdi
je 0x5c76
movb 0x1b(%rdi), %r12b
callq 0x3050
testb %r12b, %r12b
jne 0x5c76
movq 0x4b9d(%rip), %r12      # 0xa768
movq %r12, %rdi
movl %ebp, %esi
callq 0x3560
xorl %r15d, %r15d
leaq 0x10(%rsp), %rdx
movq %r12, %rdi
movl %eax, %esi
xorl %ecx, %ecx
callq 0x35d0
cmpb $0x1, %al
jne 0x5c76
movq 0x18(%rsp), %rax
testq %r14, %r14
je 0x5c00
movl (%rax), %ecx
movl %ecx, (%r14)
movl 0x10(%rsp), %ecx
movq 0x4b5d(%rip), %rdx      # 0xa768
xorl %esi, %esi
xorl %r12d, %r12d
xorl %r15d, %r15d
cmpq %rsi, %rcx
je 0x5c3a
movl (%rax,%rsi,4), %edi
cmpl 0x104(%rdx), %edi
je 0x5c69
cmpl 0xe8(%rdx), %edi
je 0x5c59
testl %r15d, %r15d
cmovel %edi, %r15d
incq %rsi
movb $0x1, %r12b
jmp 0x5c13
leaq 0x10(%rsp), %rdi
callq 0x3040
testb $0x1, %r12b
je 0x5c73
movl %ebp, %edi
movl %r15d, %esi
callq 0x69bb
movb $0x1, %r15b
jmp 0x5c76
testq %r14, %r14
je 0x5c61
movl %edi, (%r14)
testq %rbx, %rbx
je 0x5c69
movb $0x1, (%rbx)
leaq 0x10(%rsp), %rdi
callq 0x3040
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq