// File: matallui[P]nibble-curses/src/CNibbles.cpp
// Function: CNibbles::DrawMenu(char (*) [30], char*, int const&, int const&)
void CNibbles::DrawMenu ( char menu[5][30], char title[30], int const & size, int const & item )
{
  // clean and draw frame
  bkgd ( COLOR_PAIR (1) );
  attrset ( COLOR_PAIR (4) );
  for ( int j = 0; j < m_maxCols; j++ )
  {
    mvaddch ( 0, j, '+' );
    mvaddch ( m_maxLines-1, j, '+' );
  }
  for ( int i = 0; i < m_maxLines; i++ )
  {
    mvaddch ( i, 0, '+' );
    mvaddch ( i, m_maxCols-1, '+' );
  }
  
  // draw menu
  attrset ( COLOR_PAIR(5) );
  mvaddstr ( 8, 20, title );
  attrset ( COLOR_PAIR(3) );
  
  for ( int c = 0; c < size; c++ )
  {
    if ( c == item )
      attron ( A_REVERSE );
    mvaddstr( 12+(c*2), 25, menu[c] );
    attroff ( A_REVERSE );
  }
  
  refresh();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq 0x5e05(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x34b0
movq 0x5df1(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3330
movl $0x0, -0x2c(%rbp)
movq -0x40(%rbp), %rcx
movl -0x2c(%rbp), %eax
cmpl 0x4(%rcx), %eax
jge 0xa26f
movq 0x5dca(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl -0x2c(%rbp), %edx
xorl %esi, %esi
callq 0x3300
cmpl $-0x1, %eax
jne 0xa21a
jmp 0xa22e
movq 0x5daf(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl $0x2b, %esi
callq 0x30e0
movq -0x40(%rbp), %rax
movq 0x5d97(%rip), %rcx      # 0xffd0
movq (%rcx), %rdi
movl (%rax), %esi
subl $0x1, %esi
movl -0x2c(%rbp), %edx
callq 0x3300
cmpl $-0x1, %eax
jne 0xa250
jmp 0xa264
movq 0x5d79(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl $0x2b, %esi
callq 0x30e0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xa1f3
movl $0x0, -0x30(%rbp)
movq -0x40(%rbp), %rcx
movl -0x30(%rbp), %eax
cmpl (%rcx), %eax
jge 0xa2f2
movq 0x5d48(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl -0x30(%rbp), %esi
xorl %edx, %edx
callq 0x3300
cmpl $-0x1, %eax
jne 0xa29c
jmp 0xa2b0
movq 0x5d2d(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl $0x2b, %esi
callq 0x30e0
movq -0x40(%rbp), %rax
movq 0x5d15(%rip), %rcx      # 0xffd0
movq (%rcx), %rdi
movl -0x30(%rbp), %esi
movl 0x4(%rax), %edx
subl $0x1, %edx
callq 0x3300
cmpl $-0x1, %eax
jne 0xa2d3
jmp 0xa2e7
movq 0x5cf6(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl $0x2b, %esi
callq 0x30e0
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xa276
movq 0x5cd7(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl $0x500, %esi            # imm = 0x500
callq 0x3330
movq 0x5cc3(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl $0x8, %esi
movl $0x14, %edx
callq 0x3300
cmpl $-0x1, %eax
jne 0xa326
jmp 0xa33e
movq 0x5ca3(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3110
movq 0x5c8b(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl $0x300, %esi            # imm = 0x300
callq 0x3330
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xa3f7
movl -0x34(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl (%rcx), %eax
jne 0xa38b
movq 0x5c56(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %eax, %eax
movl %eax, %edx
callq 0x3190
movq 0x5c3e(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl -0x34(%rbp), %esi
shll %esi
addl $0xc, %esi
movl $0x19, %edx
callq 0x3300
cmpl $-0x1, %eax
jne 0xa3ae
jmp 0xa3d1
movq 0x5c1b(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movslq -0x34(%rbp), %rax
imulq $0x1e, %rax, %rax
addq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3110
movq 0x5bf8(%rip), %rax      # 0xffd0
movq (%rax), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %eax, %eax
movl %eax, %edx
callq 0x33f0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xa359
callq 0x34c0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)