// File: /workspace/github_c_makefile_star2_O1/comfies[P]custard/src/wm/window.c
// Function: window_should_be_managed
unsigned short window_should_be_managed(xcb_window_t window_id) {
    if (window_id == xcb_screen->root || window_id == ewmh_window ||
        window_id == XCB_WINDOW_NONE) return 0;
    if (window_is_managed(window_id)) return 0;

    xcb_get_window_attributes_cookie_t window_attributes_cookie;
    window_attributes_cookie = xcb_get_window_attributes(xcb_connection,
        window_id);

    xcb_get_window_attributes_reply_t *attributes;
    attributes = xcb_get_window_attributes_reply(xcb_connection,
        window_attributes_cookie, NULL);

    if (attributes && attributes->override_redirect) return 0;

    xcb_ewmh_get_atoms_reply_t window_type;
    xcb_get_property_cookie_t window_type_cookie;
    window_type_cookie = xcb_ewmh_get_wm_window_type(ewmh_connection,
        window_id);

    if (xcb_ewmh_get_wm_window_type_reply(ewmh_connection, window_type_cookie,
        &window_type, NULL)) {
        xcb_atom_t atom;

        for (unsigned int index = 0; index < window_type.atoms_len; index++) {
            atom = window_type.atoms[index];

            if (atom == ewmh_connection->_NET_WM_WINDOW_TYPE_TOOLBAR       ||
                atom == ewmh_connection->_NET_WM_WINDOW_TYPE_MENU          ||
                atom == ewmh_connection->_NET_WM_WINDOW_TYPE_DROPDOWN_MENU ||
                atom == ewmh_connection->_NET_WM_WINDOW_TYPE_POPUP_MENU    ||
                atom == ewmh_connection->_NET_WM_WINDOW_TYPE_DND           ||
                atom == ewmh_connection->_NET_WM_WINDOW_TYPE_DOCK          ||
                atom == ewmh_connection->_NET_WM_WINDOW_TYPE_DESKTOP       ||
                atom == ewmh_connection->_NET_WM_WINDOW_TYPE_NOTIFICATION) {
                xcb_ewmh_get_atoms_reply_wipe(&window_type);
                return 0;
            } else if (atom == ewmh_connection->_NET_WM_WINDOW_TYPE_SPLASH) {
                xcb_ewmh_get_atoms_reply_wipe(&window_type);
                // do something else

                return 0;
            }
        }

        xcb_ewmh_get_atoms_reply_wipe(&window_type);
    }

    return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
leaq 0x5cc1(%rip), %rax      # 0xc900
movq (%rax), %rax
cmpl %edi, (%rax)
je 0x6c65
movl %edi, %ebp
xorl %ebx, %ebx
testl %edi, %edi
je 0x6c67
leaq 0x5cc3(%rip), %rax      # 0xc918
cmpl %ebp, (%rax)
je 0x6c67
movl %ebp, %edi
callq 0x6d63
testq %rax, %rax
je 0x6c72
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x5c7f(%rip), %rbx      # 0xc8f8
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x3420
movq (%rbx), %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x3290
testq %rax, %rax
je 0x6c9a
cmpb $0x0, 0x1b(%rax)
jne 0x6c65
leaq 0x5c7f(%rip), %r14      # 0xc920
movq (%r14), %rdi
movl %ebp, %esi
callq 0x35c0
movq (%r14), %rdi
leaq 0x8(%rsp), %rdx
movl %eax, %esi
xorl %ecx, %ecx
callq 0x3670
testb %al, %al
je 0x6d37
movl 0x8(%rsp), %eax
movw $0x1, %bx
testq %rax, %rax
je 0x6d42
movq 0x10(%rsp), %rcx
movq (%r14), %rdx
movl 0xd8(%rdx), %esi
xorl %edi, %edi
movl (%rcx,%rdi,4), %r8d
cmpl %esi, %r8d
je 0x6d40
cmpl 0xdc(%rdx), %r8d
je 0x6d40
cmpl 0xec(%rdx), %r8d
je 0x6d40
cmpl 0xf0(%rdx), %r8d
je 0x6d40
cmpl 0x100(%rdx), %r8d
je 0x6d40
cmpl 0xd4(%rdx), %r8d
je 0x6d40
cmpl 0xd0(%rdx), %r8d
je 0x6d40
cmpl 0xf8(%rdx), %r8d
je 0x6d40
cmpl 0xe4(%rdx), %r8d
je 0x6d40
incq %rdi
cmpl %edi, %eax
jne 0x6cdd
jmp 0x6d42
movw $0x1, %bx
jmp 0x6c67
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdi
callq 0x3040
jmp 0x6c67