// File: /workspace/github_c_makefile_star2_O0/skeeto[P]flappy/flappy.cc
// Function: Display::read_name(int, int, char*, unsigned long)
bool read_name(int y, int x, char *target, size_t n) {
    int p = 0;
    timeout(-1);
    curs_set(1);
    init_pair(4, COLOR_YELLOW, COLOR_BLACK);
    int style = A_BOLD | A_UNDERLINE | COLOR_PAIR(4);
    attron(style);
    bool reading = true, cancelled = false;
    while (reading) {
      move(y, x + p);
      refresh();
      int c = getch();
      switch (c) {
        case '':
          cancelled = true;
        case KEY_ENTER:
        case '\n':
        case '\r':
        case ERR:
          reading = false;
          break;
        case KEY_LEFT:
        case KEY_BACKSPACE:
          attroff(style);
          if (p > 0) mvaddch(y, x + --p, ' ');
          attron(style);
          break;
        case ' ':
          if (p == 0) {
            break;
          }
        default:
          if (p < n - 1) {
            target[p] = c;
            mvaddch(y, x + p++, c);
          }
      }
    }
    target[p + 1] = '\0';
    attroff(style);
    timeout(0);
    curs_set(0);
    return !cancelled;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x24(%rbp)
movq 0xa9fc0(%rip), %rax     # 0xb1fe0
movq (%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x7350
movl $0x1, %edi
callq 0x7250
movl $0x4, %edi
movl $0x3, %esi
xorl %edx, %edx
callq 0x7050
movl $0x220400, -0x28(%rbp)  # imm = 0x220400
movq 0xa9f8a(%rip), %rax     # 0xb1fe0
movq (%rax), %rdi
movl -0x28(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7180
movb $0x1, -0x29(%rbp)
movb $0x0, -0x2a(%rbp)
testb $0x1, -0x29(%rbp)
je 0x81eb
movl -0xc(%rbp), %edi
movl -0x10(%rbp), %esi
movl -0x24(%rbp), %eax
addl %eax, %esi
callq 0x71e0
movq -0x38(%rbp), %rdi
callq 0x9f20
movq 0xa9f49(%rip), %rax     # 0xb1fe0
movq (%rax), %rdi
callq 0x70f0
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x3c(%rbp)
subl $-0x1, %eax
je 0x8106
jmp 0x80af
movl -0x3c(%rbp), %eax
subl $0x3, %eax
je 0x8102
jmp 0x80b9
movl -0x3c(%rbp), %eax
subl $0xa, %eax
je 0x8106
jmp 0x80c3
movl -0x3c(%rbp), %eax
subl $0xd, %eax
je 0x8106
jmp 0x80cd
movl -0x3c(%rbp), %eax
subl $0x20, %eax
je 0x817e
jmp 0x80db
movl -0x3c(%rbp), %eax
subl $0x104, %eax            # imm = 0x104
je 0x810f
jmp 0x80e7
movl -0x3c(%rbp), %eax
subl $0x107, %eax            # imm = 0x107
je 0x810f
jmp 0x80f3
movl -0x3c(%rbp), %eax
subl $0x157, %eax            # imm = 0x157
je 0x8106
jmp 0x8188
movb $0x1, -0x2a(%rbp)
movb $0x0, -0x29(%rbp)
jmp 0x81e6
movq 0xa9eca(%rip), %rax     # 0xb1fe0
movq (%rax), %rdi
movl -0x28(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x73c0
cmpl $0x0, -0x24(%rbp)
jle 0x8166
movq 0xa9eae(%rip), %rax     # 0xb1fe0
movq (%rax), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
addl %eax, %edx
callq 0x72f0
cmpl $-0x1, %eax
jne 0x8152
jmp 0x8166
movq 0xa9e87(%rip), %rax     # 0xb1fe0
movq (%rax), %rdi
movl $0x20, %esi
callq 0x70b0
movq 0xa9e73(%rip), %rax     # 0xb1fe0
movq (%rax), %rdi
movl -0x28(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7180
jmp 0x81e6
cmpl $0x0, -0x24(%rbp)
jne 0x8186
jmp 0x81e6
jmp 0x8188
movslq -0x24(%rbp), %rax
movq -0x20(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x81e4
movl -0x30(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq 0xa9e30(%rip), %rax     # 0xb1fe0
movq (%rax), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movl -0x24(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x24(%rbp)
addl %eax, %edx
callq 0x72f0
cmpl $-0x1, %eax
jne 0x81d2
jmp 0x81e4
movq 0xa9e07(%rip), %rax     # 0xb1fe0
movq (%rax), %rdi
movl -0x30(%rbp), %esi
callq 0x70b0
jmp 0x81e6
jmp 0x806d
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movq 0xa9ddd(%rip), %rax     # 0xb1fe0
movq (%rax), %rdi
movl -0x28(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x73c0
movq 0xa9dc7(%rip), %rax     # 0xb1fe0
movq (%rax), %rdi
xorl %esi, %esi
callq 0x7350
xorl %edi, %edi
callq 0x7250
movb -0x2a(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)