// File: /workspace/github_c_makefile_star2_O0/mchackorg[P]mcwm/mcwm.c
// Function: maximize
void maximize(struct client *client)
{
    uint32_t values[4];
    uint32_t mask = 0;
    int16_t mon_x;
    int16_t mon_y;
    uint16_t mon_width;
    uint16_t mon_height;

    if (NULL == client)
    {
        PDEBUG("maximize: client was NULL!\n");
        return;
    }

    if (NULL == client->monitor)
    {
        mon_x = 0;
        mon_y = 0;
        mon_width = screen->width_in_pixels;
        mon_height = screen->height_in_pixels;
    }
    else
    {
        mon_x = client->monitor->x;
        mon_y = client->monitor->y;
        mon_width = client->monitor->width;
        mon_height = client->monitor->height;
    }

    /*
     * Check if maximized already. If so, revert to stored
     * geometry.
     */
    if (client->maxed)
    {
        unmax(client);
        client->maxed = false;
        return;
    }

    /* Raise first. Pretty silly to maximize below something else. */
    raisewindow(client->id);

    /* FIXME: Store original geom in property as well? */
    client->origsize.x = client->x;
    client->origsize.y = client->y;
    client->origsize.width = client->width;
    client->origsize.height = client->height;

    /* Remove borders. */
    values[0] = 0;
    mask = XCB_CONFIG_WINDOW_BORDER_WIDTH;
    xcb_configure_window(conn, client->id, mask, values);

    /* Move to top left and resize. */
    client->x = mon_x;
    client->y = mon_y;
    client->width = mon_width;
    client->height = mon_height;

    values[0] = client->x;
    values[1] = client->y;
    values[2] = client->width;
    values[3] = client->height;
    xcb_configure_window(conn, client->id, XCB_CONFIG_WINDOW_X
                         | XCB_CONFIG_WINDOW_Y
                         | XCB_CONFIG_WINDOW_WIDTH
                         | XCB_CONFIG_WINDOW_HEIGHT, values);

    xcb_flush(conn);

    client->maxed = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0x24(%rbp)
xorl %eax, %eax
cmpq -0x8(%rbp), %rax
jne 0x74f0
jmp 0x768e
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq 0x38(%rcx), %rax
jne 0x7528
movw $0x0, -0x26(%rbp)
movw $0x0, -0x28(%rbp)
movq 0x4f89(%rip), %rax      # 0xc498
movw 0x14(%rax), %ax
movw %ax, -0x2a(%rbp)
movq 0x4f7a(%rip), %rax      # 0xc498
movw 0x16(%rax), %ax
movw %ax, -0x2c(%rbp)
jmp 0x7568
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movw 0x10(%rax), %ax
movw %ax, -0x26(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movw 0x12(%rax), %ax
movw %ax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movw 0x14(%rax), %ax
movw %ax, -0x2a(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movw 0x16(%rax), %ax
movw %ax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
testb $0x1, 0x31(%rax)
je 0x7588
movq -0x8(%rbp), %rdi
callq 0x7f80
movq -0x8(%rbp), %rax
movb $0x0, 0x31(%rax)
jmp 0x768e
movq -0x8(%rbp), %rax
movl (%rax), %edi
callq 0x5460
movq -0x8(%rbp), %rax
movw 0x6(%rax), %cx
movq -0x8(%rbp), %rax
movw %cx, 0xe(%rax)
movq -0x8(%rbp), %rax
movw 0x8(%rax), %cx
movq -0x8(%rbp), %rax
movw %cx, 0x10(%rax)
movq -0x8(%rbp), %rax
movw 0xa(%rax), %cx
movq -0x8(%rbp), %rax
movw %cx, 0x12(%rax)
movq -0x8(%rbp), %rax
movw 0xc(%rax), %cx
movq -0x8(%rbp), %rax
movw %cx, 0x14(%rax)
movl $0x0, -0x20(%rbp)
movl $0x10, -0x24(%rbp)
movq 0x4ea8(%rip), %rdi      # 0xc490
movq -0x8(%rbp), %rax
movl (%rax), %esi
movl -0x24(%rbp), %eax
leaq -0x20(%rbp), %rcx
movzwl %ax, %edx
callq 0x2200
movl %eax, -0x30(%rbp)
movw -0x26(%rbp), %cx
movq -0x8(%rbp), %rax
movw %cx, 0x6(%rax)
movw -0x28(%rbp), %cx
movq -0x8(%rbp), %rax
movw %cx, 0x8(%rax)
movw -0x2a(%rbp), %cx
movq -0x8(%rbp), %rax
movw %cx, 0xa(%rax)
movw -0x2c(%rbp), %cx
movq -0x8(%rbp), %rax
movw %cx, 0xc(%rax)
movq -0x8(%rbp), %rax
movswl 0x6(%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movswl 0x8(%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movzwl 0xa(%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movzwl 0xc(%rax), %eax
movl %eax, -0x14(%rbp)
movq 0x4e2d(%rip), %rdi      # 0xc490
movq -0x8(%rbp), %rax
movl (%rax), %esi
leaq -0x20(%rbp), %rcx
movl $0xf, %edx
callq 0x2200
movl %eax, -0x34(%rbp)
movq 0x4e0f(%rip), %rdi      # 0xc490
callq 0x2140
movq -0x8(%rbp), %rax
movb $0x1, 0x31(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)