// File: /workspace/github_c_makefile_star2_O0/tkln[P]mcwm/mcwm.c
// Function: maxvert
int maxvert(struct client *client, const union cb_arg arg)
{
    (void) arg;
    uint32_t values[2];
    int16_t mon_y;
    uint16_t mon_height;
    
    if (NULL == client)
    {
        PDEBUG("maxvert: client was NULL\n");
        return 0;
    }

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

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

    /* Raise first. Pretty silly to maximize below something else. */
    raisewindow(client->id);
    
    /*
     * Store original coordinates and geometry.
     * FIXME: Store in property as well?
     */
    client->origsize.x = client->x;
    client->origsize.y = client->y;
    client->origsize.width = client->width;
    client->origsize.height = client->height;

    client->y = mon_y;
    /* Compute new height considering height increments and screen height. */
    client->height = mon_height - conf.borderwidth * 2;
    client->height -= (client->height - client->base_height)
        % client->height_inc;

    /* Move to top of screen and resize. */
    values[0] = client->y;
    values[1] = client->height;
    
    xcb_configure_window(conn, client->id, XCB_CONFIG_WINDOW_Y
                         | XCB_CONFIG_WINDOW_HEIGHT, values);
    xcb_flush(conn);

    /* Remember that this client is vertically maximized. */
    client->vertmaxed = true;    
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rsi, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
xorl %eax, %eax
cmpq -0x18(%rbp), %rax
jne 0x3a34
movl $0x0, -0x4(%rbp)
jmp 0x3b82
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq 0x38(%rcx), %rax
jne 0x3a57
movw $0x0, -0x22(%rbp)
movq 0x9efb(%rip), %rax      # 0xd948
movw 0x16(%rax), %ax
movw %ax, -0x24(%rbp)
jmp 0x3a77
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movw 0x12(%rax), %ax
movw %ax, -0x22(%rbp)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movw 0x16(%rax), %ax
movw %ax, -0x24(%rbp)
movq -0x18(%rbp), %rax
testb $0x1, 0x30(%rax)
je 0x3a9e
movq -0x18(%rbp), %rdi
callq 0x7760
movq -0x18(%rbp), %rax
movb $0x0, 0x30(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x3b82
movq -0x18(%rbp), %rax
movl (%rax), %edi
callq 0x6f50
movq -0x18(%rbp), %rax
movw 0x6(%rax), %cx
movq -0x18(%rbp), %rax
movw %cx, 0xe(%rax)
movq -0x18(%rbp), %rax
movw 0x8(%rax), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x10(%rax)
movq -0x18(%rbp), %rax
movw 0xa(%rax), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x12(%rax)
movq -0x18(%rbp), %rax
movw 0xc(%rax), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x14(%rax)
movw -0x22(%rbp), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x8(%rax)
movzwl -0x24(%rbp), %eax
movl 0x9e51(%rip), %ecx      # 0xd950
shll %ecx
subl %ecx, %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0xc(%rax)
movq -0x18(%rbp), %rax
movzwl 0xc(%rax), %eax
movq -0x18(%rbp), %rcx
subl 0x2c(%rcx), %eax
movq -0x18(%rbp), %rcx
cltd
idivl 0x24(%rcx)
movq -0x18(%rbp), %rax
movzwl 0xc(%rax), %ecx
subl %edx, %ecx
movw %cx, 0xc(%rax)
movq -0x18(%rbp), %rax
movswl 0x8(%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movzwl 0xc(%rax), %eax
movl %eax, -0x1c(%rbp)
movq 0x9e28(%rip), %rdi      # 0xd978
movq -0x18(%rbp), %rax
movl (%rax), %esi
leaq -0x20(%rbp), %rcx
movl $0xa, %edx
callq 0x3200
movl %eax, -0x28(%rbp)
movq 0x9e0a(%rip), %rdi      # 0xd978
callq 0x3140
movq -0x18(%rbp), %rax
movb $0x1, 0x30(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)