// File: /workspace/github_c_makefile_star2_O0/kaugm[P]mmwm/mmwm.c
// Function: setup
int setup(int default_screen)
{
    xcb_intern_atom_cookie_t *cookie;

    sigchld();
    screen = xcb_screen_of_display(dis, default_screen);
    if (!screen)
        err(EXIT_FAILURE, "error: cannot aquire screen\n");
    setup_display();
    select_desktop(0);      /* initialize global pointers */

#ifdef EWMH_TASKBAR
    Reset_Global_Strut();   /* struts are not yet ready. */
#endif /* EWMH_TASKBAR */
    borders = BORDER_WIDTH;

    aliens.head = NULL;
    aliens.tail = NULL;
	
    win_focus   = getcolor(FOCUS);
    win_unfocus = getcolor(UNFOCUS);

    /* setup keyboard */
    if (setup_keyboard() == -1)
        err(EXIT_FAILURE, "error: failed to setup keyboard\n");

    /* set up atoms for dialog/notification windows */
    xcb_get_atoms(WM_ATOM_NAME, wmatoms, WM_COUNT);

    /* check if another wm is running */
    if (xcb_checkotherwm())
        err(EXIT_FAILURE, "error: other wm is running\n");

    /* initialize EWMH */
    ewmh = calloc(1, sizeof(xcb_ewmh_connection_t));
    if (!ewmh)
        err(EXIT_FAILURE, "error: failed to set ewmh atoms\n");
    cookie = xcb_ewmh_init_atoms(dis, ewmh);
    xcb_ewmh_init_atoms_replies(ewmh, cookie, (void *)0);

    /* set EWMH atoms */
    xcb_atom_t net_atoms[] = { ewmh->_NET_SUPPORTED,
#ifdef EWMH_TASKBAR
                               ewmh->_NET_CLIENT_LIST,
                               ewmh->_NET_WM_STRUT,
                               ewmh->_NET_WM_STRUT_PARTIAL,
#endif /* EWMH_TASKBAR */
                               ewmh->_NET_WM_STATE_FULLSCREEN,
                               ewmh->_NET_WM_STATE,
                               ewmh->_NET_SUPPORTING_WM_CHECK,
                               ewmh->_NET_ACTIVE_WINDOW,
                               ewmh->_NET_NUMBER_OF_DESKTOPS,
                               ewmh->_NET_CURRENT_DESKTOP,
                               ewmh->_NET_DESKTOP_GEOMETRY,
                               ewmh->_NET_DESKTOP_VIEWPORT,
                               ewmh->_NET_WORKAREA,
                               ewmh->_NET_SHOWING_DESKTOP,
                               ewmh->_NET_CLOSE_WINDOW,
                               ewmh->_NET_WM_DESKTOP,
                               ewmh->_NET_WM_WINDOW_TYPE };

    xcb_ewmh_coordinates_t viewports[2] = {{ 0, 0 }};
    /* TODO: calculate workarea properly by substracting optional panel space */
    xcb_ewmh_geometry_t workarea[2] = {{ 0, 0, M_WW, M_WH }};

    /* functionless window required by the EWMH standard */
    uint32_t noevents = 0;
    checkwin = xcb_generate_id(dis);
    xcb_create_window(dis, 0, checkwin, screen->root, 0, 0, 1, 1, 0,
                      XCB_WINDOW_CLASS_INPUT_ONLY, 0, XCB_CW_EVENT_MASK, &noevents);
    xcb_ewmh_set_wm_name(ewmh, checkwin, sizeof(WM_NAME)-1, WM_NAME);

    xcb_ewmh_set_supported(ewmh, default_screen, LENGTH(net_atoms), net_atoms);
    xcb_ewmh_set_supporting_wm_check(ewmh, screen->root, checkwin);
    xcb_ewmh_set_number_of_desktops(ewmh, default_screen, DESKTOPS);
    xcb_ewmh_set_current_desktop(ewmh, default_screen, DEFAULT_DESKTOP);
    xcb_ewmh_set_desktop_geometry(ewmh, default_screen, M_WW, M_WH);
    xcb_ewmh_set_desktop_viewport(ewmh, default_screen, 1, viewports);
    xcb_ewmh_set_workarea(ewmh, default_screen, 1, workarea);
    xcb_ewmh_set_showing_desktop(ewmh, default_screen, 0);

    xcb_change_property(dis, XCB_PROP_MODE_REPLACE, screen->root,
                        ewmh->_NET_SUPPORTED, XCB_ATOM_ATOM, 32,
                        LENGTH(net_atoms), net_atoms);

    grabkeys();

    /* set events */
    for (unsigned int i = 0; i < XCB_NO_OPERATION; i++)
        events[i] = NULL;
    events[0]                       = xerror;
    events[XCB_BUTTON_PRESS]        = buttonpress;
    events[XCB_CLIENT_MESSAGE]      = clientmessage;
    events[XCB_CONFIGURE_REQUEST]   = configurerequest;
    events[XCB_DESTROY_NOTIFY]      = destroynotify;
    events[XCB_ENTER_NOTIFY]        = enternotify;
    events[XCB_KEY_PRESS]           = keypress;
    events[XCB_MAP_NOTIFY]          = mapnotify;
    events[XCB_MAP_REQUEST]         = maprequest;
    events[XCB_PROPERTY_NOTIFY]     = propertynotify;
    events[XCB_UNMAP_NOTIFY]        = unmapnotify;

    /* grab existing windows */
    xcb_query_tree_reply_t *reply;

    reply = xcb_query_tree_reply(dis, xcb_query_tree(dis, screen->root), 0);
    if (reply) {
        int len = xcb_query_tree_children_length(reply);
        xcb_window_t *children = xcb_query_tree_children(reply);
        uint32_t cd = current_desktop_number;
        for (int i = 0; i < len; i++) {
            xcb_atom_t wtype = ewmh->_NET_WM_WINDOW_TYPE_NORMAL;
            xcb_get_window_attributes_reply_t *attr;

//            if (window_is_override_redirect(children[i]))
            if (check_if_window_is_alien(children[i], NULL, &wtype))
                continue;

            attr = xcb_get_window_attributes_reply(dis,
                            xcb_get_window_attributes(dis, children[i]), NULL);
            if (!attr)
                continue;
            /* ignore windows in override redirect mode or with input only
             * class as we won't see them */
            if (!attr->override_redirect
                && attr->_class != XCB_WINDOW_CLASS_INPUT_ONLY) {
                uint32_t dsk = cd;

                xcb_get_property_reply_t *prop_reply;
                prop_reply = xcb_get_property_reply(dis, xcb_get_property_unchecked(
                                               dis, 0, children[i], ewmh->_NET_WM_STATE,
                                                XCB_ATOM_ATOM, 0, 1), NULL);
                                                /* TODO: error handling */
                if (prop_reply) {
                    if (prop_reply->format == 32) {
                        for (unsigned int i = 0; i < prop_reply->value_len; i++) {
                            DEBUGP("%d : %d\n", i, v[i]);
                        }
                    }
                    free(prop_reply);
                }

/*
 * case 1: window has no desktop property and is unmapped --> ignore
 * case 2: window has no desktop property and is mapped --> add desktop property and append to client list.
 * case 3: window has current desktop property and is unmapped --> map and append to client list.
 * case 4: window has desktop and hidden property -> move to miniq and append to client list.
 * case 5: window has current desktop property and is mapped  --> append to client list.
 * case 6: window has different desktop property and is unmapped -> append to client list.
 * case 7: window has different desktop property and is mapped -> unmap and append to client list.
 * case 8: window has desktop property > DESKTOPS -> move window to last desktop
 * case 9: window has desktop property = -1 -> TODO: sticky window support.
 */
                bool case7 = False;
                if (!(xcb_ewmh_get_wm_desktop_reply(ewmh,
                      xcb_ewmh_get_wm_desktop(ewmh, children[i]), &dsk, NULL))) {
                    if (attr->map_state == XCB_MAP_STATE_UNMAPPED)
                        continue;                                               /* case 1 */
                    else
                        xcb_ewmh_set_wm_desktop(ewmh, children[i], dsk = cd);   /* case 2 */
                }
                else {                                    /* case 4 */
                    if ((int)dsk > DESKTOPS-1)
                        xcb_ewmh_set_wm_desktop(ewmh, children[i], dsk = DESKTOPS-1);  /* case 8 */
                    if (dsk == cd) {
                        if (attr->map_state == XCB_MAP_STATE_UNMAPPED) {
                            if (wtype == ewmh->_NET_WM_WINDOW_TYPE_NORMAL)
                                xcb_map_window(dis, children[i]);               /* case 3 */
                            else
                                continue;   /* ignore _NET_WM_WINDOW_TYPE_DIALOG windows */
                        }
                        else
                            { ; }                                               /* case 5 */
                    }
                    else {  /* different desktop */
                        if (attr->map_state == XCB_MAP_STATE_UNMAPPED)
                            { ; }                                               /* case 6 */
                        else
                            case7 = True;                                       /* case 7 */
                    }
                }

            /* sane defaults */
                xcb_remove_property(dis, children[i], ewmh->_NET_WM_STATE, ewmh->_NET_WM_STATE_FULLSCREEN);
                xcb_remove_property(dis, children[i], ewmh->_NET_WM_STATE, ewmh->_NET_WM_STATE_HIDDEN);

                if (cd != dsk)
                    select_desktop(dsk);
                client *c = addwindow(children[i], wtype);

                if (case7)
                    xcb_move(dis, c->win, -2 * M_WW, 0, &c->position_info);
                grabbuttons(c);
                if (cd != dsk) {
                    xcb_move(dis, c->win, -2 * M_WW, 0, &c->position_info);
                    select_desktop(cd);
                }
            }
            free(attr);
        }
        free(reply);
    }

    change_desktop(&(Arg){.i = DEFAULT_DESKTOP});
    switch_mode(&(Arg){.i = TILE});

#ifdef EWMH_TASKBAR
    Setup_EWMH_Taskbar_Support();
    Setup_Global_Strut();
#endif

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movl %edi, -0x4(%rbp)
callq 0x7c20
movq 0x9226(%rip), %rdi      # 0xd7a0
movl -0x4(%rbp), %esi
callq 0x60e0
movq %rax, 0x9237(%rip)      # 0xd7c0
cmpq $0x0, 0x922f(%rip)      # 0xd7c0
jne 0x45a6
movl $0x1, %edi
leaq 0x5b62(%rip), %rsi      # 0xa101
movb $0x0, %al
callq 0x3400
callq 0x6160
xorl %edi, %edi
callq 0x5570
movl $0x0, 0x9284(%rip)      # 0xd840
movq $0x0, 0x9219(%rip) # 0xd7e0
movq $0x0, 0x9216(%rip) # 0xd7e8
leaq 0x5b45(%rip), %rdi      # 0xa11e
callq 0x6350
movl %eax, 0x923c(%rip)      # 0xd820
leaq 0x5b3b(%rip), %rdi      # 0xa126
callq 0x6350
movl %eax, 0x922e(%rip)      # 0xd824
callq 0x3990
cmpl $-0x1, %eax
jne 0x4613
movl $0x1, %edi
leaq 0x5b22(%rip), %rsi      # 0xa12e
movb $0x0, %al
callq 0x3400
leaq 0x8d56(%rip), %rdi      # 0xd370
leaq 0x920f(%rip), %rsi      # 0xd830
movl $0x4, %edx
callq 0x6430
callq 0x6560
cmpl $0x0, %eax
je 0x4648
movl $0x1, %edi
leaq 0x5b0e(%rip), %rsi      # 0xa14f
movb $0x0, %al
callq 0x3400
movl $0x1, %edi
movl $0x168, %esi            # imm = 0x168
callq 0x3300
movq %rax, 0x915a(%rip)      # 0xd7b8
cmpq $0x0, 0x9152(%rip)      # 0xd7b8
jne 0x467b
movl $0x1, %edi
leaq 0x5af7(%rip), %rsi      # 0xa16b
movb $0x0, %al
callq 0x3400
movq 0x911e(%rip), %rdi      # 0xd7a0
movq 0x912f(%rip), %rsi      # 0xd7b8
callq 0x3140
movq %rax, -0x10(%rbp)
movq 0x911f(%rip), %rdi      # 0xd7b8
movq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x3680
movq 0x910b(%rip), %rax      # 0xd7b8
movl 0x20(%rax), %eax
movl %eax, -0x50(%rbp)
movq 0x90fe(%rip), %rax      # 0xd7b8
movl 0x128(%rax), %eax
movl %eax, -0x4c(%rbp)
movq 0x90ee(%rip), %rax      # 0xd7b8
movl 0x84(%rax), %eax
movl %eax, -0x48(%rbp)
movq 0x90de(%rip), %rax      # 0xd7b8
movl 0x48(%rax), %eax
movl %eax, -0x44(%rbp)
movq 0x90d1(%rip), %rax      # 0xd7b8
movl 0x40(%rax), %eax
movl %eax, -0x40(%rbp)
movq 0x90c4(%rip), %rax      # 0xd7b8
movl 0x2c(%rax), %eax
movl %eax, -0x3c(%rbp)
movq 0x90b7(%rip), %rax      # 0xd7b8
movl 0x38(%rax), %eax
movl %eax, -0x38(%rbp)
movq 0x90aa(%rip), %rax      # 0xd7b8
movl 0x30(%rax), %eax
movl %eax, -0x34(%rbp)
movq 0x909d(%rip), %rax      # 0xd7b8
movl 0x34(%rax), %eax
movl %eax, -0x30(%rbp)
movq 0x9090(%rip), %rax      # 0xd7b8
movl 0x44(%rax), %eax
movl %eax, -0x2c(%rbp)
movq 0x9083(%rip), %rax      # 0xd7b8
movl 0x54(%rax), %eax
movl %eax, -0x28(%rbp)
movq 0x9076(%rip), %rax      # 0xd7b8
movl 0x58(%rax), %eax
movl %eax, -0x24(%rbp)
movq 0x9069(%rip), %rax      # 0xd7b8
movl 0x7c(%rax), %eax
movl %eax, -0x20(%rbp)
movq 0x905c(%rip), %rax      # 0xd7b8
movl 0x80(%rax), %eax
movl %eax, -0x1c(%rbp)
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x3270
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x3270
movq 0x904c(%rip), %rax      # 0xd7d8
movl 0x34(%rax), %eax
movl %eax, -0x78(%rbp)
movq 0x903f(%rip), %rax      # 0xd7d8
movl 0x38(%rax), %eax
movl %eax, -0x74(%rbp)
movl $0x0, -0x84(%rbp)
movq 0x8ff0(%rip), %rdi      # 0xd7a0
callq 0x31a0
movl %eax, 0x9089(%rip)      # 0xd844
movq 0x8fde(%rip), %rdi      # 0xd7a0
movl 0x907c(%rip), %edx      # 0xd844
movq 0x8ff1(%rip), %rax      # 0xd7c0
movl (%rax), %ecx
xorl %r9d, %r9d
leaq -0x84(%rbp), %rax
movl %r9d, %esi
movl %r9d, %r8d
movl $0x1, (%rsp)
movl $0x1, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x2, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movl $0x800, 0x28(%rsp)      # imm = 0x800
movq %rax, 0x30(%rsp)
callq 0x30d0
movl %eax, -0x88(%rbp)
movq 0x8f91(%rip), %rdi      # 0xd7b8
movl 0x9017(%rip), %esi      # 0xd844
movq 0x8b5c(%rip), %rcx      # 0xd390
movl $0x7, %edx
callq 0x3210
movl %eax, -0x8c(%rbp)
movq 0x8f6d(%rip), %rdi      # 0xd7b8
movl -0x4(%rbp), %esi
leaq -0x50(%rbp), %rcx
movl $0xe, %edx
callq 0x3530
movl %eax, -0x90(%rbp)
movq 0x8f4f(%rip), %rdi      # 0xd7b8
movq 0x8f50(%rip), %rax      # 0xd7c0
movl (%rax), %esi
movl 0x8fcc(%rip), %edx      # 0xd844
callq 0x3610
movl %eax, -0x94(%rbp)
movq 0x8f2e(%rip), %rdi      # 0xd7b8
movl -0x4(%rbp), %esi
movl $0xa, %edx
callq 0x3180
movl %eax, -0x98(%rbp)
movq 0x8f14(%rip), %rdi      # 0xd7b8
movl -0x4(%rbp), %esi
xorl %edx, %edx
callq 0x3550
movl %eax, -0x9c(%rbp)
movq 0x8efd(%rip), %rdi      # 0xd7b8
movl -0x4(%rbp), %esi
movq 0x8f13(%rip), %rax      # 0xd7d8
movl 0x34(%rax), %edx
movq 0x8f09(%rip), %rax      # 0xd7d8
movl 0x38(%rax), %ecx
callq 0x33a0
movl %eax, -0xa0(%rbp)
movq 0x8ed4(%rip), %rdi      # 0xd7b8
movl -0x4(%rbp), %esi
leaq -0x60(%rbp), %rcx
movl $0x1, %edx
callq 0x3090
movl %eax, -0xa4(%rbp)
movq 0x8eb6(%rip), %rdi      # 0xd7b8
movl -0x4(%rbp), %esi
leaq -0x80(%rbp), %rcx
movl $0x1, %edx
callq 0x3200
movl %eax, -0xa8(%rbp)
movq 0x8e98(%rip), %rdi      # 0xd7b8
movl -0x4(%rbp), %esi
xorl %edx, %edx
callq 0x32b0
movl %eax, -0xac(%rbp)
movq 0x8e69(%rip), %rdi      # 0xd7a0
movq 0x8e82(%rip), %rax      # 0xd7c0
movl (%rax), %edx
movq 0x8e71(%rip), %rax      # 0xd7b8
movl 0x20(%rax), %ecx
leaq -0x50(%rbp), %rax
xorl %esi, %esi
movl $0x4, %r8d
movl $0x20, %r9d
movl $0xe, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x35d0
movl %eax, -0xb0(%rbp)
callq 0x65d0
movl $0x0, -0xb4(%rbp)
cmpl $0x7f, -0xb4(%rbp)
jae 0x49b3
movl -0xb4(%rbp), %eax
movl %eax, %ecx
leaq 0x8eb6(%rip), %rax      # 0xd850
movq $0x0, (%rax,%rcx,8)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x4982
leaq 0x1d56(%rip), %rax      # 0x6710
movq %rax, 0x8e8f(%rip)      # 0xd850
leaq 0x1d68(%rip), %rax      # 0x6730
movq %rax, 0x8ea1(%rip)      # 0xd870
leaq 0x1f2a(%rip), %rax      # 0x6900
movq %rax, 0x8f7b(%rip)      # 0xd958
leaq 0x20ec(%rip), %rax      # 0x6ad0
movq %rax, 0x8f1d(%rip)      # 0xd908
leaq 0x234e(%rip), %rax      # 0x6d40
movq %rax, 0x8edf(%rip)      # 0xd8d8
leaq 0x23d0(%rip), %rax      # 0x6dd0
movq %rax, 0x8e81(%rip)      # 0xd888
leaq 0x23e2(%rip), %rax      # 0x6df0
movq %rax, 0x8e4b(%rip)      # 0xd860
leaq 0x24d4(%rip), %rax      # 0x6ef0
movq %rax, 0x8ec5(%rip)      # 0xd8e8
leaq 0x25c6(%rip), %rax      # 0x6ff0
movq %rax, 0x8ebf(%rip)      # 0xd8f0
leaq 0x2af8(%rip), %rax      # 0x7530
movq %rax, 0x8ef1(%rip)      # 0xd930
leaq 0x2b9a(%rip), %rax      # 0x75e0
movq %rax, 0x8e93(%rip)      # 0xd8e0
movq 0x8d4c(%rip), %rax      # 0xd7a0
movq %rax, -0x138(%rbp)
movq 0x8d3e(%rip), %rdi      # 0xd7a0
movq 0x8d57(%rip), %rax      # 0xd7c0
movl (%rax), %esi
callq 0x3220
movq -0x138(%rbp), %rdi
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x32e0
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
je 0x4f45
movq -0xc0(%rbp), %rdi
callq 0x33d0
movl %eax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x3280
movq %rax, -0xd0(%rbp)
movl 0x8d2c(%rip), %eax      # 0xd7f8
movl %eax, -0xd4(%rbp)
movl $0x0, -0xd8(%rbp)
movl -0xd8(%rbp), %eax
cmpl -0xc8(%rbp), %eax
jge 0x4f39
movq 0x8cc3(%rip), %rax      # 0xd7b8
movl 0x104(%rax), %eax
movl %eax, -0xdc(%rbp)
movq -0xd0(%rbp), %rax
movslq -0xd8(%rbp), %rcx
movl (%rax,%rcx,4), %edi
xorl %eax, %eax
movl %eax, %esi
leaq -0xdc(%rbp), %rdx
callq 0x7650
testb $0x1, %al
jne 0x4b28
jmp 0x4b2d
jmp 0x4f25
movq 0x8c6c(%rip), %rax      # 0xd7a0
movq %rax, -0x140(%rbp)
movq 0x8c5e(%rip), %rdi      # 0xd7a0
movq -0xd0(%rbp), %rax
movslq -0xd8(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x33e0
movq -0x140(%rbp), %rdi
movl %eax, -0xec(%rbp)
movl -0xec(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x3230
movq %rax, -0xe8(%rbp)
cmpq $0x0, -0xe8(%rbp)
jne 0x4b8a
jmp 0x4f25
movq -0xe8(%rbp), %rax
cmpb $0x0, 0x1b(%rax)
jne 0x4f19
movq -0xe8(%rbp), %rax
movzwl 0xc(%rax), %eax
cmpl $0x2, %eax
je 0x4f19
movl -0xd4(%rbp), %eax
movl %eax, -0xf0(%rbp)
movq 0x8bde(%rip), %rax      # 0xd7a0
movq %rax, -0x148(%rbp)
movq 0x8bd0(%rip), %rdi      # 0xd7a0
movq -0xd0(%rbp), %rax
movslq -0xd8(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x8bd0(%rip), %rax      # 0xd7b8
movl 0x84(%rax), %ecx
xorl %r9d, %r9d
movl $0x4, %r8d
movl %r9d, %esi
movl $0x1, (%rsp)
callq 0x31e0
movq -0x148(%rbp), %rdi
movl %eax, -0xfc(%rbp)
movl -0xfc(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x3500
movq %rax, -0xf8(%rbp)
cmpq $0x0, -0xf8(%rbp)
je 0x4c80
movq -0xf8(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x20, %eax
jne 0x4c74
movl $0x0, -0x100(%rbp)
movl -0x100(%rbp), %eax
movq -0xf8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x4c72
jmp 0x4c61
movl -0x100(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x100(%rbp)
jmp 0x4c4d
jmp 0x4c74
movq -0xf8(%rbp), %rdi
callq 0x3050
movb $0x0, -0x101(%rbp)
movq 0x8b2a(%rip), %rax      # 0xd7b8
movq %rax, -0x150(%rbp)
movq 0x8b1c(%rip), %rdi      # 0xd7b8
movq -0xd0(%rbp), %rax
movslq -0xd8(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x35b0
movq -0x150(%rbp), %rdi
movl %eax, -0x108(%rbp)
movl -0x108(%rbp), %esi
leaq -0xf0(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x7810
cmpb $0x0, %al
jne 0x4d22
movq -0xe8(%rbp), %rax
movzbl 0x1a(%rax), %eax
cmpl $0x0, %eax
jne 0x4cee
jmp 0x4f25
movq 0x8ac3(%rip), %rdi      # 0xd7b8
movq -0xd0(%rbp), %rax
movslq -0xd8(%rbp), %rcx
movl (%rax,%rcx,4), %esi
movl -0xd4(%rbp), %edx
movl %edx, -0xf0(%rbp)
callq 0x3650
movl %eax, -0x10c(%rbp)
jmp 0x4ddd
cmpl $0x9, -0xf0(%rbp)
jle 0x4d5d
movq 0x8a86(%rip), %rdi      # 0xd7b8
movq -0xd0(%rbp), %rax
movslq -0xd8(%rbp), %rcx
movl (%rax,%rcx,4), %esi
movl $0x9, -0xf0(%rbp)
movl $0x9, %edx
callq 0x3650
movl %eax, -0x110(%rbp)
movl -0xf0(%rbp), %eax
cmpl -0xd4(%rbp), %eax
jne 0x4dc0
movq -0xe8(%rbp), %rax
movzbl 0x1a(%rax), %eax
cmpl $0x0, %eax
jne 0x4dbc
movl -0xdc(%rbp), %eax
movq 0x8a30(%rip), %rcx      # 0xd7b8
cmpl 0x104(%rcx), %eax
jne 0x4db5
movq 0x8a09(%rip), %rdi      # 0xd7a0
movq -0xd0(%rbp), %rax
movslq -0xd8(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x34c0
movl %eax, -0x114(%rbp)
jmp 0x4dba
jmp 0x4f25
jmp 0x4dbe
jmp 0x4dbe
jmp 0x4ddb
movq -0xe8(%rbp), %rax
movzbl 0x1a(%rax), %eax
cmpl $0x0, %eax
jne 0x4dd2
jmp 0x4dd9
movb $0x1, -0x101(%rbp)
jmp 0x4ddb
jmp 0x4ddd
movq 0x89bc(%rip), %rdi      # 0xd7a0
movq -0xd0(%rbp), %rax
movslq -0xd8(%rbp), %rcx
movl (%rax,%rcx,4), %esi
movq 0x89bc(%rip), %rax      # 0xd7b8
movl 0x84(%rax), %edx
movq 0x89af(%rip), %rax      # 0xd7b8
movl 0x128(%rax), %ecx
callq 0x3800
movq 0x8985(%rip), %rdi      # 0xd7a0
movq -0xd0(%rbp), %rax
movslq -0xd8(%rbp), %rcx
movl (%rax,%rcx,4), %esi
movq 0x8985(%rip), %rax      # 0xd7b8
movl 0x84(%rax), %edx
movq 0x8978(%rip), %rax      # 0xd7b8
movl 0x124(%rax), %ecx
callq 0x3800
movl -0xd4(%rbp), %eax
cmpl -0xf0(%rbp), %eax
je 0x4e64
movl -0xf0(%rbp), %edi
callq 0x5570
movq -0xd0(%rbp), %rax
movslq -0xd8(%rbp), %rcx
movl (%rax,%rcx,4), %edi
movl -0xdc(%rbp), %esi
callq 0x7850
movq %rax, -0x120(%rbp)
testb $0x1, -0x101(%rbp)
je 0x4ec1
movq 0x8909(%rip), %rdi      # 0xd7a0
movq -0x120(%rbp), %rax
movl 0x20(%rax), %esi
movq 0x8930(%rip), %rax      # 0xd7d8
imull $0xfffffffe, 0x34(%rax), %edx # imm = 0xFFFFFFFE
movq -0x120(%rbp), %r8
addq $0x30, %r8
xorl %ecx, %ecx
callq 0x5410
movq -0x120(%rbp), %rdi
callq 0x78c0
movl -0xd4(%rbp), %eax
cmpl -0xf0(%rbp), %eax
je 0x4f17
movq 0x88be(%rip), %rdi      # 0xd7a0
movq -0x120(%rbp), %rax
movl 0x20(%rax), %esi
movq 0x88e5(%rip), %rax      # 0xd7d8
imull $0xfffffffe, 0x34(%rax), %edx # imm = 0xFFFFFFFE
movq -0x120(%rbp), %r8
addq $0x30, %r8
xorl %ecx, %ecx
callq 0x5410
movl -0xd4(%rbp), %edi
callq 0x5570
jmp 0x4f19
movq -0xe8(%rbp), %rdi
callq 0x3050
movl -0xd8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0x4adc
movq -0xc0(%rbp), %rdi
callq 0x3050
movl $0x0, -0x128(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x79a0
movl $0x0, -0x130(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x7ba0
xorl %eax, %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nopl (%rax)