// File: /workspace/github_c_makefile_star2_O0/Cloudef[P]dwm-fork/dwm.c
// Function: createmenu
static int
createmenu( menu_t *m, const menuCtx *ctx, int x, int y ) {
   int valid = 0;
   size_t i, j;
   unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
   KeyCode code;

   if(ctxtomenu(ctx)) return(-1);

   m->x    = x;
   m->y    = y;
   m->w    = 0;
   m->h    = 0;
   m->ctx  = ctx;
   m->sel  = -1;
   m->child= NULL;

   for(i = 0; m->ctx[i].title; ++i)
   {
#ifdef XFT
      if(m->w < TEXTW2(m->ctx[i].title))
         m->w = TEXTW2(m->ctx[i].title);
#else
      if(m->w < TEXTW(m->ctx[i].title))
         m->w = TEXTW(m->ctx[i].title);
#endif

      if(strlen(m->ctx[i].title)) { m->h += dc.font.height; valid = 1; }
      else m->h += 4;
   }
   if(i == 0 || !valid) return(-1);

   XSetWindowAttributes wattr;
   wattr.override_redirect = True;
   wattr.background_pixmap = ParentRelative;
   wattr.event_mask = ButtonPressMask|ExposureMask;

   m->win = XCreateWindow(dpy, root, m->x, m->y, m->w, m->h, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWBackPixmap|CWOverrideRedirect|CWEventMask, &wattr);

   XSelectInput(dpy, m->win, PointerMotionMask|ButtonPressMask|KeyPressMask);

   XDefineCursor(dpy, m->win, cursor[CurNormal]);
   XMapRaised(dpy, m->win);

   m->drawable = XCreatePixmap(dpy, root, m->w, m->h, DefaultDepth(dpy, screen));
   updatemenu(m, m->x, m->y);

   if(selmon && selmon->sel)
   { grabbuttons(selmon->sel,False); XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); XSync(dpy,False); }

   /* keyboard input */
   updatenumlockmask();
   {
      XUngrabKey(dpy, AnyKey, AnyModifier, m->win);
      for(i = 0; i < LENGTH(menu_keys); i++) {
         if((code = XKeysymToKeycode(dpy, menu_keys[i].keysym)))
            for(j = 0; j < LENGTH(modifiers); j++)
               XGrabKey(dpy, code, menu_keys[i].mod | modifiers[j], m->win,
                     True, GrabModeAsync, GrabModeAsync);
      }
   }

   XSetInputFocus(dpy, m->win, RevertToPointerRoot, CurrentTime);

   return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x2, -0x4c(%rbp)
movl 0x9814(%rip), %eax      # 0x18968
movl %eax, -0x48(%rbp)
movl 0x980b(%rip), %eax      # 0x18968
orl $0x2, %eax
movl %eax, -0x44(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5930
cmpq $0x0, %rax
je 0xf17e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf5d7
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x38(%rax) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movq $0x0, 0x28(%rax)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0xf304
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0xcc(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x52d0
movq -0xd8(%rbp), %rdi
movl %eax, %esi
callq 0x9690
movl %eax, %ecx
movl -0xcc(%rbp), %eax
addl 0x9577(%rip), %ecx      # 0x187c8
cmpl %ecx, %eax
jge 0xf2aa
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x52d0
movq -0xe0(%rbp), %rdi
movl %eax, %esi
callq 0x9690
movl %eax, %ecx
addl 0x9525(%rip), %ecx      # 0x187c8
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x52d0
cmpq $0x0, %rax
je 0xf2e4
movl 0x94f7(%rip), %ecx      # 0x187c8
movq -0x10(%rbp), %rax
addl 0x14(%rax), %ecx
movl %ecx, 0x14(%rax)
movl $0x1, -0x24(%rbp)
jmp 0xf2f1
movq -0x10(%rbp), %rax
movl 0x14(%rax), %ecx
addl $0x4, %ecx
movl %ecx, 0x14(%rax)
jmp 0xf2f3
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xf1d3
cmpq $0x0, -0x30(%rbp)
je 0xf311
cmpl $0x0, -0x24(%rbp)
jne 0xf31d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf5d7
movl $0x1, -0x70(%rbp)
movq $0x1, -0xc8(%rbp)
movq $0x8004, -0x80(%rbp)    # imm = 0x8004
movq 0x92da(%rip), %rdi      # 0x18618
movq 0x949b(%rip), %rsi      # 0x187e0
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x10(%rbp), %rax
movl 0x10(%rax), %r8d
movq -0x10(%rbp), %rax
movl 0x14(%rax), %r9d
movq 0x92ae(%rip), %rax      # 0x18618
movq 0xe8(%rax), %rax
movslq 0x9480(%rip), %r10      # 0x187f8
shlq $0x7, %r10
addq %r10, %rax
movl 0x38(%rax), %r11d
movq 0x928e(%rip), %rax      # 0x18618
movq 0xe8(%rax), %rax
movslq 0x9460(%rip), %r10      # 0x187f8
shlq $0x7, %r10
addq %r10, %rax
movq 0x40(%rax), %r10
xorl %eax, %eax
leaq -0xc8(%rbp), %rax
movl $0x0, (%rsp)
movl %r11d, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq $0xa01, 0x20(%rsp)      # imm = 0xA01
movq %rax, 0x28(%rsp)
callq 0x5240
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq 0x922f(%rip), %rdi      # 0x18618
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0x45, %edx
callq 0x54a0
movq 0x9217(%rip), %rdi      # 0x18618
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq 0x9401(%rip), %rdx      # 0x18810
callq 0x55b0
movq 0x91fd(%rip), %rdi      # 0x18618
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x5720
movq 0x91ea(%rip), %rdi      # 0x18618
movq 0x93ab(%rip), %rsi      # 0x187e0
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x10(%rbp), %rax
movl 0x14(%rax), %ecx
movq 0x91ce(%rip), %rax      # 0x18618
movq 0xe8(%rax), %rax
movslq 0x93a0(%rip), %r8       # 0x187f8
shlq $0x7, %r8
addq %r8, %rax
movl 0x38(%rax), %r8d
callq 0x5710
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edx
callq 0xeaa0
cmpq $0x0, 0x916e(%rip)      # 0x18600
je 0xf4e4
movq 0x9165(%rip), %rax      # 0x18600
cmpq $0x0, 0x80(%rax)
je 0xf4e4
movq 0x9154(%rip), %rax      # 0x18600
movq 0x80(%rax), %rdi
xorl %esi, %esi
callq 0xc860
movq 0x9157(%rip), %rdi      # 0x18618
movq 0x9318(%rip), %rsi      # 0x187e0
movl $0x1, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x54b0
movq 0x913b(%rip), %rdi      # 0x18618
xorl %esi, %esi
callq 0x54d0
callq 0xa2f0
movq 0x9128(%rip), %rdi      # 0x18618
movq -0x10(%rbp), %rax
movq (%rax), %rcx
xorl %esi, %esi
movl $0x8000, %edx           # imm = 0x8000
callq 0x5230
movq $0x0, -0x30(%rbp)
cmpq $0x6, -0x30(%rbp)
jae 0xf5b4
movq 0x90fb(%rip), %rdi      # 0x18618
movq -0x30(%rbp), %rcx
leaq 0x8ca8(%rip), %rax      # 0x181d0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
callq 0x5640
movb %al, -0x51(%rbp)
cmpb $0x0, %al
je 0xf5a1
movq $0x0, -0x38(%rbp)
cmpq $0x4, -0x38(%rbp)
jae 0xf59f
movq 0x90c3(%rip), %rdi      # 0x18618
movzbl -0x51(%rbp), %esi
movq -0x30(%rbp), %rcx
leaq 0x8c6c(%rip), %rax      # 0x181d0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %edx
movq -0x38(%rbp), %rax
orl -0x50(%rbp,%rax,4), %edx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl $0x1, %r9d
movl %r9d, %r8d
movl $0x1, (%rsp)
callq 0x5680
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xf547
jmp 0xf5a1
jmp 0xf5a3
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xf50b
movq 0x905d(%rip), %rdi      # 0x18618
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0x1, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x54b0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)