// File: /workspace/github_c_makefile_star2_O1/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
movq %rsi, %rbx
leaq 0x9558(%rip), %rax      # 0xda70
cmpq $0x0, (%rax)
je 0x4555
movq (%rax), %rcx
leaq 0x2(%rcx), %rdx
movq %rdx, (%rax)
movzwl (%rcx), %edx
testw %dx, %dx
je 0x482f
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 0x4536
movl %ecx, %eax
jmp 0x4831
movl %ecx, %r15d
movl %edx, 0x4(%rsp)
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x43cc
leaq 0x92fc(%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 0x47b7
decl 0x4(%rsp)
xorl %ebp, %ebp
cmpl $0x14, %eax
jle 0x4624
cmpl $0x7f, %eax
je 0x462d
cmpl $0x15, %eax
jne 0x4702
xorl %r14d, %r14d
testl %ebp, %ebp
je 0x4793
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 0x8b7b(%rip)            # 0xd164
cmpb $0x1f, -0x1(%rbx,%rbp)
jg 0x461a
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 0x8b4a(%rip)            # 0xd164
decq %rbp
jne 0x45bf
jmp 0x4793
cmpl $0x8, %eax
jne 0x46f9
testl %ebp, %ebp
je 0x46f2
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 0x8b05(%rip)            # 0xd164
movslq %ebp, %rbp
cmpb $0x1f, -0x1(%rbx,%rbp)
jg 0x4693
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 0x8ad1(%rip)            # 0xd164
decq %rbp
cmpb $0xa, (%rbx,%rbp)
jne 0x4790
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 $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x478a
xorl %ebp, %ebp
jmp 0x479d
cmpl $0x7, %eax
je 0x484c
cmpl 0x4(%rsp), %ebp
jge 0x479d
movslq %ebp, %rax
movb %r14b, (%rbx,%rax)
cmpl $0x20, %r14d
setge %al
cmpl $0xa, %r14d
sete %cl
orb %al, %cl
jne 0x473b
movl $0x5e, %edi
xorl %eax, %eax
callq *0x28(%r12)
incl 0x8a2d(%rip)            # 0xd164
xorl $0x40, %r14d
incl %ebp
movq 0x28(%r12), %rcx
cmpl $0xa, %r14d
jne 0x477e
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)
addl $0x3, 0x89e8(%rip)      # 0xd164
jmp 0x4785
movl %r14d, %edi
xorl %eax, %eax
callq *%rcx
movl $0x1, %eax
addl %eax, 0x89d4(%rip)      # 0xd164
movl %ebp, %r14d
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 0x4596
movslq %ebp, %rcx
movb $0x0, (%rbx,%rcx)
leaq 0x928b(%rip), %rax      # 0xda50
movq (%rax), %rdx
testq %rdx, %rdx
je 0x4810
leaq (%rdx,%rcx,2), %rcx
addq $0x2, %rcx
movl $0x1fa, %edx            # imm = 0x1FA
addq 0x87ff(%rip), %rdx      # 0xcfe0
cmpq %rdx, %rcx
ja 0x486b
testl %ebp, %ebp
js 0x4810
movq (%rax), %rcx
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 0x47f9
movl $0xd, %edi
xorl %eax, %eax
callq *0x28(%r12)
movl $0x0, 0x893e(%rip)      # 0xd164
xorl %eax, %eax
callq *0x30(%r12)
jmp 0x4835
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, 0x88f9(%rip)      # 0xd164
xorl %edi, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x5eb7
xorl %eax, %eax
callq *0x30(%r12)
movl $0x2, %eax
jmp 0x483d