// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %r8, %r14
movq %rcx, 0x8(%rsp)
movq %rdx, 0x18(%rsp)
movl %esi, %ebp
movq 0x8130e(%rip), %rbx     # 0x88fe0
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, 0x20(%rsp)
movb $0x1, %r14b
movq $0x0, 0x10(%rsp)
movq 0x18(%rsp), %rax
leal (%r12,%rax), %r13d
movl %ebp, %edi
movl %r13d, %esi
callq 0x71a0
callq 0x7490
movq %rbx, %r15
movq (%rbx), %rdi
callq 0x70f0
movl %eax, %ebx
cmpl $0x1f, %eax
jg 0x7d66
cmpl $0x9, %ebx
jg 0x7d84
cmpl $-0x1, %ebx
je 0x7da0
cmpl $0x3, %ebx
jne 0x7e0b
movb $0x1, %al
movq %rax, 0x10(%rsp)
jmp 0x7da0
cmpl $0x106, %ebx            # imm = 0x106
jg 0x7d90
cmpl $0x20, %ebx
je 0x7e06
cmpl $0x104, %ebx            # imm = 0x104
je 0x7da8
jmp 0x7e0b
cmpl $0xa, %ebx
je 0x7da0
cmpl $0xd, %ebx
je 0x7da0
jmp 0x7e0b
cmpl $0x107, %ebx            # imm = 0x107
je 0x7da8
cmpl $0x157, %ebx            # imm = 0x157
jne 0x7e0b
xorl %r14d, %r14d
movq %r15, %rbx
jmp 0x7dfa
movq %r15, %rbx
movq (%r15), %rdi
movl $0x220400, %esi         # imm = 0x220400
xorl %edx, %edx
callq 0x7380
testl %r12d, %r12d
jle 0x7deb
movq (%rbx), %rdi
movl %r12d, %eax
decl %r12d
movq 0x18(%rsp), %rcx
leal (%rax,%rcx), %edx
decl %edx
movl %ebp, %esi
callq 0x72d0
cmpl $-0x1, %eax
je 0x7deb
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x70b0
movq (%rbx), %rdi
movl $0x220400, %esi         # imm = 0x220400
xorl %edx, %edx
callq 0x7160
testb $0x1, %r14b
jne 0x7d20
jmp 0x7e4d
testl %r12d, %r12d
je 0x7e45
movslq %r12d, %rax
cmpq %rax, 0x20(%rsp)
jbe 0x7da3
movq 0x8(%rsp), %rcx
movb %bl, (%rcx,%rax)
movq (%r15), %rdi
incl %r12d
movl %ebp, %esi
movl %r13d, %edx
callq 0x72d0
cmpl $-0x1, %eax
je 0x7da3
movq (%r15), %rdi
movl %ebx, %esi
callq 0x70b0
jmp 0x7da3
xorl %r12d, %r12d
jmp 0x7da3
movslq %r12d, %rax
movq 0x8(%rsp), %rcx
movb $0x0, 0x1(%rcx,%rax)
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
movq 0x10(%rsp), %rax
notb %al
andb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq