// File: /workspace/github_c_makefile_star2_O3/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, 0x8(%rsp)
movl %edx, %r15d
movl %esi, %ebp
movq 0x82344(%rip), %rbx     # 0x89fe0
movq (%rbx), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x7310
movl $0x1, %edi
callq 0x7220
xorl %r12d, %r12d
movl $0x4, %edi
movl $0x3, %esi
xorl %edx, %edx
callq 0x7050
movq (%rbx), %rdi
movl $0x220400, %esi         # imm = 0x220400
xorl %edx, %edx
callq 0x7160
decq %r14
movq %r14, 0x10(%rsp)
movq %r15, (%rsp)
movq %r12, %rax
addl %r15d, %r12d
movq %rax, %r14
movslq %eax, %r15
movl %ebp, %edi
movl %r12d, %esi
callq 0x71a0
callq 0x7490
movq (%rbx), %rdi
callq 0x70f0
movl %eax, %r13d
cmpl $0x1f, %eax
jle 0x7d26
cmpl $0x103, %r13d           # imm = 0x103
jg 0x7d41
cmpl $0x20, %r13d
jne 0x7d76
testl %r14d, %r14d
jne 0x7d76
jmp 0x7dff
cmpl $0x9, %r13d
jg 0x7d62
cmpl $-0x1, %r13d
je 0x7e23
cmpl $0x3, %r13d
jne 0x7d76
jmp 0x7e28
cmpl $0x104, %r13d           # imm = 0x104
je 0x7dba
cmpl $0x157, %r13d           # imm = 0x157
je 0x7e23
cmpl $0x107, %r13d           # imm = 0x107
jne 0x7d76
jmp 0x7dba
cmpl $0xa, %r13d
je 0x7e23
cmpl $0xd, %r13d
je 0x7e23
cmpq %r15, 0x10(%rsp)
jbe 0x7cee
movq 0x8(%rsp), %rax
movb %r13b, (%rax,%r15)
movq (%rbx), %rdi
incl %r14d
movl %ebp, %esi
movl %r12d, %edx
movq %r14, %r12
callq 0x72d0
cmpl $-0x1, %eax
movq (%rsp), %r15
je 0x7ce2
movq (%rbx), %rdi
movl %r13d, %esi
callq 0x70b0
jmp 0x7ce2
movq (%rbx), %rdi
movl $0x220400, %esi         # imm = 0x220400
xorl %edx, %edx
callq 0x7380
movq %r14, %r12
testl %r12d, %r12d
jle 0x7e0b
movq (%rbx), %rdi
movl %r12d, %eax
decl %r12d
movq (%rsp), %r15
leal (%rax,%r15), %edx
decl %edx
movl %ebp, %esi
callq 0x72d0
cmpl $-0x1, %eax
je 0x7e0f
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x70b0
jmp 0x7e0f
xorl %r12d, %r12d
movq (%rsp), %r15
jmp 0x7ce2
movq (%rsp), %r15
movq (%rbx), %rdi
movl $0x220400, %esi         # imm = 0x220400
xorl %edx, %edx
callq 0x7160
jmp 0x7ce2
movb $0x1, %bpl
jmp 0x7e2a
xorl %ebp, %ebp
movq 0x8(%rsp), %rax
movb $0x0, 0x1(%rax,%r15)
movq (%rbx), %rdi
movl $0x220400, %esi         # imm = 0x220400
xorl %edx, %edx
callq 0x7380
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x7310
xorl %edi, %edi
callq 0x7220
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq