// File: /workspace/github_c_makefile_star2_O2/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 %rbx
subq $0x18, %rsp
leaq 0x60e7(%rip), %rax      # 0xc8f0
movq (%rax), %rax
cmpl %edi, (%rax)
je 0x682f
movl %edi, %ebp
xorl %ebx, %ebx
testl %edi, %edi
je 0x6831
leaq 0x60e9(%rip), %rax      # 0xc908
cmpl %ebp, (%rax)
je 0x6831
movl %ebp, %edi
callq 0x6904
testw %ax, %ax
je 0x683a
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0x60a7(%rip), %rbx      # 0xc8e8
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x3410
movq (%rbx), %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x3290
testq %rax, %rax
je 0x6862
cmpb $0x0, 0x1b(%rax)
jne 0x682f
leaq 0x60a7(%rip), %rbx      # 0xc910
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x35b0
movq (%rbx), %rdi
movq %rsp, %rdx
movl %eax, %esi
xorl %ecx, %ecx
callq 0x3660
testb %al, %al
je 0x68f5
movl (%rsp), %eax
movq 0x8(%rsp), %rcx
movq (%rbx), %rdx
xorl %esi, %esi
cmpq %rsi, %rax
je 0x68fe
movl (%rcx,%rsi,4), %edi
cmpl 0xd8(%rdx), %edi
je 0x68e6
cmpl 0xdc(%rdx), %edi
je 0x68e6
cmpl 0xec(%rdx), %edi
je 0x68e6
cmpl 0xf0(%rdx), %edi
je 0x68e6
cmpl 0x100(%rdx), %edi
je 0x68e6
cmpl 0xd4(%rdx), %edi
je 0x68e6
cmpl 0xd0(%rdx), %edi
je 0x68e6
cmpl 0xf8(%rdx), %edi
je 0x68e6
incq %rsi
cmpl 0xe4(%rdx), %edi
jne 0x6893
xorl %ebx, %ebx
movq %rsp, %rdi
callq 0x3040
jmp 0x6831
movw $0x1, %bx
jmp 0x6831
movw $0x1, %bx
jmp 0x68e8