// File: /workspace/github_c_makefile_star2_O0/seanpringle[P]xoat/./menu.c
// Function: menu_create
void menu_create(int spot, int mon)
{
	short x, y, w, h;
	int i, n = 0; Client *c;
	char *name = NULL;

	Monitor *m = &monitors[menu->monitor];
	
	if (menu->mb)
		menu_close();

	x = m->spots[spot].x;
	y = m->spots[spot].y;
	w = m->spots[SPOT3].w/2;
	h = 10;

	Menubox *mb = menubox_create(root, MB_AUTOHEIGHT|MB_AUTOWIDTH|MB_MINWIDTH, x, y, w, h, 
		settings.border, settings.menu, settings.title_focus, settings.border_focus, settings.title_blur, settings.border_blur);
	
	menu->mb = mb;
	menu->spot = spot;
	menu->monitor = mon;

	for_windows(i,c) if (n < sizeof(menu->items)/sizeof(MenuMap) && c->manage && c->spot == spot && c->monitor == mon && (name = window_get_name(c->window)) && name)
	{
		menu->items[n].name = name;
		menu->items[n].window = c->window;
		n++;
	}

	qsort(menu->items, n, sizeof(MenuMap), menu_sort);

	for (i = 0; i < n; i++)
		menubox_add(mb, i, menu->items[i].name);

	x = (m->spots[spot].w - MIN(mb->w, m->spots[spot].w-100))/2;
	y = (m->spots[spot].h - MIN(mb->h, m->spots[spot].h-100))/2;

	x += m->spots[spot].x;
	y += m->spots[spot].y;

	menubox_moveresize(mb, x, y, w, h);

	menubox_show(mb);
	menubox_draw(mb);
	menubox_grab(mb);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movl %edi, -0x1c(%rbp)
movl %esi, -0x20(%rbp)
movl $0x0, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq 0xa367(%rip), %rax      # 0x14230
movswq 0x2(%rax), %rcx
leaq 0x9cdb(%rip), %rax      # 0x13bb0
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq 0xa349(%rip), %rax      # 0x14230
cmpq $0x0, 0x648(%rax)
je 0x9ef6
callq 0x9be0
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movw 0x8(%rax,%rcx,8), %ax
movw %ax, -0x22(%rbp)
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movw 0xa(%rax,%rcx,8), %ax
movw %ax, -0x24(%rbp)
movq -0x48(%rbp), %rax
movswl 0x24(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movw %ax, -0x26(%rbp)
movw $0xa, -0x28(%rbp)
movq 0xa25f(%rip), %rdi      # 0x14198
movw -0x22(%rbp), %dx
movw -0x24(%rbp), %cx
movw -0x26(%rbp), %r8w
movw -0x28(%rbp), %r9w
movl 0xa25f(%rip), %eax      # 0x141b0
movw %ax, %r15w
movq 0xa29c(%rip), %r14      # 0x141f8
movq 0xa285(%rip), %rbx      # 0x141e8
movq 0xa256(%rip), %r11      # 0x141c0
movq 0xa26f(%rip), %r10      # 0x141e0
movq 0xa240(%rip), %rax      # 0x141b8
movl $0xb, %esi
movswl %dx, %edx
movswl %cx, %ecx
movswl %r8w, %r8d
movswl %r9w, %r9d
movswl %r15w, %r15d
movl %r15d, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0x4ee0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
movq 0xa270(%rip), %rax      # 0x14230
movq %rcx, 0x648(%rax)
movl -0x1c(%rbp), %eax
movw %ax, %cx
movq 0xa25c(%rip), %rax      # 0x14230
movw %cx, (%rax)
movl -0x20(%rbp), %eax
movw %ax, %cx
movq 0xa24c(%rip), %rax      # 0x14230
movw %cx, 0x2(%rax)
callq 0x7380
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movswl 0x9d92(%rip), %ecx      # 0x13d90
cmpl %ecx, %eax
jge 0xa0e0
movslq -0x2c(%rbp), %rcx
leaq 0x9d7f(%rip), %rax      # 0x13d90
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0xa0d0
movslq -0x30(%rbp), %rax
cmpq $0x64, %rax
jae 0xa0ce
movq -0x38(%rbp), %rax
movswl 0x104(%rax), %eax
cmpl $0x0, %eax
je 0xa0ce
movq -0x38(%rbp), %rax
movq 0x118(%rax), %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
jne 0xa0ce
movq -0x38(%rbp), %rax
movswl 0x100(%rax), %eax
cmpl -0x20(%rbp), %eax
jne 0xa0ce
movq -0x38(%rbp), %rax
movq (%rax), %rdi
callq 0x7210
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0xa0ce
cmpq $0x0, -0x40(%rbp)
je 0xa0ce
movq -0x40(%rbp), %rcx
movq 0xa19e(%rip), %rax      # 0x14230
addq $0x8, %rax
movslq -0x30(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq 0xa17d(%rip), %rax      # 0x14230
addq $0x8, %rax
movslq -0x30(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xa0d0
jmp 0xa0d2
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x9ff4
movq 0xa149(%rip), %rdi      # 0x14230
addq $0x8, %rdi
movslq -0x30(%rbp), %rsi
movl $0x10, %edx
leaq -0x38b(%rip), %rcx      # 0x9d70
callq 0x3420
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0xa140
movq -0x50(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq 0xa113(%rip), %rax      # 0x14230
addq $0x8, %rax
movslq -0x2c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdx
callq 0x5430
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xa107
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movswl 0xc(%rax,%rcx,8), %eax
movl %eax, -0x54(%rbp)
movq -0x50(%rbp), %rax
movswl 0x1c(%rax), %eax
movq -0x48(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
movswl 0xc(%rcx,%rdx,8), %ecx
subl $0x64, %ecx
cmpl %ecx, %eax
jge 0xa179
movq -0x50(%rbp), %rax
movswl 0x1c(%rax), %eax
movl %eax, -0x58(%rbp)
jmp 0xa18c
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movswl 0xc(%rax,%rcx,8), %eax
subl $0x64, %eax
movl %eax, -0x58(%rbp)
movl -0x54(%rbp), %eax
movl -0x58(%rbp), %ecx
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movw %ax, -0x22(%rbp)
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movswl 0xe(%rax,%rcx,8), %eax
movl %eax, -0x5c(%rbp)
movq -0x50(%rbp), %rax
movswl 0x1e(%rax), %eax
movq -0x48(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
movswl 0xe(%rcx,%rdx,8), %ecx
subl $0x64, %ecx
cmpl %ecx, %eax
jge 0xa1d9
movq -0x50(%rbp), %rax
movswl 0x1e(%rax), %eax
movl %eax, -0x60(%rbp)
jmp 0xa1ec
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movswl 0xe(%rax,%rcx,8), %eax
subl $0x64, %eax
movl %eax, -0x60(%rbp)
movl -0x5c(%rbp), %eax
movl -0x60(%rbp), %ecx
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movw %ax, -0x24(%rbp)
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movswl 0x8(%rax,%rcx,8), %ecx
movswl -0x22(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x22(%rbp)
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movswl 0xa(%rax,%rcx,8), %ecx
movswl -0x24(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x24(%rbp)
movq -0x50(%rbp), %rdi
movw -0x22(%rbp), %dx
movw -0x24(%rbp), %cx
movw -0x26(%rbp), %ax
movswl %dx, %esi
movswl %cx, %edx
movswl %ax, %ecx
movswl -0x28(%rbp), %r8d
callq 0x5220
movq -0x50(%rbp), %rdi
callq 0x5860
movq -0x50(%rbp), %rdi
callq 0x56b0
movq -0x50(%rbp), %rdi
callq 0x5640
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopw (%rax,%rax)