// File: /workspace/github_c_makefile_star2_O3/seanpringle[P]xoat/./menubox.c
// Function: menubox_create
Menubox* menubox_create(Window parent, unsigned long flags, short x, short y, short w, short h, short padding, char *font, char *fg_focus, char *bg_focus, char *fg_blur, char *bg_blur)
{
	Menubox *mb = calloc(1, sizeof(Menubox));
	mb->boxes = (Textbox**) calloc(1, sizeof(Textbox));
	mb->ids = (int*) calloc(1, sizeof(int));
	mb->show = (int*) calloc(1, sizeof(int));

	mb->flags = flags;
	mb->parent = parent;
	mb->font = font;
	mb->fg_focus = fg_focus;
	mb->fg_blur = fg_blur;
	mb->bg_focus = bg_focus;
	mb->bg_blur = bg_blur;
	mb->padding = padding;
	mb->box_active = 0;

	mb->x = x; mb->y = y; mb->w = MAX(1, w); mb->h = MAX(1, h);

	XColor color; Colormap map = DefaultColormap(display, DefaultScreen(display));
	unsigned int cp = XAllocNamedColor(display, map, bg_blur, &color, &color) ? color.pixel: None;

	mb->window = XCreateSimpleWindow(display, mb->parent, mb->x, mb->y, mb->w, mb->h, 0, None, cp);

	// calc line height
	mb->input = textbox_create(mb->window, TB_AUTOHEIGHT|TB_EDITABLE, mb->padding, mb->padding, mb->w, 0, mb->font, mb->fg_blur, mb->bg_blur, "", "> ");
	mb->line_height = mb->input->h;

	// auto height/width modes get handled here
	menubox_moveresize(mb, mb->x, mb->y, mb->w, mb->h);

	return mb;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %r14d
movl %r8d, %ebx
movl %ecx, (%rsp)
movl %edx, %r12d
movq %rsi, 0x8(%rsp)
movq %rdi, %rbp
movq %rdi, 0x10(%rsp)
movswl 0x60(%rsp), %r13d
movl %r13d, 0x4(%rsp)
movl $0x1, %edi
movl $0x78, %esi
callq 0x3500
movq %rax, %r15
movl $0x1, %edi
movl $0x80, %esi
callq 0x3500
movq %rax, 0x58(%r15)
movl $0x1, %edi
movl $0x4, %esi
callq 0x3500
movq %rax, 0x60(%r15)
movl $0x1, %edi
movl $0x4, %esi
callq 0x3500
movq %rax, 0x68(%r15)
movq 0x8(%rsp), %rax
movq %rax, (%r15)
movq %rbp, 0x10(%r15)
movq 0x68(%rsp), %rax
movq %rax, 0x28(%r15)
movaps 0x70(%rsp), %xmm0
movups %xmm0, 0x30(%r15)
movq 0x80(%rsp), %rax
movq %rax, 0x40(%r15)
movq 0x88(%rsp), %rdx
movq %rdx, 0x48(%r15)
movw %r13w, 0x22(%r15)
movw %r12w, 0x18(%r15)
movl %r12d, %r13d
movl (%rsp), %r12d
movw %r12w, 0x1a(%r15)
cmpw $0x2, %bx
movl $0x1, %ebp
cmovll %ebp, %ebx
movw %bx, 0x1c(%r15)
cmpw $0x2, %r14w
cmovgel %r14d, %ebp
movw %bp, 0x1e(%r15)
movq 0x9db0(%rip), %rdi      # 0xebb0
movq 0xe8(%rdi), %rax
movslq 0xe0(%rdi), %rcx
shlq $0x7, %rcx
movq 0x50(%rax,%rcx), %rsi
leaq 0x18(%rsp), %r14
movq %r14, %rcx
movq %r14, %r8
callq 0x31a0
xorl %r10d, %r10d
testl %eax, %eax
movl (%r14), %eax
movq 0x9d7a(%rip), %rdi      # 0xebb0
cmovneq %rax, %r10
subq $0x8, %rsp
movq 0x18(%rsp), %rsi
movl %r13d, %edx
movl %r12d, %ecx
movl %ebx, %r8d
movl %ebp, %r9d
pushq %r10
pushq $0x0
pushq $0x0
callq 0x31e0
addq $0x20, %rsp
movq %rax, 0x8(%r15)
subq $0x8, %rsp
leaq 0x5542(%rip), %r10      # 0xa3af
leaq 0x5896(%rip), %r11      # 0xa70a
movl $0x80001, %esi          # imm = 0x80001
movq %rax, %rdi
movl 0xc(%rsp), %ecx
movl %ecx, %edx
movl %ebx, %r8d
xorl %r9d, %r9d
pushq %r10
pushq %r11
pushq 0xa0(%rsp)
pushq 0xa0(%rsp)
pushq 0x90(%rsp)
callq 0x41e6
addq $0x30, %rsp
movq %rax, 0x70(%r15)
movzwl 0x1e(%rax), %eax
movw %ax, 0x20(%r15)
movq %r15, %rdi
movl %r13d, %esi
movl %r12d, %edx
movl %ebx, %ecx
movl %ebp, %r8d
callq 0x4edc
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq