// File: /workspace/github_c_makefile_star2_O0/mati75[P]evilwm/events.c
// Function: handle_client_message
static void handle_client_message(XClientMessageEvent *e) {
	struct screen *s = find_current_screen();
	struct client *c;

	LOG_ENTER("handle_client_message(window=%lx, format=%d, type=%s)", (unsigned long)e->window, e->format, debug_atom_name(e->message_type));

	if (e->message_type == X_ATOM(_NET_CURRENT_DESKTOP)) {
		switch_vdesk(s, e->data.l[0]);
		LOG_LEAVE();
		return;
	}

	c = find_client(e->window);
	if (!c) {

		// _NET_REQUEST_FRAME_EXTENTS is intended to be sent from
		// unmapped windows.  The reply only needs to be an _estimate_
		// of the border widths, but calculate it anyway - the only
		// thing that affects this for us is MWM hints.

		if (e->message_type == X_ATOM(_NET_REQUEST_FRAME_EXTENTS)) {
			int bw = window_normal_border(e->window);
			ewmh_set_net_frame_extents(e->window, bw);
		}

		LOG_LEAVE();
		return;
	}

	if (e->message_type == X_ATOM(_NET_ACTIVE_WINDOW)) {
		// Only do this if it came from direct user action
		if (e->data.l[0] == 2) {
			if (c->screen == s)
				select_client(c);
		}
		LOG_LEAVE();
		return;
	}

	if (e->message_type == X_ATOM(_NET_CLOSE_WINDOW)) {
		// Only do this if it came from direct user action
		if (e->data.l[1] == 2) {
			send_wm_delete(c, 0);
		}
		LOG_LEAVE();
		return;
	}

	if (e->message_type == X_ATOM(_NET_MOVERESIZE_WINDOW)) {
		// Only do this if it came from direct user action
		int source_indication = (e->data.l[0] >> 12) & 3;
		if (source_indication == 2) {
			int value_mask = (e->data.l[0] >> 8) & 0x0f;
			int gravity = e->data.l[0] & 0xff;
			XWindowChanges wc;

			wc.x = e->data.l[1];
			wc.y = e->data.l[2];
			wc.width = e->data.l[3];
			wc.height = e->data.l[4];
			do_window_changes(value_mask, &wc, c, gravity);
		}
		LOG_LEAVE();
		return;
	}

	if (e->message_type == X_ATOM(_NET_RESTACK_WINDOW)) {
		// Only do this if it came from direct user action
		if (e->data.l[0] == 2) {
			XWindowChanges wc;

			wc.sibling = e->data.l[1];
			wc.stack_mode = e->data.l[2];
			do_window_changes(CWSibling | CWStackMode, &wc, c, c->win_gravity);
		}
		LOG_LEAVE();
		return;
	}

	if (e->message_type == X_ATOM(_NET_WM_DESKTOP)) {
		// Only do this if it came from direct user action
		if (e->data.l[1] == 2) {
			client_to_vdesk(c, e->data.l[0]);
		}
		LOG_LEAVE();
		return;
	}

	if (e->message_type == X_ATOM(_NET_WM_STATE)) {
		int i, maximise_hv = 0;
		// Message can contain up to two state changes:
		for (i = 1; i <= 2; i++) {
			if ((Atom)e->data.l[i] == X_ATOM(_NET_WM_STATE_MAXIMIZED_VERT)) {
				maximise_hv |= MAXIMISE_VERT;
			} else if ((Atom)e->data.l[i] == X_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ)) {
				maximise_hv |= MAXIMISE_HORZ;
			} else if ((Atom)e->data.l[i] == X_ATOM(_NET_WM_STATE_FULLSCREEN)) {
				maximise_hv |= MAXIMISE_VERT|MAXIMISE_HORZ;
			}
		}
		if (maximise_hv) {
			client_maximise(c, e->data.l[0], maximise_hv);
		}
		LOG_LEAVE();
		return;
	}

	LOG_LEAVE();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
callq 0xca90
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0x9879(%rip), %rcx      # 0x12d80
cmpq 0x70(%rcx), %rax
jne 0x9525
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl %eax, %esi
callq 0xc590
jmp 0x97fb
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x5820
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x957b
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0x9834(%rip), %rcx      # 0x12d80
cmpq 0xa8(%rcx), %rax
jne 0x9576
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xcdb0
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movslq -0x1c(%rbp), %rsi
callq 0xa4f0
jmp 0x97fb
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0x97f6(%rip), %rcx      # 0x12d80
cmpq 0x78(%rcx), %rax
jne 0x95b9
movq -0x8(%rbp), %rax
cmpq $0x2, 0x38(%rax)
jne 0x95b4
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x95b2
movq -0x18(%rbp), %rdi
callq 0x5f40
jmp 0x95b4
jmp 0x97fb
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0x97b8(%rip), %rcx      # 0x12d80
cmpq 0x90(%rcx), %rax
jne 0x95ec
movq -0x8(%rbp), %rax
cmpq $0x2, 0x40(%rax)
jne 0x95e7
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x62d0
jmp 0x97fb
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0x9785(%rip), %rcx      # 0x12d80
cmpq 0x98(%rcx), %rax
jne 0x9689
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
sarq $0xc, %rax
andq $0x3, %rax
movl %eax, -0x20(%rbp)
cmpl $0x2, -0x20(%rbp)
jne 0x9684
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
sarq $0x8, %rax
andq $0xf, %rax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
andq $0xff, %rax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl %eax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movl %eax, -0x4c(%rbp)
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl %eax, -0x44(%rbp)
movl -0x24(%rbp), %edi
movq -0x18(%rbp), %rdx
movl -0x28(%rbp), %ecx
leaq -0x50(%rbp), %rsi
callq 0x98a0
jmp 0x97fb
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0x96e8(%rip), %rcx      # 0x12d80
cmpq 0xa0(%rcx), %rax
jne 0x96e4
movq -0x8(%rbp), %rax
cmpq $0x2, 0x38(%rax)
jne 0x96df
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movl %eax, -0x58(%rbp)
movq -0x18(%rbp), %rdx
movq -0x18(%rbp), %rax
movl 0x90(%rax), %ecx
movl $0x60, %edi
leaq -0x78(%rbp), %rsi
callq 0x98a0
jmp 0x97fb
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0x968d(%rip), %rcx      # 0x12d80
cmpq 0xb8(%rcx), %rax
jne 0x971f
movq -0x8(%rbp), %rax
cmpq $0x2, 0x40(%rax)
jne 0x971a
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl %eax, %esi
callq 0x6040
jmp 0x97fb
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0x9652(%rip), %rcx      # 0x12d80
cmpq 0xe0(%rcx), %rax
jne 0x97fb
movl $0x0, -0x80(%rbp)
movl $0x1, -0x7c(%rbp)
cmpl $0x2, -0x7c(%rbp)
jg 0x97dd
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq 0x38(%rax,%rcx,8), %rax
leaq 0x9619(%rip), %rcx      # 0x12d80
cmpq 0xe8(%rcx), %rax
jne 0x977b
movl -0x80(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x80(%rbp)
jmp 0x97cd
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq 0x38(%rax,%rcx,8), %rax
leaq 0x95f1(%rip), %rcx      # 0x12d80
cmpq 0xf0(%rcx), %rax
jne 0x97a3
movl -0x80(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x97cb
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq 0x38(%rax,%rcx,8), %rax
leaq 0x95c9(%rip), %rcx      # 0x12d80
cmpq 0x100(%rcx), %rax
jne 0x97c9
movl -0x80(%rbp), %eax
orl $0x3, %eax
movl %eax, -0x80(%rbp)
jmp 0x97cb
jmp 0x97cd
jmp 0x97cf
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x9749
cmpl $0x0, -0x80(%rbp)
je 0x97f9
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl %eax, %esi
movl -0x80(%rbp), %edx
callq 0x7950
jmp 0x97fb
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)