// File: /workspace/github_c_makefile_star2_O0/kek[P]evilwm/events.c
// Function: handle_client_message
static void handle_client_message(XClientMessageEvent *e) {
#ifdef VWM
	ScreenInfo *s = find_current_screen();
#endif
	Client *c;

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

#ifdef VWM
	if (e->message_type == xa_net_current_desktop) {
		switch_vdesk(s, e->data.l[0]);
		LOG_LEAVE();
		return;
	}
#endif
	c = find_client(e->window);
	if (!c && e->message_type == xa_net_request_frame_extents) {
		ewmh_set_net_frame_extents(e->window);
		LOG_LEAVE();
		return;
	}
	if (!c) {
		LOG_LEAVE();
		return;
	}
	if (e->message_type == xa_net_active_window) {
		/* Only do this if it came from direct user action */
		if (e->data.l[0] == 2) {
#ifdef VWM
			if (c->screen == s)
#endif
				select_client(c);
		}
		LOG_LEAVE();
		return;
	}
	if (e->message_type == xa_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 == xa_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 == xa_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;
	}
#ifdef VWM
	if (e->message_type == xa_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;
	}
#endif
	if (e->message_type == xa_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] == xa_net_wm_state_maximized_vert) {
				maximise_hv |= MAXIMISE_VERT;
			} else if ((Atom)e->data.l[i] == xa_net_wm_state_maximized_horz) {
				maximise_hv |= MAXIMISE_HORZ;
			} else if ((Atom)e->data.l[i] == xa_net_wm_state_fullscreen) {
				maximise_hv |= MAXIMISE_VERT|MAXIMISE_HORZ;
			}
		}
		if (maximise_hv) {
			maximise_client(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 0xa6b0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0xa511(%rip), %rcx      # 0xf838
cmpq (%rcx), %rax
jne 0x5344
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl %eax, %esi
callq 0xa480
jmp 0x55e6
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x3880
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x5382
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0xa505(%rip), %rcx      # 0xf870
cmpq (%rcx), %rax
jne 0x5382
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x6ba0
jmp 0x55e6
cmpq $0x0, -0x18(%rbp)
jne 0x538e
jmp 0x55e6
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0xa4a3(%rip), %rcx      # 0xf840
cmpq (%rcx), %rax
jne 0x53cb
movq -0x8(%rbp), %rax
cmpq $0x2, 0x38(%rax)
jne 0x53c6
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x53c4
movq -0x18(%rbp), %rdi
callq 0x3d30
jmp 0x53c6
jmp 0x55e6
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0xa47e(%rip), %rcx      # 0xf858
cmpq (%rcx), %rax
jne 0x53fa
movq -0x8(%rbp), %rax
cmpq $0x2, 0x40(%rax)
jne 0x53f5
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x40a0
jmp 0x55e6
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0xa457(%rip), %rcx      # 0xf860
cmpq (%rcx), %rax
jne 0x5493
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
sarq $0xc, %rax
andq $0x3, %rax
movl %eax, -0x1c(%rbp)
cmpl $0x2, -0x1c(%rbp)
jne 0x548e
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
sarq $0x8, %rax
andq $0xf, %rax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
andq $0xff, %rax
movl %eax, -0x24(%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 -0x20(%rbp), %edi
movq -0x18(%rbp), %rdx
movl -0x24(%rbp), %ecx
leaq -0x50(%rbp), %rsi
callq 0x5630
jmp 0x55e6
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0xa3c6(%rip), %rcx      # 0xf868
cmpq (%rcx), %rax
jne 0x54e7
movq -0x8(%rbp), %rax
cmpq $0x2, 0x38(%rax)
jne 0x54e2
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 0x6c(%rax), %ecx
movl $0x60, %edi
leaq -0x78(%rbp), %rsi
callq 0x5630
jmp 0x55e6
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0xa38a(%rip), %rcx      # 0xf880
cmpq (%rcx), %rax
jne 0x551e
movq -0x8(%rbp), %rax
cmpq $0x2, 0x40(%rax)
jne 0x5519
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl %eax, %esi
callq 0x3e20
jmp 0x55e6
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
leaq 0xa373(%rip), %rcx      # 0xf8a0
cmpq (%rcx), %rax
jne 0x55e6
movl $0x0, -0x80(%rbp)
movl $0x1, -0x7c(%rbp)
cmpl $0x2, -0x7c(%rbp)
jg 0x55c8
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq 0x38(%rax,%rcx,8), %rax
leaq 0xa34a(%rip), %rcx      # 0xf8a8
cmpq (%rcx), %rax
jne 0x556e
movl -0x80(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x80(%rbp)
jmp 0x55b8
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq 0x38(%rax,%rcx,8), %rax
leaq 0xa32e(%rip), %rcx      # 0xf8b0
cmpq (%rcx), %rax
jne 0x5592
movl -0x80(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x55b6
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq 0x38(%rax,%rcx,8), %rax
leaq 0xa312(%rip), %rcx      # 0xf8b8
cmpq (%rcx), %rax
jne 0x55b4
movl -0x80(%rbp), %eax
orl $0x3, %eax
movl %eax, -0x80(%rbp)
jmp 0x55b6
jmp 0x55b8
jmp 0x55ba
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x5544
cmpl $0x0, -0x80(%rbp)
je 0x55e4
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl %eax, %esi
movl -0x80(%rbp), %edx
callq 0xa050
jmp 0x55e6
addq $0x80, %rsp
popq %rbp
retq
nop