// File: /workspace/github_c_makefile_star2_O2/Cloudef[P]dwm-fork/dwm.c
// Function: updatemenu
static void
updatemenu( menu_t *m, int x, int y ) {
   Drawable dble = dc.drawable;
   int ow = dc.w, oh = dc.h, ox = dc.x, oy = dc.y;
   size_t col;

   if(!m) return;
   const int osel = m->sel;

   dc.drawable = m->drawable;
#ifdef XFT
   XftDrawChange(dc.xftdrawable, dc.drawable);
#endif
   size_t i;
   dc.x = 0; dc.y = 0;
   dc.w = m->w;

   for(i = 0; m->ctx[i].title; ++i)
   {
      if (x > 0    && x < m->w &&
          y > dc.y && y < dc.y + dc.font.height &&
          strlen(m->ctx[i].title))
         m->sel = i;

      /* this check cause there is keyboard input too */
      if(m->sel == i) { col = 9; m->sely = dc.y; }
      else col = 10;

      if(strlen(m->ctx[i].title))
      {
         dc.h = dc.font.height;
         drawtext(m->ctx[i].title, col, False);

      }
      else { dc.h = 4; drawhline(11); }
      dc.y += dc.h;
   }

   XCopyArea(dpy, dc.drawable, m->win, dc.gc, 0, 0, m->w, m->h, 0, 0);
   XSync(dpy, False);

   dc.w = ow; dc.h = oh; dc.x = ox; dc.y = oy;
   dc.drawable = dble;
#ifdef XFT
   XftDrawChange(dc.xftdrawable, dc.drawable);
#endif

   /* only for mouse */
   if(m->sel != osel)
   {
      if(m->child) { closemenu(m->child); m->child = NULL; }
      if(m->ctx[m->sel].ctx != NULL)
         m->child = openmenupos( m->ctx[m->sel].ctx, m->x + m->w, m->y + m->sely );
   }
}

// Assembly:
testq %rdi, %rdi
je 0xb29f
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
movq 0x85dd(%rip), %rax      # 0x13620
movq %rax, 0x38(%rsp)
movaps 0x84a1(%rip), %xmm0     # 0x134f0
movaps %xmm0, 0x40(%rsp)
movl 0x38(%rdi), %eax
movl %eax, 0x34(%rsp)
movq 0x18(%rdi), %rax
movq %rax, 0x85ba(%rip)      # 0x13620
andq $0x0, 0x8482(%rip)      # 0x134f0
movl 0x10(%rdi), %eax
movl %eax, 0x8481(%rip)      # 0x134f8
xorl %r12d, %r12d
pushq $0xa
popq %r13
xorl %eax, %eax
xorl %r15d, %r15d
movq 0x30(%rbx), %rcx
movq (%rcx,%r12), %rdi
testq %rdi, %rdi
je 0xb1e4
testl %r14d, %r14d
jle 0xb0c1
cmpl %r14d, 0x10(%rbx)
setg %cl
cmpl %ebp, %eax
setl %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xb0c1
movl 0x8586(%rip), %ecx      # 0x13638
addl %eax, %ecx
cmpl %ebp, %ecx
jle 0xb0c1
cmpb $0x0, (%rdi)
je 0xb0c1
movl %r15d, 0x38(%rbx)
movslq 0x38(%rbx), %rcx
movq %r13, %rsi
cmpq %rcx, %r15
jne 0xb0d3
movl %eax, 0x3c(%rbx)
pushq $0x9
popq %rsi
cmpb $0x0, (%rdi)
je 0xb0f0
movl 0x855a(%rip), %eax      # 0x13638
movl %eax, 0x8418(%rip)      # 0x134fc
xorl %edx, %edx
callq 0x80ba
jmp 0xb1c6
movl $0x4, 0x8402(%rip)      # 0x134fc
movzwl 0x83ef(%rip), %ecx      # 0x134f0
movw %cx, 0x2c(%rsp)
movw %ax, 0x2e(%rsp)
movzwl 0x83e6(%rip), %eax      # 0x134f8
movw %ax, 0x30(%rsp)
movw $0x4, 0x32(%rsp)
movq 0x8363(%rip), %rdi      # 0x13488
movq 0x84fc(%rip), %rsi      # 0x13628
movq 0x84e5(%rip), %rdx      # 0x13618
callq 0x5330
movq 0x8349(%rip), %rdi      # 0x13488
movq 0x84da(%rip), %rsi      # 0x13620
movq 0x84db(%rip), %rdx      # 0x13628
leaq 0x2c(%rsp), %rcx
pushq $0x1
popq %r8
callq 0x5310
movq 0x84ae(%rip), %rax      # 0x13610
movq %rax, 0x68(%rsp)
movq 0x831a(%rip), %rdi      # 0x13488
movq 0x84b3(%rip), %rsi      # 0x13628
pushq $0x4
popq %rdx
leaq 0x58(%rsp), %rcx
callq 0x5500
movq 0x82ff(%rip), %rdi      # 0x13488
movq 0x8490(%rip), %rsi      # 0x13620
movq 0x8491(%rip), %r8       # 0x13628
movl 0x8353(%rip), %ecx      # 0x134f0
movl 0x8359(%rip), %eax      # 0x134fc
cltd
pushq $0x2
popq %r9
idivl %r9d
addl 0x8343(%rip), %eax      # 0x134f4
movl 0x8340(%rip), %r9d      # 0x134f8
movl %eax, (%rsp)
movq %r8, %rdx
movl %eax, %r8d
callq 0x52d0
movl 0x8328(%rip), %eax      # 0x134f4
addl 0x832a(%rip), %eax      # 0x134fc
movl %eax, 0x831c(%rip)      # 0x134f4
incq %r15
addq $0x20, %r12
jmp 0xb083
movq 0x829d(%rip), %rdi      # 0x13488
movq 0x842e(%rip), %rsi      # 0x13620
movq (%rbx), %rdx
movq 0x842c(%rip), %rcx      # 0x13628
movl 0x10(%rbx), %eax
movl 0x14(%rbx), %r8d
andl $0x0, 0x18(%rsp)
andl $0x0, 0x10(%rsp)
movl %r8d, 0x8(%rsp)
movl %eax, (%rsp)
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x52b0
movq 0x8261(%rip), %rdi      # 0x13488
xorl %esi, %esi
callq 0x54c0
movaps 0x40(%rsp), %xmm0
movaps %xmm0, 0x82b6(%rip)     # 0x134f0
movq 0x38(%rsp), %rax
movq %rax, 0x83da(%rip)      # 0x13620
movl 0x38(%rbx), %eax
cmpl 0x34(%rsp), %eax
je 0xb28e
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0xb265
callq 0xb2a0
andq $0x0, 0x28(%rbx)
movl 0x38(%rbx), %eax
movq 0x30(%rbx), %rcx
cltq
shlq $0x5, %rax
movq 0x8(%rcx,%rax), %rdi
testq %rdi, %rdi
je 0xb28e
movl 0x10(%rbx), %esi
movl 0x3c(%rbx), %edx
addl 0x8(%rbx), %esi
addl 0xc(%rbx), %edx
callq 0xb373
movq %rax, 0x28(%rbx)
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq