// File: /workspace/github_c_makefile_star2_O0/tudurom[P]windowchef/wm.c
// Function: handle_wm_state
static void
handle_wm_state(struct client *client, xcb_atom_t state, unsigned int action)
{
	int16_t mon_x, mon_y;
	uint16_t mon_w, mon_h;

	get_monitor_size(client, &mon_x, &mon_y, &mon_w, &mon_h);

	if (state == ewmh->_NET_WM_STATE_FULLSCREEN) {
		if (action == XCB_EWMH_WM_STATE_ADD) {
			maximize_window(client, mon_x, mon_y, mon_w, mon_h);
		} else if (action == XCB_EWMH_WM_STATE_REMOVE && client->maxed) {
			reset_window(client);
			set_focused(client);
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
			if (client->maxed) {
				reset_window(client);
				set_focused(client);
			} else {
				maximize_window(client, mon_x, mon_y, mon_w, mon_h);
			}
		}
	} else if (state == ewmh->_NET_WM_STATE_MAXIMIZED_VERT) {
		if (action == XCB_EWMH_WM_STATE_ADD) {
			vmaximize_window(client, mon_y, mon_h);
		} else if (action == XCB_EWMH_WM_STATE_REMOVE) {
			if (client->vmaxed)
				reset_window(client);
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
			if (client->vmaxed)
				reset_window(client);
			else
				vmaximize_window(client, mon_y, mon_h);
		}
	} else if (state == ewmh->_NET_WM_STATE_MAXIMIZED_HORZ) {
		if (action == XCB_EWMH_WM_STATE_ADD) {
			hmaximize_window(client, mon_y, mon_h);
		} else if (action == XCB_EWMH_WM_STATE_REMOVE) {
			if (client->hmaxed)
				reset_window(client);
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
			if (client->hmaxed)
				reset_window(client);
			else
				hmaximize_window(client, mon_x, mon_w);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x12(%rbp), %rsi
leaq -0x14(%rbp), %rdx
leaq -0x16(%rbp), %rcx
leaq -0x18(%rbp), %r8
callq 0x5550
movl -0xc(%rbp), %eax
movq 0x802b(%rip), %rcx      # 0xf3e0
cmpl 0x128(%rcx), %eax
jne 0x7462
cmpl $0x1, -0x10(%rbp)
jne 0x73ec
movq -0x8(%rbp), %rdi
movw -0x12(%rbp), %dx
movw -0x14(%rbp), %cx
movw -0x16(%rbp), %ax
movswl %dx, %esi
movswl %cx, %edx
movzwl %ax, %ecx
movzwl -0x18(%rbp), %r8d
callq 0x5640
jmp 0x745d
cmpl $0x0, -0x10(%rbp)
jne 0x7410
movq -0x8(%rbp), %rax
testb $0x1, 0x24(%rax)
je 0x7410
movq -0x8(%rbp), %rdi
callq 0x57f0
movq -0x8(%rbp), %rdi
callq 0x6a10
jmp 0x745b
cmpl $0x2, -0x10(%rbp)
jne 0x7459
movq -0x8(%rbp), %rax
testb $0x1, 0x24(%rax)
je 0x7434
movq -0x8(%rbp), %rdi
callq 0x57f0
movq -0x8(%rbp), %rdi
callq 0x6a10
jmp 0x7457
movq -0x8(%rbp), %rdi
movw -0x12(%rbp), %dx
movw -0x14(%rbp), %cx
movw -0x16(%rbp), %ax
movswl %dx, %esi
movswl %cx, %edx
movzwl %ax, %ecx
movzwl -0x18(%rbp), %r8d
callq 0x5640
jmp 0x7459
jmp 0x745b
jmp 0x745d
jmp 0x7569
movl -0xc(%rbp), %eax
movq 0x7f74(%rip), %rcx      # 0xf3e0
cmpl 0x110(%rcx), %eax
jne 0x74e5
cmpl $0x1, -0x10(%rbp)
jne 0x7490
movq -0x8(%rbp), %rdi
movw -0x14(%rbp), %ax
movswl %ax, %esi
movzwl -0x18(%rbp), %edx
callq 0x7570
jmp 0x74e0
cmpl $0x0, -0x10(%rbp)
jne 0x74ab
movq -0x8(%rbp), %rax
testb $0x1, 0x26(%rax)
je 0x74a9
movq -0x8(%rbp), %rdi
callq 0x57f0
jmp 0x74de
cmpl $0x2, -0x10(%rbp)
jne 0x74dc
movq -0x8(%rbp), %rax
testb $0x1, 0x26(%rax)
je 0x74c6
movq -0x8(%rbp), %rdi
callq 0x57f0
jmp 0x74da
movq -0x8(%rbp), %rdi
movw -0x14(%rbp), %ax
movswl %ax, %esi
movzwl -0x18(%rbp), %edx
callq 0x7570
jmp 0x74dc
jmp 0x74de
jmp 0x74e0
jmp 0x7567
movl -0xc(%rbp), %eax
movq 0x7ef1(%rip), %rcx      # 0xf3e0
cmpl 0x114(%rcx), %eax
jne 0x7565
cmpl $0x1, -0x10(%rbp)
jne 0x7513
movq -0x8(%rbp), %rdi
movw -0x14(%rbp), %ax
movswl %ax, %esi
movzwl -0x18(%rbp), %edx
callq 0x7680
jmp 0x7563
cmpl $0x0, -0x10(%rbp)
jne 0x752e
movq -0x8(%rbp), %rax
testb $0x1, 0x25(%rax)
je 0x752c
movq -0x8(%rbp), %rdi
callq 0x57f0
jmp 0x7561
cmpl $0x2, -0x10(%rbp)
jne 0x755f
movq -0x8(%rbp), %rax
testb $0x1, 0x25(%rax)
je 0x7549
movq -0x8(%rbp), %rdi
callq 0x57f0
jmp 0x755d
movq -0x8(%rbp), %rdi
movw -0x12(%rbp), %ax
movswl %ax, %esi
movzwl -0x16(%rbp), %edx
callq 0x7680
jmp 0x755f
jmp 0x7561
jmp 0x7563
jmp 0x7565
jmp 0x7567
jmp 0x7569
addq $0x20, %rsp
popq %rbp
retq
nop