// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movl -0x8(%rbp), %eax
leaq 0x5abb(%rip), %rcx      # 0xd900
movq (%rcx), %rcx
cmpl (%rcx), %eax
je 0x7e60
movl -0x8(%rbp), %eax
leaq 0x5ac2(%rip), %rcx      # 0xd918
cmpl (%rcx), %eax
je 0x7e60
cmpl $0x0, -0x8(%rbp)
jne 0x7e6b
movw $0x0, -0x2(%rbp)
jmp 0x8039
movl -0x8(%rbp), %edi
callq 0x8050
cmpw $0x0, %ax
je 0x7e84
movw $0x0, -0x2(%rbp)
jmp 0x8039
leaq 0x5a6d(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0x8(%rbp), %esi
callq 0x3430
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0xc(%rbp)
leaq 0x5a52(%rip), %rax      # 0xd8f8
movq (%rax), %rdi
movl -0xc(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x3290
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x7ed8
movq -0x18(%rbp), %rax
movzbl 0x1b(%rax), %eax
cmpl $0x0, %eax
je 0x7ed8
movw $0x0, -0x2(%rbp)
jmp 0x8039
leaq 0x5a41(%rip), %rax      # 0xd920
movq (%rax), %rdi
movl -0x8(%rbp), %esi
callq 0x35d0
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x34(%rbp)
leaq 0x5a26(%rip), %rax      # 0xd920
movq (%rax), %rdi
movl -0x34(%rbp), %esi
leaq -0x30(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x3680
cmpb $0x0, %al
je 0x8033
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x30(%rbp), %eax
jae 0x802a
movq -0x28(%rbp), %rax
movl -0x40(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
leaq 0x59e1(%rip), %rcx      # 0xd920
movq (%rcx), %rcx
cmpl 0xd8(%rcx), %eax
je 0x7fe1
movl -0x3c(%rbp), %eax
leaq 0x59c8(%rip), %rcx      # 0xd920
movq (%rcx), %rcx
cmpl 0xdc(%rcx), %eax
je 0x7fe1
movl -0x3c(%rbp), %eax
leaq 0x59b3(%rip), %rcx      # 0xd920
movq (%rcx), %rcx
cmpl 0xec(%rcx), %eax
je 0x7fe1
movl -0x3c(%rbp), %eax
leaq 0x599e(%rip), %rcx      # 0xd920
movq (%rcx), %rcx
cmpl 0xf0(%rcx), %eax
je 0x7fe1
movl -0x3c(%rbp), %eax
leaq 0x5989(%rip), %rcx      # 0xd920
movq (%rcx), %rcx
cmpl 0x100(%rcx), %eax
je 0x7fe1
movl -0x3c(%rbp), %eax
leaq 0x5974(%rip), %rcx      # 0xd920
movq (%rcx), %rcx
cmpl 0xd4(%rcx), %eax
je 0x7fe1
movl -0x3c(%rbp), %eax
leaq 0x595f(%rip), %rcx      # 0xd920
movq (%rcx), %rcx
cmpl 0xd0(%rcx), %eax
je 0x7fe1
movl -0x3c(%rbp), %eax
leaq 0x594a(%rip), %rcx      # 0xd920
movq (%rcx), %rcx
cmpl 0xf8(%rcx), %eax
jne 0x7ff2
leaq -0x30(%rbp), %rdi
callq 0x3040
movw $0x0, -0x2(%rbp)
jmp 0x8039
movl -0x3c(%rbp), %eax
leaq 0x5924(%rip), %rcx      # 0xd920
movq (%rcx), %rcx
cmpl 0xe4(%rcx), %eax
jne 0x8018
leaq -0x30(%rbp), %rdi
callq 0x3040
movw $0x0, -0x2(%rbp)
jmp 0x8039
jmp 0x801a
jmp 0x801c
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x7f1c
leaq -0x30(%rbp), %rdi
callq 0x3040
movw $0x1, -0x2(%rbp)
movw -0x2(%rbp), %ax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)