// File: /workspace/github_c_makefile_star2_O0/9wm[P]9wm/menu.c
// Function: button
void
button(XButtonEvent * e)
{
	int n, shift;
	Client *c;
	Window dw;
	ScreenInfo *s;

	curtime = e->time;
	s = getscreen(e->root);
	if (s == 0)
		return;
	c = getclient(e->window, 0);
	if (c) {
		e->x += c->x - BORDER + 1;
		e->y += c->y - BORDER + 1;
	} else if (e->window != e->root)
		XTranslateCoordinates(dpy, e->window, s->root, e->x, e->y, &e->x, &e->y, &dw);
	switch (e->button) {
	case Button1:
		if (c) {
			XMapRaised(dpy, c->parent);
			top(c);
			active(c);
		}
		return;
	case Button2:
		if ((e->state & (ShiftMask | ControlMask)) == (ShiftMask | ControlMask)) {
			menuhit(e, &egg);
		} else {
			spawn(s, "9wm-mm");
		}
		return;
	default:
		return;
	case Button3:
		break;
	}

	if (current && current->screen == s)
		cmapnofocus(s);
	switch (n = menuhit(e, &b3menu)) {
	case 0:		/* New */
		spawn(s, termprog);
		break;
	case 1:		/* Reshape */
		reshape(selectwin(1, 0, s));
		break;
	case 2:		/* Move */
		move(selectwin(0, 0, s));
		break;
	case 3:		/* Delete */
		shift = 0;
		c = selectwin(1, &shift, s);
		delete(c, shift);
		break;
	case 4:		/* Hide */
		hide(selectwin(1, 0, s));
		break;
	default:		/* unhide window */
		unhide(n - B3FIXED, 1);
		break;
	case -1:		/* nothing */
		break;
	}
	if (current && current->screen == s)
		cmapfocus(current);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movl %eax, %ecx
leaq 0x6a9b(%rip), %rax      # 0xc998
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
movb $0x0, %al
callq 0x3350
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x5f1e
jmp 0x61ba
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x6e90
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x5f76
movq -0x18(%rbp), %rax
movl 0x28(%rax), %ecx
leaq 0x63d8(%rip), %rax      # 0xc320
subl (%rax), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
addl 0x40(%rax), %ecx
movl %ecx, 0x40(%rax)
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %ecx
leaq 0x63bb(%rip), %rax      # 0xc320
subl (%rax), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
addl 0x44(%rax), %ecx
movl %ecx, 0x44(%rax)
jmp 0x5fd5
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x28(%rcx), %rax
je 0x5fd3
leaq 0x69e9(%rip), %rax      # 0xc978
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x8(%rbp), %rax
movl 0x40(%rax), %ecx
movq -0x8(%rbp), %rax
movl 0x44(%rax), %r8d
movq -0x8(%rbp), %r9
addq $0x40, %r9
movq -0x8(%rbp), %r10
addq $0x44, %r10
leaq -0x20(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x2070
jmp 0x5fd5
movq -0x8(%rbp), %rax
movl 0x54(%rax), %eax
movl %eax, -0x2c(%rbp)
subl $0x1, %eax
je 0x5ffa
jmp 0x5fe6
movl -0x2c(%rbp), %eax
subl $0x2, %eax
je 0x6033
jmp 0x5ff0
movl -0x2c(%rbp), %eax
subl $0x3, %eax
je 0x6070
jmp 0x606b
cmpq $0x0, -0x18(%rbp)
je 0x602e
leaq 0x6970(%rip), %rax      # 0xc978
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x2340
movq -0x18(%rbp), %rdi
movb $0x0, %al
callq 0x6df0
movq -0x18(%rbp), %rdi
movb $0x0, %al
callq 0x6b40
jmp 0x61ba
movq -0x8(%rbp), %rax
movl 0x50(%rax), %eax
andl $0x5, %eax
cmpl $0x5, %eax
jne 0x6056
movq -0x8(%rbp), %rdi
leaq 0x647b(%rip), %rsi      # 0xc4c8
movb $0x0, %al
callq 0x7410
jmp 0x6066
movq -0x28(%rbp), %rdi
leaq 0x3600(%rip), %rsi      # 0x9661
callq 0x61c0
jmp 0x61ba
jmp 0x61ba
jmp 0x6072
leaq 0x6ab7(%rip), %rax      # 0xcb30
cmpq $0x0, (%rax)
je 0x60a1
leaq 0x6aaa(%rip), %rax      # 0xcb30
movq (%rax), %rax
movq 0xf8(%rax), %rax
cmpq -0x28(%rbp), %rax
jne 0x60a1
movq -0x28(%rbp), %rdi
movb $0x0, %al
callq 0x5830
movq -0x8(%rbp), %rdi
leaq 0x6404(%rip), %rsi      # 0xc4b0
xorl %eax, %eax
callq 0x7410
movl %eax, -0xc(%rbp)
incl %eax
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0x5, %eax
ja 0x6171
movq -0x38(%rbp), %rax
leaq 0x355a(%rip), %rcx      # 0x962c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x28(%rbp), %rdi
leaq 0x687a(%rip), %rax      # 0xc960
movq (%rax), %rsi
callq 0x61c0
jmp 0x6185
movq -0x28(%rbp), %rdx
movl $0x1, %edi
xorl %esi, %esi
movb $0x0, %al
callq 0x7de0
movq %rax, %rdi
callq 0x62a0
jmp 0x6185
movq -0x28(%rbp), %rdx
xorl %esi, %esi
movl %esi, %edi
movb $0x0, %al
callq 0x7de0
movq %rax, %rdi
callq 0x63e0
jmp 0x6185
movl $0x0, -0x10(%rbp)
movq -0x28(%rbp), %rdx
movl $0x1, %edi
leaq -0x10(%rbp), %rsi
movb $0x0, %al
callq 0x7de0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x6480
jmp 0x6185
movq -0x28(%rbp), %rdx
movl $0x1, %edi
xorl %esi, %esi
movb $0x0, %al
callq 0x7de0
movq %rax, %rdi
callq 0x6500
jmp 0x6185
movl -0xc(%rbp), %edi
subl $0x5, %edi
movl $0x1, %esi
callq 0x6650
jmp 0x6185
jmp 0x6185
leaq 0x69a4(%rip), %rax      # 0xcb30
cmpq $0x0, (%rax)
je 0x61ba
leaq 0x6997(%rip), %rax      # 0xcb30
movq (%rax), %rax
movq 0xf8(%rax), %rax
cmpq -0x28(%rbp), %rax
jne 0x61ba
leaq 0x6980(%rip), %rax      # 0xcb30
movq (%rax), %rdi
movb $0x0, %al
callq 0x56b0
addq $0x50, %rsp
popq %rbp
retq