// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r14
movq %rcx, (%rsp)
movl %edx, %r12d
movl %esi, %ebp
movq 0x783ef(%rip), %rbx     # 0x7ffe0
movq (%rbx), %rdi
pushq $-0x1
popq %rsi
callq 0x7320
pushq $0x1
popq %rdi
callq 0x7230
pushq $0x4
popq %rdi
pushq $0x3
popq %rsi
movq $0x0, 0x8(%rsp)
xorl %edx, %edx
callq 0x7050
movq (%rbx), %rdi
movl $0x220400, %esi         # imm = 0x220400
xorl %edx, %edx
callq 0x7170
decq %r14
movq %r14, 0x10(%rsp)
movb $0x1, %cl
xorl %edx, %edx
movslq %edx, %r15
testb $0x1, %cl
je 0x7d65
movl %edx, %ebx
leal (%rbx,%r12), %r14d
movl %ebp, %edi
movl %r14d, %esi
callq 0x71b0
callq 0x74c0
movq 0x78383(%rip), %rax     # 0x7ffe0
movq (%rax), %rdi
callq 0x70f0
xorl %ecx, %ecx
movl %ebx, %edx
cmpl $-0x1, %eax
je 0x7c35
movl %eax, %r13d
movl %ebx, %edx
cmpl $0x157, %eax            # imm = 0x157
je 0x7c35
movl %ebx, %edx
cmpl $0xa, %r13d
je 0x7c35
movl %ebx, %edx
cmpl $0xd, %r13d
je 0x7c35
cmpl $0x20, %r13d
je 0x7d04
cmpl $0x104, %r13d           # imm = 0x104
je 0x7cb5
cmpl $0x107, %r13d           # imm = 0x107
je 0x7cb5
cmpl $0x3, %r13d
jne 0x7d10
movb $0x1, %al
movq %rax, 0x8(%rsp)
xorl %ecx, %ecx
movl %ebx, %edx
jmp 0x7c35
movq 0x78324(%rip), %r14     # 0x7ffe0
movq (%r14), %rdi
movl $0x220400, %esi         # imm = 0x220400
xorl %edx, %edx
callq 0x7390
testl %ebx, %ebx
jle 0x7cf3
movq (%r14), %rdi
movl %ebx, %eax
decl %ebx
leal (%rax,%r12), %edx
decl %edx
movl %ebp, %esi
callq 0x72e0
cmpl $-0x1, %eax
je 0x7cf3
movq (%r14), %rdi
pushq $0x20
popq %rsi
callq 0x70b0
movq (%r14), %rdi
movl $0x220400, %esi         # imm = 0x220400
xorl %edx, %edx
callq 0x7170
jmp 0x7d5c
xorl %edx, %edx
movb $0x1, %cl
testl %ebx, %ebx
je 0x7c35
movb $0x1, %cl
movl %ebx, %edx
cmpq %r15, 0x10(%rsp)
jbe 0x7c35
movq (%rsp), %rax
movb %r13b, (%rax,%r15)
movq 0x782b2(%rip), %rax     # 0x7ffe0
movq (%rax), %rdi
incl %ebx
movl %ebp, %esi
movl %r14d, %edx
callq 0x72e0
movb $0x1, %cl
movl %ebx, %edx
cmpl $-0x1, %eax
je 0x7c35
movq 0x7828f(%rip), %rax     # 0x7ffe0
movq (%rax), %rdi
movl %r13d, %esi
callq 0x70b0
movb $0x1, %cl
movl %ebx, %edx
jmp 0x7c35
movq (%rsp), %rax
movb $0x0, 0x1(%rax,%r15)
movq 0x7826a(%rip), %rbx     # 0x7ffe0
movq (%rbx), %rdi
movl $0x220400, %esi         # imm = 0x220400
xorl %edx, %edx
callq 0x7390
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x7320
xorl %edi, %edi
callq 0x7230
movq 0x8(%rsp), %rax
notb %al
andb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq