// File: /workspace/github_c_makefile_star2_O3/hughbarney[P]pEmacs/display.c
// Function: mlreplyt
int mlreplyt (char *prompt, char *buf, int nbuf, char eolchar)
{
  int cpos, i, c;

  cpos = 0;

  if (kbdmop != NULL)
    {
      while ((c = *kbdmop++) != '\0')
	buf[cpos++] = c;
      buf[cpos] = 0;
      if (buf[0] == 0)
	return (FALSE);
      return (TRUE);
    }
  mlwrite (prompt);

  for (;;)
    {
      /* get a character from the user. if it is a <ret> change it to a <NL> */
      c = (*term.t_getchar) ();
      if (c == 0x0d)
	c = '\n';

      if (c == eolchar)
	{
	  buf[cpos++] = 0;

	  if (kbdmip != NULL)
	    {
	      if (kbdmip + cpos > &kbdm[NKBDM - 3])
		{
		  ctrlg (FALSE, 0);
		  (*term.t_flush) ();
		  return (ABORT);
		}
	      for (i = 0; i < cpos; ++i)
		*kbdmip++ = buf[i];
	    }
	  (*term.t_putchar) ('\r');
	  ttcol = 0;
	  (*term.t_flush) ();

	  if (buf[0] == 0)
	    return (FALSE);

	  return (TRUE);

	}
      else if (c == 0x07)
	{			     /* Bell, abort */
	  (*term.t_putchar) ('^');
	  (*term.t_putchar) ('G');
	  ttcol += 2;
	  ctrlg (FALSE, 0);
	  (*term.t_flush) ();
	  return (ABORT);
	}
      else if (c == 0x7F || c == 0x08)
	{			       /* rubout/erase */
	  if (cpos != 0)
	    {
	      (*term.t_putchar) ('\b');
	      (*term.t_putchar) (' ');
	      (*term.t_putchar) ('\b');
	      --ttcol;

	      if (buf[--cpos] < 0x20)
		{
		  (*term.t_putchar) ('\b');
		  (*term.t_putchar) (' ');
		  (*term.t_putchar) ('\b');
		  --ttcol;
		}
	      if (buf[cpos] == '\n')
		{
		  (*term.t_putchar) ('\b');
		  (*term.t_putchar) ('\b');
		  (*term.t_putchar) (' ');
		  (*term.t_putchar) (' ');
		  (*term.t_putchar) ('\b');
		  (*term.t_putchar) ('\b');
		  --ttcol;
		  --ttcol;
		}
	      (*term.t_flush) ();
	    }
	}
      else if (c == 0x15)
	{				 /* C-U, kill */
	  while (cpos != 0)
	    {
	      (*term.t_putchar) ('\b');
	      (*term.t_putchar) (' ');
	      (*term.t_putchar) ('\b');
	      --ttcol;
	      if (buf[--cpos] < 0x20)
		{
		  (*term.t_putchar) ('\b');
		  (*term.t_putchar) (' ');
		  (*term.t_putchar) ('\b');
		  --ttcol;
		}
	    }
	  (*term.t_flush) ();
	}
      else
	{
	  if (cpos < nbuf - 1)
	    {
	      buf[cpos++] = c;
	      if ((c < ' ') && (c != '\n'))
		{
		  (*term.t_putchar) ('^');
		  ++ttcol;
		  c ^= 0x40;
		}
	      if (c != '\n')
		(*term.t_putchar) (c);
	      else
		{		/* put out <NL> for <ret> */
		  (*term.t_putchar) ('<');
		  (*term.t_putchar) ('N');
		  (*term.t_putchar) ('L');
		  (*term.t_putchar) ('>');
		  ttcol += 3;
		}
	      ++ttcol;
	      (*term.t_flush) ();
	    }
	}
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r15d
movq %rsi, %rbx
leaq 0x96db(%rip), %rax      # 0xda70
movq (%rax), %rcx
testq %rcx, %rcx
je 0x43d1
leaq 0x2(%rcx), %rdx
movq %rdx, (%rax)
movzwl (%rcx), %edx
testw %dx, %dx
je 0x46b0
xorl %ecx, %ecx
movb %dl, (%rbx,%rcx)
incq %rcx
movq (%rax), %rdx
leaq 0x2(%rdx), %rsi
movq %rsi, (%rax)
movzwl (%rdx), %edx
testw %dx, %dx
jne 0x43b2
movl %ecx, %eax
jmp 0x46b2
movl %edx, 0x4(%rsp)
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x4246
leaq 0x9483(%rip), %r12      # 0xd868
xorl %eax, %eax
callq *0x20(%r12)
cmpl $0xd, %eax
movl $0xa, %r13d
movl %eax, %r14d
cmovel %r13d, %r14d
movsbl %r15b, %r15d
cmpl %r15d, %r14d
je 0x463f
decl 0x4(%rsp)
xorl %ebp, %ebp
cmpl $0x14, %eax
jle 0x449d
cmpl $0x7f, %eax
je 0x44a6
cmpl $0x15, %eax
jne 0x4585
xorl %r14d, %r14d
testl %ebp, %ebp
je 0x461b
movslq %ebp, %rbp
movl $0x8, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x20, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x8, %edi
xorl %eax, %eax
callq *0x28(%r12)
decl 0x8d02(%rip)            # 0xd164
cmpb $0x1f, -0x1(%rbx,%rbp)
jg 0x4493
movl $0x8, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x20, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x8, %edi
xorl %eax, %eax
callq *0x28(%r12)
decl 0x8cd1(%rip)            # 0xd164
decq %rbp
jne 0x4438
jmp 0x461b
cmpl $0x8, %eax
jne 0x457c
testl %ebp, %ebp
je 0x4575
movl $0x8, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x20, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x8, %edi
xorl %eax, %eax
callq *0x28(%r12)
decl 0x8c8c(%rip)            # 0xd164
movslq %ebp, %rax
leaq -0x1(%rax), %r14
cmpb $0x1f, -0x1(%rbx,%rax)
jg 0x461b
movl $0x8, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x20, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x8, %edi
xorl %eax, %eax
callq *0x28(%r12)
decl 0x8c50(%rip)            # 0xd164
cmpb $0xa, (%rbx,%r14)
jne 0x461b
movl $0x8, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x8, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x20, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x20, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x8, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x8, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl 0x8bf7(%rip), %eax      # 0xd164
addl $-0x2, %eax
jmp 0x4615
xorl %ebp, %ebp
jmp 0x4625
cmpl $0x7, %eax
je 0x46cd
cmpl 0x4(%rsp), %ebp
jge 0x4625
movslq %ebp, %rax
movb %r14b, (%rbx,%rax)
cmpl $0x20, %r14d
setge %al
cmpl $0xa, %r14d
sete %cl
orb %al, %cl
jne 0x45be
movl $0x5e, %edi
xorl %eax, %eax
callq *0x28(%r12)
incl 0x8baa(%rip)            # 0xd164
xorl $0x40, %r14d
movq 0x28(%r12), %rcx
cmpl $0xa, %r14d
jne 0x4601
movl $0x3c, %edi
xorl %eax, %eax
callq *%rcx
movl $0x4e, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x4c, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x3e, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl 0x8b68(%rip), %eax      # 0xd164
addl $0x3, %eax
jmp 0x460e
movl %r14d, %edi
xorl %eax, %eax
callq *%rcx
movl 0x8b56(%rip), %eax      # 0xd164
incl %ebp
incl %eax
movl %ebp, %r14d
movl %eax, 0x8b49(%rip)      # 0xd164
xorl %eax, %eax
callq *0x30(%r12)
movl %r14d, %ebp
xorl %eax, %eax
callq *0x20(%r12)
cmpl $0xd, %eax
movl %eax, %r14d
cmovel %r13d, %r14d
cmpl %r15d, %r14d
jne 0x440f
movslq %ebp, %rdx
movb $0x0, (%rbx,%rdx)
leaq 0x9403(%rip), %rax      # 0xda50
movq (%rax), %rcx
testq %rcx, %rcx
je 0x4691
leaq (%rcx,%rdx,2), %rdx
addq $0x2, %rdx
movl $0x1fa, %esi            # imm = 0x1FA
addq 0x8977(%rip), %rsi      # 0xcfe0
cmpq %rsi, %rdx
ja 0x46ec
testl %ebp, %ebp
js 0x4691
incl %ebp
addq $0x2, %rcx
xorl %edx, %edx
movsbl (%rbx,%rdx), %esi
movq %rcx, (%rax)
movw %si, -0x2(%rcx)
incq %rdx
addq $0x2, %rcx
cmpq %rdx, %rbp
jne 0x467a
movl $0xd, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x0, 0x8abd(%rip)      # 0xd164
xorl %eax, %eax
callq *0x30(%r12)
jmp 0x46b6
xorl %eax, %eax
movb $0x0, (%rbx,%rax)
xorl %eax, %eax
cmpb $0x0, (%rbx)
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x5e, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x47, %edi
xorl %eax, %eax
callq *0x28(%r12)
addl $0x2, 0x8a78(%rip)      # 0xd164
xorl %edi, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x5d72
xorl %eax, %eax
callq *0x30(%r12)
movl $0x2, %eax
jmp 0x46be